OSDN Git Service

Revisit(er) & ReadOnly chunk use
[automap/automap.git] / ShardProcessor / Program.cs
index e9e5b6c..2f834a3 100644 (file)
@@ -1,19 +1,88 @@
 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
-{
-       class MainClass
+{      
+       public partial class MainClass
        {
-               /*
+               //private ILogger Logger { get; set; }
+               const string chunkFile_filter = @"*_*.png";
+               static Regex chunkShardRegex = new Regex(@"(?<X>[\d]+)_(?<Z>[\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;
                }
+
+               
+
+               }
+
+
+
        }
 }