Configuration.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. bool FConfirmOverwriting;
  27. AnsiString FIniFileStorageName;
  28. bool FRememberPassword;
  29. bool FDisablePasswordStoring;
  30. int FGSSAPIInstalled;
  31. AnsiString __fastcall GetOSVersionStr();
  32. TVSFixedFileInfo *__fastcall GetFixedApplicationInfo();
  33. void * __fastcall GetApplicationInfo();
  34. virtual AnsiString __fastcall GetVersionStr();
  35. virtual AnsiString __fastcall GetVersion();
  36. AnsiString __fastcall GetProductVersion();
  37. AnsiString __fastcall GetProductName();
  38. AnsiString __fastcall GetCompanyName();
  39. AnsiString __fastcall TrimVersion(AnsiString Version);
  40. AnsiString __fastcall GetStoredSessionsSubKey();
  41. AnsiString __fastcall GetPuttySessionsKey();
  42. AnsiString __fastcall GetPuttyRegistryStorageKey();
  43. void __fastcall SetRandomSeedFile(AnsiString value);
  44. AnsiString __fastcall GetRandomSeedFile();
  45. AnsiString __fastcall GetSshHostKeysSubKey();
  46. AnsiString __fastcall GetRootKeyStr();
  47. AnsiString __fastcall GetConfigurationSubKey();
  48. TEOLType __fastcall GetLocalEOLType();
  49. void __fastcall SetLogging(bool value);
  50. void __fastcall SetLogFileName(AnsiString value);
  51. void __fastcall SetLogToFile(bool value);
  52. bool __fastcall GetLogToFile();
  53. void __fastcall SetLogWindowLines(int value);
  54. void __fastcall SetLogWindowComplete(bool value);
  55. bool __fastcall GetLogWindowComplete();
  56. void __fastcall SetLogFileAppend(bool value);
  57. AnsiString __fastcall GetDefaultLogFileName();
  58. AnsiString __fastcall GetTimeFormat();
  59. void __fastcall SetStorage(TStorage value);
  60. AnsiString __fastcall GetRegistryStorageKey();
  61. AnsiString __fastcall GetIniFileStorageName();
  62. void __fastcall SetIniFileStorageName(AnsiString value);
  63. AnsiString __fastcall GetPartialExt() const;
  64. AnsiString __fastcall GetFileInfoString(const AnsiString Key);
  65. AnsiString __fastcall GetLocalInvalidChars();
  66. bool __fastcall GetGSSAPIInstalled();
  67. protected:
  68. TStorage FStorage;
  69. TCriticalSection * FCriticalSection;
  70. virtual TStorage __fastcall GetStorage();
  71. virtual void __fastcall Changed();
  72. virtual void __fastcall SaveSpecial(THierarchicalStorage * Storage);
  73. virtual void __fastcall LoadSpecial(THierarchicalStorage * Storage);
  74. virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
  75. virtual AnsiString __fastcall GetDefaultKeyFile();
  76. virtual void __fastcall ModifyAll();
  77. void __fastcall CleanupRegistry(AnsiString CleanupSubKey);
  78. virtual bool __fastcall GetConfirmOverwriting();
  79. virtual void __fastcall SetConfirmOverwriting(bool value);
  80. virtual AnsiString __fastcall ModuleFileName();
  81. AnsiString __fastcall GetFileFileInfoString(const AnsiString Key,
  82. const AnsiString FileName);
  83. void * __fastcall GetFileApplicationInfo(const AnsiString FileName);
  84. AnsiString __fastcall GetFileProductVersion(const AnsiString FileName);
  85. AnsiString __fastcall GetFileProductName(const AnsiString FileName);
  86. AnsiString __fastcall GetFileCompanyName(const AnsiString FileName);
  87. public:
  88. __fastcall TConfiguration();
  89. virtual __fastcall ~TConfiguration();
  90. virtual void __fastcall Default();
  91. virtual void __fastcall Load();
  92. virtual void __fastcall Save();
  93. void __fastcall CleanupConfiguration();
  94. void __fastcall CleanupIniFile();
  95. void __fastcall CleanupHostKeys();
  96. void __fastcall CleanupRandomSeedFile();
  97. void __fastcall BeginUpdate();
  98. void __fastcall EndUpdate();
  99. void __fastcall LoadDirectoryChangesCache(const AnsiString SessionKey,
  100. TRemoteDirectoryChangesCache * DirectoryChangesCache);
  101. void __fastcall SaveDirectoryChangesCache(const AnsiString SessionKey,
  102. TRemoteDirectoryChangesCache * DirectoryChangesCache);
  103. virtual THierarchicalStorage * CreateScpStorage(bool SessionList);
  104. __property TVSFixedFileInfo *FixedApplicationInfo = { read=GetFixedApplicationInfo };
  105. __property void * ApplicationInfo = { read=GetApplicationInfo };
  106. __property AnsiString StoredSessionsSubKey = {read=GetStoredSessionsSubKey};
  107. __property AnsiString PuttyRegistryStorageKey = { read=GetPuttyRegistryStorageKey };
  108. __property AnsiString PuttySessionsKey = { read=GetPuttySessionsKey };
  109. __property AnsiString RandomSeedFile = { read=GetRandomSeedFile, write=SetRandomSeedFile };
  110. __property AnsiString SshHostKeysSubKey = { read=GetSshHostKeysSubKey };
  111. __property AnsiString RootKeyStr = { read=GetRootKeyStr };
  112. __property AnsiString ConfigurationSubKey = { read=GetConfigurationSubKey };
  113. __property bool DontSave = { read=FDontSave, write=FDontSave };
  114. __property bool RandomSeedSave = { read=FRandomSeedSave, write=FRandomSeedSave };
  115. __property TEOLType LocalEOLType = { read = GetLocalEOLType };
  116. __property AnsiString VersionStr = { read=GetVersionStr };
  117. __property AnsiString Version = { read=GetVersion };
  118. __property AnsiString ProductVersion = { read=GetProductVersion };
  119. __property AnsiString ProductName = { read=GetProductName };
  120. __property AnsiString CompanyName = { read=GetCompanyName };
  121. __property AnsiString FileInfoString[AnsiString Key] = { read = GetFileInfoString };
  122. __property AnsiString OSVersionStr = { read = GetOSVersionStr };
  123. __property bool Logging = { read=FLogging, write=SetLogging };
  124. __property AnsiString LogFileName = { read=FLogFileName, write=SetLogFileName };
  125. __property bool LogToFile = { read=GetLogToFile, write=SetLogToFile };
  126. __property bool LogFileAppend = { read=FLogFileAppend, write=SetLogFileAppend };
  127. __property int LogWindowLines = { read=FLogWindowLines, write=SetLogWindowLines };
  128. __property bool LogWindowComplete = { read=GetLogWindowComplete, write=SetLogWindowComplete };
  129. __property AnsiString DefaultLogFileName = { read=GetDefaultLogFileName };
  130. __property TNotifyEvent OnChange = { read = FOnChange, write = FOnChange };
  131. __property bool ConfirmOverwriting = { read = GetConfirmOverwriting, write = SetConfirmOverwriting};
  132. __property bool RememberPassword = { read = FRememberPassword, write = FRememberPassword };
  133. __property AnsiString PartialExt = {read=GetPartialExt};
  134. __property AnsiString TimeFormat = { read = GetTimeFormat };
  135. __property TStorage Storage = { read=GetStorage, write=SetStorage };
  136. __property AnsiString RegistryStorageKey = { read=GetRegistryStorageKey };
  137. __property AnsiString IniFileStorageName = { read=GetIniFileStorageName, write=SetIniFileStorageName };
  138. __property AnsiString DefaultKeyFile = { read = GetDefaultKeyFile };
  139. __property AnsiString LocalInvalidChars = { read = GetLocalInvalidChars };
  140. __property bool DisablePasswordStoring = { read = FDisablePasswordStoring };
  141. __property bool GSSAPIInstalled = { read = GetGSSAPIInstalled };
  142. };
  143. //---------------------------------------------------------------------------
  144. #endif