예제 #1
0
 public void FromXml(XmlProviderManagerSettings xml)
 {
     this.Providers.Clear();
     if (xml.Providers != null)
     {
         foreach (XmlProvider current in xml.Providers)
         {
             ProviderSettings providerSettings = new ProviderSettings(current.ProviderId, current.InstanceId);
             if (current.Properties != null)
             {
                 foreach (XmlProviderProperty current2 in current.Properties)
                 {
                     providerSettings.Properties.SetValue(current2.Name, current2.Value);
                 }
             }
             this.Providers[new ProviderSettingsKey(providerSettings.ProviderId, providerSettings.InstanceId)] = providerSettings;
         }
     }
 }
예제 #2
0
 public void FromXml(XmlProviderManagerSettings xml)
 {
     this.Providers.Clear();
     if (xml.Providers != null)
     {
         foreach (XmlProvider current in xml.Providers)
         {
             ProviderSettings providerSettings = new ProviderSettings(current.ProviderId, current.InstanceId);
             if (current.Properties != null)
             {
                 foreach (XmlProviderProperty current2 in current.Properties)
                 {
                     providerSettings.Properties.SetValue(current2.Name, current2.Value);
                 }
             }
             this.Providers[new ProviderSettingsKey(providerSettings.ProviderId, providerSettings.InstanceId)] = providerSettings;
         }
     }
 }
예제 #3
0
 private void LoadSettings()
 {
     try
     {
         string settingsFilePath = this.GetSettingsFilePath();
         if (File.Exists(settingsFilePath))
         {
             XmlSerializer xmlSerializer = new XmlSerializer(typeof(XmlProviderManagerSettings));
             using (FileStream fileStream = new FileStream(settingsFilePath, FileMode.Open))
             {
                 XmlProviderManagerSettings xml = (XmlProviderManagerSettings)xmlSerializer.Deserialize(fileStream);
                 this.settings.FromXml(xml);
             }
         }
     }
     catch
     {
     }
 }
예제 #4
0
        public XmlProviderManagerSettings ToXml()
        {
            XmlProviderManagerSettings result = default(XmlProviderManagerSettings);

            result.Providers = new List <XmlProvider>();
            foreach (ProviderSettings providerSettings in this.Providers)
            {
                XmlProvider item = default(XmlProvider);
                item.ProviderId = providerSettings.ProviderId;
                item.InstanceId = providerSettings.InstanceId;
                item.Properties = new List <XmlProviderProperty>();
                foreach (ProviderProperty current in providerSettings.Properties.All)
                {
                    XmlProviderProperty item2 = default(XmlProviderProperty);
                    item2.Name  = current.Name;
                    item2.Value = current.Value;
                    item.Properties.Add(item2);
                }
                result.Providers.Add(item);
            }
            return(result);
        }