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


C# ConfigSection类代码示例

本文整理汇总了C#中ConfigSection的典型用法代码示例。如果您正苦于以下问题:C# ConfigSection类的具体用法?C# ConfigSection怎么用?C# ConfigSection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ConfigKeyAttribute

 protected ConfigKeyAttribute( ConfigSection section, [NotNull] Type valueType, object defaultValue, [NotNull] string description )
     : base( description ) {
     if( valueType == null ) throw new ArgumentNullException( "valueType" );
     if( description == null ) throw new ArgumentNullException( "description" );
     ValueType = valueType;
     DefaultValue = defaultValue;
     Section = section;
     NotBlank = false;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:9,代码来源:ConfigKey.Metadata.cs

示例2: Create

        public static ComponentBase Create(IDictionary<string, string> globalValues, ConfigSection section, int index)
        {
            if (!section.ContainsKey(ComponentTypeString))
            {
                throw new ArgumentException("No ComponentType given for section: " + section.Name);
            }

            //assign all global values to the local configSection.
            IDictionary<string, string> localValues = section.ValuesAsDictionary;
            foreach (KeyValuePair<string, string> globalValue in globalValues)
            {
                if (!localValues.ContainsKey(globalValue.Key))
                {
                    localValues.Add(globalValue.Key, globalValue.Value);
                }
            }

            ComponentBase item = null;

            switch (ParseToComponentType(section[ComponentTypeString]))
            {
                case ComponentType.FileInstaller:
                    item = new  FileInstallerComponentGraph(section.Name, localValues);
                    break;
                case ComponentType.FileRemover:
                    item = new FileRemoverComponentGraph(section.Name, localValues);
                    break;
                case ComponentType.AppPoolInstaller:
                    item = new AppPoolInstallerComponentGraph(section.Name, localValues);
                    break;
                case ComponentType.WebSiteInstaller:
                case ComponentType.ApplicationInstaller:
                    item =  null;
                    break;
                case ComponentType.RemoteExecutionComponent:
                    item = new RemoteExecutionComponentGraph(section.Name, localValues);
                    break;
                case ComponentType.AppPoolRemover:
                    item = new IisRemoverComponentGraph(section.Name, localValues, ComponentType.AppPoolRemover);
                    break;
                case ComponentType.WebSiteRemover:
                    item = new IisRemoverComponentGraph(section.Name, localValues, ComponentType.WebSiteRemover);
                    break;
                case ComponentType.ApplicationRemover:
                    item = new IisRemoverComponentGraph(section.Name, localValues, ComponentType.ApplicationRemover);
                    break;
                default:
                    throw new ArgumentException("unknown installer section: " + section[ComponentTypeString]);
            }

            if (item != null)
            {
                item.Index = index;
            }

            return item;
        }
开发者ID:neeraj1032,项目名称:AutomatedDeployments,代码行数:57,代码来源:ComponentFactory.cs

示例3: CollectionsGroup

        internal CollectionsGroup(CollectionsGroupCollection collections, ConfigSection parent)
        {
            if (collections == null)
            {
                throw new ArgumentException("CollectionsGroupCollection object was null.");
            }
            Collections = collections;

            foreach (ConfigurationGroupElement configGroup in collections)
            {
                collectionNames.Add(configGroup.Name);
            }

            Parent = parent;
        }
开发者ID:olcayseker,项目名称:CustomConfigurations,代码行数:15,代码来源:CollectionsGroup.cs

示例4: CollectionsGroup

        internal CollectionsGroup(CollectionsGroupCollection collections, ConfigSection parent, bool allowValueInheritance)
        {
            AllowValueInheritance = allowValueInheritance;
            if (collections == null)
            {
                throw new ArgumentException("CollectionsGroupCollection object was null.");
            }
            Collections = collections;

            foreach (ConfigurationGroupElement configGroup in collections)
            {
                collectionNames.Add(configGroup.Name);
            }

            Parent = parent;
        }
开发者ID:twistedtwig,项目名称:CustomConfigurations,代码行数:16,代码来源:CollectionsGroup.cs

示例5: ProtectedConfiguration

		public static Configuration ProtectedConfiguration( string connectionProvider, ConfigSection configSection, Configuration configuration )
		{
			switch( configSection )
			{
				case ConfigSection.AppSettings:
					configuration = ProtectAppSettings( connectionProvider, configuration );
					break;
				case ConfigSection.ConnectionStrings:
					configuration = ProtectConnectionStrings( connectionProvider, configuration );
					break;
				default:
					configuration = ProtectAppSettings( connectionProvider, configuration );
					configuration = ProtectConnectionStrings( connectionProvider, configuration );
					break;
			}
			return configuration;
		}
开发者ID:bedford603067,项目名称:Augment,代码行数:17,代码来源:DataEncryption.cs

示例6: Initialise

        public override void Initialise(IBuilderContext builderContext)
        {
            var configMain = builderContext.ConfigurationResolver
                                 .GetConfigSection(HiveConfigSection.ConfigXmlKey) as HiveConfigSection;

            if (configMain == null)
                throw new ConfigurationErrorsException(
                    string.Format("Configuration section '{0}' not found when building packaging provider '{1}'",
                                  HiveConfigSection.ConfigXmlKey, ProviderKey));

            var readWriteConfig = configMain.Providers.ReadWriters[ProviderKey] ?? configMain.Providers.Readers[ProviderKey];

            if (readWriteConfig == null)
                throw new ConfigurationErrorsException(
                    string.Format("No configuration found for persistence provider '{0}'", ProviderKey));

            var deepConfigManager = DeepConfigManager.Default;
            var localConfig = !string.IsNullOrEmpty(readWriteConfig.ConfigSectionKey)
                              ? deepConfigManager.GetFirstWebSetting<ConfigSection, ConfigSection>(readWriteConfig.ConfigSectionKey, x => x, "~/App_Plugins")
                                ??
                                readWriteConfig.GetLocalProviderConfig() as ConfigSection
                              : null;

            _configSection = localConfig;

            // ElementInformation.Source appears to be one of few ways to determine if the config-section exists or was returned on-demand with default values
            if (_configSection != null && !string.IsNullOrEmpty(_configSection.ElementInformation.Source))
            {
                CanBuild = true;
                var supportedExtensions = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.SupportedExtensions, "~/App_Plugins");
                var rootPath = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.RootPath, "~/App_Plugins");
                var excludedExtensions = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.ExcludedExetensions, "~/App_Plugins");
                var excludedDirectories = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.ExcludedDirectories, "~/App_Plugins");
                var rootPublicDomain = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.RootPublicDomain, "~/App_Plugins");
                rootPath = rootPath.TrimEnd("/") + "/";
                _settings = new Settings(supportedExtensions, "", rootPath, excludedExtensions, excludedDirectories, rootPublicDomain);
            }
            else
            {
                LogHelper.Warn<ProviderDemandBuilder>("Cannot register dependencies for provider {0} because ProviderConfigurationSection was specified with key '{1}' but no matching configSection was found. The provider may not be installed correctly.",
                    ProviderKey,
                    readWriteConfig.ConfigSectionKey);
            }
        }
