/// <summary> /// Main logic here /// </summary> private static int RunAndReturn(Options options) { // Print program info Console.WriteLine(HeadingInfo.Default); Console.WriteLine(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).LegalCopyright); // Check arguments PreRunTest(options); Console.WriteLine("MapleStory Location: {0}", options.MapleStoryPath); // Initialize render MapRenderInvoker renderInvoker = new MapRenderInvoker(options.MapleStoryPath, options.Encoding == string.Empty ? Encoding.Default : Encoding.GetEncoding(options.Encoding), false); // TODO: Iterate each map var map = options.Maps.First(); string imgText = map.EndsWith(".img") ? map : (map + ".img"); renderInvoker.LoadMap(imgText); renderInvoker.Launch(options.RenderWidth, options.RenderHeight); // Do sampling! IDatasetWriter writer; if (options.DarkNet) { writer = new DarknetWriter(options.OutputPath); } else { writer = new TfRecordWriter(options.OutputPath + "/" + map); } Sampler.Sampler sampler = new Sampler.Sampler(renderInvoker); if (options.PostProcessingEnable && options.PlayerImageDirectory != "") { IPostProcessor postProcessor = new PlayerProcessor(options.PlayerImageDirectory); sampler.OnSampleCaptured += (s, e) => postProcessor.Process(s); } sampler.SampleAll(options.StepX, options.StepY, writer, options.SampleInterval); writer.Finish(); return(0); }