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


C# Configuration.Configuration类代码示例

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


Configuration类属于System.Configuration命名空间,在下文中一共展示了Configuration类的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: OptionsForm

        private OptionsForm(bool local)
        {
            InitializeComponent();
            
            // Copy the Bootstrap.exe file to New.exe,
            // so that the configuration file will load properly
            string currentDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            string sandboxDir = Path.Combine(currentDir, "Sandbox");

            if (!File.Exists(Path.Combine(sandboxDir, "New.exe")))
            {
                File.Copy(
                    Path.Combine(sandboxDir, "Bootstrap.exe"),
                    Path.Combine(sandboxDir, "New.exe")
                );
            }

            string filename = local ? "New.exe" : "Bootstrap.exe";
            string filepath = Path.Combine(sandboxDir, filename);
            _Configuration = ConfigurationManager.OpenExeConfiguration(filepath);
            
            // Get the DDay.Update configuration section
            _Cfg = _Configuration.GetSection("DDay.Update") as DDayUpdateConfigurationSection;

            // Set the default setting on which application folder to use.
            cbAppFolder.SelectedIndex = 0;

            SetValuesFromConfig();

            if (!local)
                _Configuration.SaveAs(Path.Combine(sandboxDir, "New.exe.config"));
        }
开发者ID:jltrem,项目名称:DDay.Update,代码行数:32,代码来源:OptionsForm.cs

示例3: AddModule

        // https://msdn.microsoft.com/en-us/library/tkwek5a4%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
        // Example Configuration Code for an HTTP Module:
        public static void AddModule(Configuration config, string moduleName, string moduleClass)
        {
            HttpModulesSection section =
                (HttpModulesSection)config.GetSection("system.web/httpModules");

            // Create a new module action object.
            HttpModuleAction moduleAction = new HttpModuleAction(
                moduleName, moduleClass);
            // "RequestTimeIntervalModule", "Samples.Aspnet.HttpModuleExamples.RequestTimeIntervalModule");

            // Look for an existing configuration for this module.
            int indexOfModule = section.Modules.IndexOf(moduleAction);
            if (-1 != indexOfModule)
            {
                // Console.WriteLine("RequestTimeIntervalModule module is already configured at index {0}", indexOfModule);
            }
            else
            {
                section.Modules.Add(moduleAction);

                if (!section.SectionInformation.IsLocked)
                {
                    config.Save();
                    // Console.WriteLine("RequestTimeIntervalModule module configured.");
                }
            }
        }
开发者ID:akrisiun,项目名称:git-dot-aspx,代码行数:29,代码来源:RoutingModule.cs

示例4: btnSubmit_Click

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
            //操作appSettings
            AppSettingsSection appseting = (AppSettingsSection)Configuration.GetSection("appSettings");      //修改设置
            try
            {
                appseting.Settings["txtiosapplink"].Value = this.txtiosapplink.Text;
            }
            catch (Exception)
            {

                appseting.Settings.Add("txtiosapplink", this.txtiosapplink.Text);
            }
            try
            {
                appseting.Settings["txtapklink"].Value = this.txtapklink.Text;
            }
            catch (Exception)
            {

                appseting.Settings.Add("txtapklink", this.txtapklink.Text);
            }
            Configuration.Save();
        }
开发者ID:lijiajin1987,项目名称:OfficialWebsite,代码行数:25,代码来源:Home.aspx.cs

示例5: Gadget

        public Gadget()
        {
            InitializeComponent();

            cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            Left = Int32.Parse(cfg.AppSettings.Settings["LocationX"].Value);
            Top = Int32.Parse(cfg.AppSettings.Settings["LocationY"].Value);
            Width = Int32.Parse(cfg.AppSettings.Settings["Width"].Value);
            Height = Int32.Parse(cfg.AppSettings.Settings["Height"].Value);

            string symbols = cfg.AppSettings.Settings["Symbols"].Value;
            if (!string.IsNullOrWhiteSpace(symbols))
            {
                string[] arr = symbols.Split(new char[] { ';' });
                cbSymbols.ItemsSource = arr;
            }

            SourceInitialized += new EventHandler(Gadjet_SourceInitialized);

            int defaultCardRank = Int32.Parse(cfg.AppSettings.Settings["DefaultRank"].Value);
            if (defaultCardRank < 0) defaultCardRank = 10;
            presenter = new CardStackPresenter(this, defaultCardRank);
            presenter.NextCard();
        }
开发者ID:paveltimofeev,项目名称:Wordcards,代码行数:25,代码来源:Gadget.xaml.cs

示例6: CrearArchivoConfig

 private static void CrearArchivoConfig()
 {
     XmlTextWriter.Create(Assembly.GetExecutingAssembly().Location + ".config");
     _config =
         ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     _config.Save();
 }
开发者ID:Maharba,项目名称:YACM,代码行数:7,代码来源:ConfigAcciones.cs

