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


C# Configuration.Set方法代码示例

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


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

示例1: ConfigureGitConfig

        public static void ConfigureGitConfig( 
        ConfigurationLevel level = ConfigurationLevel.Global, 
        string file = null )
        {
            var config = new Configuration( file, file, file );

              LogManager.GetCurrentClassLogger().Info( "Installing failmerge driver to " + ( file ?? level.ToString() ) );
              config.Set( "merge.failmerge.name", "fail merge driver", level );
              config.Set( "merge.failmerge.driver", "false", level );
              config.Set( "merge.failmerge.recursive", "binary", level );
        }
开发者ID:configit-open-source,项目名称:csmerge,代码行数:11,代码来源:GitHelper.cs

示例2: GetChromeDriverDir

        public static string GetChromeDriverDir(Configuration cfg)
        {
            string chromeDriverDir = cfg.Get("PiroPiro.Selenium.ChromeDriverDir", false);
            if (string.IsNullOrEmpty(chromeDriverDir))
            {
                #region FindChromeDriverExe

                chromeDriverDir = Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(SeleniumBrowserFactory)).Location);
                while (!File.Exists(Path.Combine(chromeDriverDir, "chromedriver.exe")))
                {
                    if (chromeDriverDir == "" || chromeDriverDir == Path.GetPathRoot(chromeDriverDir))
                    {
                        chromeDriverDir = null;
                        break;
                    }
                    chromeDriverDir = Path.GetDirectoryName(chromeDriverDir);
                }
                #endregion
                if (!string.IsNullOrEmpty(chromeDriverDir))
                {
                    cfg.Set("PiroPiro.Selenium.ChromeDriverDir", chromeDriverDir);
                }
                else
                {
                    chromeDriverDir = Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(SeleniumBrowserFactory)).Location);
                    throw new Exception("chromediver.exe not found in \"" + chromeDriverDir + "\", use ChromeDriverDir setting to specify a path");
                }
            }
            return chromeDriverDir;
        }
开发者ID:benjamine,项目名称:PiroPiro,代码行数:30,代码来源:SeleniumBrowserFactory.cs

示例3: Set

 public static void Set(Configuration allcfg, string name, string value)
 {
     allcfg.Set<string>(String.Concat(prefix, name), value, ConfigurationLevel.Global);
 }
开发者ID:carlosmn,项目名称:git-alias,代码行数:4,代码来源:Main.cs

示例4: SettingLocalConfigurationOutsideAReposThrows

 public void SettingLocalConfigurationOutsideAReposThrows()
 {
     using (var config = new Configuration())
     {
         Assert.Throws<LibGit2SharpException>(() => config.Set("unittests.intsetting", 3));
     }
 }
开发者ID:TiThompson,项目名称:libgit2sharp,代码行数:7,代码来源:ConfigurationFixture.cs

示例5: CanSetGlobalStringValueWithoutRepo

        public void CanSetGlobalStringValueWithoutRepo()
        {
            using(var config = new Configuration())
            {
                InconclusiveIf(() => !config.HasConfig(ConfigurationLevel.Global),
                    "No Git global configuration available");

                var existing = config.Get<string>("user.name");
                Assert.NotNull(existing);

                try
                {
                    config.Set("user.name", "Unit Test", ConfigurationLevel.Global);

                    AssertValueInGlobalConfigFile("name = Unit Test$");
                }
                finally
                {
                    config.Set("user.name", existing.Value, ConfigurationLevel.Global);
                }
            }
        }
开发者ID:TiThompson,项目名称:libgit2sharp,代码行数:22,代码来源:ConfigurationFixture.cs

示例6: CreateConfigurationWithDummyUser

        /// <summary>
        /// Creates a configuration file with user.name and user.email set to signature
        /// </summary>
        /// <remarks>The configuration file will be removed automatically when the tests are finished</remarks>
        /// <param name="signature">The signature to use for user.name and user.email</param>
        /// <returns>The path to the configuration file</returns>
        protected string CreateConfigurationWithDummyUser(Signature signature)
        {
            SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
            Directory.CreateDirectory(scd.DirectoryPath);
            string configFilePath = Path.Combine(scd.DirectoryPath, "global-config");

            using (Configuration config = new Configuration(configFilePath))
            {
                config.Set("user.name", signature.Name, ConfigurationLevel.Global);
                config.Set("user.email", signature.Email, ConfigurationLevel.Global);
            }

            return configFilePath;
        }
开发者ID:kgybels,项目名称:libgit2sharp,代码行数:20,代码来源:BaseFixture.cs


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