mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-11-04 12:51:48 +00:00
Auto detect all Visual Studio and Rider installs
This commit is contained in:
@@ -2,12 +2,22 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using GlitchyEngine;
|
||||
using System.Collections;
|
||||
using GlitchyEditor.Settings;
|
||||
|
||||
namespace GlitchyEditor.CodeEditors;
|
||||
|
||||
class VisualStudioIdeAdapter : IIdeAdapter
|
||||
{
|
||||
public static bool IsRunning()
|
||||
private IdeInstallation _ideInstallation;
|
||||
|
||||
public this(IdeInstallation ideInstallation)
|
||||
{
|
||||
Debug.Assert(ideInstallation.Ide == .VisualStudio);
|
||||
|
||||
_ideInstallation = ideInstallation;
|
||||
}
|
||||
|
||||
public bool IsRunning()
|
||||
{
|
||||
List<Process> processes = scope .();
|
||||
|
||||
@@ -19,6 +29,7 @@ class VisualStudioIdeAdapter : IIdeAdapter
|
||||
|
||||
for (Process process in processes)
|
||||
{
|
||||
// TODO?
|
||||
}
|
||||
|
||||
ClearAndDeleteItems!(processes);
|
||||
@@ -26,12 +37,12 @@ class VisualStudioIdeAdapter : IIdeAdapter
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void OpenScript(StringView fileName)
|
||||
public void OpenScript(StringView fileName, int lineNumber)
|
||||
{
|
||||
if (IsRunning())
|
||||
{
|
||||
ProcessStartInfo startInfo = scope .();
|
||||
startInfo.SetFileName(EditorApp.Instance.Settings.ScriptSettings.VisualStudioPath);
|
||||
startInfo.SetFileName(_ideInstallation.Path);
|
||||
startInfo.SetArguments(scope $"/Edit {fileName}");
|
||||
|
||||
scope SpawnedProcess().Start(startInfo);
|
||||
@@ -39,25 +50,20 @@ class VisualStudioIdeAdapter : IIdeAdapter
|
||||
else
|
||||
{
|
||||
ProcessStartInfo startInfo = scope .();
|
||||
startInfo.SetFileName(EditorApp.Instance.Settings.ScriptSettings.VisualStudioPath);
|
||||
startInfo.SetFileName(_ideInstallation.Path);
|
||||
startInfo.SetArguments(scope $"/Edit {fileName}");
|
||||
|
||||
scope SpawnedProcess().Start(startInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OpenScript(StringView fileName, int lineNumber)
|
||||
{
|
||||
OpenScript(fileName);
|
||||
}
|
||||
|
||||
public static void OpenScriptProject()
|
||||
public void OpenScriptProject()
|
||||
{
|
||||
String solutionPath = scope .();
|
||||
Editor.Instance.CurrentProject.GetPathToScriptSolutionFile(solutionPath);
|
||||
|
||||
ProcessStartInfo psi = scope .();
|
||||
psi.SetFileName("devenv");
|
||||
psi.SetFileName(_ideInstallation.Path);
|
||||
psi.SetArguments(solutionPath);
|
||||
|
||||
scope SpawnedProcess().Start(psi);
|
||||
|
||||
Reference in New Issue
Block a user