summaryrefslogtreecommitdiff
path: root/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
diff options
context:
space:
mode:
authorAndreas Haas <Hinsbart@users.noreply.github.com>2017-10-03 00:13:40 +0200
committerGitHub <noreply@github.com>2017-10-03 00:13:40 +0200
commitb0194a33f65970948ef66819913bf3034a3a22e8 (patch)
tree35e21b53b10bbd525506bb5b72b7f89214e1234f /modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
parent5cd68abf8896fd86a33c048d6fece61c3cd3f8e5 (diff)
parentd5caf71c3fcdeb422d1b0ea97a836fcdb57a8713 (diff)
Merge pull request #11739 from neikeq/tengo-el-mono
Moved mono module here
Diffstat (limited to 'modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs')
-rw-r--r--modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs58
1 files changed, 58 insertions, 0 deletions
diff --git a/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs b/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
new file mode 100644
index 0000000000..303be3b732
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
@@ -0,0 +1,58 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace GodotSharpTools.Editor
+{
+ public class MonoDevelopInstance
+ {
+ private Process process;
+ private string solutionFile;
+
+ public void Execute(string[] files)
+ {
+ bool newWindow = process == null || process.HasExited;
+
+ List<string> args = new List<string>();
+
+ args.Add("--ipc-tcp");
+
+ if (newWindow)
+ args.Add("\"" + Path.GetFullPath(solutionFile) + "\"");
+
+ foreach (var file in files)
+ {
+ int semicolonIndex = file.IndexOf(';');
+
+ string filePath = semicolonIndex < 0 ? file : file.Substring(0, semicolonIndex);
+ string cursor = semicolonIndex < 0 ? string.Empty : file.Substring(semicolonIndex);
+
+ args.Add("\"" + Path.GetFullPath(filePath.NormalizePath()) + cursor + "\"");
+ }
+
+ if (newWindow)
+ {
+ ProcessStartInfo startInfo = new ProcessStartInfo(MonoDevelopFile, string.Join(" ", args));
+ process = Process.Start(startInfo);
+ }
+ else
+ {
+ Process.Start(MonoDevelopFile, string.Join(" ", args));
+ }
+ }
+
+ public MonoDevelopInstance(string solutionFile)
+ {
+ this.solutionFile = solutionFile;
+ }
+
+ private static string MonoDevelopFile
+ {
+ get
+ {
+ return "monodevelop";
+ }
+ }
+ }
+}