示例7: AddinSettings

        /// <summary>
        /// Merge default settings (install DLLs) with current settings (user.config)
        /// Read settings from %APPDATA%\ho\ho_tools\user.config
        /// </summary>
        public AddinSettings()
        {
            Configuration roamingConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);

            //the roamingConfig now get a path such as C:\Users\<user>\AppData\Roaming\Sparx_Systems_Pty_Ltd\DefaultDomain_Path_2epjiwj3etsq5yyljkyqqi2yc4elkrkf\9,_2,_0,_921\user.config
            // which I don't like. So we move up three directories and then add a directory for the EA Navigator so that we get
            // C:\Users\<user>\AppData\Roaming\GeertBellekens\EANavigator\user.config
            string configFileName = System.IO.Path.GetFileName(roamingConfig.FilePath);
            string configDirectory = System.IO.Directory.GetParent(roamingConfig.FilePath).Parent.Parent.Parent.FullName;

            string newConfigFilePath = configDirectory + @"\ho\ho_Tools\" + configFileName;
            // Map the roaming configuration file. This
            // enables the application to access 
            // the configuration file using the
            // System.Configuration.Configuration class
            ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
            configFileMap.ExeConfigFilename = newConfigFilePath;
            // Get the mapped configuration file.
            currentConfig = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
            //merge the default settings
            this.mergeDefaultSettings();
            this.shortcutsSearch = getShortcutsSearch();
            this.shortcutsServices = getShortcutsServices();
            this.globalShortcutsService = getGlobalShortcutsService();
            this.globalShortcutsSearch = getGlobalShortcutsSearch();

            getConnector(_logicalConnectors);
            getConnector(_activityConnectors);
            getAllServices();
            updateSearchesAndServices();
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:35,代码来源:Settings.cs

示例8: ConfigurationManager

        public ConfigurationManager()
        {
            //_configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(exePath);
            _configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            SetDefaultSettings();
        }
开发者ID:Sagittarius10k,项目名称:MigrationTool,代码行数:7,代码来源:ConfigurationManager.cs

示例9: getCurrentConfig

        //private static string AppConfigPath()
        //{
        //    return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AppConfigFileName);
        //}

        /// <summary>
        /// 获取当前应用配置
        /// </summary>
        /// <returns></returns>
        public Configuration getCurrentConfig(char AppType = EnumAppType.Web)
        {
            if (currentConfig==null){
                currentConfig = UtilSystem.getCurrentConfig(AppType);
            }
            return currentConfig;
        }
开发者ID:skygreen2001,项目名称:Betterlife.Net,代码行数:16,代码来源:AppConfig.cs

示例10: ConfigAppSettingsto

 protected static Configuration ConfigAppSettingsto(string filename)
 {
     ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
     fileMap.ExeConfigFilename = filename;
     config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
     return config;
 }
开发者ID:Crazye,项目名称:VPRR,代码行数:7,代码来源:ConfigAppSettings.cs

示例11: FormUpdater

        public FormUpdater(string patcherExecutable, string patcherArguments)
        {
            this.patcherExecutable = patcherExecutable;
            this.patcherArguments = patcherArguments;
            try
            {
                hyperConfigFile = ConfigurationManager.OpenExeConfiguration(patcherExecutable);
            }
            catch (Exception)
            {
                MessageBox.Show("Failed to load " + patcherExecutable + ".config file", "Selfupdater");
                Environment.Exit(0);
            }
            hyperSettings = hyperConfigFile.AppSettings.Settings;
            hyperFolder = new DirectoryInfo(Environment.CurrentDirectory);
            InitializeComponent();
            try
            {
                hyperVersion = Convert.ToUInt32(hyperSettings["hyperVersion"].Value);
                patchesWebPath = new Uri(hyperSettings["patchesWebPath"].Value);
            }
            catch (Exception)
            {
                hyperVersion = 0;
            }

            MessageBox.Show("Updates are going to be installed now.", "Selfupdater");
            InitUpdateProcess();
        }
开发者ID:BenYao,项目名称:Hyperbyte-Patcher,代码行数:29,代码来源:FormUpdater.cs

示例12: ConfigurationMap

		public ConfigurationMap(Configuration file, IPluginSettings settings, bool autoLoad)
		{
			this.file = file;
			this.settings = settings;
			if (autoLoad)
				Load();
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:ConfigurationMap.cs

示例13: ContentPathProvider

        public ContentPathProvider(VirtualPathProvider baseProvider, Configuration.Configuration services)
        {
            _baseProvider = baseProvider;
            _config = services;
            _internalResources = new Dictionary<string, string>();

            switch (_config.ViewEngineOptions.Type)
            {
                case Configuration.ViewEngineType.Razor:
                    _extension = ".cshtml";
                    break;
                case Configuration.ViewEngineType.ASPX:
                    _extension = ".aspx";
                    break;
                default:
                    throw new ArgumentException("Invalid ViewEngine Specified.");
            }

            Action<string> addResource = (file) =>
                _internalResources.Add(file + _extension, string.Format("Meek.Content.{0}.{1}{2}", _config.ViewEngineOptions.Type.ToString(), file, _extension));

            addResource("Manage");
            addResource("CreatePartial");
            addResource("List");
            addResource("BrowseFiles");
            addResource("UploadFileSuccess");
        }
开发者ID:GStore,项目名称:Meek,代码行数:27,代码来源:ContentPathProvider.cs

示例14: SecureSettings

 static SecureSettings()
 {
     if (System.Web.HttpContext.Current != null)
         _config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
     else
         _config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
 }
开发者ID:kdcllc,项目名称:KDCLLCWeb,代码行数:7,代码来源:SecureSettings.cs

示例15: BaseTest

	    public BaseTest()
	    {
            var configMap = new ExeConfigurationFileMap {ExeConfigFilename = "MySettings.config"};
	        Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);
	        if (config.HasFile)
	            _config = config;
	    }
开发者ID:kernicus,项目名称:usergrid-.net-sdk,代码行数:7,代码来源:BaseTest.cs


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