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


C# KeyValue.AddChild方法代码示例

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


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

示例1: 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

示例2: 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

示例3: serializeSettings

        public void serializeSettings()
        {
            KeyValue rootKV = new KeyValue("Addons");
            foreach (KeyValuePair<string, Addon> a in addons) {
                string addonName = a.Key;
                Addon addon = a.Value;
                KeyValue addonKV = new KeyValue(addonName);
                addon.serializeSettings(addonKV);
                rootKV.AddChild(addonKV);
            }

            // compress string to take up less space.
            /*StringBuilder sb = new StringBuilder();
            string[] split = rootKV.ToString().Split('\n');
            for (int i = 0; i < split.Length; i++) {
                string l = split[i];
                l = l.Trim();
                sb.AppendLine(l);
            }*/

            Settings.Default.AddonsKV = rootKV.ToString();
            Settings.Default.Save();
        }
开发者ID:kylie-xie,项目名称:Dota-2-ModKit,代码行数:23,代码来源:MainForm.cs

示例4: serializeSettings

		public void serializeSettings() {
			var root = new KeyValue("InstalledAddons");
			foreach (var kv in installedCustomGames) {
				var cg = kv.Value;
				cg.serializeSettings();
				root.AddChild(cg.addonKV);
			}
			Settings.Default.InstalledAddonsKV = root.ToString();

			Settings.Default.Save();
		}
开发者ID:KimimaroTsukimiya,项目名称:CustomGameBrowser,代码行数:11,代码来源:MainForm.cs

示例5: serializeSettings

		public void serializeSettings() {
			KeyValue rootKV = new KeyValue("Addons");
			foreach (KeyValuePair<string, Addon> a in addons) {
				string addonName = a.Key;
				Addon addon = a.Value;
				KeyValue addonKV = new KeyValue(addonName);
				addon.serializeSettings(addonKV);
				rootKV.AddChild(addonKV);
			}

			Settings.Default.AddonsKV = rootKV.ToString();

			// serialize the customTiles
			string customTilesSerialized = "";
			for (int i = 0; i < customTiles.Length; i++) {
				customTilesSerialized += customTiles[i].serializedTileInfo + "|";
			}
			Settings.Default.CustomTileInfo = customTilesSerialized;
			Settings.Default.Save();
		}
开发者ID:KimimaroTsukimiya,项目名称:Dota-2-ModKit,代码行数:20,代码来源:MainForm.cs

示例6: generateSoundMapFile

		private void generateSoundMapFile() {
			string[] files = Directory.GetFiles(Path.Combine(Environment.CurrentDirectory, "possible_sscripts"), "*.txt", SearchOption.AllDirectories);
			vsndToName = new Dictionary<string, List<string>>();

			foreach (string file in files) {
				try {
					if (file.Contains("sounds") && !file.Contains("phonemes")) {
						KeyValue[] roots = KVParser.KV1.ParseAll(File.ReadAllText(file));
						if (roots == null || roots.Count() == 0) {
							continue;
						}

						foreach (KeyValue kv2 in roots) {
							string soundName = kv2.Key;


							if (kv2.HasChildren) {
								foreach (KeyValue kv3 in kv2.Children) {
									if (kv3.Key.Contains("wave")) {
										if (kv3.HasChildren) {
											foreach (KeyValue kv4 in kv3.Children) {
												string val4 = kv4.GetString();
												if (val4.EndsWith(".wav") || val4.EndsWith(".mp3")) {
													string vsnd = fixWave(val4);
													//Debug.WriteLine(val4 + " | " + soundName);
													string val = soundName + "|" + file.Replace(Path.Combine(Environment.CurrentDirectory, "possible_sscripts"), "soundevents");
                                                    if (!vsndToName.ContainsKey(vsnd)) {
														List<string> soundNames = new List<string>();
														soundNames.Add(val);
														vsndToName[vsnd] = soundNames;
													} else {
														if (!vsndToName[vsnd].Contains(val)) {
															vsndToName[vsnd].Add(val);
														}
													}
												}

											}
										} else {
											string val3 = kv3.GetString();
											if (val3.EndsWith(".wav") || val3.EndsWith(".mp3")) {
												string vsnd = fixWave(val3);
												//Debug.WriteLine(val3 + " | " + soundName);
												string val = soundName + "|" + file.Replace(Path.Combine(Environment.CurrentDirectory, "possible_sscripts"), "soundevents");
												if (!vsndToName.ContainsKey(vsnd)) {
													List<string> soundNames = new List<string>();
													soundNames.Add(val);
													vsndToName[vsnd] = soundNames;
												} else {
													if (!vsndToName[vsnd].Contains(val)) {
														vsndToName[vsnd].Add(val);
													}
												}
											}
										}
									}
								}
							}
						}
					}
				} catch (Exception ex) {
					Debug.WriteLine("Skipping " + file + ":");
					//Debug.WriteLine(ex.ToString());
					continue;
				}
			}

			KeyValue root = new KeyValue("Sounds");
			foreach (KeyValuePair<string, List<string>> m in vsndToName) {
				string soundVsnd = m.Key;
				List<string> soundInfos = m.Value;
				KeyValue soundKV = new KeyValue(soundVsnd);
				root.AddChild(soundKV);

				foreach (string soundInfo in soundInfos) {
					string[] parts = soundInfo.Split('|');
					string soundName = parts[0];
					string vsndevts = parts[1];

					vsndevts = vsndevts.Replace("\\", "/");
					vsndevts = vsndevts.Replace(".txt", ".vsndevts");

					KeyValue waveKV = new KeyValue(soundName + "|" + vsndevts);
					soundKV.AddChild(waveKV);
				}
			}

			File.WriteAllText(vsnd_to_soundname_Path, root.ToString());
		}
