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


C# KeyValue类代码示例

本文整理汇总了C#中KeyValue的典型用法代码示例。如果您正苦于以下问题:C# KeyValue类的具体用法?C# KeyValue怎么用?C# KeyValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KeyValue类属于命名空间,在下文中一共展示了KeyValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadFromKeyValues

        public override void LoadFromKeyValues(KeyValue kv)
        {
            base.LoadFromKeyValues(kv);

            ActionList = new AbilityActionCollection();

            foreach(string key in ActionList.Actions.Keys)
            {
                KeyValue kvActions = kv[key];
                if (kvActions == null) continue; //We don't have any actions there so skip
                foreach(KeyValue actionChild in kvActions.Children)
                {
                    if (!actionChild.HasChildren) continue; //TODO: Handle the Dontdestroy key
                    BaseAction action = DotaActionFactory.CreateNewAction(actionChild.Key);
                    if(action == null)
                    {
                        MessageBox.Show("WARNING: Action " + actionChild.Key + " not found in factory when creating ability: " + this.ClassName, "Loading Warning", MessageBoxButtons.OK);
                        continue;
                    }

                    action.LoadFromKeyValues(actionChild);
                    ActionList.Actions[key].Add(action);
                }
            }
        }
开发者ID:hex6,项目名称:WorldSmith,代码行数:25,代码来源:DotaAbilityParser.cs

示例2: AppendQueryString

 /// <summary>
 /// Appends a parameter to the given url as a query string
 /// </summary>
 /// <param name="path">url</param>
 /// <param name="queryStringParameter">parameter to append</param>
 /// <returns>url appended with the query string</returns>
 public static string AppendQueryString(string path, KeyValue queryStringParameter)
 {
     if (!string.IsNullOrEmpty(path) && queryStringParameter != null)
     {
         if (path.Contains(CommonStrings.QuestionSymbol.ToString()))
         {
             return (string.Concat(path,
                                   CommonStrings.AndSymbol,
                                   queryStringParameter.Key,
                                   CommonStrings.EqualSymbol,
                                   Convert.ToString(queryStringParameter.Value)));
         }
         else
         {
             return (string.Concat(path,
                                   CommonStrings.QuestionSymbol,
                                   queryStringParameter.Key,
                                   CommonStrings.EqualSymbol,
                                   Convert.ToString(queryStringParameter.Value)));
         }
     }
     else
     {
         throw new ArgumentException();
     }
 }
开发者ID:mrofferz,项目名称:mrofferz,代码行数:32,代码来源:Utility.cs

示例3: Add

 public void Add(KeyCode key, string descr, KeyCode alt = KeyCode.None)
 {
     var keyValue = new KeyValue() { descr = descr, keyCodeAlt = new[] { key, alt }, main = key };
     keyValue.Load();
     keys.Add(keyValue);
     m_alternatives[(int)key] = keyValue;
 }
开发者ID:friuns,项目名称:New-Unity-Project-Eddy-Car-Phys,代码行数:7,代码来源:InputManager.cs

示例4: Import

        public void Import(KeyValue root)
        {
            this.Data = new MemoryStream();
            this.FileVersion = 0;

            long newOffset = this.Structures[0].DataSize;
            this.ImportStructure(this.Structures[0], root, 0, ref newOffset, new ImportState());
        }
开发者ID:dhk-room101,项目名称:da2_toolset,代码行数:8,代码来源:GenericFile_Data.cs

示例5: ToKV

        public KeyValue ToKV(string key)
        {
            KeyValue parent = new KeyValue(key);
            parent += new KeyValue("var_type") + Type.ToString();
            parent += new KeyValue(Name) + DefaultValue;

            return parent;
        }
开发者ID:hex6,项目名称:WorldSmith,代码行数:8,代码来源:BaseActionVariable.cs

示例6: LoadFromKeyValues

        public virtual void LoadFromKeyValues(KeyValue kv)
        {
            PropertyInfo[] properties = this.GetType().GetProperties();

            ClassName = kv.Key;

            foreach(PropertyInfo info in properties)
            {
                if (info.Name == "ClassName") continue;
                if (info.Name == "WasModified") continue;

                KeyValue subkey = kv[info.Name];
                if (subkey == null)
                {
                    continue;
                }
                if (subkey.HasChildren) continue; //TODO parse children because this is AbilitySpecial

                object data = null;
                if(info.PropertyType == typeof(int))
                {
                    data = subkey.GetInt();
                }
                if(info.PropertyType == typeof(float))
                {
                    data = subkey.GetFloat();
                }
                if(info.PropertyType == typeof(bool))
                {
                    data = subkey.GetBool();
                }
                if(info.PropertyType == typeof(string))
                {
                    data = subkey.GetString();
                }
                if (typeof(Enum).IsAssignableFrom(info.PropertyType) && subkey.GetString() != "")
                {
                    if (info.PropertyType.GetCustomAttribute(typeof(FlagsAttribute)) != null)
                    {
                        string[] flags = subkey.GetString().Replace(" ", "").Split('|').Where(x => x != "").ToArray();
                        string p = String.Join(", ", flags);

                        data = Enum.Parse(info.PropertyType, p);
                    }
                    else
                    {
                        data = Enum.Parse(info.PropertyType, subkey.GetString());
                    }
                }
                if (info.PropertyType == typeof(PerLevel))
                {
                    data = new PerLevel(subkey.GetString().Trim());
                }
                if(data != null) info.SetMethod.Invoke(this, new object[] { data });

            }
        }
