本文整理汇总了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;
}
示例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());
}
示例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);
}