void AddFile(string fileName)
 {
     Git.Add(fileName,
             exitcode => WorkbenchSingleton.SafeThreadAsyncCall(ClearStatusCacheAndEnqueueFile, fileName)
             );
 }
 void AfterFinish(UnitTestApplicationStartHelper helper, string path)
 {
     helper.Project.AddSessionToProject(path);
     WorkbenchSingleton.SafeThreadAsyncCall(TestsFinished);
     LoggingService.Info("shutting profiler down...");
 }
 void NAntExited(object sender, NAntExitEventArgs e)
 {
     WorkbenchSingleton.SafeThreadAsyncCall(UpdateToolbar);
 }
示例#4
0
 public void BringToFront()
 {
     SDIntegration.Instance.IDEIsVisible = true;
     WorkbenchSingleton.SafeThreadAsyncCall(BringToFrontInternal);
 }
示例#5
0
 public void Callback()
 {
     WorkbenchSingleton.SafeThreadAsyncCall(CallbackInvoked);
 }
示例#6
0
 public void Hide()
 {
     SDIntegration.Instance.IDEIsVisible = false;
     WorkbenchSingleton.SafeThreadAsyncCall(HideInternal);
 }
示例#7
0
 public void Detach()
 {
     WorkbenchSingleton.SafeThreadAsyncCall(DetachInternal);
 }
示例#8
0
 public void MakeTransparent()
 {
     WorkbenchSingleton.SafeThreadAsyncCall(MakeTransparentInternal);
 }
示例#9
0
        public FSharpInteractive()
        {
            if (Array.Exists(ConfigurationManager.AppSettings.AllKeys, x => x == "alt_fs_bin_path"))
            {
                string path = Path.Combine(ConfigurationManager.AppSettings["alt_fs_bin_path"], "fsi.exe");
                if (File.Exists(path))
                {
                    fsiProcess.StartInfo.FileName = path;
                    foundCompiler = true;
                }
                else
                {
                    AppendLine("you are trying to use the app setting alt_fs_bin_path, but fsi.exe is not localed in the given directory");
                    foundCompiler = false;
                }
            }
            else
            {
                string[] paths = Environment.GetEnvironmentVariable("PATH").Split(';');
                string   path  = Array.Find(paths, x => {
                    try {
                        return(File.Exists(Path.Combine(x, "fsi.exe")));
                    } catch {
                        return(false);
                    }
                });
                if (path != null)
                {
                    fsiProcess.StartInfo.FileName = Path.Combine(path, "fsi.exe");
                    foundCompiler = true;
                }
                else
                {
                    path = FindFSharpInteractiveInProgramFilesFolder();
                    if (path != null)
                    {
                        fsiProcess.StartInfo.FileName = path;
                        foundCompiler = true;
                    }
                    else
                    {
                        AppendLine("Can not find the fsi.exe, ensure a version of the F# compiler is installed." + Environment.NewLine +
                                   "Please see http://research.microsoft.com/fsharp for details of how to install the compiler");
                        foundCompiler = false;
                    }
                }
            }

            if (foundCompiler)
            {
                //fsiProcess.StartInfo.Arguments <- "--fsi-server sharpdevelopfsi";
                fsiProcess.StartInfo.UseShellExecute        = false;
                fsiProcess.StartInfo.CreateNoWindow         = true;
                fsiProcess.StartInfo.RedirectStandardError  = true;
                fsiProcess.StartInfo.RedirectStandardInput  = true;
                fsiProcess.StartInfo.RedirectStandardOutput = true;
                fsiProcess.EnableRaisingEvents = true;
                fsiProcess.ErrorDataReceived  += delegate(object sender, DataReceivedEventArgs e) {
                    lock (outputQueue) {
                        outputQueue.Enqueue(e.Data);
                    }
                    WorkbenchSingleton.SafeThreadAsyncCall(ReadAll);
                };
                fsiProcess.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) {
                    lock (outputQueue) {
                        outputQueue.Enqueue(e.Data);
                    }
                    WorkbenchSingleton.SafeThreadAsyncCall(ReadAll);
                };
                fsiProcess.Exited += delegate(object sender, EventArgs e) {
                    lock (outputQueue) {
                        outputQueue.Enqueue("fsi.exe died");
                        outputQueue.Enqueue("restarting ...");
                    }
                    WorkbenchSingleton.SafeThreadAsyncCall(ReadAll);
                    WorkbenchSingleton.SafeThreadAsyncCall(StartFSharp);
                };
                StartFSharp();
            }
        }
示例#10
0
 public void SafeThreadAsyncCall <A>(Action <A> method, A arg1)
 {
     WorkbenchSingleton.SafeThreadAsyncCall <A>(method, arg1);
 }
