Configuration.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. //---------------------------------------------------------------------------
  2. #ifndef ConfigurationH
  3. #define ConfigurationH
  4. #include "RemoteFiles.h"
  5. #include "FileBuffer.h"
  6. #include "HierarchicalStorage.h"
  7. //---------------------------------------------------------------------------
  8. #define SET_CONFIG_PROPERTY(PROPERTY) \
  9. if (PROPERTY != value) { F ## PROPERTY = value; Changed(); }
  10. //---------------------------------------------------------------------------
  11. class TCriticalSection;
  12. //---------------------------------------------------------------------------
  13. class TConfiguration : public TObject
  14. {
  15. private:
  16. bool FDontSave;
  17. bool FChanged;
  18. int FUpdating;
  19. TNotifyEvent FOnChange;
  20. bool FRandomSeedSave;
  21. void * FApplicationInfo;
  22. bool FLogging;
  23. AnsiString FLogFileName;
  24. int FLogWindowLines;
  25. bool FLogFileAppend;
  26. int FLogProtocol;
  27. bool FConfirmOverwriting;
  28. bool FConfirmResume;
  29. AnsiString FIniFileStorageName;
  30. bool FDisablePasswordStoring;
  31. int FGSSAPIInstalled;
  32. AnsiString __fastcall GetOSVersionStr();
  33. TVSFixedFileInfo *__fastcall GetFixedApplicationInfo();
  34. void * __fastcall GetApplicationInfo();
  35. virtual AnsiString __fastcall GetVersionStr();
  36. virtual AnsiString __fastcall GetVersion();
  37. AnsiString __fastcall GetProductVersion();
  38. AnsiString __fastcall GetProductName();
  39. AnsiString __fastcall GetCompanyName();
  40. AnsiString __fastcall TrimVersion(AnsiString Version);
  41. AnsiString __fastcall GetStoredSessionsSubKey();
  42. AnsiString __fastcall GetPuttySessionsKey();
  43. AnsiString __fastcall GetPuttyRegistryStorageKey();
  44. void __fastcall SetRandomSeedFile(AnsiString value);
  45. AnsiString __fastcall GetRandomSeedFile();
  46. AnsiString __fastcall GetSshHostKeysSubKey();
  47. AnsiString __fastcall GetRootKeyStr();
  48. AnsiString __fastcall GetConfigurationSubKey();
  49. TEOLType __fastcall GetLocalEOLType();
  50. void __fastcall SetLogging(bool value);
  51. void __fastcall SetLogFileName(AnsiString value);
  52. void __fastcall SetLogToFile(bool value);
  53. bool __fastcall GetLogToFile();
  54. void __fastcall SetLogWindowLines(int value);
  55. void __fastcall SetLogWindowComplete(bool value);
  56. bool __fastcall GetLogWindowComplete();
  57. void __fastcall SetLogFileAppend(bool value);
  58. void __fastcall SetLogProtocol(int value);
  59. AnsiString __fastcall GetDefaultLogFileName();
  60. AnsiString __fastcall GetTimeFormat();
  61. void __fastcall SetStorage(TStorage value);
  62. AnsiString __fastcall GetRegistryStorageKey();
  63. AnsiString __fastcall GetIniFileStorageName();
  64. void __fastcall SetIniFileStorageName(AnsiString value);
  65. AnsiString __fastcall GetPartialExt() const;
  66. AnsiString __fastcall GetFileInfoString(const AnsiString Key);
  67. AnsiString __fastcall GetLocalInvalidChars();
  68. bool __fastcall GetGSSAPIInstalled();
  69. protected:
  70. TStorage FStorage;
  71. TCriticalSection * FCriticalSection;
  72. virtual TStorage __fastcall GetStorage();
  73. virtual void __fastcall Changed();
  74. virtual void __fastcall SaveSpecial(THierarchicalStorage * Storage);
  75. virtual void __fastcall LoadSpecial(THierarchicalStorage * Storage);
  76. virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
  77. virtual AnsiString __fastcall GetDefaultKeyFile();
  78. virtual void __fastcall ModifyAll();
  79. void __fastcall CleanupRegistry(AnsiString CleanupSubKey);
  80. virtual bool __fastcall GetConfirmOverwriting();
  81. virtual void __fastcall SetConfirmOverwriting(bool value);
  82. bool __fastcall GetConfirmResume();
  83. void __fastcall SetConfirmResume(bool value);
  84. virtual bool __fastcall GetRememberPassword();
  85. virtual AnsiString __fastcall ModuleFileName();
  86. AnsiString __fastcall GetFileFileInfoString(const AnsiString Key,
  87. const AnsiString FileName);
  88. void * __fastcall GetFileApplicationInfo(const AnsiString FileName);
  89. AnsiString __fastcall GetFileProductVersion(const AnsiString FileName);
  90. AnsiString __fastcall GetFileProductName(const AnsiString FileName);
  91. AnsiString __fastcall GetFileCompanyName(const AnsiString FileName);
  92. public:
  93. __fastcall TConfiguration();
  94. virtual __fastcall ~TConfiguration();
  95. virtual void __fastcall Default();
  96. virtual void __fastcall Load();
  97. virtual void __fastcall Save();
  98. void __fastcall CleanupConfiguration();
  99. void __fastcall CleanupIniFile();
  100. void __fastcall CleanupHostKeys();
  101. void __fastcall CleanupRandomSeedFile();
  102. void __fastcall BeginUpdate();
  103. void __fastcall EndUpdate();
  104. void __fastcall LoadDirectoryChangesCache(const AnsiString SessionKey,
  105. TRemoteDirectoryChangesCache * DirectoryChangesCache);
  106. void __fastcall SaveDirectoryChangesCache(const AnsiString SessionKey,
  107. TRemoteDirectoryChangesCache * DirectoryChangesCache);
  108. virtual THierarchicalStorage * CreateScpStorage(bool SessionList);
  109. __property TVSFixedFileInfo *FixedApplicationInfo = { read=GetFixedApplicationInfo };
  110. __property void * ApplicationInfo = { read=GetApplicationInfo };
  111. __property AnsiString StoredSessionsSubKey = {read=GetStoredSessionsSubKey};
  112. __property AnsiString PuttyRegistryStorageKey = { read=GetPuttyRegistryStorageKey };
  113. __property AnsiString PuttySessionsKey = { read=GetPuttySessionsKey };
  114. __property AnsiString RandomSeedFile = { read=GetRandomSeedFile, write=SetRandomSeedFile };
  115. __property AnsiString SshHostKeysSubKey = { read=GetSshHostKeysSubKey };
  116. __property AnsiString RootKeyStr = { read=GetRootKeyStr };
  117. __property AnsiString ConfigurationSubKey = { read=GetConfigurationSubKey };
  118. __property TEOLType LocalEOLType = { read = GetLocalEOLType };
  119. __property AnsiString VersionStr = { read=GetVersionStr };
  120. __property AnsiString Version = { read=GetVersion };
  121. __property AnsiString ProductVersion = { read=GetProductVersion };
  122. __property AnsiString ProductName = { read=GetProductName };
  123. __property AnsiString CompanyName = { read=GetCompanyName };
  124. __property AnsiString FileInfoString[AnsiString Key] = { read = GetFileInfoString };
  125. __property AnsiString OSVersionStr = { read = GetOSVersionStr };
  126. __property bool Logging = { read=FLogging, write=SetLogging };
  127. __property AnsiString LogFileName = { read=FLogFileName, write=SetLogFileName };
  128. __property bool LogToFile = { read=GetLogToFile, write=SetLogToFile };
  129. __property bool LogFileAppend = { read=FLogFileAppend, write=SetLogFileAppend };
  130. __property int LogProtocol = { read=FLogProtocol, write=SetLogProtocol };
  131. __property int LogWindowLines = { read=FLogWindowLines, write=SetLogWindowLines };
  132. __property bool LogWindowComplete = { read=GetLogWindowComplete, write=SetLogWindowComplete };
  133. __property AnsiString DefaultLogFileName = { read=GetDefaultLogFileName };
  134. __property TNotifyEvent OnChange = { read = FOnChange, write = FOnChange };
  135. __property bool ConfirmOverwriting = { read = GetConfirmOverwriting, write = SetConfirmOverwriting};
  136. __property bool ConfirmResume = { read = GetConfirmResume, write = SetConfirmResume};
  137. __property bool RememberPassword = { read = GetRememberPassword };
  138. __property AnsiString PartialExt = {read=GetPartialExt};
  139. __property AnsiString TimeFormat = { read = GetTimeFormat };
  140. __property TStorage Storage = { read=GetStorage, write=SetStorage };
  141. __property AnsiString RegistryStorageKey = { read=GetRegistryStorageKey };
  142. __property AnsiString IniFileStorageName = { read=GetIniFileStorageName, write=SetIniFileStorageName };
  143. __property AnsiString DefaultKeyFile = { read = GetDefaultKeyFile };
  144. __property AnsiString LocalInvalidChars = { read = GetLocalInvalidChars };
  145. __property bool DisablePasswordStoring = { read = FDisablePasswordStoring };
  146. __property bool GSSAPIInstalled = { read = GetGSSAPIInstalled };
  147. };
  148. //---------------------------------------------------------------------------
  149. #endif