当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.GetSectionGroup方法代码示例

本文整理汇总了C#中System.Configuration.Configuration.GetSectionGroup方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.GetSectionGroup方法的具体用法?C# Configuration.GetSectionGroup怎么用?C# Configuration.GetSectionGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Configuration.Configuration的用法示例。


在下文中一共展示了Configuration.GetSectionGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSectionGroup

		public static SerializationSectionGroup GetSectionGroup (ConfigurationType config)
		{
			var ret = (SerializationSectionGroup) config.GetSectionGroup ("system.runtime.serialization");
			if (ret == null)
				throw new SystemException ("Internal configuration error: section 'system.runtime.serialization' was not found.");
			return ret;
		}
开发者ID:jamescourtney,项目名称:mono,代码行数:7,代码来源:SerializationSectionGroup.cs

示例2: GetSectionGroup

 static public TransactionsSectionGroup GetSectionGroup(Configuration config)
 {
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     return (TransactionsSectionGroup)config.GetSectionGroup(ConfigurationStrings.SectionGroupName);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:TransactionsSectionGroup.cs

示例3: GetSectionGroup

		public static ServiceModelSectionGroup GetSectionGroup (
			ConfigurationType config)
		{
			ServiceModelSectionGroup ret = (ServiceModelSectionGroup) config.GetSectionGroup ("system.serviceModel");
			if (ret == null)
				throw new SystemException ("Internal configuration error: section 'system.serviceModel' was not found.");
			return ret;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:8,代码来源:ServiceModelSectionGroup.cs

示例4: GetSetting

 private static SettingElement GetSetting(Configuration config, string name)
 {
     var group = config.GetSectionGroup("applicationSettings");
     var section = group.Sections.Get("Toggl.Tests.Properties.Settings") as ClientSettingsSection;
     var settings = section.Settings;
     var setting = settings.Get(name);
     return setting;
 }
开发者ID:lbarbisan,项目名称:TogglAPI.Net,代码行数:8,代码来源:Constants.cs

示例5: DeclareSection

        // Declares the section handler of a given section in its section group, if a declaration isn't already
        // present. 
        private void DeclareSection(Configuration config, string sectionName) {
            ConfigurationSectionGroup settingsGroup = config.GetSectionGroup(UserSettingsGroupName);
            
            if (settingsGroup == null) {
                //Declare settings group
                ConfigurationSectionGroup group = new UserSettingsGroup();
                config.SectionGroups.Add(UserSettingsGroupName, group);
            }

            settingsGroup = config.GetSectionGroup(UserSettingsGroupName);

            Debug.Assert(settingsGroup != null, "Failed to declare settings group");

            if (settingsGroup != null) {
                ConfigurationSection section = settingsGroup.Sections[sectionName];
                if (section == null) {
                    section = new ClientSettingsSection();
                    section.SectionInformation.AllowExeDefinition = ConfigurationAllowExeDefinition.MachineToLocalUser;
                    section.SectionInformation.RequirePermission = false;
                    settingsGroup.Sections.Add(sectionName, section);
                }
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:25,代码来源:ClientSettingsStore.cs

示例6: AddSection

       /// <summary>
       /// 
       /// </summary>
       /// <param name="pConfiguration">Configuration del app.config</param>
       /// <param name="pSectionName">Seccion</param>
        /// <param name="pSectionGroupName">Grupo</param>
       internal static void AddSection(Configuration pConfiguration, String pSectionName,String pSectionGroupName,String pSettingTemplateName)
       {
           ConfigurationSectionGroup wConfigurationSectionGroup =null;
           SettingElement wSettingElement = null;
           XmlDocument doc = new XmlDocument();
           XmlNode xmlValue = doc.CreateNode(XmlNodeType.Element, "value", String.Empty);
           ConfigurationSectionCollection wSections = null;
           if (pSectionGroupName.Length == 0)
           {
               AddSectionFromAssembly(pConfiguration, pSectionName);
               return;
           }
           else
           {
               wConfigurationSectionGroup = pConfiguration.GetSectionGroup(pSectionGroupName);
               if (wConfigurationSectionGroup == null)
                   wConfigurationSectionGroup = AddSectionGroup(pConfiguration, pSectionGroupName);
               wSections = wConfigurationSectionGroup.Sections;
               
           }

           if (wSections.Get(pSectionName) != null) return;

           ClientSettingsSection wClientSettingsSection = new ClientSettingsSection();
           wClientSettingsSection.SectionInformation.RequirePermission = false;
           wClientSettingsSection.SectionInformation.ForceSave = true;
           
           #region Settings


           Dictionary<String, String> wSettings = TemplateProvider.GetSettingDic(pSettingTemplateName);

           if (wSettings != null)
           {
               foreach (KeyValuePair<string, string> seting in wSettings)
               {
                   wSettingElement = new SettingElement();
                   wSettingElement.Name = seting.Key;
                   xmlValue.InnerXml = seting.Value;
                   wSettingElement.Value.ValueXml = xmlValue.Clone();
                   wClientSettingsSection.Settings.Add(wSettingElement);
               }


           }
           #endregion
           wSections.Add(pSectionName, wClientSettingsSection);
           
       }
开发者ID:gpanayir,项目名称:sffwk,代码行数:55,代码来源:SecctionsAndGroupsConfig.cs

示例7: GetSectionGroup

 static public NetSectionGroup GetSectionGroup(Configuration config)
 {
     if (config == null)
         throw new ArgumentNullException("config");
     return config.GetSectionGroup(ConfigurationStrings.SectionGroupName) as NetSectionGroup;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:6,代码来源:NetSectionGroup.cs

示例8: RemoveSection

       /// <summary>
       /// Elimina una seccion de la Configuration /  applicationSettings
       /// </summary>
       /// <param name="pConfiguration">Configuration App.Config</param>
       /// <param name="pSectionName">Nombre de la seccion</param>
      internal  static void RemoveSection(Configuration pConfiguration, String pSectionName)
       {
           ConfigurationSectionGroup wSectionGroup = pConfiguration.GetSectionGroup("applicationSettings");

           ConfigurationSection wSection = wSectionGroup.Sections.Get(pSectionName);//ConfigurationSection wSection = pConfiguration.GetSection("applicationSettings/" + pSectionName);
           wSection.SectionInformation.ForceSave = true;
           pConfiguration.GetSectionGroup("applicationSettings").Sections.Remove(pSectionName);

           pConfiguration.Sections.Remove(pSectionName);
       }
开发者ID:gpanayir,项目名称:sffwk,代码行数:15,代码来源:SecctionsAndGroupsConfig.cs

示例9: Add_SettingInSection

       internal static void Add_SettingInSection(Configuration pConfiguration,
           String pSectionName,
           String pSectionGroupName,
           String pSettingName,String settingValue)
       {
           ConfigurationSectionGroup wConfigurationSectionGroup = null;
           //SettingElement wSettingElement = null;
           XmlDocument doc = new XmlDocument();
           XmlNode xmlValue = doc.CreateNode(XmlNodeType.Element, "value", String.Empty);
           ConfigurationSectionCollection wSections = null;
           if (pSectionGroupName.Length == 0)
           {
               AddSectionFromAssembly(pConfiguration, pSectionName);
               return;
           }
           else
           {
               wConfigurationSectionGroup = pConfiguration.GetSectionGroup(pSectionGroupName);
               if (wConfigurationSectionGroup == null)
                   wConfigurationSectionGroup = AddSectionGroup(pConfiguration, pSectionGroupName);
               wSections = wConfigurationSectionGroup.Sections;
           }

           ConfigurationSection wConfigurationSection = wSections.Get(pSectionName);
           ClientSettingsSection wClientSettingsSection = (ClientSettingsSection)wConfigurationSection;
           wClientSettingsSection.SectionInformation.RequirePermission = false;
           wClientSettingsSection.SectionInformation.ForceSave = true;

           #region Settings
           //wClientSettingsSection.Settings.Get(pSettingName);

           SettingElement wSettingElement = new SettingElement();
           wSettingElement.Name = pSettingName;
           xmlValue.InnerXml = settingValue;
           wSettingElement.Value.ValueXml = xmlValue.Clone();
           wClientSettingsSection.Settings.Add(wSettingElement);

           #endregion

       }
开发者ID:gpanayir,项目名称:sffwk,代码行数:40,代码来源:SecctionsAndGroupsConfig.cs

示例10: GetSettingElementCollection

        /// <summary>
        /// Gets the <see cref="SettingElementCollection"/> for the specified section name within
        /// the specified configuration.
        /// </summary>
        /// <param name="config">The <see cref="Configuration"/> object.</param>
        /// <param name="sectionName">The settings section name.</param>
        /// <returns>
        /// A <see cref="SettingElementCollection"/> for the section, or an empty section if not found.
        /// </returns>
        private static SettingElementCollection GetSettingElementCollection(Configuration config, string sectionName)
        {
            var userSettings = config.GetSectionGroup("userSettings");
            if (userSettings == null)
            {
                userSettings = new UserSettingsGroup();
                config.SectionGroups.Add("userSettings", userSettings);
            }

            var section = userSettings.Sections.Get(sectionName) as ClientSettingsSection;
            if (section == null)
            {
                section = new ClientSettingsSection();
                userSettings.Sections.Add(sectionName, section);
            }

            return section.Settings;
        }
开发者ID:reima,项目名称:codemaid,代码行数:27,代码来源:CodeMaidSettingsProvider.cs

示例11: RemoveSettingsValues

		public static void RemoveSettingsValues(SystemConfiguration configuration, Type settingsClass)
		{
			var sectionPath = new ConfigurationSectionPath(settingsClass, SettingScope.Application);
			ConfigurationSectionGroup group = configuration.GetSectionGroup(sectionPath.GroupPath);
			if (group != null)
				group.Sections.Remove(sectionPath.SectionName);

			sectionPath = new ConfigurationSectionPath(settingsClass, SettingScope.User);
			group = configuration.GetSectionGroup(sectionPath.GroupPath);
			if (group != null)
				group.Sections.Remove(sectionPath.SectionName);

			configuration.Save(ConfigurationSaveMode.Minimal, true);
		}
开发者ID:khaha2210,项目名称:radio,代码行数:14,代码来源:SystemConfigurationHelper.cs

示例12: GenerateEnvironmentConfiguration

        private static void GenerateEnvironmentConfiguration(Configuration envConfig, Configuration mainConfig)
        {
            // Connection strings
            foreach (ConnectionStringSettings connectionString in envConfig.ConnectionStrings.ConnectionStrings)
            {
                if (connectionString.Name == "LocalSqlServer") continue;
                mainConfig.ConnectionStrings.ConnectionStrings[connectionString.Name].ConnectionString =
                    connectionString.ConnectionString;
            }

            // app settings
            foreach (KeyValueConfigurationElement setting in envConfig.AppSettings.Settings)
            {
                mainConfig.AppSettings.Settings[setting.Key].Value = setting.Value;
            }

            // applicationSettings
            var group = envConfig.GetSectionGroup("applicationSettings");
            if (group != null)
            {
                foreach (ConfigurationSection section in group.Sections)
                {
                    if (!(section is ClientSettingsSection)) continue;

                    var s = (ClientSettingsSection)section;

                    var mainGroup = mainConfig.GetSectionGroup("applicationSettings");
                    if (mainGroup == null)
                    {
                        mainConfig.SectionGroups.Add("applicationSettings", group);
                        break;
                    }

                    var mainS = mainGroup.Sections.Get(s.SectionInformation.Name) as ClientSettingsSection;
                    if (mainS == null)
                    {
                        mainGroup.Sections.Add(s.SectionInformation.Name, s);
                    }
                    else
                    {
                        foreach (SettingElement setting in s.Settings)
                        {
                            var toRemove = mainS.Settings.Get(setting.Name);
                            if (toRemove != null)
                            {
                                mainS.Settings.Remove(toRemove);
                            }

                            mainS.Settings.Add(setting);
                        }
                    }
                }
            }

            mainConfig.Save();
        }
开发者ID:tclem,项目名称:pstrano,代码行数:56,代码来源:WriteEnvironmentConfiguration.cs

示例13: GetSection

        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the section <paramref name="sectionName"/> in the section group "userSettings".
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private static ClientSettingsSection GetSection(Configuration config, string sectionName,
			string sectionGroup = "userSettings")
        {
            var userSettingsGroup = config.GetSectionGroup(sectionGroup);
            if (userSettingsGroup == null)
            {
                userSettingsGroup = new ConfigurationSectionGroup();
                config.SectionGroups.Add(sectionGroup, userSettingsGroup);
            }
            var section = userSettingsGroup.Sections[sectionName] as ClientSettingsSection;
            if (section == null)
            {
                section = new ClientSettingsSection();
                userSettingsGroup.Sections.Add(sectionName, section);
            }
            return section;
        }
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:22,代码来源:LibSettingsProvider.cs

示例14: Instance

 public static SmtpMailer Instance(Configuration configuration)
 {
     _mailSettings = configuration.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup;
     return _instance ?? (_instance = new SmtpMailer());
 }
开发者ID:CyberNyanta,项目名称:QueryBuilder,代码行数:5,代码来源:SmtpMailer.cs

示例15: SetDisUrl

		//修改applicationSettings
		private void SetDisUrl(WsConfig wsconfig, Configuration config)
		{			
			ApplicationSettingsGroup appSection = config.GetSectionGroup("applicationSettings") as ApplicationSettingsGroup;			
			ClientSettingsSection css = appSection.Sections[0] as ClientSettingsSection;

			SettingElement se = css.Settings.Get("CM_EDI_Service_DocumentManagement_WSTosEdiInterface_WSTosEdiInterface");
			if (se != null)
			{
				css.Settings.Remove(se);
				se.Value.ValueXml.InnerXml = string.Format("http://{0}:{1}/Service.asmx", IISWorker.GetIp(), wsconfig.DISInterAPIServerSitePort);
				css.Settings.Add(se);
			}
			se = css.Settings.Get("CM_CTOS_BLL_BLLWebProxy_WSEdiTosInterface_WsEdiTosInterface");
			if (se != null)
			{
				css.Settings.Remove(se);
				se.Value.ValueXml.InnerXml = string.Format("http://{0}:{1}/Service.asmx", IISWorker.GetIp(), wsconfig.EdiServerSitePort);
				css.Settings.Add(se);
			}
			se = css.Settings.Get("TosPACSAddress");
			if (se != null)
			{
				css.Settings.Remove(se);
				se.Value.ValueXml.InnerXml = string.Format("http://{0}:{1}/Service.asmx", IISWorker.GetIp(), wsconfig.RpcDomainPort);
				css.Settings.Add(se);
			}
			se = css.Settings.Get("CM_CTOS_BLL_BLLWebProxy_WSBaseDataSearchForBilling_WSBaseDataSearch");
			if (se != null)
			{
				string url = string.IsNullOrEmpty(wsconfig.BillingDataServerSitePath) ? se.Value.ValueXml.InnerText = wsconfig.BillingDataServerSite :string.Format("http://{0}:{1}/{2}/Service.asmx", IISWorker.GetIp(), wsconfig.BillingDataServerSitePort, wsconfig.BillingDataServerSite);

				css.Settings.Remove(se);
				se.Value.ValueXml.InnerXml = url;
				css.Settings.Add(se);
			}
			se = css.Settings.Get("CM_CTOS_BLL_BLLWebProxy_WSBillingExternalInterface_WSBillingExternalInterface");
			if (se != null)
			{
				string url = string.IsNullOrEmpty(wsconfig.BillingInternelServerSitePath) ? se.Value.ValueXml.InnerText = wsconfig.BillingInternelServerSite :string.Format("http://{0}:{1}/{2}/Service.asmx", IISWorker.GetIp(), wsconfig.BillingInternelServerSitePort);

				css.Settings.Remove(se);
				se.Value.ValueXml.InnerXml = url;
				css.Settings.Add(se);
			}
		}
开发者ID:szlfwolf,项目名称:FZF,代码行数:46,代码来源:disconfigedit.cs


注:本文中的System.Configuration.Configuration.GetSectionGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。