private static void Main(string [] args) { var unit = "KOF"; if (args.Length == 1) { if (args[0] == "--d") { // IsDebug = true; } else { unit = args[0]; } } var bitmapSaver = new BitmapSaver(SpritesDirectory); var bitmapProcessor = new BitmapProcessor(BaseDirectory, IsDebug); var mdParser = new MdFileParser(Path.Combine(MDDirectory, unit + ".md")); var userLCs = mdParser.FindUserLCShadow(); var results = new ConcurrentStack<SpriteGrid>(); var uiii = mdParser.FindUserTransitionData(); Parallel.ForEach(userLCs, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, userLCId => { var sw = Stopwatch.StartNew(); try { var grid = bitmapProcessor.RunAllSteps(userLCId); results.Push(grid); } catch (FileNotFoundException e) { Console.WriteLine("File not found: {0}", e.Message); } catch (Exception e) { Console.WriteLine("{0}", e); Console.ReadKey(); } finally { Console.WriteLine("{0} {1} - {2:g}", userLCId[1], userLCId[2].ToUpperInvariant(), sw.Elapsed); sw.Stop(); } }); bitmapSaver.SaveJsonAndBitmaps(results); bitmapSaver.SaveInfo(results, "sprites-info.json", SpritesDirectory, "sprites"); bitmapSaver.SaveInfo(uiii, "transitions.json", SpritesDirectory, "transitions"); }
private static void Main(string [] args) { var unit = "KOF"; if (args.Length == 1) { if (args[0] == "--d") { // IsDebug = true; } else { unit = args[0]; } } var bitmapSaver = new BitmapSaver(SpritesDirectory); var bitmapProcessor = new BitmapProcessor(BaseDirectory, IsDebug); var mdParser = new MdFileParser(Path.Combine(MDDirectory, unit + ".md")); var userLCs = mdParser.FindUserLCShadow(); var results = new ConcurrentStack <SpriteGrid>(); var uiii = mdParser.FindUserTransitionData(); Parallel.ForEach(userLCs, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, userLCId => { var sw = Stopwatch.StartNew(); try { var grid = bitmapProcessor.RunAllSteps(userLCId); results.Push(grid); } catch (FileNotFoundException e) { Console.WriteLine("File not found: {0}", e.Message); } catch (Exception e) { Console.WriteLine("{0}", e); Console.ReadKey(); } finally { Console.WriteLine("{0} {1} - {2:g}", userLCId[1], userLCId[2].ToUpperInvariant(), sw.Elapsed); sw.Stop(); } }); bitmapSaver.SaveJsonAndBitmaps(results); bitmapSaver.SaveInfo(results, "sprites-info.json", SpritesDirectory, "sprites"); bitmapSaver.SaveInfo(uiii, "transitions.json", SpritesDirectory, "transitions"); }