Esempio n. 1
0
        private void открытьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();

            op.Filter = "(*.csv)|*.csv";
            if (op.ShowDialog() == DialogResult.OK)
            {
                SeparatorForm sep = new SeparatorForm();
                if (sep.ShowDialog() == DialogResult.OK)
                {
                    string fileName = op.FileName;
                    sampler = new Sampler.Sampler(sep.Separator);
                    sampler.LoadData(fileName, true);
                    selected = sampler.Data;
                    Display();
                }
            }
        }
        /// <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);
        }