From e36fb95c50ce0cd0ab9621afe668332895712c2e Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Mon, 2 Oct 2017 23:24:00 +0200 Subject: Added mono module --- .../GodotSharpTools/Editor/MonoDevelopInstance.cs | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs (limited to 'modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs') 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 args = new List(); + + 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"; + } + } + } +} -- cgit v1.2.3