コード例 #1
0
        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;
        }
コード例 #2
0
 public void Save(CasClientConfiguration config, string configname)
 {
     var settingFile = GetSettingFile(configname);
     DataContractSerializationHelper.Serialize(config, settingFile);
 }
コード例 #3
0
 public void Save(CasClientConfiguration config)
 {
     this.Save(config, null);
 }
コード例 #4
0
 private static void ConfigProviderConfigChangedEvent(object sender, System.EventArgs e)
 {
     _config = ConfigProvider.Get();
 }