/// <summary> /// Constructor with model /// </summary> /// <param name="model">Model</param> public FilesProvider(MsSqlAuditorModel model) : this() { this._model = model; if (this._model != null) { this.SystemSettingsFileName = Path.Combine( this.StartUpFolder, CurrentAssembly.ProcessNameBase + ".SystemSettings.xml" ); this.UserSettingDefaultFileName = Path.Combine( this.StartUpFolder, CurrentAssembly.ProcessNameBase + ".UserSettings.xml" ); this.LocaleFileName = Path.Combine( this.StartUpFolder, CurrentAssembly.ProcessNameBase + ".i18n.xml" ); } var systemSetting = SettingsLoader.GetSystemSetting(this.SystemSettingsFileName); if (systemSetting != null && !string.IsNullOrEmpty(systemSetting.UserDocsAppFolder)) { this.UserDocsAppFolder = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.Personal), systemSetting.UserDocsAppFolder ); this.UserDocsAppFolderLastOnly = systemSetting.UserDocsAppFolder; } else { if (this._model != null) { this.UserDocsAppFolder = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.Personal), CurrentAssembly.ProcessNameBase ); this.UserDocsAppFolderLastOnly = CurrentAssembly.ProcessNameBase; } } if (this.UserDocsAppFolder != null) { if (!Directory.Exists(this.UserDocsAppFolder)) { Directory.CreateDirectory(this.UserDocsAppFolder); } } var fileSystemWatcher = new FileSystemWatcher(this.StartUpFolder) { IncludeSubdirectories = true, EnableRaisingEvents = true }; fileSystemWatcher.Changed += FileSystemWatcherChanged; fileSystemWatcher.Created += FileSystemWatcherChanged; fileSystemWatcher.Deleted += FileSystemWatcherChanged; fileSystemWatcher.Renamed += FileSystemWatcherChanged; var fileUserWatcher = new FileSystemWatcher(this.UserDocsAppFolder) { IncludeSubdirectories = false, EnableRaisingEvents = true }; fileUserWatcher.Changed += FileUserWatcherChanged; fileUserWatcher.Created += FileUserWatcherChanged; fileUserWatcher.Deleted += FileUserWatcherChanged; fileUserWatcher.Renamed += FileUserWatcherChanged; var tempDocsWatcher = new FileSystemWatcher(GetTempDocsFolder()) { IncludeSubdirectories = true, EnableRaisingEvents = true }; tempDocsWatcher.Changed += FileUserWatcherChanged; tempDocsWatcher.Created += FileUserWatcherChanged; tempDocsWatcher.Deleted += FileUserWatcherChanged; tempDocsWatcher.Renamed += FileUserWatcherChanged; }