当前位置: 首页>>代码示例>>C#>>正文


C# SerializableDictionary.ContainsKey方法代码示例

本文整理汇总了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);
 }
开发者ID:renning22,项目名称:SnifferPlayer,代码行数:15,代码来源:AcfunDownloaderConfigurationForm.cs

示例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;
 }
开发者ID:aries544,项目名称:eXpand,代码行数:7,代码来源:ModelValueConverter.cs

示例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;
        }
开发者ID:nokiadatagathering,项目名称:WP7-Official,代码行数:27,代码来源:JavaMessagesParser.cs

示例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;
            }
        }
开发者ID:jianfengye,项目名称:MouseMonitor,代码行数:29,代码来源:MouseState.cs

示例5: GetDefaultAspectFromVersion9

        private string GetDefaultAspectFromVersion9(SerializableDictionary<string, string> serializableDictionary, List<string> aspects, string defaultAspect) {
            if (serializableDictionary.ContainsKey("Schema")) {
                return GetAspectFromXml(aspects, defaultAspect);
            }

            return defaultAspect;
        }
开发者ID:krazana,项目名称:eXpand,代码行数:7,代码来源:Updater.cs

示例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>>();
		}
开发者ID:GoogleFrog,项目名称:Zero-K-Infrastructure,代码行数:8,代码来源:ServerState.cs

示例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];
        }
开发者ID:NellyWhadsDev,项目名称:MultiMiner,代码行数:10,代码来源:MinerFactory.cs

示例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"])) : "";
		}
开发者ID:kwedr,项目名称:acdown,代码行数:20,代码来源:BilibiliDownloaderConfigurationForm.cs

示例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) : "");
        }
开发者ID:DVitinnik,项目名称:UniversityApps,代码行数:57,代码来源:NaiveBayes.cs

示例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;
        }
开发者ID:27miller87,项目名称:MultiMiner,代码行数:18,代码来源:MinerFactory.cs

示例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]);
         }
     }
 }
开发者ID:TroutZhang,项目名称:unreal-debugger,代码行数:11,代码来源:ExplorerPanel.cs

示例12: HasRelationship

 private bool HasRelationship(string siblingAccount, SerializableDictionary<string, string> dictRelation)
 {
     lock (dictRelation)
         return dictRelation.ContainsKey(siblingAccount.ToLowerInvariant());
 }
开发者ID:quynh68,项目名称:msnp-sharp,代码行数:5,代码来源:DeltasList.cs

示例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());
                }
            }
        }
开发者ID:hardborn,项目名称:MonitorManager,代码行数:45,代码来源:MonitorAllConfig.cs

示例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);
                }
            }
        }
开发者ID:TroutZhang,项目名称:unreal-debugger,代码行数:12,代码来源:UserWatchPanel.cs

示例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;
        }
开发者ID:TimeZeroForever,项目名称:TZToolz,代码行数:26,代码来源:GameItemsGroup.cs


注:本文中的SerializableDictionary.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。