public static void Main(string[] args) { String error = Global.Instance.Initialize(); if (args.Length != 2) { Console.WriteLine("TMapper"); Console.WriteLine("You must specify a world and a image filename output"); Console.WriteLine("TMapper.exe [worldpath] [imageout]"); } else { string mappath = args[0]; TileProperties.Initialize(); ResourceManager.Instance.Initialize(); SettingsManager.Instance.Initialize(); string file = mappath; Console.WriteLine(file); Global.Instance.InConsole = true; WorldMapper mapper = new WorldMapper(); mapper.Initialize(); mapper.OpenWorld(); mapper.ProcessWorld(file, null); mapper.CreatePreviewPNG(args[1], null); } }
public void Generate() { try { Console.WriteLine("Generating the map image..."); Console.WriteLine("World Path: "+World.WorldPath); WorldMapper mapper = new WorldMapper(); mapper.Initialize(); mapper.OpenWorld(); if (!Directory.Exists(OutputFolder)) { Directory.CreateDirectory(OutputFolder); } string path = Path.Combine(OutputFolder, MapFileName); mapper.ProcessWorld(World.WorldPath, null); mapper.CreatePreviewPNG(path, null); ImageCutter cutter = new ImageCutter(path, Path.Combine(OutputFolder, CutsFolder)); cutter.Cuts(); //Generating the map info MapStaticInfo msi = new MapStaticInfo(); msi.Cols = cutter.Cols; msi.Rows = cutter.Rows; msi.WorldName = World.WorldName; File.WriteAllText(Path.Combine(OutputFolder, CutsFolder, MapInfoFile), msi.ToString()); File.WriteAllText(Path.Combine(OutputFolder, CutsFolder, StampFile), msi.Generated.ToString()); Console.WriteLine("Map image generated!"); //Release thread ref thread = null; } catch (Exception e) { Console.WriteLine("Error while generating the image map"); Console.WriteLine(e.StackTrace); Console.WriteLine(e.Message); //thread.Abort(); thread = null; } }