Пример #1
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            completion = new ICSharpCode.CodeCompletion.CSharpCompletion(new ScriptProvider());
            OpenFile(@"..\SampleFiles\Sample1.cs");
            OpenFile(@"..\SampleFiles\SampleScript1.csx");
        }
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            completion = new ICSharpCode.CodeCompletion.CSharpCompletion(new ScriptProvider());
            OpenFile(@"..\SampleFiles\Sample1.cs");
            OpenFile(@"..\SampleFiles\SampleScript1.csx");
        }
Пример #3
0
 public void InitCompletion(IShell shell)
 {
     _completion = new CSharpCompletion(shell);
     Parallel.ForEach(_editors, (e) => {
         CodeTextEditor target;
         if(e.TryGetTarget(out target))
         {
             target.Completion = _completion;
         }
     });
 }
Пример #4
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            string bp = System.IO.Path.GetDirectoryName(Assembly.GetAssembly(typeof(MainWindow)).Location);

            _completion = new ICSharpCode.CodeCompletion.CSharpCompletion();
            _completion.AddAssembly(Assembly.GetAssembly(typeof(MainWindow)).Location);
            _completion.AddAssembly(System.IO.Path.Combine(bp, "NPoco.dll"));
            _completion.AddAssembly(System.IO.Path.Combine(bp, "NPOI.dll"));
            _completion.AddAssembly(System.IO.Path.Combine(bp, "NPOI.OOXML.dll"));
            _completion.AddAssembly(System.IO.Path.Combine(bp, "NPOI.OpenXml4Net.dll"));
            _completion.AddAssembly(System.IO.Path.Combine(bp, "NPOI.OpenXmlFormats.dll"));
            _completion.AddAssembly(System.IO.Path.Combine(bp, "ICSharpCode.SharpZipLib.dll"));

            var allscripts = Settings.Settings.Default.GetScriptItems();

            foreach (var scr in allscripts)
            {
                addScriptToTreeView(scr);
            }
        }
Пример #5
0
 private void PrepareTextEditor()
 {
     codeCompletion = new ICSharpCode.CodeCompletion.CSharpCompletion();
     codeCompletion.AddAssembly( "UOMachine.exe" );
     scriptTextBox.Completion = codeCompletion;
     scriptTextBox.FontFamily = new FontFamily( "Consolas" );
     scriptTextBox.FontSize = 12;
     scriptTextBox.TextArea.DefaultInputHandler.NestedInputHandlers.Add( new SearchInputHandler( scriptTextBox.TextArea ) );
     FileNew_Click( null, null );
     scriptTextBox.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition( "C#" );
     scriptTextBox.Options = myCurrentOptions.TextEditorOptions;
     foldingManager = FoldingManager.Install( scriptTextBox.TextArea );
     new BraceFoldingStrategy().UpdateFoldings( foldingManager, scriptTextBox.Document );
 }
Пример #6
0
        public ScriptingEngine()
        {
            tokenSource = new CancellationTokenSource();
            taskFactory = new TaskFactory(tokenSource.Token);

            context = new CompilerContext(new Mono.CSharp.CompilerSettings(), new ConsoleReportPrinter());
            evaluator = new Evaluator(context);
            evaluator.InteractiveBaseClass = typeof(ScriptingInteractiveBase);
            evaluator.DescribeTypeExpressions = true;

            ScriptingInteractiveBase.Evaluator = evaluator;
            var errorStream = new GuiStream(TextType.Error, OnConsoleOutput);
            var guiOutput = new StreamWriter(errorStream);
            guiOutput.AutoFlush = true;
            Console.SetError(guiOutput);
            ScriptingInteractiveBase.Output = guiOutput;

            var stdoutStream = new GuiStream(TextType.Output, OnConsoleOutput);
            guiOutput = new StreamWriter(stdoutStream);
            guiOutput.AutoFlush = true;
            Console.SetOut(guiOutput);
            ScriptingInteractiveBase.Error = guiOutput;

            codeCompletion = new CSharpCompletion(this);

            Evaluate("using System; using System.Linq; using System.Collections; using System.Collections.Generic;");

            //init the code completion so that the first character typed is not delayed
            var readOnlyDocument = new ReadOnlyDocument(new StringTextSource(""), "init.csx");
            codeCompletion.GetCompletions(readOnlyDocument, 0);
        }