public CasClientConfiguration Get(string configname) { CasClientConfiguration instance; var xmlFile = GetSettingFile(configname); if (File.Exists(xmlFile)) { instance = DataContractSerializationHelper.Deserialize<CasClientConfiguration>(xmlFile); } else { instance = new CasClientConfiguration { CasServerUrl = "http://passport.xxxxxx.com", CasPath = "/CAS", //LocalLoginPath = Utils.WebConfigUtils.FormsLoginUrl() }; this.Save(instance, configname); } if (filewatcher == null) { filewatcher = new System.IO.FileSystemWatcher(); //filewatcher. filewatcher.Filter = Path.GetFileName(xmlFile); //filewatcher.NotifyFilter = NotifyFilters.LastWrite; filewatcher.Path = Path.GetDirectoryName(xmlFile).TrimEnd('\\') + "\\"; filewatcher.Changed += this.FlilewatcherChanged; filewatcher.EnableRaisingEvents = true; } return instance; }
public void Save(CasClientConfiguration config, string configname) { var settingFile = GetSettingFile(configname); DataContractSerializationHelper.Serialize(config, settingFile); }
public void Save(CasClientConfiguration config) { this.Save(config, null); }
private static void ConfigProviderConfigChangedEvent(object sender, System.EventArgs e) { _config = ConfigProvider.Get(); }