示例#11
0
 public void SafeThreadAsyncCall <A, B>(Action <A, B> method, A arg1, B arg2)
 {
     WorkbenchSingleton.SafeThreadAsyncCall <A, B>(method, arg1, arg2);
 }
示例#12
0
 public void Detach()
 {
     WorkbenchSingleton.SafeThreadAsyncCall(() => DebuggerService.CurrentDebugger.Detach());
 }
示例#13
0
 public void Attach(Process process)
 {
     WorkbenchSingleton.SafeThreadAsyncCall(p => DebuggerService.CurrentDebugger.Attach(p), process);
 }
示例#14
0
        public FSharpInteractive()
        {
            input = new TextBox {
                Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right,
                Width  = panel.Width
            };
            output = new TextBox {
                Multiline  = true,
                Top        = input.Height,
                Height     = panel.Height - input.Height,
                Width      = panel.Width,
                ReadOnly   = true,
                ScrollBars = ScrollBars.Both,
                WordWrap   = false,
                Anchor     = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom
            };
            panel.Controls.Add(input);
            panel.Controls.Add(output);

            if (Array.Exists(ConfigurationManager.AppSettings.AllKeys, x => x == "alt_fs_bin_path"))
            {
                string path = Path.Combine(ConfigurationManager.AppSettings["alt_fs_bin_path"], "fsi.exe");
                if (File.Exists(path))
                {
                    fsiProcess.StartInfo.FileName = path;
                    foundCompiler = true;
                }
                else
                {
                    output.Text   = "you are trying to use the app setting alt_fs_bin_path, but fsi.exe is not localed in the given directory";
                    foundCompiler = false;
                }
            }
            else
            {
                string[] paths = Environment.GetEnvironmentVariable("PATH").Split(';');
                string   path  = Array.Find(paths, x => {
                    try {
                        return(File.Exists(Path.Combine(x, "fsi.exe")));
                    } catch {
                        return(false);
                    }
                });
                if (path != null)
                {
                    fsiProcess.StartInfo.FileName = Path.Combine(path, "fsi.exe");
                    foundCompiler = true;
                }
                else
                {
                    string programFiles  = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                    var    possibleFiles = from fsdir in Directory.GetDirectories(programFiles, "FSharp*")
                                           //LoggingService.Debug("Trying to find fsi in '" + fsdir + "'");
                                           let fileInfo = new FileInfo(Path.Combine(fsdir, "bin\\fsi.exe"))
                                                          where fileInfo.Exists
                                                          orderby fileInfo.CreationTime
                                                          select fileInfo;
                    FileInfo file = possibleFiles.FirstOrDefault();
                    if (file != null)
                    {
                        fsiProcess.StartInfo.FileName = file.FullName;
                        foundCompiler = true;
                    }
                    else
                    {
                        output.Text = "Can not find the fsi.exe, ensure a version of the F# compiler is installed." + Environment.NewLine +
                                      "Please see http://research.microsoft.com/fsharp for details of how to install the compiler";
                        foundCompiler = false;
                    }
                }
            }

            if (foundCompiler)
            {
                input.KeyUp += delegate(object sender, KeyEventArgs e) {
                    if (e.KeyData == Keys.Return)
                    {
                        fsiProcess.StandardInput.WriteLine(input.Text);
                        input.Text = "";
                    }
                };
                //fsiProcess.StartInfo.Arguments <- "--fsi-server sharpdevelopfsi";
                fsiProcess.StartInfo.UseShellExecute        = false;
                fsiProcess.StartInfo.CreateNoWindow         = true;
                fsiProcess.StartInfo.RedirectStandardError  = true;
                fsiProcess.StartInfo.RedirectStandardInput  = true;
                fsiProcess.StartInfo.RedirectStandardOutput = true;
                fsiProcess.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) {
                    lock (outputQueue) {
                        outputQueue.Enqueue(e.Data);
                    }
                    WorkbenchSingleton.SafeThreadAsyncCall(ReadAll);
                };
                fsiProcess.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) {
                    lock (outputQueue) {
                        outputQueue.Enqueue(e.Data);
                    }
                    WorkbenchSingleton.SafeThreadAsyncCall(ReadAll);
                };
                fsiProcess.Exited += delegate(object sender, EventArgs e) {
                    lock (outputQueue) {
                        outputQueue.Enqueue("fsi.exe died");
                        outputQueue.Enqueue("restarting ...");
                    }
                    WorkbenchSingleton.SafeThreadAsyncCall(ReadAll);
                    fsiProcess.Start();
                };
                fsiProcess.Start();
                fsiProcess.BeginErrorReadLine();
                fsiProcess.BeginOutputReadLine();
            }
            else
            {
                input.KeyUp += delegate(object sender, KeyEventArgs e) {
                    if (e.KeyData == Keys.Return)
                    {
                        output.AppendText(Environment.NewLine + "F# not installed - could not execute command");
                        input.Text = "";
                    }
                };
            }
        }
