本文整理汇总了C#中Config.SetStringList方法的典型用法代码示例。如果您正苦于以下问题:C# Config.SetStringList方法的具体用法?C# Config.SetStringList怎么用?C# Config.SetStringList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config.SetStringList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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());
}
示例2: TestEmptyString
public virtual void TestEmptyString()
{
Config c = Parse("[my]\n\tempty =\n");
NUnit.Framework.Assert.IsNull(c.GetString("my", null, "empty"));
string[] values = c.GetStringList("my", null, "empty");
NUnit.Framework.Assert.IsNotNull(values);
NUnit.Framework.Assert.AreEqual(1, values.Length);
NUnit.Framework.Assert.IsNull(values[0]);
// always matches the default, because its non-boolean
NUnit.Framework.Assert.IsTrue(c.GetBoolean("my", "empty", true));
NUnit.Framework.Assert.IsFalse(c.GetBoolean("my", "empty", false));
NUnit.Framework.Assert.AreEqual("[my]\n\tempty =\n", c.ToText());
c = new Config();
c.SetStringList("my", null, "empty", Arrays.AsList(values));
NUnit.Framework.Assert.AreEqual("[my]\n\tempty =\n", c.ToText());
}
示例3: Update
/// <summary>Update this remote's definition within the configuration.</summary>
/// <remarks>Update this remote's definition within the configuration.</remarks>
/// <param name="rc">the configuration file to store ourselves into.</param>
public virtual void Update(Config rc)
{
IList<string> vlst = new AList<string>();
vlst.Clear();
foreach (URIish u in URIs)
{
vlst.AddItem(u.ToPrivateString());
}
rc.SetStringList(SECTION, Name, KEY_URL, vlst);
vlst.Clear();
foreach (URIish u_1 in PushURIs)
{
vlst.AddItem(u_1.ToPrivateString());
}
rc.SetStringList(SECTION, Name, KEY_PUSHURL, vlst);
vlst.Clear();
foreach (RefSpec u_2 in FetchRefSpecs)
{
vlst.AddItem(u_2.ToString());
}
rc.SetStringList(SECTION, Name, KEY_FETCH, vlst);
vlst.Clear();
foreach (RefSpec u_3 in PushRefSpecs)
{
vlst.AddItem(u_3.ToString());
}
rc.SetStringList(SECTION, Name, KEY_PUSH, vlst);
Set(rc, KEY_UPLOADPACK, UploadPack, DEFAULT_UPLOAD_PACK);
Set(rc, KEY_RECEIVEPACK, ReceivePack, DEFAULT_RECEIVE_PACK);
Set(rc, KEY_TAGOPT, TagOpt.Option(), NGit.Transport.TagOpt.AUTO_FOLLOW.Option());
Set(rc, KEY_MIRROR, mirror, DEFAULT_MIRROR);
Set(rc, KEY_TIMEOUT, timeout, 0);
if (!oldName.Equals(name))
{
rc.UnsetSection(SECTION, oldName);
oldName = name;
}
}