public DebugWindow(ISerpentWare root, EditForm ef) :
            this()
        {
            mRoot = root;

            sBox.ReadOnly       = true;
            sBox.Document.Lines = File.ReadAllLines(ef.Doc.Path);
            sBox.Document.Parser.Init(ef.sBox.Document.Parser.SyntaxDefinition);

            Doc  = ef.Doc;
            Text = ef.Doc.Title;

            mTracebackAction = new Action <TraceBackFrame, string, object>(OnTraceback);
        }
Exemple #2
0
        public PyConsole(ISerpentWare root) :
            this()
        {
            mRoot = root;
            if (!mRoot.IsLicensed)
            {
                EWC.Utils.DoRequestLicense(mRoot.ApplicationName, mRoot.Version, Resources.Python, () => mRoot.IsLicensed);
            }

            // http://crashreporterdotnet.codeplex.com/documentation
            Application.ThreadException += ApplicationThreadException;

            // http://autoupdaterdotnet.codeplex.com/documentation
            const string EllieWare  = @"http://www.EllieWare.com";
            var          appCast    = mRoot.ApplicationName.Replace(' ', '_') + ".xml";
            var          appCastUrl = EllieWare + @"/" + appCast;

            AutoUpdater.Start(appCastUrl, mRoot.ApplicationName, mRoot.Version);

            Text = mRoot.ApplicationName;
        }
Exemple #3
0
        public static ScriptEngine CreateEngine(ISerpentWare root, TextWriter output, string path)
        {
            var engine = IronPython.Hosting.Python.CreateEngine();

            // add directory of file to Python search path
            var paths   = engine.GetSearchPaths();
            var fileDir = Path.GetDirectoryName(path);

            if (!paths.Contains(fileDir))
            {
                paths.Add(fileDir);
                engine.SetSearchPaths(paths);
            }

            engine.Runtime.IO.SetOutput(new MemoryStream(), output);
            engine.Runtime.IO.SetErrorOutput(new MemoryStream(), output);

            foreach (var assy in root.Assemblies)
            {
                engine.Runtime.LoadAssembly(assy);
            }

            return(engine);
        }