static void Main(string[] args) { //GenerateFontMap(@"C:\root\git\thenfour\PetsciiMapgen\img\fonts\EmojiOneColor.otf", 32, @"c:\temp\emojione.png"); //GenerateFontMap2(@"C:\root\git\thenfour\PetsciiMapgen\img\fonts\EmojiOneColor.otf", 32, @"c:\temp\comicsans.png"); //GenerateFontMap(@"Arial Unicode MS", 32, @"c:\temp\aunicod1.png"); //GenerateFontMap2(@"Arial Unicode MS", 32, @"c:\temp\aunicod2.png"); //args = new string[] { "-batchrun", "C64", "heavy", "+2" }; ArgSetList batchOverride = null; //batchOverride = Batches.Or(Batches.Args(new string[] { @"fonttag:emojidark12", @"-fonttype", @"normal", @"-fontImage", @"C:\root\git\thenfour\PetsciiMapgen\img\fonts\emojidark12.png", @"-charsize", @"12x12", @"pftag:Heavy Grayscale", @"-cs", @"lab", @"-pf", @"fivetile", @"-pfargs", @"48v5+0", @"-partitions", @"4", @"-testpalette", @"ThreeBit", @"-loadOrCreateMap", @"-outdir", @"f:\maps\emojidark12 Heavy Grayscale" })); //batchOverride = Batches.Args( // //@"-processImagesInDir", @"C:\root\git\thenfour\PetsciiMapgen\img\testImages", // //@"-testpalette", "ThreeBit", // @"-outdir", @"f:\maps", // @"-fonttype", @"mono", // @"-palette", "C64Color", // @"-fontImage", @"C:\root\git\thenfour\PetsciiMapgen\img\fonts\c64opt160.png", // @"-charsize", @"8x8", // @"-cs", @"lab", // @"-pf", @"fivetile", // @"-pfargs", @"9v5+2" //) + Batches.Or( // //Batches.Args(@"-tessellator", "a"), // //Batches.Args(@"-tessellator", "b"), // Batches.Args(@"-tessellator", "c") // ) + Batches.Or( // Batches.Args(@"-partitions", "2") // //Batches.Args(@"-partitions", "7"), // //Batches.Args(@"-partitions", "10") // ); //batchOverride = Batches.Or( // Batches.Args( // @"-fonttype", @"mono", @"-fontImage", @"C:\root\git\thenfour\PetsciiMapgen\img\fonts\c64opt160.png", @"-charsize", @"8x8", // @"-processImagesInDir", @"C:\root\git\thenfour\PetsciiMapgen\img\testImages", // @"-testpalette", "ThreeBit", // @"-palette", @"C64Color", // @"-cs", @"lab", // @"-pf", @"fivetile", // @"-pfargs", @"14v5+0", // @"-partitions", @"2", // @"-loadOrCreateMap", // @"-outdir", @"f:\maps\C64 Budget Color") // ); //batchOverride = Batches.Or(Batches.Args("-batchrun", "C64", "heavy", "+2" )); using (var stayon = new StayOn()) { if (batchOverride != null) { int ibatch = 0; Log.WriteLine("Batch contains {0} runs", batchOverride.argSets.Count()); foreach (var argset in batchOverride.argSets) { Log.EnterTask("Running batch #{0}", ibatch); Log.WriteLine("Args: {0}", argset.ToCSString()); Main2(argset.Args.ToArray()); Log.EndTask(); ibatch++; } return; } string[] batchKeywords = new string[] { }; List <string> batchAddArgs = new List <string>(); BatchCommand batchCommand = BatchCommand.None; args.ProcessArg2(new string[] { "-batchrun", "-batchlist" }, (thisArg, remainingArgs) => { if (remainingArgs != null) { batchKeywords = remainingArgs.ToArray(); } switch (thisArg.ToLowerInvariant()) { case "-batchrun": batchCommand = BatchCommand.Run; break; default: case "-batchlist": batchCommand = BatchCommand.List; break; } }); if (batchCommand == BatchCommand.None) { Main2(args); return; } string batchBaseDir = @"f:\maps"; string batchFontDir = @"C:\root\git\thenfour\PetsciiMapgen\img\fonts"; LogCore batchLog = new LogCore(); args.ProcessArg("-batchfontdir", s => { batchFontDir = s; batchLog.WriteLine("Setting font dir: {0}", batchFontDir); }); args.ProcessArg("-batchbasedir", s => { batchBaseDir = s; batchLog.WriteLine("Setting base dir: {0}", batchBaseDir); }); batchLog.WriteLine("Batch font dir: {0}", batchFontDir); batchLog.WriteLine("Batch base dir: {0}", batchBaseDir); string batchLogPath = System.IO.Path.Combine(batchBaseDir, @"batchLog.txt"); batchLog.SetLogFile(batchLogPath); Func <string, string> batchFontPath = delegate(string s) { return(System.IO.Path.Combine(batchFontDir, s)); }; args.ProcessArg("-batchaddarg", s => { batchAddArgs.Add(s); }); foreach (var arg in batchKeywords) { batchLog.WriteLine("Using batch keyword: {0}", arg); } foreach (var arg in batchAddArgs) { batchLog.WriteLine("Adding additional batch argument: {0}", arg); } var All = Batches.GetAllBatches(batchBaseDir, batchFontPath, batchAddArgs); var filtered = All.Filter(batchKeywords).ToArray(); switch (batchCommand) { case BatchCommand.None: Debug.Assert(false);// handled above. break; case BatchCommand.List: int ibatch = 0; foreach (var argset in filtered) { batchLog.WriteLine(" {0}: {1}", ibatch, argset.ToCSString()); ibatch++; } batchLog.WriteLine("Batch contains {0} runs", filtered.Length); break; case BatchCommand.Run: ibatch = 0; batchLog.WriteLine("Batch contains {0} runs", filtered.Length); foreach (var argset in filtered) { batchLog.EnterTask("Running batch #{0} of keywords", ibatch, string.Join(", ", batchKeywords)); batchLog.WriteLine("Args: {0}", argset.ToCSString()); Main2(argset.Args.ToArray()); batchLog.EndTask(); ibatch++; } break; } } }