/// <summary> /// Returns -1 on config error, 0 on success. /// </summary> /// <param name="args"></param> /// <returns></returns> static int Main(string[] args) { Console.Title = "Demoder's GUI Compiler (Console) v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); DateTime starttime = DateTime.Now; Console.WriteLine("Checking configuration parameters"); CommandLineParameters cmdParams = new CommandLineParameters(args); uint batch = cmdParams.LongFlag("batch"); //Source directory. DirectoryInfo srcDir = null; if (!String.IsNullOrEmpty(cmdParams.Argument("srcdir"))) { if (Directory.Exists(cmdParams.Argument("srcdir"))) { srcDir = new DirectoryInfo(cmdParams.Argument("srcdir")); } } if (srcDir == null) { Console.WriteLine("You need to provide a source directory containing the GUI image files: --srcdir=\"directory\""); if (batch == 0) { Console.ReadLine(); } return(-1); } else { Console.WriteLine(" Source Directory: {0} ", srcDir); } //Destination directory. DirectoryInfo dstDir = null; if (!String.IsNullOrEmpty(cmdParams.Argument("dstdir"))) { dstDir = new DirectoryInfo(cmdParams.Argument("dstdir")); } if (dstDir == null) { Console.WriteLine("You need to provide a directory to store the archive to: --dstdir=\"directory\""); if (batch == 0) { Console.ReadLine(); } return(-1); } else { Console.WriteLine(" Destination Directory: {0} ", dstDir); } //Destination directory. string archiveName = null; if (!String.IsNullOrEmpty(cmdParams.Argument("name"))) { archiveName = cmdParams.Argument("name"); } if (archiveName == null) { Console.WriteLine("You need to provide an archive name (without extension): --name=\"archivename\""); if (batch == 0) { Console.ReadLine(); } return(-1); } else { Console.WriteLine(" Archive Name: {0} ", archiveName); } Console.WriteLine(); Console.WriteLine(" Loading images"); ImageArchive ia = new ImageArchive(); int imgloaded = ia.Add(srcDir); Console.WriteLine(" {0} images loaded.", imgloaded); Console.WriteLine("Saving archive"); ia.Save(dstDir, archiveName); Console.WriteLine("\nDone.\n Archive: {1} KiB.\n Index: {2} KiB\n Worktime: {0} seconds.", Math.Round((DateTime.Now - starttime).TotalSeconds, 3), Math.Round((double)(new FileInfo(dstDir.FullName + Path.DirectorySeparatorChar + archiveName + ".UVGA").Length) / 1024), Math.Round((double)(new FileInfo(dstDir.FullName + Path.DirectorySeparatorChar + archiveName + ".UVGI").Length) / 1024)); if (batch == 0) { Console.ReadLine(); } return(0); }