Пример #1
0
 public override void Setup()
 {
     base.Setup();
     runnerConfig = new ProtoScript.Config.RunConfiguration();
     runnerConfig.IsParrallel = false;
     fsr = new ProtoScript.Runners.DebugRunner(core);
 }
Пример #2
0
 public void Setup()
 {
     // Specify some of the requirements of IDE.
     ProtoCore.Options options = new ProtoCore.Options();
     options.ExecutionMode = ProtoCore.ExecutionMode.Serial;
     options.SuppressBuildOutput = false;
     core = new ProtoCore.Core(options);
     core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core));
     core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core));
     runnerConfig = new ProtoScript.Config.RunConfiguration();
     runnerConfig.IsParrallel = false;
     fsr = new ProtoScript.Runners.DebugRunner(core);
 }
Пример #3
0
 public override void TearDown()
 {
     base.TearDown();
     fsr = null;
 }
Пример #4
0
 public override void Setup()
 {
     base.Setup();
     fsr = new ProtoScript.Runners.DebugRunner(core);
 }
Пример #5
0
 public override void TearDown()
 {
     base.TearDown();
     fsr = null;
 }
Пример #6
0
 public override void Setup()
 {
     base.Setup();
     fsr = new ProtoScript.Runners.DebugRunner(core);
 }
Пример #7
0
        public bool DebugScript(string dsPath)
        {
            if (string.IsNullOrEmpty(GeometryFactoryName))
            {
                throw new Exception("GeometryFactory not set!");
            }

            if (string.IsNullOrEmpty(PersistenceManagerName))
            {
                throw new Exception("PersistenceManager not set!");
            }

            if (!File.Exists(dsPath))
            {
                throw new FileNotFoundException(dsPath + " Does not exist");
            }

            bool success = false;

            System.IO.StringWriter stringStream = new StringWriter();
            executionLog = new StringBuilder();
            ProtoCore.Core        core        = null;
            ProtoCore.RuntimeCore runtimeCore = null;
            try
            {
                core = new ProtoCore.Core(new ProtoCore.Options());
                core.BuildStatus.SetStream(stringStream);
                core.Options.RootModulePathName = ProtoCore.Utils.FileUtils.GetFullPathName(dsPath);
                core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core));
                core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(core));

                core.Configurations.Add(Autodesk.DesignScript.Interfaces.ConfigurationKeys.GeometryFactory, GeometryFactoryName);
                core.Configurations.Add(Autodesk.DesignScript.Interfaces.ConfigurationKeys.PersistentManager, PersistenceManagerName);

                ProtoScript.Runners.DebugRunner     debugRunner  = new ProtoScript.Runners.DebugRunner(core);
                ProtoScript.Config.RunConfiguration runnerConfig = new ProtoScript.Config.RunConfiguration();
                runnerConfig.IsParrallel = false;
                ExecutionMirror mirror;
                debugRunner.LoadAndPreStart(dsPath, runnerConfig);
                ProtoScript.Runners.DebugRunner.VMState currentVmState;



                executionLog.AppendLine("Script executed successfully.");

                executionLog.AppendLine();
                executionLog.AppendLine("=================================CoreDump=================================");
                string coreDump;
                bool   step = true;

                while (step == true)
                {
                    try
                    {
                        currentVmState = debugRunner.StepOver(); // Perform one step.
                        mirror         = currentVmState.mirror;
                        coreDump       = null;
                        coreDump       = mirror.GetCoreDump();
                        executionLog.AppendLine();
                        executionLog.AppendLine(coreDump);
                        success = true;
                        if (currentVmState.isEnded == true)
                        {
                            step = false;
                        }
                    }
                    catch (System.Exception ex)
                    {
                        executionLog.AppendLine(ex.Message);
                        executionLog.AppendLine(ex.StackTrace);

                        success = false;
                    }
                }

                executionLog.AppendLine("=================================CoreDump=================================");
            }
            catch (System.Exception ex)
            {
                success = false;
                executionLog.AppendLine("Fail to execute script.");
                executionLog.AppendLine("Exceptions:");
                executionLog.AppendLine(ex.Message);
                executionLog.AppendLine("StackTrace:");
                executionLog.AppendLine(ex.StackTrace);
            }
            finally
            {
                if (core != null)
                {
                    core.BuildStatus.SetStream(null);
                }
            }

            return(success);
        }
Пример #8
0
        public bool DebugScript(string dsPath)
        {
            if (string.IsNullOrEmpty(GeometryFactoryName))
                throw new Exception("GeometryFactory not set!");

            if (string.IsNullOrEmpty(PersistenceManagerName))
                throw new Exception("PersistenceManager not set!");

            if (!File.Exists(dsPath))
                throw new FileNotFoundException(dsPath + " Does not exist");

            bool success = false;
            System.IO.StringWriter stringStream = new StringWriter();
            executionLog = new StringBuilder();
            ProtoCore.Core core = null;
            try
            {
                core = new ProtoCore.Core(new ProtoCore.Options());
                core.BuildStatus.SetStream(stringStream);
                core.Options.RootModulePathName = ProtoCore.Utils.FileUtils.GetFullPathName(dsPath);
                core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core));
                core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core));
                core.Configurations.Add(Autodesk.DesignScript.Interfaces.ConfigurationKeys.GeometryFactory, GeometryFactoryName);
                core.Configurations.Add(Autodesk.DesignScript.Interfaces.ConfigurationKeys.PersistentManager, PersistenceManagerName);
                ProtoScript.Runners.DebugRunner debugRunner = new ProtoScript.Runners.DebugRunner(core);
                ProtoScript.Config.RunConfiguration runnerConfig = new ProtoScript.Config.RunConfiguration();
                runnerConfig.IsParrallel = false; 
                ExecutionMirror mirror; 
                debugRunner.LoadAndPreStart(dsPath, runnerConfig);
                ProtoScript.Runners.DebugRunner.VMState currentVmState ;

               

                executionLog.AppendLine("Script executed successfully.");                

                executionLog.AppendLine();
                executionLog.AppendLine("=================================CoreDump=================================");
                string coreDump;
                bool step = true;

                while (step == true)
                {

                    try
                    {
                        currentVmState = debugRunner.StepOver(); // Perform one step.
                        mirror = currentVmState.mirror;
                        coreDump = null;
                        coreDump = mirror.GetCoreDump();
                        executionLog.AppendLine();
                        executionLog.AppendLine(coreDump);
                        success = true;
                        if (currentVmState.isEnded == true)
                            step = false;
                    }
                    catch (System.Exception ex)
                    {
                        executionLog.AppendLine(ex.Message);
                        executionLog.AppendLine(ex.StackTrace);

                        success = false;
                    }
                }

                executionLog.AppendLine("=================================CoreDump=================================");


            }
            catch (System.Exception ex)
            {
                success = false;
                executionLog.AppendLine("Fail to execute script.");
                executionLog.AppendLine("Exceptions:");
                executionLog.AppendLine(ex.Message);
                executionLog.AppendLine("StackTrace:");
                executionLog.AppendLine(ex.StackTrace);
            }
            finally
            {
                if (core != null)
                {
                    core.BuildStatus.SetStream(null);                    
                }
            }

            return success;
        }