开发者ID:hex6,项目名称:WorldSmith,代码行数:57,代码来源:DotaDataObject.cs

示例7: getKV

			public KeyValue getKV() {
				KeyValue root = new KeyValue("Return Value");
				KeyValue type = new KeyValue("Type");
				type.Set(this.type);
				KeyValue desc = new KeyValue("Description");
				desc.Set(description);
				root.AddChild(type);
				root.AddChild(desc);
				return root;
			}
开发者ID:stephenfournier,项目名称:Dota2FunctionParser,代码行数:10,代码来源:D2Function.cs

示例8: generateKV

		static void generateKV() {
			KeyValue root = new KeyValue("Dota2Functions");
			string currClass = "Global";
			foreach (var kv in funcs) {
				kv.Value.processStats();
				KeyValue func_kv = kv.Value.getKV();
				root.AddChild(func_kv);
			}
			File.WriteAllText("d2functions.txt", root.ToString());
		}
开发者ID:stephenfournier,项目名称:Dota2FunctionParser,代码行数:10,代码来源:Program.cs

示例9: Main

        static void Main()
        {
            var value = new KeyValue { Key = "Key1", Value = "Value1" };

            Db.Main.KeyValues.InsertOnSubmit(value);
            Db.Main.SubmitChanges();

            System.Console.WriteLine(Db.Main.KeyValues.Where(p => p.Key == "Key1").Count());
            System.Console.ReadLine();
        }
开发者ID:FreeApophis,项目名称:SQLiteMinimal,代码行数:10,代码来源:Program.cs

示例10: ToKV

        public KeyValue ToKV(string Key)
        {
            KeyValue doc = new KeyValue(Key);
            foreach(BaseAction action in this.List.Cast<BaseAction>())
            {
                KeyValue child = new KeyValue(action.ClassName);
                doc += action.SaveToKV();

            }
            return doc;
        }
开发者ID:hex6,项目名称:WorldSmith,代码行数:11,代码来源:ActionCollection.cs

示例11: ToKV

        public KeyValue ToKV()
        {
            KeyValue kv = new KeyValue("Actions");
            foreach (KeyValuePair<string, ActionCollection> k in Actions)
            {
                KeyValue child = k.Value.ToKV(k.Key);
                kv += child;
            }

            return kv;
        }
开发者ID:hex6,项目名称:WorldSmith,代码行数:11,代码来源:AbilityActionCollection.cs

示例12: Add

 public void Add(KeyCode key, string descr, params KeyCode[] alt)
 {
     var l = new List<KeyCode>(alt.Take(1));
     l.Insert(0, key);
     foreach (KeyCode a in l)
         KeyBack[a] = key;
     var keyValue = new KeyValue() { descr = descr, keyCodeAlt = l.ToArray(), main = key };
     keyValue.Load();
     keys.Add(keyValue);
     m_alternatives[(int)key] = keyValue;
 }
开发者ID:friuns,项目名称:New-Unity-Project-tm2---Copy,代码行数:11,代码来源:InputManager.cs

示例13: Move

        public static void Move(string space, string oldKey, string newKey) {
            KeysList l;
            if (!_instance._storage.TryGetValue(space, out l)) {
                throw new Exception("Unsupported space: " + space);
            }

            var i = l.FindIndex(x => x.Item1 == oldKey);
            if (i == -1) return;

            l[i] = new KeyValue(newKey, l[i].Item2);
            _instance.Save(space);
        }
开发者ID:gro-ove,项目名称:actools,代码行数:12,代码来源:LimitedStorage.cs

示例14: KeyValueBuilder

 /// <summary>
 /// 
 /// </summary>
 /// <param name="kvs"></param>
 public KeyValueBuilder(Dictionary<string, string> kvs)
 {
     if (kvs == null)
     {
         throw new ArgumentNullException();
     }
     foreach (var item in kvs)
     {
         var infoValue = new KeyValue {Key = item.Key, Value = item.Value};
         _list.Add(infoValue);
     }
 }
开发者ID:mingkongbin,项目名称:anycmd,代码行数:16,代码来源:KeyValueBuilder.cs

示例15: BuildUniqueSources

        private static IEnumerable<KeyValue> BuildUniqueSources()
        {
            var result = new List<KeyValue>();

            for (int i = 0; i < 10000; i++)
            {
                for (int j = 65; j < 91; j++)
                {
                    var obj = new KeyValue() { Key = string.Format("{0}{0}{0}-{1}", (char)j, i), Value = i };
                    result.Add(obj);
                }
            }

            return result;
        }
开发者ID:yuanrui,项目名称:Examples,代码行数:15,代码来源:GetOneElementDemo.cs


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