ReleaseInfo Class Reference

#include <release.h>

List of all members.

Static Public Member Functions

static const TCHARGetInfo ()
static const TCHARGetLicensee ()
static const TCHARGetSerialNumber ()
static const TCHARGetCompany ()
static void CacheProfileSettings ()
 Stores the current ReleaseInfo settings from the .ini file to an internal buffer This is currently used to prevent user information being lost when the default user profile is restored. Scope: static.
static BOOL RestoreProfileSettings ()
 Restores the current ReleaseInfo settings in the .ini file to the values present in the cache This is currently used to prevent user information being lost when the default user profile is restored. Scope: static.

Static Protected Member Functions

static BOOL WriteProfile (LPCTSTR pKey, LPCTSTR pValue)
 Support function for RestoreCurrentSettings() Writes an .ini file setting in the UserInfo section of the current apps profile file using WritePrivateProfileString() and the given key and value.

Private Attributes

UINT32 SerialNumber
const TCHARName


Detailed Description

Definition at line 116 of file release.h.


Member Function Documentation

void ReleaseInfo::CacheProfileSettings  )  [static]
 

Stores the current ReleaseInfo settings from the .ini file to an internal buffer This is currently used to prevent user information being lost when the default user profile is restored. Scope: static.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/09/96
See Also: RestoreProfileSettings()

Definition at line 293 of file release.cpp.

00294 {
00295     camStrcpy(PublicInfo.Name, GetLicensee());
00296 #ifndef WEBSTER
00297     // No serial number in Webster v2.0.
00298     // This happens too early to get resources.
00299     camStrcpy(szCachedSerial, GetSerialNumber());
00300 #endif
00301     camStrcpy(PublicInfo.Company, GetCompany());
00302 }

const TCHAR * ReleaseInfo::GetCompany  )  [static]
 

Definition at line 256 of file release.cpp.

00257 {
00258     static TCHAR buffer[64];
00259     // read the company preference value into a string
00260     String_256 Str;
00261     BOOL ok = Camelot.GetPrefDirect(szUISection, szCompany, &Str);
00262     if (ok) 
00263     {
00264         // coy the string into the return buffer
00265         TCHAR* StringBuf = (TCHAR*)Str;
00266         camSprintf(buffer, _T("%s"), StringBuf);
00267     }
00268     else
00269     {
00270         // something went wrong so use a default, the bound in one
00271         camSprintf(buffer,_T("%s"),PublicInfo.Company);
00272     }
00273 
00274     return buffer;
00275 }

const TCHAR * ReleaseInfo::GetInfo  )  [static]
 

Definition at line 180 of file release.cpp.

00181 {
00182     static TCHAR buf[256];
00183 
00184 #ifndef STANDALONE
00185 //  camSprintf(buf, "%s (#101-%09ld)", PublicInfo.Name, PublicInfo.Serial );
00186 //  camSprintf(buf, TEXT("%s (#%s)"), ReleaseInfo::GetLicensee(), ReleaseInfo::GetSerialNumber());
00187 
00188     String_256 jcf;
00189     jcf.MakeMsg(_R(IDS_RELEASE_INFO_FORMAT), ReleaseInfo::GetLicensee(), ReleaseInfo::GetSerialNumber());
00190     camStrcpy(buf, jcf);
00191 
00192 #else
00193     camStrcpy(buf, PublicInfo.Name);
00194 #endif
00195 
00196     return buf;
00197 }

const TCHAR * ReleaseInfo::GetLicensee  )  [static]
 

Definition at line 201 of file release.cpp.