示例#15
0
 void ProcessExited(object source, EventArgs e)
 {
     WorkbenchSingleton.SafeThreadAsyncCall(TestsFinished);
 }
示例#16
0
 void ReceiveAllChangedPaths(LogMessage logMessage)
 {
     WorkbenchSingleton.SafeThreadAsyncCall(this.ReceiveAllChangedPathsInvoked, logMessage);
 }
示例#17
0
 void DebuggerFinished(object sender, EventArgs e)
 {
     DebuggerService.DebugStopped -= DebuggerFinished;
     WorkbenchSingleton.SafeThreadAsyncCall(TestsFinished);
 }
示例#18
0
 private void UpdateTick(object sender, ParserUpdateStepEventArgs e)
 {
     WorkbenchSingleton.SafeThreadAsyncCall(UpdateTick, e);
 }
示例#19
0
 public void Attach(Process process)
 {
     WorkbenchSingleton.SafeThreadAsyncCall(AttachInternal, process);
 }
示例#20
0
 /// <summary>
 /// Displays the output from PartCover after it has exited.
 /// </summary>
 /// <param name="sender">The event source.</param>
 /// <param name="e">The PartCover exit event arguments.</param>
 void PartCoverExited(object sender, PartCoverExitEventArgs e)
 {
     DisplayCoverageResults(runner.Output);
     WorkbenchSingleton.SafeThreadAsyncCall(TestsFinished);
 }
示例#21
0
 public void Build()
 {
     WorkbenchSingleton.SafeThreadAsyncCall(BuildInternal);
 }
示例#22
0
 /// <summary>
 /// Clears the code coverage results on display before running
 /// a series of tests.
 /// </summary>
 protected override void OnBeforeRunTests()
 {
     WorkbenchSingleton.SafeThreadAsyncCall(Category.ClearText);
     WorkbenchSingleton.SafeThreadAsyncCall(CodeCoverageService.ClearResults);
 }
 void TestFinished(object source, TestFinishedEventArgs e)
 {
     WorkbenchSingleton.SafeThreadAsyncCall(ShowResult, e.Result);
 }
示例#24
0
        /// <summary>
        /// This methods is called after trying to continue with editted code.
        /// It gets a result of searching changes in code and applies them to
        /// running process if it is possible.
        /// <param name="eventLog">Contains changes done to code during pause.</param>
        /// </summary>
        private bool patchWithEnC(EditorEvent eventLog)
        {
            // Build new version of assembly.
            resource.Load(eventLog.touched);

            // Exit when errors in compiling
            if (!resource.CompileSuccessful)
            {
                return(false);
            }
            metadata.Update();

            byte[] dmeta = null, dil = null;

            DeltaBuilder dBuilder = new DeltaBuilder(this);

            // Initialize symbol emitter.
            SymbolWriterClass dWriter = new SymbolWriterClass(this, metadata);

            dWriter.Initialize(metadata.OldEmitter.CorMetaDataEmit, metadata.NewImporter.CorMetaDataImport);

            dBuilder.SymbolWriter = dWriter;

            // Process changes and tries to make delta metadata and IL code.
            // If changes not valid exits.
            try {
                if (!processChanges(eventLog, dBuilder))
                {
                    return(false);
                }

                process.AppDomains.ForEach(delegate(AppDomain app) { app.ResetCache(); });
                regenMovedSymbols(dWriter, lastEvent);
                // Update symbols emitted during changes.
                updateSymbolStore(dWriter);
                dWriter.Close();
                // Recieve deltas and applies them to running module
                dil   = dBuilder.getDeltaIL();
                dmeta = dBuilder.getDeltaMetadata();
                resource.CurrentModule.ApplyChanges(dmeta, dil);
                // Log output if in debug mode
                if (debugMode)
                {
                    StreamWriter writer = new StreamWriter(resource.TemporaryPath + "enc_log_il");
                    writer.BaseStream.Write(dil, 0, dil.Length);
                    writer.Flush();
                    writer.Close();

                    writer = new StreamWriter(resource.TemporaryPath + "enc_log_meta");
                    writer.BaseStream.Write(dmeta, 0, dmeta.Length);
                    writer.Flush();
                    writer.Close();
                }
                funcRemap = new FunctionRemapper(this, dBuilder.SequencePointRemappers);

                updateBreakpoints();
                return(true);
            } catch (TranslatingException e) {
                dWriter.Close();
                TaskService.Clear();
                WorkbenchSingleton.SafeThreadAsyncCall(
                    delegate()
                {
                    TaskService.Clear();
                    TaskService.Add(new Task(null, e.Message, 0, 0, TaskType.Error));
                }
                    );
                return(false);
            }
        }