Esempio n. 1
0
        /*
         * [ArgActionMethod, ArgDescription("Run scan")]
         * public void scan(ScanOptions oo)
         *
         * {
         *  CliHelper cli = new CliHelper();
         *
         *  var scanit = new Scan();
         *
         *  vtero = scanit.Scanit(oo);
         *
         *  return;
         * }
         *
         * [ArgActionMethod, ArgDescription("Run default dump routine")]
         * public void dump(DumpOptions oo)
         * {
         *  var ops = new DumpOptions();
         *
         *  vtero = new Vtero();
         *
         *  var saveStateFile = $"{ops.Global.FileName }.inVtero.net";
         *  if (File.Exists(saveStateFile))
         *  {
         *      vtero = vtero.CheckpointRestoreState(saveStateFile);
         *      vtero.OverRidePhase = true;
         *  }
         *
         *  // TODO: fail when no state
         *
         *  Timer = Stopwatch.StartNew();
         *
         *  //var dumper = new Dumper(vtero, string.Empty, null);
         *
         *  //dumper.DumpIt();
         *  return;
         * }
         *
         * [ArgActionMethod, ArgDescription("Run default analyze routine")]
         * public void analyze(AnalyzeOptions ops)
         * {
         *
         *  if (!string.IsNullOrWhiteSpace(FileName))
         *      ops.Global.FileName = FileName;
         *
         *  vtero = new Vtero();
         *
         *  var saveStateFile = $"{ops.Global.FileName}.inVtero.net";
         *  if (File.Exists(saveStateFile))
         *  {
         *      vtero = vtero.CheckpointRestoreState(saveStateFile);
         *      vtero.OverRidePhase = true;
         *  }
         *
         *  Mem.InitMem(ops.Global.FileName, null, vtero.DetectedDesc);
         *
         *  var analyzer = new Analyze();
         *
         *  Timer = Stopwatch.StartNew();
         *  analyzer.StartAnalyze(ops, vtero);
         *
         *  return;
         * }
         */



        public static int Main(string[] args)
        {
            try
            {
                CancelKeyPress += Console_CancelKeyPress;
                AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;

                if (args.Length < 1)
                {
                    args = new string[] { "python" }
                }
                ;

                RunCLIREPL._Main(args);

                var p = new quickdumps();



                /*
                 *
                 * // I wanted a flexible syntax that I didn't know how to (yet) attribute with CommandLine 2.0beta :\
                 * if (args.Length > 1 && File.Exists(args[0]))
                 * {
                 *  p.FileName = args[0];
                 *  var tmp = new string[args.Length-1];
                 *  Array.Copy(args, 1, tmp, 0, args.Length - 1);
                 *  args = tmp;
                 * }
                 *
                 * var parser = new Parser(with => with.EnableDashDash = true);
                 *
                 * return CommandLine.Parser.Default.ParseArguments<ScanOptions, DumpOptions, AnalyzeOptions>(args)
                 *  .MapResult(
                 *    (ScanOptions opts) => p.InitialPhaseScans(opts),
                 *    (DumpOptions opts) => p.DoDumping(opts),
                 *    (AnalyzeOptions opts) => p.DoAnalyze(opts),
                 *    errs => 1);
                 */
            }
            catch (Exception ex)
            {
                Write("Error in processing, likely need to adjust run/gaps. ");
                Write(ex.ToString());
                WriteLine((ex.InnerException == null ? "." : ex.InnerException.ToString()));
            }
            finally
            {
                ResetColor();
            }
            return(0);
        }
Esempio n. 2
0
        /*
        [ArgActionMethod, ArgDescription("Run scan")]
        public void scan(ScanOptions oo)

        {
            CliHelper cli = new CliHelper();

            var scanit = new Scan();

            vtero = scanit.Scanit(oo);

            return;
        }

        [ArgActionMethod, ArgDescription("Run default dump routine")]
        public void dump(DumpOptions oo)
        {
            var ops = new DumpOptions();

            vtero = new Vtero();

            var saveStateFile = $"{ops.Global.FileName }.inVtero.net";
            if (File.Exists(saveStateFile))
            {
                vtero = vtero.CheckpointRestoreState(saveStateFile);
                vtero.OverRidePhase = true;
            }

            // TODO: fail when no state

            Timer = Stopwatch.StartNew();

            //var dumper = new Dumper(vtero, string.Empty, null);

            //dumper.DumpIt();
            return;
        }

        [ArgActionMethod, ArgDescription("Run default analyze routine")]
        public void analyze(AnalyzeOptions ops)
        {

            if (!string.IsNullOrWhiteSpace(FileName))
                ops.Global.FileName = FileName;

            vtero = new Vtero();

            var saveStateFile = $"{ops.Global.FileName}.inVtero.net";
            if (File.Exists(saveStateFile))
            {
                vtero = vtero.CheckpointRestoreState(saveStateFile);
                vtero.OverRidePhase = true;
            }

            Mem.InitMem(ops.Global.FileName, null, vtero.DetectedDesc);

            var analyzer = new Analyze();

            Timer = Stopwatch.StartNew();
            analyzer.StartAnalyze(ops, vtero);

            return;
        }
        */



        public static int Main(string[] args)
        {
            try
            {
                CancelKeyPress += Console_CancelKeyPress;
                AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;

                RunCLIREPL._Main(args);

                var p = new quickdumps();
                



                /*

                // I wanted a flexible syntax that I didn't know how to (yet) attribute with CommandLine 2.0beta :\
                if (args.Length > 1 && File.Exists(args[0]))
                {
                    p.FileName = args[0];
                    var tmp = new string[args.Length-1];
                    Array.Copy(args, 1, tmp, 0, args.Length - 1);
                    args = tmp;
                }

                var parser = new Parser(with => with.EnableDashDash = true);

                return CommandLine.Parser.Default.ParseArguments<ScanOptions, DumpOptions, AnalyzeOptions>(args)
                    .MapResult(
                      (ScanOptions opts) => p.InitialPhaseScans(opts),
                      (DumpOptions opts) => p.DoDumping(opts),
                      (AnalyzeOptions opts) => p.DoAnalyze(opts),
                      errs => 1);
                      */
            }
            catch (Exception ex)
            {
                Write("Error in processing, likely need to adjust run/gaps. ");
                Write(ex.ToString());
                WriteLine((ex.InnerException == null ? "." : ex.InnerException.ToString()));
            }
            finally
            {
                ResetColor();
            }
            return 0;
        }