コード例 #1
0
        private bool SetupDebugRunner(string scriptPath)
        {
            if (string.IsNullOrEmpty(scriptPath))
            {
                return(false); // No script to execute.
            }
            if (File.Exists(scriptPath) == false)
            {
                return(false); // File does not exist.
            }
            Logger.LogInfo("SetupDebugRunner", "Init");
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            SetupCommonRunner(true);

            RunConfiguration runnerConfig = new RunConfiguration();

            runnerConfig.IsParrallel = false;

#if DEBUG
            var dumpBytecCodeFlag = this.core.Options.DumpByteCode;
            var verboseFlag       = this.core.Options.Verbose;
            var prevAsmOutput     = this.core.AsmOutput;

            this.core.Options.DumpByteCode = true;
            this.core.Options.Verbose      = true;

            this.ByteCodeStream = new MemoryStream();
            this.core.AsmOutput = new StreamWriter(this.ByteCodeStream);
#endif

            debugRunner = new DebugRunner(this.core);
            bool startSucceeded = debugRunner.LoadAndPreStart(scriptPath, runnerConfig);

#if DEBUG
            this.core.Options.DumpByteCode = dumpBytecCodeFlag;
            this.core.Options.Verbose      = verboseFlag;
            this.core.AsmOutput.Close();
            this.core.AsmOutput = prevAsmOutput == null ? Console.Out : prevAsmOutput;
#endif

            Logger.LogPerf("SetupDebugRunner", sw.ElapsedMilliseconds + " ms");
            return(startSucceeded);
        }