Configuration.h 8.8 KB

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