本文整理汇总了C#中SerializableDictionary.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# SerializableDictionary.ContainsKey方法的具体用法?C# SerializableDictionary.ContainsKey怎么用?C# SerializableDictionary.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializableDictionary
的用法示例。
在下文中一共展示了SerializableDictionary.ContainsKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AcfunDownloaderConfigurationForm
public AcfunDownloaderConfigurationForm(SerializableDictionary<string, string> Configuration)
{
//初始化界面
InitializeComponent();
//读取插件设置
this.Configuration = Configuration;
//生成AcPlay设置
string genAcPlay = Configuration.ContainsKey("GenerateAcPlay") ? Configuration["GenerateAcPlay"] : "true";
chkGenerateAcPlay.Checked = (genAcPlay == "true");
//自定义命名
txtFormat.Text = Configuration.ContainsKey("CustomFileName") ?
Configuration["CustomFileName"] : AcFunPlugin.DefaultFileNameFormat;
//预览
txtFormat_TextChanged(this, EventArgs.Empty);
}
示例2: GetDefaultAspectFromVersion9
string GetDefaultAspectFromVersion9(SerializableDictionary<string, string> serializableDictionary, List<string> aspects, string defaultAspect) {
if (serializableDictionary.ContainsKey("Schema")){
var helper = new DictionaryHelper();
defaultAspect = helper.GetAspectFromXml(aspects, defaultAspect);
}
return defaultAspect;
}
示例3: GetLanguageStrings
public static SerializableDictionary<string, string> GetLanguageStrings(Stream javaMessagesStream)
{
var result = new SerializableDictionary<string, string>();
using (var reader = new StreamReader(javaMessagesStream))
{
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
var deviderIndex = line.IndexOf('=');
if (deviderIndex != -1 && line[0] != '#')
{
var text = line.Substring(deviderIndex + 1);
var regex = new Regex(@"\\u[A-Za-z0-9]{4}");
text = regex.Replace(text, m => ((Char)UInt16.Parse(m.Value.Substring(2), System.Globalization.NumberStyles.AllowHexSpecifier)).ToString());
var key = line.Substring(0, deviderIndex);
if (!result.ContainsKey(key))
result.Add(key, text);
}
}
}
return result;
}
示例4: loadClick
public void loadClick(DateTime time)
{
// 储存到文件,比如20130203.xml
string fileName = this.logFile;
string today = time.ToString("yyyyMMdd");
SerializableDictionary fileDatas = new SerializableDictionary();
using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Read))
{
stream.Lock(0, stream.Length);
XmlSerializer serializer = new XmlSerializer(typeof(SerializableDictionary));
if (stream.Length != 0)
{
fileDatas = (SerializableDictionary)serializer.Deserialize(stream);
if (!fileDatas.ContainsKey(today))
{
fileDatas[today] = new MouseState();
}
}
else
{
fileDatas = new SerializableDictionary();
fileDatas[today] = new MouseState();
}
this.leftClickCount = fileDatas[today].leftClickCount;
this.rightClickCount = fileDatas[today].rightClickCount;
this.middleClickCount = fileDatas[today].middleClickCount;
}
}
示例5: GetDefaultAspectFromVersion9
private string GetDefaultAspectFromVersion9(SerializableDictionary<string, string> serializableDictionary, List<string> aspects, string defaultAspect) {
if (serializableDictionary.ContainsKey("Schema")) {
return GetAspectFromXml(aspects, defaultAspect);
}
return defaultAspect;
}
示例6: ServerState
public ServerState()
{
Accounts = new SerializableDictionary<string, Hash>();
if (!Accounts.ContainsKey("guest")) {
Accounts.Add("guest", Hash.HashString("guest"));
}
UpgradeData = new SerializableDictionary<string, List<UpgradeDef>>();
}
示例7: GetMiner
public MinerDescriptor GetMiner(DeviceKind deviceKind, CoinAlgorithm algorithm, SerializableDictionary<CoinAlgorithm, string> miners)
{
if (deviceKind != DeviceKind.GPU)
return GetDefaultMiner();
if (miners.ContainsKey(algorithm))
return Miners.Single(m => m.Name.Equals(miners[algorithm], StringComparison.OrdinalIgnoreCase));
else
return DefaultMiners[algorithm];
}
示例8: BilibiliDownloaderConfigurationForm
public BilibiliDownloaderConfigurationForm(SerializableDictionary<string, string> Configuration)
{
//初始化界面
InitializeComponent();
//读取插件设置
this.Configuration = Configuration;
//生成AcPlay设置
string genAcPlay = Configuration.ContainsKey("GenerateAcPlay") ? Configuration["GenerateAcPlay"] : "true";
chkGenerateAcPlay.Checked = (genAcPlay == "true");
//自定义命名
txtFormat.Text = Configuration.ContainsKey("CustomFileName") ?
Configuration["CustomFileName"] : BilibiliPlugin.DefaultFileNameFormat;
//预览
txtFormat_TextChanged(this, EventArgs.Empty);
//用户名密码
txtUsername.Text = Configuration.ContainsKey("Username") ?
Encoding.UTF8.GetString(Convert.FromBase64String(Configuration["Username"])) : "";
txtPassword.Text = Configuration.ContainsKey("Password") ?
Encoding.UTF8.GetString(Convert.FromBase64String(Configuration["Password"])) : "";
}
示例9: Classify
/// <summary>
/// Calculate the probability for each category,
/// and will determine which one is the largest
/// and whether it exceeds the next largest by more than its threshold
/// </summary>
/// <param name="item">Item</param>
/// <param name="defaultCat">Default category</param>
/// <returns>Category which item mostly belongs to</returns>
public string Classify(string item, string defaultCat = "unknown")
{
SerializableDictionary<string, double> probs = new SerializableDictionary<string, double>();
string best = "";
string possible = "";
// Find the category with highest probability
double max = 0.0;
foreach (var category in Categories())
{
probs.Add(category, Probability(item, category));
if (probs[category] > max)
{
max = probs[category];
best = category;
}
}
// Find the second suitable category
if (probs.ContainsKey(best))
{
probs.Remove(best);
}
max = 0.0;
foreach (var category in probs)
{
if (category.Value > max)
{
max = category.Value;
possible = category.Key;
}
}
probs.Add(best, Probability(item, best));
// Make sure the probability exceeds threshould*next best
foreach (var cat in probs)
{
if (cat.Key == best)
{
continue;
}
if (cat.Value * GetThreshold(best) > probs[best])
{
return defaultCat;
}
}
return best + (possible.Length > 0 ? (" or " + possible) : "");
}
示例10: GetMiner
public MinerDescriptor GetMiner(DeviceKind deviceKind, CoinAlgorithm algorithm, SerializableDictionary<string, string> miners)
{
if (deviceKind != DeviceKind.GPU)
return GetDefaultMiner();
string algorithmName = algorithm.Name;
MinerDescriptor result = null;
if (miners.ContainsKey(algorithmName))
// SingleOrDefault - the user may have a config file with a backend
// miner registered that no longer exists in their Miners\ folder
result = Miners.SingleOrDefault(m => m.Name.Equals(miners[algorithmName], StringComparison.OrdinalIgnoreCase));
if ((result == null) && (algorithm.DefaultMiner != null))
result = Miners.Single(m => m.Name.Equals(algorithm.DefaultMiner, StringComparison.OrdinalIgnoreCase));
return result;
}
示例11: OnReadUserData
void OnReadUserData(SerializableDictionary<string, string> userData)
{
for (int position = 1; position <= MaxFileHistoryCount; ++position)
{
string key = "RecentFile[" + position.ToString() + "]";
if (userData.ContainsKey(key))
{
this._recentFiles.Add(userData[key]);
}
}
}
示例12: HasRelationship
private bool HasRelationship(string siblingAccount, SerializableDictionary<string, string> dictRelation)
{
lock (dictRelation)
return dictRelation.ContainsKey(siblingAccount.ToLowerInvariant());
}
示例13: SetPhysicalDisplayInfoUpdated
private void SetPhysicalDisplayInfoUpdated(LEDDisplayInfoCollection infoCollection)
{
_allCommPortLedDisplayDic = new SerializableDictionary<string, List<ILEDDisplayInfo>>();
foreach (KeyValuePair<string, List<SimpleLEDDisplayInfo>> keyValue
in infoCollection.LedSimples)
{
foreach (SimpleLEDDisplayInfo simple in keyValue.Value)
{
if (!_allCommPortLedDisplayDic.ContainsKey(keyValue.Key))
{
_allCommPortLedDisplayDic.Add(keyValue.Key, new List<ILEDDisplayInfo>());
}
_allCommPortLedDisplayDic[keyValue.Key].Add(
new SimpleLEDDisplayInfo(simple.PixelColsInScanBd,
simple.PixelRowsInScanBd, simple.ScanBdCols, simple.ScanBdRows, simple.PortCols,
simple.PortRows, simple.SenderIndex, simple.X, simple.Y,
simple.VirtualMode, simple.PortScanBdInfoList));
}
}
foreach (KeyValuePair<string, List<StandardLEDDisplayInfo>> keyValue
in infoCollection.LedStandards)
{
foreach (StandardLEDDisplayInfo standard in keyValue.Value)
{
if (!_allCommPortLedDisplayDic.ContainsKey(keyValue.Key))
{
_allCommPortLedDisplayDic.Add(keyValue.Key, new List<ILEDDisplayInfo>());
}
_allCommPortLedDisplayDic[keyValue.Key].Add((StandardLEDDisplayInfo)standard.Clone());
}
}
foreach (KeyValuePair<string, List<ComplexLEDDisplayInfo>> keyValue
in infoCollection.LedComplex)
{
foreach (ComplexLEDDisplayInfo complex in keyValue.Value)
{
if (!_allCommPortLedDisplayDic.ContainsKey(keyValue.Key))
{
_allCommPortLedDisplayDic.Add(keyValue.Key, new List<ILEDDisplayInfo>());
}
_allCommPortLedDisplayDic[keyValue.Key].Add((ComplexLEDDisplayInfo)complex.Clone());
}
}
}
示例14: OnReadUserData
void OnReadUserData(SerializableDictionary<string, string> userData)
{
if (userData.ContainsKey("UserWatches"))
{
string[] tokens = userData["UserWatches"].Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string token in tokens)
{
UnrealDebuggerIDE.Commands.AddWatch(token);
}
}
}
示例15: ReorderSubGroups
public void ReorderSubGroups(List<string> subGroupsOrderList)
{
SerializableDictionary<string, GameItemsSubGroup> newSubGroups =
new SerializableDictionary<string, GameItemsSubGroup>();
foreach (string ident in subGroupsOrderList)
{
if (_subGroups.ContainsKey(ident) && !newSubGroups.ContainsKey(ident))
{
GameItemsSubGroup subGroup = _subGroups[ident];
newSubGroups.Add(ident, subGroup);
_subGroups.Remove(ident);
}
}
foreach (string orphantIdent in _subGroups.Keys)
{
if (!newSubGroups.ContainsKey(orphantIdent))
{
GameItemsSubGroup subGroup = _subGroups[orphantIdent];
newSubGroups.Add(orphantIdent, subGroup);
}
}
_subGroups = newSubGroups;
}