本文整理汇总了C#中ConfigItem类的典型用法代码示例。如果您正苦于以下问题:C# ConfigItem类的具体用法?C# ConfigItem怎么用?C# ConfigItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfigItem类属于命名空间,在下文中一共展示了ConfigItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CoreSection
public CoreSection()
{
StartPaused = new ConfigItem<bool>(false);
WatchDirectories = new ConfigItem<string[]>(new string[] {});
BuildExecutables = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
NUnitTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
MSTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
XUnitTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
MSpecTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
CodeEditor = new ConfigItem<CodeEditor>(new CodeEditor("", ""));
DebuggingEnabled = new ConfigItem<bool>(false);
GrowlNotify = new ConfigItem<string>(null);
NotifyOnRunStarted = new ConfigItem<bool>(true);
NotifyOnRunCompleted = new ConfigItem<bool>(true);
WatchIgnoreFile = new ConfigItem<string>("");
TestAssembliesToIgnore = new ConfigItem<string[]>(new string[] {});
TestCategoriesToIgnore = new ConfigItem<string[]>(new string[] {});
FileChangeBatchDelay = new ConfigItem<int>(100);
CustomOutputPath = new ConfigItem<string>("");
RerunFailedTestsFirst = new ConfigItem<bool>(false);
WhenWatchingSolutionBuildSolution = new ConfigItem<bool>(true);
UseAutoTestTestRunner = new ConfigItem<bool>(true);
UseLowestCommonDenominatorAsWatchPath = new ConfigItem<bool>(true);
Keys = new List<KeyValuePair<string, string>>();
}
示例2: CoreSection
public CoreSection()
{
StartPaused = new ConfigItem<bool>(false);
WatchDirectories = new ConfigItem<string[]>(new string[] {});
BuildExecutables = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
NUnitTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
MSTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
XUnitTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
MSpecTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
CodeEditor = new ConfigItem<CodeEditor>(new CodeEditor("", ""));
DebuggingEnabled = new ConfigItem<bool>(false);
MSBuildAdditionalParameters = new ConfigItem<string>("");
MSBuildParallelBuildCount = new ConfigItem<int>(0);
GrowlNotify = new ConfigItem<string>(null);
NotifyOnRunStarted = new ConfigItem<bool>(true);
NotifyOnRunCompleted = new ConfigItem<bool>(true);
WatchIgnoreFile = new ConfigItem<string>("");
TestAssembliesToIgnore = new ConfigItem<string[]>(new string[] {});
TestCategoriesToIgnore = new ConfigItem<string[]>(new string[] {});
FileChangeBatchDelay = new ConfigItem<int>(100);
CustomOutputPath = new ConfigItem<string>("");
RerunFailedTestsFirst = new ConfigItem<bool>(false);
WhenWatchingSolutionBuildSolution = new ConfigItem<bool>(true);
UseAutoTestTestRunner = new ConfigItem<bool>(true);
UseLowestCommonDenominatorAsWatchPath = new ConfigItem<bool>(true);
WatchAllFiles = new ConfigItem<bool>(false);
RunAssembliesInParallel = new ConfigItem<bool>(false);
TestRunnerCompatibilityMode = new ConfigItem<bool>(false);
LogRecycleSize = new ConfigItem<long>(1024000);
ProjectsToIgnore = new ConfigItem<string[]>(new string[] {});
Keys = new List<KeyValuePair<string, string>>();
DataGathererServiceUrl = new ConfigItem<string>("");
}
示例3: Grid2DConfig
public Grid2DConfig(ConfigNode config)
{
_config = config;
_all2allEn = new ConfigItem<bool>(_config, "All2AllEnable", true);
_verticalLinesEn = new ConfigItem<bool>(_config, "VerticalLinesEnable", true);
_horizontalLinesEn = new ConfigItem<bool>(_config, "HorizontalLinesEnable", true);
_ringsEn = new ConfigItem<bool>(_config, "RingsEnable", true);
_littleSquaresEn = new ConfigItem<bool>(_config, "LittleSquaresEnable", true);
}
示例4: TrainingConfig
public TrainingConfig(ConfigNode config)
{
_config = config;
_gaussian = new NormalGenerator(0.0, 0.5);
_basic = new BasicConfig(config);
_autoTrainingEpochs = new ConfigItem<int>(_config, "AutoTrainingEpochs", 400);
_autoTrainingAttempts = new ConfigItem<int>(_config, "AutoTrainingAttempts", 1);
_autoTrainingPercentSuccessful = new ConfigItem<double>(_config, "AutoTrainingPercentSuccessful", 1.0);
_shuffleSwapProbability = new ConfigItem<double>(_config, "ShuffleSwapProbability", 0.05);
_shuffleNoiseSigma = new ConfigItem<double>(_config, "ShuffleNoiseSigma", 0.5);
_shuffleEn = new ConfigItem<bool>(_config, "ShuffleEnable", false);
}
示例5: Configuration
public Configuration()
{
GraphProvider = new ConfigItem<string>();
MinimizerDebug = new ConfigItem<bool>();
MinimizerAssemblies = new List<ConfigItem<string>>();
MinimizerLevel = new ConfigItem<string>();
ProfilerSetup = new ConfigItem<string>();
ProfilerNamespaces = new List<ConfigItem<string>>();
IgnoreWarmup = new ConfigItem<bool>();
IgnoreThisUpgrade = new ConfigItem<string>();
RealtimeFeedback = new ConfigItem<bool>();
AllDisabled = new ConfigItem<bool>();
AnonFeedback = new ConfigItem<bool>();
BuildErrorsInFeedbackWindow = new ConfigItem<bool>();
BuildWarningsInFeedbackWindow = new ConfigItem<bool>();
FailingTestsInFeedbackWindow = new ConfigItem<bool>();
IgnoredTestsInFeedbackWindow = new ConfigItem<bool>();
StartPaused = new ConfigItem<bool>();
MSBuild = new List<ConfigItem<VersionConfig>>();
BuildSolution = new ConfigItem<bool>();
NUnit = new List<ConfigItem<VersionConfig>>();
MSTest = new List<ConfigItem<VersionConfig>>();
XUnit = new List<ConfigItem<VersionConfig>>();
IgnoreFile = new ConfigItem<IgnoreFile> { Item = new IgnoreFile() };
IgnoredAssemblies = new List<ConfigItem<string>>();
IgnoredCategories = new List<ConfigItem<string>>();
ChangeDelay = new ConfigItem<string>();
BuildOutputPath = new ConfigItem<string>();
GrowlNotifyPath = new ConfigItem<string>();
NotifyOnStartup = new ConfigItem<bool>();
NotifyOnFinish = new ConfigItem<bool>();
Debug = new ConfigItem<bool>();
CatMode = new ConfigItem<bool>();
OverlayNotifications = new ConfigItem<bool>();
RunAssembliesInParallel = new ConfigItem<bool>();
RunTestsInCompatibilityMode = new ConfigItem<bool>();
RiscEnabled = new ConfigItem<bool>();
MSBuildParallelBuildCount = new ConfigItem<int>();
}
示例6: InitVariables
private bool InitVariables()
{
if (_actionType == "edit")
{
_configItem = ConfigServer.GetConfigItem(_id);
if (_configItem == null)
return false;
}
if (!string.IsNullOrEmpty(_parentId))
{
_parentConfigItem = ConfigServer.GetConfigItem(_parentId);
if (_parentConfigItem == null)
return false;
}
return true;
}
示例7: CoreSection
public CoreSection()
{
WatchDirectories = new ConfigItem<string[]>(new string[] {});
BuildExecutables = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
NUnitTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
MSTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
XUnitTestRunner = new ConfigItem<KeyValuePair<string, string>[]>(new KeyValuePair<string, string>[] {});
CodeEditor = new ConfigItem<CodeEditor>(new CodeEditor("", ""));
DebuggingEnabled = new ConfigItem<bool>(false);
GrowlNotify = new ConfigItem<string>(null);
NotifyOnRunStarted = new ConfigItem<bool>(true);
NotifyOnRunCompleted = new ConfigItem<bool>(true);
WatchIgnoreFile = new ConfigItem<string>("");
TestAssembliesToIgnore = new ConfigItem<string[]>(new string[] {});
TestCategoriesToIgnore = new ConfigItem<string[]>(new string[] {});
FileChangeBatchDelay = new ConfigItem<int>(100);
}
示例8: ReadConfig
public string ReadConfig(ConfigItem Item,out string a,out bool b)
{
try
{
HasConfig();//没有配置文件就新建
AMSystemConfig tmpConfig = new AMSystemConfig();
AuthDao.ADSecret ads = new AuthDao.ADSecret();
string FileName = Environment.CurrentDirectory + "\\Config.dat";
Stream fStr = new FileStream(FileName, FileMode.Open);
fStr.Position = 0;
BinaryFormatter bf = new BinaryFormatter();
tmpConfig = (AMSystemConfig)bf.Deserialize(fStr);
fStr.Close();
tmpConfig.ConnectionString = ads.DesDecrypt(tmpConfig.ConnectionString, "JinDi123");
switch (Item)
{
case ConfigItem.ConnectionString:
a = tmpConfig.ConnectionString;
b = false;
break;
case ConfigItem.LoginUserName:
a = tmpConfig.LoginUserNames;
b = false;
break;
case ConfigItem.LoginPassword:
a = tmpConfig.LoginPassword;
b = tmpConfig.LoginSavePass;
break;
default:
a = "";
b = false;
break;
}
return "true";
}
catch (Exception x)
{
a = "";
b = false;
return "ReadConfig:" + x.Message;
}
}
示例9: writeIgnoreFileSetting
private void writeIgnoreFileSetting(ConfigItem<IgnoreFile> item)
{
RemoveNode("IgnoreFile");
if (item.Exists)
writeSimpleSetting(item.Item.File, true, item.ShouldExclude, "IgnoreFile");
try
{
if (item.Item.WriteContent)
{
if (Directory.Exists(Path.GetDirectoryName(item.Item.File)) && Path.IsPathRooted(item.Item.File))
File.WriteAllText(item.Item.File, item.Item.Content);
else if (Directory.Exists(item.Item.ContentPath))
File.WriteAllText(Path.Combine(item.Item.ContentPath, item.Item.File), item.Item.Content);
}
}
catch (Exception ex)
{
Logging.Logger.Write(ex);
}
}
示例10: AddExtTreeNode
/// <summary>
/// 返回节点
/// </summary>
/// <param name="psType"></param>
/// <param name="psName"></param>
/// <param name="psValue"></param>
/// <returns></returns>
private void AddExtTreeNode(Node nd, DataTable dt)
{
Node nd1 = new Node();
string typeS = dt.Rows[0]["PSType2"].ToString();
double PDTotalData = 0;
for (int i = 0; i < dt.Rows.Count; i++)
{
Node ndx = new Node();
ndx.Leaf = true;
string PSType2 = dt.Rows[i]["PSType2"].ToString();
string PSName = dt.Rows[i]["PSName"].ToString();
double db1 = Convert.ToDouble(dt.Rows[i]["PDBaseData"]);
double db2 = Convert.ToDouble(dt.Rows[i]["PDProjectData"]);
double PDData = db1 + db2;
PDTotalData += PDData;
ConfigItem cf1 = new ConfigItem("PSType2", PSType2, ParameterMode.Value);
ConfigItem cf2 = new ConfigItem("PSName", PSName, ParameterMode.Value);
ConfigItem cf3 = new ConfigItem("PDData", PDData.ToString("f8").TrimEnd('0'), ParameterMode.Value);
ndx.CustomAttributes.Add(cf1);
ndx.CustomAttributes.Add(cf2);
ndx.CustomAttributes.Add(cf3);
nd1.Children.Add(ndx);
}
ConfigItem cft1 = new ConfigItem("PSType2", typeS, ParameterMode.Value);
ConfigItem cft2 = new ConfigItem("PSName", "", ParameterMode.Value);
ConfigItem cft3 = new ConfigItem("PDData", PDTotalData.ToString("f8").TrimEnd('0'), ParameterMode.Value);
nd1.CustomAttributes.Add(cft1);
nd1.CustomAttributes.Add(cft2);
nd1.CustomAttributes.Add(cft3);
nd.Children.Add(nd1);
}
示例11: mergeValueItem
private int mergeValueItem(ConfigItem<int> settingToMerge, int defaultValue)
{
if (settingToMerge.ShouldExclude)
return defaultValue;
return settingToMerge.Value;
}
示例12: QueryItemFromServerAsync
private static IAsyncResult QueryItemFromServerAsync(string key, ConfigType type, Action<ConfigItem, Exception> callback)
{
string url = new UrlBuilder()
.SetPath("/ActiveConfig/v1/GetKey")
.AddParam("appid", _appKey)
.AddParam("secretkey", _appSecret)
.AddParam("key", key + ":" + (int)type)
.GetUrl();
return Http.GetStringAsync(url, (s, e) =>
{
ConfigItem result = null;
if (e == null)
{
result = null;
try
{
var dict = JSON.Parse(s);
if (dict != null)
{
string code = dict["code"].Value;
string msg = dict["msg"].Value;
string data = dict["data"].Value;
if (code != "0")
{
Debug.WriteLine("Server return error {0}: {1}", code, msg);
e = new ActiveConfigException(msg);
}
else
{
if (dict["data"].Count == 1)
{
var item = dict["data"][0];
result = new ConfigItem();
result.Key = item["key"].Value;
result.Value = item["value"].Value;
result.Type = (ConfigType)Enum.Parse(typeof(ConfigType), item["type"].Value, true);
result.ExpireTime = Helper.ConvertTime(item["endtime"].Value);
result.MD5 = item["md5"].Value;
result.ID = string.Format("{0}:{1}", (int)result.Type, result.Key);
if (result.Status == ItemStatus.KeyNotFound)
{
e = new KeyNotFoundException(key);
}
}
else
{
e = new KeyNotFoundException(key);
}
}
}
else
{
e = new ActiveConfigException("Parsing json failed");
}
}
catch (Exception err)
{
e = new ActiveConfigException("Parsing json failed", err);
}
}
callback(result, e);
});
}
示例13: RegisterCustomAttribute
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
protected virtual void RegisterCustomAttribute(string key, string value)
{
bool isDefaults = key.IndexOf("Default", StringComparison.CurrentCultureIgnoreCase) == 0;
bool isOverride = key.IndexOf("X", StringComparison.CurrentCultureIgnoreCase) == 0;
if (isDefaults)
{
key = key.Substring(7);
}
else if (isOverride)
{
key = key.Substring(1);
}
var item = new ConfigItem
{
Name = key.ToLowerCamelCase(),
Mode = ParameterMode.Value
};
if (value.StartsWith("<raw>"))
{
item.Mode = ParameterMode.Raw;
value = value.Remove(0, 5);
}
else if (value.StartsWith("<string>"))
{
item.Mode = ParameterMode.Value;
value = value.Remove(0, value.StartsWith("<string><raw>") ? 13 : 8);
}
else
{
bool boolTest;
double doubleTest;
DateTime dateTest;
if (bool.TryParse(value, out boolTest) || double.TryParse(value, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out doubleTest))
{
item.Mode = ParameterMode.Raw;
value = value.ToLowerInvariant();
}
else if (DateTime.TryParse(value, CultureInfo.CurrentCulture, DateTimeStyles.None, out dateTest))
{
item.Mode = ParameterMode.Raw;
value = DateTimeUtils.DateNetToJs(dateTest);
}
}
item.Value = value;
if (this is AbstractContainer && isDefaults)
{
((AbstractContainer)this).Defaults.Add(new Parameter(item.Name, item.Value, item.Mode));
}
else
{
this.CustomConfig.Add(item);
}
}
示例14: getValue
private ConfigItem<string> getValue(string xpath, bool isLocal)
{
var node = _xml.SelectSingleNode(xpath);
if (node == null)
return new ConfigItem<string>() { Item = "", IsLocal = isLocal, Exists = false };
var item = new ConfigItem<string>() { Item = node.InnerText, IsLocal = isLocal, Exists = true };
var overrideIfno = "";
if (node.Attributes.GetNamedItem("override") != null)
overrideIfno = node.Attributes.GetNamedItem("override").InnerText;
if (overrideIfno == "exclude")
item.ShouldExclude = true;
if (overrideIfno == "merge")
item.ShouldMerge = true;
return item;
}
示例15: mergeVersionedItem
private void mergeVersionedItem(List<KeyValuePair<string, string>> setting, ConfigItem<KeyValuePair<string, string>[]> settingToMerge)
{
if (!settingToMerge.WasReadFromConfig)
return;
if (settingToMerge.ShouldExclude)
{
setting.Clear();
return;
}
if (settingToMerge.ShouldMerge)
{
foreach (var mergedItem in settingToMerge.Value)
{
setting.RemoveAll(x => x.Key.Equals(mergedItem.Key));
setting.Add(mergedItem);
}
return;
}
setting.Clear();
setting.AddRange(settingToMerge.Value);
}