using System; using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; using Automap; using Hjg.Pngcs; using Hjg.Pngcs.Chunks; using ProtoBuf; using Vintagestory.GameContent; namespace ShardProcessor { public partial class MainClass { //private ILogger Logger { get; set; } const string chunkFile_filter = @"*_*.png"; static Regex chunkShardRegex = new Regex(@"(?[\d]+)_(?[\d]+)\.png", RegexOptions.Singleline); static string mapPath; internal const string _chunkPath = @"Chunks"; internal const string _minimapTilesPath = @"Tiles"; /* TODO: -Process existing PNGs: Report/Dump contents of Chunk Metadata, as per current version -Grayscale Heightmap extraction from P.Buf heightmap from shards -Extract contents of game's SQLLite map DB, INTO Automap type shards... -Other stuff? chunk fixing / validation? */ public static void Main(string[ ] args) { Console.WriteLine("AUTOMAP Offline Shard processor v0.1"); //Called once - thus it can only be in a static constructor. PngChunk.FactoryRegister(PngMetadataChunk.ID, typeof(PngMetadataChunk)); ArgsDecoder(args); } private static void ArgsDecoder(string[ ] args) { //#1 Path to maps '~/ApplicationData/vintagestory/Map/World_1234567890 mapPath = args.Length > 1 ? args[1] : String.Empty; //#0 Command: Heightmaps (Generation from existing shard data) string command = args[0]; switch (command) { case @"--heightmap": Process_ShardData( ); break; case @"--shards": Scan_ShardData( ); break; case @"--points": Scan_PointsData( ); break; case @"--oneshard": Scan_OneShard( ); break; case @"--protoheader": Emit_ProtoHeader(); break; case "--minidump": Dump_Minimap( ); break; default: Console.WriteLine("Unrecognized Command: {0}", command); break; } } } }