/// <summary> /// Constructor with mainform /// </summary> /// <param name="mainForm">Mainform </param> public MsSqlAuditorModel() { this._vaultProcessors = new Dictionary<ConnectionGroupInfo, IStorageManager>(); this._settings = null; this._layoutSettings = null; this._localeManager = null; this._templateSettings = null; this._filesProvider = new FilesProvider(this); LoadSettings(); this._visualizeProcessor = new VisualizeProcessor(this); this._cryptoService = new CachingCryptoService(Settings.EncryptionKey); DeleteTempCurrentDbFile(); }
private void LoadSettings() { if (!File.Exists(FilesProvider.SystemSettingsFileName)) { MessageBox.Show("System settings file doesn't exists at path " + FilesProvider.SystemSettingsFileName); throw new FileLoadException("System settings file doesn't exists at path " + FilesProvider.SystemSettingsFileName); } if (File.Exists(FilesProvider.UserSettingsFileName)) { this._settings = SettingsLoader.LoadFromXml( FilesProvider.UserSettingsFileName, FilesProvider.SystemSettingsFileName ); } else { this._settings = SettingsLoader.LoadFromXml( FilesProvider.UserSettingDefaultFileName, FilesProvider.SystemSettingsFileName ); SettingsLoader.SaveToXml( FilesProvider.UserSettingsFileName, this._settings ); } if (File.Exists(FilesProvider.UserLayoutSettingsFileName)) { this._layoutSettings = SettingsLoader.LoadAsBaseFromXml<LayoutSettings>( FilesProvider.UserLayoutSettingsFileName ); } else { this._layoutSettings = new LayoutSettings(); SettingsLoader.SaveToXml( FilesProvider.UserLayoutSettingsFileName, this._layoutSettings ); } if (File.Exists(FilesProvider.UserTemplateSettingsFileName)) { // this._templateSettings = SettingsLoader.LoadAsTemplateFromXml<ActivityLayoutSetting>(FilesProvider.UserTemplateSettingsFileName); // ActivityLayoutSetting loader = new ActivityLayoutSetting(); this._templateSettings = new ActivityLayoutSetting(); this._templateSettings.UserSettings = SettingsLoader.LoadAsTemplateFromXml<List<InstanceTemplate>>( FilesProvider.UserTemplateSettingsFileName ); } else { this._templateSettings = new ActivityLayoutSetting(); SettingsLoader.SaveTemplateToXml( FilesProvider.UserTemplateSettingsFileName, this._templateSettings ); } }