Configuration.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //---------------------------------------------------------------------------
  2. #ifndef ConfigurationH
  3. #define ConfigurationH
  4. #include "CopyParam.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 TConfiguration : public TObject
  12. {
  13. private:
  14. bool FDontSave;
  15. bool FChanged;
  16. int FUpdating;
  17. TNotifyEvent FOnChange;
  18. bool FRandomSeedSave;
  19. TCopyParamType FCopyParam;
  20. void * FApplicationInfo;
  21. bool FDefaultDirIsHome;
  22. TDateTime FIgnoreCancelBeforeFinish;
  23. bool FLogging;
  24. AnsiString FLogFileName;
  25. int FLogWindowLines;
  26. bool FLogFileAppend;
  27. bool FConfirmOverwriting;
  28. AnsiString FIniFileStorageName;
  29. bool FDisablePasswordStoring;
  30. TVSFixedFileInfo *__fastcall GetFixedApplicationInfo();
  31. void * __fastcall GetApplicationInfo();
  32. virtual AnsiString __fastcall GetVersionStr();
  33. virtual AnsiString __fastcall GetVersion();
  34. AnsiString __fastcall GetProductVersion();
  35. AnsiString __fastcall GetProductName();
  36. AnsiString __fastcall TrimVersion(AnsiString Version);
  37. AnsiString __fastcall GetStoredSessionsSubKey();
  38. AnsiString __fastcall GetPuttySessionsKey();
  39. AnsiString __fastcall GetPuttyRegistryStorageKey();
  40. void __fastcall SetRandomSeedFile(AnsiString value);
  41. AnsiString __fastcall GetRandomSeedFile();
  42. AnsiString __fastcall GetSshHostKeysSubKey();
  43. AnsiString __fastcall GetRootKeyStr();
  44. AnsiString __fastcall GetConfigurationSubKey();
  45. void __fastcall CleanupRegistry(AnsiString CleanupSubKey);
  46. TEOLType __fastcall GetLocalEOLType();
  47. void __fastcall SetDefaultDirIsHome(bool value);
  48. void __fastcall SetCopyParam(TCopyParamType value);
  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 SetIgnoreCancelBeforeFinish(TDateTime value);
  60. void __fastcall SetStorage(TStorage value);
  61. AnsiString __fastcall GetRegistryStorageKey();
  62. AnsiString __fastcall GetIniFileStorageName();
  63. void __fastcall SetIniFileStorageName(AnsiString value);
  64. AnsiString __fastcall GetPartialExt() const;
  65. AnsiString __fastcall GetFileInfoString(const AnsiString Key);
  66. AnsiString __fastcall GetLocalInvalidChars();
  67. protected:
  68. TStorage FStorage;
  69. virtual TStorage __fastcall GetStorage();
  70. virtual void __fastcall Changed();
  71. virtual void __fastcall SaveSpecial(THierarchicalStorage * Storage);
  72. virtual void __fastcall LoadSpecial(THierarchicalStorage * Storage);
  73. virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
  74. virtual AnsiString __fastcall GetDefaultKeyFile();
  75. virtual void __fastcall ModifyAll();
  76. virtual bool __fastcall GetConfirmOverwriting();
  77. virtual void __fastcall SetConfirmOverwriting(bool value);
  78. virtual AnsiString __fastcall ModuleFileName();
  79. AnsiString __fastcall GetFileFileInfoString(const AnsiString Key,
  80. const AnsiString FileName);
  81. void * __fastcall GetFileApplicationInfo(const AnsiString FileName);
  82. AnsiString __fastcall GetFileProductVersion(const AnsiString FileName);
  83. AnsiString __fastcall TConfiguration::GetFileProductName(
  84. const AnsiString FileName);
  85. public:
  86. __fastcall TConfiguration();
  87. __fastcall ~TConfiguration();
  88. virtual void __fastcall Default();
  89. virtual void __fastcall Load();
  90. virtual void __fastcall Save();
  91. void __fastcall CleanupConfiguration();
  92. void __fastcall CleanupIniFile();
  93. void __fastcall CleanupHostKeys();
  94. void __fastcall CleanupRandomSeedFile();
  95. void __fastcall BeginUpdate();
  96. void __fastcall EndUpdate();
  97. void __fastcall LoadDirectoryChangesCache(const AnsiString SessionKey,
  98. TRemoteDirectoryChangesCache * DirectoryChangesCache);
  99. void __fastcall SaveDirectoryChangesCache(const AnsiString SessionKey,
  100. TRemoteDirectoryChangesCache * DirectoryChangesCache);
  101. virtual THierarchicalStorage * CreateScpStorage(bool SessionList);
  102. __property TVSFixedFileInfo *FixedApplicationInfo = { read=GetFixedApplicationInfo };
  103. __property void * ApplicationInfo = { read=GetApplicationInfo };
  104. __property bool DefaultDirIsHome = { read = FDefaultDirIsHome, write = SetDefaultDirIsHome };
  105. __property TCopyParamType CopyParam = { read = FCopyParam, write = SetCopyParam };
  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 FileInfoString[AnsiString Key] = { read = GetFileInfoString };
  121. __property bool Logging = { read=FLogging, write=SetLogging };
  122. __property AnsiString LogFileName = { read=FLogFileName, write=SetLogFileName };
  123. __property bool LogToFile = { read=GetLogToFile, write=SetLogToFile };
  124. __property bool LogFileAppend = { read=FLogFileAppend, write=SetLogFileAppend };
  125. __property int LogWindowLines = { read=FLogWindowLines, write=SetLogWindowLines };
  126. __property bool LogWindowComplete = { read=GetLogWindowComplete, write=SetLogWindowComplete };
  127. __property AnsiString DefaultLogFileName = { read=GetDefaultLogFileName };
  128. __property TDateTime IgnoreCancelBeforeFinish = { read = FIgnoreCancelBeforeFinish, write = SetIgnoreCancelBeforeFinish };
  129. __property TNotifyEvent OnChange = { read = FOnChange, write = FOnChange };
  130. __property bool ConfirmOverwriting = { read = GetConfirmOverwriting, write = SetConfirmOverwriting};
  131. __property AnsiString PartialExt = {read=GetPartialExt};
  132. __property AnsiString TimeFormat = { read = GetTimeFormat };
  133. __property TStorage Storage = { read=GetStorage, write=SetStorage };
  134. __property AnsiString RegistryStorageKey = { read=GetRegistryStorageKey };
  135. __property AnsiString IniFileStorageName = { read=GetIniFileStorageName, write=SetIniFileStorageName };
  136. __property AnsiString DefaultKeyFile = { read = GetDefaultKeyFile };
  137. __property AnsiString LocalInvalidChars = { read = GetLocalInvalidChars };
  138. __property bool DisablePasswordStoring = { read = FDisablePasswordStoring };
  139. };
  140. //---------------------------------------------------------------------------
  141. #endif