本文整理汇总了C#中ConfigItem.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigItem.SetValue方法的具体用法?C# ConfigItem.SetValue怎么用?C# ConfigItem.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigItem
的用法示例。
在下文中一共展示了ConfigItem.SetValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getValueItem
private ConfigItem<string> getValueItem(string nodeName, string defaultValue)
{
var item = new ConfigItem<string>(defaultValue);
var str = getValue(nodeName, null);
if (str == null)
return item;
item.SetValue(str);
if (shouldExcludeFromConfig(nodeName))
item.Exclude();
return item;
}
示例2: getValues
private ConfigItem<string[]> getValues(string nodeName, bool hasParent)
{
var item = new ConfigItem<string[]>(new string[] {});
var values = new List<string>();
var nodes = _xml.SelectNodes(nodeName);
if (nodes.Count == 0)
return item;
foreach (XmlNode node in nodes)
values.Add(node.InnerText);
item.SetValue(values.ToArray());
var mainNode = nodeName;
if (hasParent)
mainNode = getParentNode(nodeName);
if (shouldMerge(mainNode))
item.SetShouldMerge();
if (shouldExcludeFromConfig(mainNode))
item.Exclude();
return item;
}
示例3: getCodeEditor
private ConfigItem<CodeEditor> getCodeEditor()
{
var item = new ConfigItem<CodeEditor>(new CodeEditor("", ""));
var executable = getValue("configuration/CodeEditor/Executable", null);
if (executable == null)
return item;
var arguments = getValue("configuration/CodeEditor/Arguments", "");
if (shouldExcludeFromConfig("configuration/CodeEditor"))
item.Exclude();
return item.SetValue(new CodeEditor(executable, arguments));
}
示例4: getLongItem
private ConfigItem<long> getLongItem(string path, long defaultValue)
{
var item = new ConfigItem<long>(defaultValue);
var val = getLong(path, null);
if (val == null)
return item;
item.SetValue((long) val);
if (shouldExcludeFromConfig(path))
item.Exclude();
return item;
}
示例5: getIntItem
private ConfigItem<int> getIntItem(string path, int defaultValue)
{
var item = new ConfigItem<int>(defaultValue);
var val = getInt(path, null);
if (val == null)
return item;
item.SetValue((int) val);
if (shouldExcludeFromConfig(path))
item.Exclude();
return item;
}
示例6: getBoolItem
private ConfigItem<bool> getBoolItem(string path, bool defaultValue)
{
var item = new ConfigItem<bool>(defaultValue);
var val = getBool(path, null);
if (val == null)
return item;
item.SetValue((bool) val);
if (shouldExcludeFromConfig(path))
item.Exclude();
return item;
}
示例7: getVersionedSetting
private ConfigItem<KeyValuePair<string, string>[]> getVersionedSetting(string xpath)
{
var item = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string,string>[] {});
var nodes = _xml.SelectNodes(xpath);
if (nodes.Count == 0)
return item;
item.SetValue(readVersionedNodes(nodes));
if (shouldMerge(xpath))
item.SetShouldMerge();
if (shouldExcludeFromConfig(xpath))
item.Exclude();
return item;
}