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


C# KeyValue.ToString方法代码示例

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


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

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

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

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

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

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


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