Configuration.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. extern const char CustomCommandFileNamePattern[];
  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. TCopyParamType FCopyParam;
  22. void * FApplicationInfo;
  23. bool FDefaultDirIsHome;
  24. TDateTime FIgnoreCancelBeforeFinish;
  25. bool FLogging;
  26. AnsiString FLogFileName;
  27. int FLogWindowLines;
  28. bool FLogFileAppend;
  29. bool FConfirmOverwriting;
  30. AnsiString FIniFileStorageName;
  31. bool FDisablePasswordStoring;
  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 TrimVersion(AnsiString Version);
  38. AnsiString __fastcall GetStoredSessionsSubKey();
  39. AnsiString __fastcall GetPuttySessionsKey();
  40. AnsiString __fastcall GetPuttyRegistryStorageKey();
  41. void __fastcall SetRandomSeedFile(AnsiString value);
  42. AnsiString __fastcall GetRandomSeedFile();
  43. AnsiString __fastcall GetSshHostKeysSubKey();
  44. AnsiString __fastcall GetRootKeyStr();
  45. AnsiString __fastcall GetConfigurationSubKey();
  46. void __fastcall CleanupRegistry(AnsiString CleanupSubKey);
  47. TEOLType __fastcall GetLocalEOLType();
  48. void __fastcall SetDefaultDirIsHome(bool value);
  49. void __fastcall SetCopyParam(TCopyParamType value);
  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. AnsiString __fastcall GetDefaultLogFileName();
  59. AnsiString __fastcall GetTimeFormat();
  60. void __fastcall SetIgnoreCancelBeforeFinish(TDateTime value);
  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. 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. public:
  80. __fastcall TConfiguration();
  81. __fastcall ~TConfiguration();
  82. virtual void __fastcall Default();
  83. virtual void __fastcall Load();
  84. virtual void __fastcall Save();
  85. void __fastcall CleanupConfiguration();
  86. void __fastcall CleanupIniFile();
  87. void __fastcall CleanupHostKeys();
  88. void __fastcall CleanupRandomSeedFile();
  89. void __fastcall BeginUpdate();
  90. void __fastcall EndUpdate();
  91. virtual THierarchicalStorage * CreateScpStorage(bool SessionList);
  92. __property TVSFixedFileInfo *FixedApplicationInfo = { read=GetFixedApplicationInfo };
  93. __property void * ApplicationInfo = { read=GetApplicationInfo };
  94. __property bool DefaultDirIsHome = { read = FDefaultDirIsHome, write = SetDefaultDirIsHome };
  95. __property TCopyParamType CopyParam = { read = FCopyParam, write = SetCopyParam };
  96. __property AnsiString StoredSessionsSubKey = {read=GetStoredSessionsSubKey};
  97. __property AnsiString PuttyRegistryStorageKey = { read=GetPuttyRegistryStorageKey };
  98. __property AnsiString PuttySessionsKey = { read=GetPuttySessionsKey };
  99. __property AnsiString RandomSeedFile = { read=GetRandomSeedFile, write=SetRandomSeedFile };
  100. __property AnsiString SshHostKeysSubKey = { read=GetSshHostKeysSubKey };
  101. __property AnsiString RootKeyStr = { read=GetRootKeyStr };
  102. __property AnsiString ConfigurationSubKey = { read=GetConfigurationSubKey };
  103. __property bool DontSave = { read=FDontSave, write=FDontSave };
  104. __property bool RandomSeedSave = { read=FRandomSeedSave, write=FRandomSeedSave };
  105. __property TEOLType LocalEOLType = { read = GetLocalEOLType };
  106. __property AnsiString VersionStr = { read=GetVersionStr };
  107. __property AnsiString Version = { read=GetVersion };
  108. __property AnsiString ProductVersion = { read=GetProductVersion };
  109. __property AnsiString FileInfoString[AnsiString Key] = { read = GetFileInfoString };
  110. __property bool Logging = { read=FLogging, write=SetLogging };
  111. __property AnsiString LogFileName = { read=FLogFileName, write=SetLogFileName };
  112. __property bool LogToFile = { read=GetLogToFile, write=SetLogToFile };
  113. __property bool LogFileAppend = { read=FLogFileAppend, write=SetLogFileAppend };
  114. __property int LogWindowLines = { read=FLogWindowLines, write=SetLogWindowLines };
  115. __property bool LogWindowComplete = { read=GetLogWindowComplete, write=SetLogWindowComplete };
  116. __property AnsiString DefaultLogFileName = { read=GetDefaultLogFileName };
  117. __property TDateTime IgnoreCancelBeforeFinish = { read = FIgnoreCancelBeforeFinish, write = SetIgnoreCancelBeforeFinish };
  118. __property TNotifyEvent OnChange = { read = FOnChange, write = FOnChange };
  119. __property bool ConfirmOverwriting = { read = GetConfirmOverwriting, write = SetConfirmOverwriting};
  120. __property AnsiString PartialExt = {read=GetPartialExt};
  121. __property AnsiString TimeFormat = { read = GetTimeFormat };
  122. __property TStorage Storage = { read=GetStorage, write=SetStorage };
  123. __property AnsiString RegistryStorageKey = { read=GetRegistryStorageKey };
  124. __property AnsiString IniFileStorageName = { read=GetIniFileStorageName, write=SetIniFileStorageName };
  125. __property AnsiString DefaultKeyFile = { read = GetDefaultKeyFile };
  126. __property bool DisablePasswordStoring = { read = FDisablePasswordStoring };
  127. };
  128. //---------------------------------------------------------------------------
  129. bool SpecialFolderLocation(int PathID, AnsiString & Path);
  130. //---------------------------------------------------------------------------
  131. #endif