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


C# Config.GetStringList方法代码示例

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


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

示例1: GetReplacements

		private IDictionary<string, string> GetReplacements(Config config, string keyName
			)
		{
			IDictionary<string, string> replacements = new Dictionary<string, string>();
			foreach (string url in config.GetSubsections(KEY_URL))
			{
				foreach (string insteadOf in config.GetStringList(KEY_URL, url, keyName))
				{
					replacements.Put(insteadOf, url);
				}
			}
			return replacements;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:13,代码来源:RemoteConfig.cs

示例2: Test005_PutGetStringList

 public virtual void Test005_PutGetStringList()
 {
     Config c = new Config();
     List<string> values = new List<string>();
     values.AddItem("value1");
     values.AddItem("value2");
     c.SetStringList("my", null, "somename", values);
     object[] expArr = Sharpen.Collections.ToArray(values);
     string[] actArr = c.GetStringList("my", null, "somename");
     NUnit.Framework.Assert.IsTrue(Arrays.Equals(expArr, actArr));
     string expText = "[my]\n\tsomename = value1\n\tsomename = value2\n";
     NUnit.Framework.Assert.AreEqual(expText, c.ToText());
 }
开发者ID:kenji-tan,项目名称:ngit,代码行数:13,代码来源:ConfigTest.cs

示例3: RemoteConfig

		/// <summary>Parse a remote block from an existing configuration file.</summary>
		/// <remarks>
		/// Parse a remote block from an existing configuration file.
		/// <p>
		/// This constructor succeeds even if the requested remote is not defined
		/// within the supplied configuration file. If that occurs then there will be
		/// no URIs and no ref specifications known to the new instance.
		/// </remarks>
		/// <param name="rc">
		/// the existing configuration to get the remote settings from.
		/// The configuration must already be loaded into memory.
		/// </param>
		/// <param name="remoteName">subsection key indicating the name of this remote.</param>
		/// <exception cref="Sharpen.URISyntaxException">one of the URIs within the remote's configuration is invalid.
		/// 	</exception>
		public RemoteConfig(Config rc, string remoteName)
		{
			name = remoteName;
			oldName = remoteName;
			string[] vlst;
			string val;
			vlst = rc.GetStringList(SECTION, name, KEY_URL);
			IDictionary<string, string> insteadOf = GetReplacements(rc, KEY_INSTEADOF);
			uris = new AList<URIish>(vlst.Length);
			foreach (string s in vlst)
			{
				uris.AddItem(new URIish(ReplaceUri(s, insteadOf)));
			}
			IDictionary<string, string> pushInsteadOf = GetReplacements(rc, KEY_PUSHINSTEADOF
				);
			vlst = rc.GetStringList(SECTION, name, KEY_PUSHURL);
			pushURIs = new AList<URIish>(vlst.Length);
			foreach (string s_1 in vlst)
			{
				pushURIs.AddItem(new URIish(ReplaceUri(s_1, pushInsteadOf)));
			}
			vlst = rc.GetStringList(SECTION, name, KEY_FETCH);
			fetch = new AList<RefSpec>(vlst.Length);
			foreach (string s_2 in vlst)
			{
				fetch.AddItem(new RefSpec(s_2));
			}
			vlst = rc.GetStringList(SECTION, name, KEY_PUSH);
			push = new AList<RefSpec>(vlst.Length);
			foreach (string s_3 in vlst)
			{
				push.AddItem(new RefSpec(s_3));
			}
			val = rc.GetString(SECTION, name, KEY_UPLOADPACK);
			if (val == null)
			{
				val = DEFAULT_UPLOAD_PACK;
			}
			uploadpack = val;
			val = rc.GetString(SECTION, name, KEY_RECEIVEPACK);
			if (val == null)
			{
				val = DEFAULT_RECEIVE_PACK;
			}
			receivepack = val;
			val = rc.GetString(SECTION, name, KEY_TAGOPT);
			tagopt = NGit.Transport.TagOpt.FromOption(val);
			mirror = rc.GetBoolean(SECTION, name, KEY_MIRROR, DEFAULT_MIRROR);
			timeout = rc.GetInt(SECTION, name, KEY_TIMEOUT, 0);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:65,代码来源:RemoteConfig.cs


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