Ejemplo n.º 1
0
		private void exporXmlMapInfoButton_Click(object sender, EventArgs e)
		{
			const string exportPath = "C:\\Export";
			const string xmlMapInfoPath = exportPath + "\\XmlMapInfo";
			Directory.CreateDirectory(xmlMapInfoPath);
			using (var us = new UnitSync(Program.SpringPath)) {
				int i = 0;
				var count = GalaxyMap.Instance.Galaxy.MapNames.Count;
				foreach (var mapName in GalaxyMap.Instance.Galaxy.MapNames) {
                    var path = Path.Combine(xmlMapInfoPath, mapName + ".xml");
                    if (File.Exists(path)) {
                        continue;
                    }
					try {
						us.GetMapInfo(mapName).Save(path);
					} catch (Exception ex) {
                        
						Debug.WriteLine(string.Format("{0} is corrupted: coult not export data. ({1}/{2}) ({3})", mapName, i++, count, ex.Message));
					}
					Debug.WriteLine(
						"Extracted data from {0} ({1}/{2})".FormatWith(mapName, ++i, count));
				}
			}
		}
Ejemplo n.º 2
0
		void btn_DumpMinimaps_Click(object sender, EventArgs e)
		{
			const string exportPath = "C:\\Export";
			const string minimapPath = exportPath + "\\Minimaps";
			const string heightmapPath = exportPath + "\\Heightmaps";
			const string metalmapPath = exportPath + "\\Metalmaps";
			const string mapInfoPath = exportPath + "\\MapInfo";
			Directory.CreateDirectory(exportPath);
			Directory.CreateDirectory(minimapPath);
			Directory.CreateDirectory(heightmapPath);
			Directory.CreateDirectory(metalmapPath);
			Directory.CreateDirectory(mapInfoPath);
			using (var us = new UnitSync(Program.SpringPath)) {
				int i = 0;
				var count = GalaxyMap.Instance.Galaxy.MapNames.Count;
				foreach (var mapName in GalaxyMap.Instance.Galaxy.MapNames) {
					try {
						var map = new Map(mapName, us.GetMapInfo(mapName), us.GetMapChecksum(mapName));
						map.FixAspectRatio(us.GetMinimap(mapName, 0)).Save(minimapPath.Combine(mapName + ".png"), ImageFormat.Png);
						us.GetHeightMap(mapName).Save(heightmapPath.Combine(mapName + ".png"), ImageFormat.Png);
						us.GetMetalMap(mapName).Save(metalmapPath.Combine(mapName + ".png"), ImageFormat.Png);
						map.Save(mapInfoPath.Combine(mapName + ".dat"));
					} catch (Exception ex) {
						Debug.WriteLine(string.Format("{0} is corrupted: coult not export data. ({1}/{2}", mapName, i++, count));
					}
					Debug.WriteLine(
						"Extracted data from {0} ({1}/{2})".FormatWith(mapName, ++i, count));
				}
			}
		}