开发者ID:KimimaroTsukimiya,项目名称:Dota-2-ModKit,代码行数:89,代码来源:SoundFeatures.cs

示例7: serializeSettings

        internal void serializeSettings(KeyValue addonKV)
        {
            KeyValue workshopIDKV = new KeyValue("workshopID");
            workshopIDKV.AddChild(new KeyValue(this.workshopID.ToString()));
            addonKV.AddChild(workshopIDKV);

            KeyValue generateNote0KV = new KeyValue("generateNote0");
            generateNote0KV.AddChild(new KeyValue(this.generateNote0.ToString()));
            addonKV.AddChild(generateNote0KV);

            KeyValue generateLoreKV = new KeyValue("generateLore");
            generateLoreKV.AddChild(new KeyValue(this.generateLore.ToString()));
            addonKV.AddChild(generateLoreKV);

            KeyValue askToBreakUp = new KeyValue("askToBreakUp");
            askToBreakUp.AddChild(new KeyValue(this.askToBreakUp.ToString()));
            addonKV.AddChild(askToBreakUp);

            KeyValue autoDeleteBin = new KeyValue("autoDeleteBin");
            autoDeleteBin.AddChild(new KeyValue(this.autoDeleteBin.ToString()));
            addonKV.AddChild(autoDeleteBin);

            KeyValue barebonesLibUpdates = new KeyValue("barebonesLibUpdates");
            barebonesLibUpdates.AddChild(new KeyValue(this.barebonesLibUpdates.ToString()));
            addonKV.AddChild(barebonesLibUpdates);

            KeyValue generateUTF8 = new KeyValue("generateUTF8");
            generateUTF8.AddChild(new KeyValue(this.generateUTF8.ToString()));
            addonKV.AddChild(generateUTF8);

            KeyValue libraries = new KeyValue("libraries");
            addonKV.AddChild(libraries);
            foreach (KeyValuePair<string, Library> libraryKV in this.libraries) {
                Library lib = libraryKV.Value;
                KeyValue libKV = new KeyValue(lib.local);
                libraries.AddChild(libKV);
                // populate libKV
                if (lib.remote != null) {
                    KeyValue remoteKV = new KeyValue("Remote");
                    remoteKV.Set(lib.remote);
                    libKV.AddChild(remoteKV);
                }
                if (lib.defaultLibPath != null) {
                    KeyValue kv = new KeyValue("DefaultLibPath");
                    kv.Set(lib.defaultLibPath);
                    libKV.AddChild(kv);
                }
                var kv2 = new KeyValue("NeverCheckForUpdates");
                kv2.Set(lib.neverCheckForUpdates);
                libKV.AddChild(kv2);
            }
        }
开发者ID:kylie-xie,项目名称:Dota-2-ModKit,代码行数:52,代码来源:Addon.cs

示例8: serializeSettings

		internal void serializeSettings() {
			addonKV = new KeyValue(workshopID);
			if (WorkshopImgSizeOnWeb != 0) {
				addonKV.AddChild(new KeyValue("WorkshopImgSizeOnWeb").Set(WorkshopImgSizeOnWeb));
			}
		}
开发者ID:KimimaroTsukimiya,项目名称:CustomGameBrowser,代码行数:6,代码来源:CustomGame.cs

示例9: addPreference

 private void addPreference(KeyValue preferences, string key, string val)
 {
     KeyValue newKV = new KeyValue(key);
     newKV.AddChild(new KeyValue(val));
     preferences.AddChild(newKV);
 }
开发者ID:hex6,项目名称:Dota-2-ModKit,代码行数:6,代码来源:MainForm.cs

示例10: addKV

 private void addKV(string addonName, string key, string val)
 {
     foreach (KeyValue kv in AddonDataMasterKV.Children)
     {
         string name = kv.Key;
         if (addonName.ToLower() == name.ToLower()) {
             KeyValue newKV = new KeyValue(key);
             newKV.AddChild(new KeyValue(val));
             kv.AddChild(newKV);
             break;
         }
     }
 }
开发者ID:hex6,项目名称:Dota-2-ModKit,代码行数:13,代码来源:MainForm.cs

示例11: initPreferences

        // init addon with basic Modkit preferences if it's never been done before.
        private void initPreferences(KeyValue addonKV, Addon a)
        {
            KeyValue pref = new KeyValue("preferences");
            addPreference(pref, "create_note0_lore", "0");
            KeyValue kv_files = new KeyValue("kv_files");
            string[] npcFiles = { "Heroes", "Units", "Items", "Abilities" };
            foreach (string s in npcFiles) {
                KeyValue name = new KeyValue(s);
                string path = Path.Combine(a.GamePath, "scripts", "npc", "npc_" + s.ToLower() + "_custom.txt");
                KeyValue pathKV = new KeyValue("path");
                pathKV.AddChild(new KeyValue(path));
                KeyValue activated = new KeyValue("activated");
                activated.AddChild(new KeyValue("1"));
                name.AddChild(pathKV);
                name.AddChild(activated);
                kv_files.AddChild(name);
            }

            pref.AddChild(kv_files);
            addonKV.AddChild(pref);
        }
开发者ID:hex6,项目名称:Dota-2-ModKit,代码行数:22,代码来源:MainForm.cs


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