开发者ID:RebelCMS,项目名称:rebelcmsxu5,代码行数:44,代码来源:ProviderDemandBuilder.cs

示例7: CreateTreeNode

 /// <summary>
 /// Returns a TreeNode created from a SettingBase.
 /// </summary>
 /// <param name="section">Setting to create TreeNode from.</param>
 /// <returns></returns>
 private TreeNode CreateTreeNode(ConfigSection section)
 {
   TreeNode node = new TreeNode();
   SectionDetails sectionTag = new SectionDetails();
   sectionTag.Section = section;
   node.Tag = sectionTag;
   node.Text = section.Text.Evaluate();
   node.ImageIndex = _treeSections.ImageList.Images.Count;
   node.SelectedImageIndex = _treeSections.ImageList.Images.Count;
   AddPNGToImageList(_treeSections.ImageList, section.SectionMetadata.IconSmallFilePath);
   return node;
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:17,代码来源:SettingsControl.cs

示例8: ShowSectionList

        static MenuState ShowSectionList()
        {
            ShowSeparator();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Config sections:");
            Console.ResetColor();
            for (int i = 0; i < sections.Length; i++)
            {
                Console.WriteLine("  {0}. {1}", i + 1, sections[i]);
            }
            //Console.WriteLine( "  Q. Quit" );
            //Console.WriteLine( "  R. Reset All" );
            //Console.WriteLine( "  S. Save" );

            string replyString;
            int reply;
            do
            {
                Console.Write("Enter your selection: "); // TODO
                replyString = Console.ReadLine();
                //!replyString.Equals("Q", StringComparison.OrdinalIgnoreCase) &&
                //     !replyString.Equals( "R", StringComparison.OrdinalIgnoreCase ) &&
                //     !replyString.Equals( "S", StringComparison.OrdinalIgnoreCase ) &&
            } while (!Int32.TryParse(replyString, out reply) &&
                     !Enum.IsDefined(typeof(ConfigSection), reply - 1));

            currentSection = (ConfigSection)(reply - 1);

            return MenuState.KeyList;
        }
开发者ID:Desertive,项目名称:800craft,代码行数:30,代码来源:Program.cs

示例9: GetSectionForPlugin

 static private ConfigSection GetSectionForPlugin(ModToolPlugin tool)
 {
     string sectionName = tool.GetType().Name;
     
     if (!s_pluginsConfig.ContainsValue(sectionName))
         s_pluginsConfig[sectionName] = new ConfigSection(sectionName);
     return s_pluginsConfig[sectionName];
 }
开发者ID:micheleissa,项目名称:dow2-toolbox,代码行数:8,代码来源:ConfigManager.cs

示例10: GetRemoteDetails

        private static RemoteDetailsComponentGraph GetRemoteDetails(ConfigSection deployment)
        {
            //see if there are any remote details specified
            if (deployment.Collections.SectionNames.Contains("RemoteDetails"))
            {
                var details = deployment.Collections.GetCollection("RemoteDetails");
                return details.Create<RemoteDetailsComponentGraph>();
            }

            return null;
        }
开发者ID:neeraj1032,项目名称:AutomatedDeployments,代码行数:11,代码来源:ConfigurationLoader.cs

示例11: BoolKeyAttribute

 public BoolKeyAttribute( ConfigSection section, bool defaultValue, string description )
     : base( section, typeof( bool ), defaultValue.ToString( CultureInfo.InvariantCulture ), description ) {
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:3,代码来源:ConfigKey.Metadata.cs

示例12: BoolKeyAttribute

 public BoolKeyAttribute( ConfigSection section, bool defaultValue, string description )
     : base( section, typeof( bool ), defaultValue, description ) {
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:3,代码来源:ConfigKey.Metadata.cs

示例13: SectionDetails

 public SectionDetails()
 {
   _section = new ConfigSection();
   _control = new FormControl();
   _designed = false;
   _rightToLeft = false;
   _width = -1;
 }
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:8,代码来源:SectionDetails.cs

示例14: FromSection

        public static ReleaseVersion FromSection(ConfigSection section)
        {
            Version ver;
            try
            {
                ver = new Version(section.SubSection);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                return null;
            }

            var version = new ReleaseVersion()
            {
                Version = ver,
                ReleaseType = ReleaseType.Major,
                DownloadPage = section.GetValue("DownloadPage")
            };

            Enum.TryParse<ReleaseType>(section.GetValue("ReleaseType"), true, out version.ReleaseType);

            return version;

        }
开发者ID:HuChundong,项目名称:gitextensions,代码行数:25,代码来源:FormUpdates.cs

示例15: ShowSectionList

        static MenuState ShowSectionList() {
            Refresh( "Editing {0}", Paths.ConfigFileName );

            TextMenu menu = new TextMenu();

            ConfigSection[] sections = (ConfigSection[])Enum.GetValues( typeof( ConfigSection ) );
            for( int i = 0; i < sections.Length; i++ ) {
                menu.AddOption( i + 1,
                                sections[i].ToString(),
                                sections[i] );
            }
            TextOption optionRanks = menu.AddOption( sections.Length + 1, "Ranks" );

            menu.Column = Column.Right;
            TextOption optionSaveAndExit = menu.AddOption( "S", "Save and exit" );
            TextOption optionQuit = menu.AddOption( "Q", "Quit without saving" );
            TextOption optionResetEverything = menu.AddOption( "D", "Use defaults" );
            TextOption optionReloadConfig = menu.AddOption( "R", "Reload config" );

            var choice = menu.Show();

            if( choice == optionSaveAndExit ) {
                if( TextMenu.ShowYesNo( "Save and exit?" ) && Config.Save() ) {
                    return MenuState.Done;
                }

            } else if( choice == optionQuit ) {
                if( TextMenu.ShowYesNo( "Exit without saving?" ) ) {
                    return MenuState.Done;
                }

            } else if( choice == optionResetEverything ) {
                if( TextMenu.ShowYesNo( "Reset everything to defaults?" ) ) {
                    Config.LoadDefaults();
                    RankManager.ResetToDefaults();
                    Config.ResetLogOptions();
                }

            } else if( choice == optionReloadConfig ) {
                if( File.Exists( Paths.ConfigFileName ) ) {
                    if( TextMenu.ShowYesNo( "Reload configuration from \"{0}\"?",
                                            Paths.ConfigFileName ) ) {
                        Config.Reload( true );
                        Console.WriteLine( "Configuration file \"{0}\" reloaded.", Paths.ConfigFileName );
                    }
                } else {
                    Console.WriteLine( "Configuration file \"{0}\" does not exist.", Paths.ConfigFileName );
                }

            } else if( choice == optionRanks ) {
                return MenuState.Ranks;

            } else {
                currentSection = (ConfigSection)choice.Tag;
                return MenuState.KeyList;
            }

            return MenuState.SectionList;
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:59,代码来源:ConfigCLI.cs


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