00202 {
00203     static TCHAR buffer[64];
00204 #if !defined(EXCLUDE_FROM_XARALX) && defined(_DEBUG)
00205     TCHAR* pLogName=_tgetenv(TCHAR);
00206     if (pLogName!=NULL)
00207         camSprintf(buffer,_T("%s"),pLogName);
00208     else
00209         camSprintf(buffer,_T("%s"),("NoLogName"));
00210 #else
00211     // read the licensee preference value into a string
00212     String_256 Str;
00213     BOOL ok = Camelot.GetPrefDirect(szUISection, szLicensee, &Str);
00214     if (ok) 
00215     {
00216         // copy the string into the return buffer
00217         TCHAR* StringBuf = (TCHAR*)Str;
00218         camSprintf(buffer, _T("%s"), StringBuf);
00219     }
00220     else
00221     {
00222         // something went wrong so use a default, the bound in one
00223         camSprintf(buffer,_T("%s"),PublicInfo.Name);
00224     }
00225 #endif
00226 
00227     return buffer;
00228 }

const TCHAR * ReleaseInfo::GetSerialNumber  )  [static]
 

Definition at line 232 of file release.cpp.

00233 {
00234     static TCHAR buffer[64];
00235 
00236     // read the serial number preference value into a string
00237     String_256 Str;
00238     BOOL ok = Camelot.GetPrefDirect(szUISection, szSerialNumber, &Str);
00239     if (ok) 
00240     {
00241         // copy the string into the return buffer
00242         TCHAR* StringBuf = (TCHAR*)Str;
00243         camSprintf(buffer, _T("%s"), StringBuf);
00244     }
00245     else
00246     {
00247         // something went wrong so use a default, the bound in one
00248         camSprintf(buffer,_T("101-%09ld"),PublicInfo.Serial);
00249     }
00250 
00251     return buffer;
00252 }

BOOL ReleaseInfo::RestoreProfileSettings  )  [static]
 

Restores the current ReleaseInfo settings in the .ini file to the values present in the cache This is currently used to prevent user information being lost when the default user profile is restored. Scope: static.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/09/96
Returns:
TRUE if successful FALSE otherwise
See Also: CacheProfileSettings()

Definition at line 321 of file release.cpp.

00322 {
00323     if (!WriteProfile(szSerialNumber, szCachedSerial))
00324     {
00325         return FALSE;
00326     }
00327 
00328     if (!WriteProfile(szLicensee, PublicInfo.Name))
00329     {
00330         return FALSE;
00331     }
00332 
00333     if (!WriteProfile(szCompany, PublicInfo.Company))
00334     {
00335         return FALSE;
00336     }
00337 
00338     return TRUE;
00339 }

BOOL ReleaseInfo::WriteProfile LPCTSTR  pKey,
LPCTSTR  pValue
[static, protected]
 

Support function for RestoreCurrentSettings() Writes an .ini file setting in the UserInfo section of the current apps profile file using WritePrivateProfileString() and the given key and value.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/09/96
Parameters:
pKey,: The key in the .ini file [INPUTS] pValue: The value to which to set it
Returns:
TRUE if successful FALSE otherwise Scope: static protected

Definition at line 359 of file release.cpp.

00360 {
00361     ERROR2IF(pKey == NULL || pValue == NULL,FALSE,"ReleaseInfo::WriteProfile Bad params!");
00362 
00363     // This will be done when the ini file is being vaped. Hence it will happen very soon after
00364     // start up. If this happens to be the first time Camelot is started up then we may be reading
00365     // from ini files and wanting to write the data into the registry. If we do this now then we 
00366     // will be writing into the ini file as we only switch over to the registry when we are
00367     // destructing Camelot. So we must make sure that this info is written out into the registry.
00368     // If we do it now then the registry section may be vaped before we write the real data out.
00369     // We will then need to ensure that if we switch from ini file to registry mode that the data
00370     // is saved out before and restored into the new place afterwards.
00371 
00372     String_256 Key(pKey);
00373     String_256 Section(szUISection);
00374     // don't use this as for some reason it seems to be corrupt
00375     // and says Tips when it comes to calling this
00376     if (!Camelot.SetPrefDirect(Section, Key, pValue, TRUE))
00377         return FALSE;
00378 
00379     return TRUE;
00380 }


Member Data Documentation

const TCHAR* ReleaseInfo::Name [private]
 

Definition at line 132 of file release.h.

UINT32 ReleaseInfo::SerialNumber [private]
 

Definition at line 131 of file release.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:25 2007 for Camelot by  doxygen 1.4.4