mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-03 21:36:06 +02:00
v2019.11.18
This commit is contained in:
@@ -4,7 +4,11 @@
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
using CefSharp;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VRCX
|
||||
@@ -39,17 +43,45 @@ namespace VRCX
|
||||
return WinApi.FindWindow("UnityWndClass", "VRChat") != IntPtr.Zero;
|
||||
}
|
||||
|
||||
public void StartGame(string location)
|
||||
public void StartGame(string location, bool desktop)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start("vrchat://launch?id=" + location);
|
||||
using (var key = Registry.ClassesRoot.OpenSubKey(@"VRChat\shell\open\command"))
|
||||
{
|
||||
// "C:\Program Files (x86)\Steam\steamapps\common\VRChat\launch.bat" "C:\Program Files (x86)\Steam\steamapps\common\VRChat" "%1"
|
||||
var match = Regex.Match(key.GetValue(string.Empty) as string, "^\"(.+\\\\VRChat)\\\\launch.bat\"");
|
||||
if (match.Success)
|
||||
{
|
||||
var path = match.Groups[1].Value;
|
||||
var args = new StringBuilder();
|
||||
if (desktop)
|
||||
{
|
||||
args.Append("--no-vr ");
|
||||
}
|
||||
args.Append("\"vrchat://launch?id=");
|
||||
args.Append(location);
|
||||
args.Append('"');
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
WorkingDirectory = path,
|
||||
FileName = path + "\\VRChat.exe",
|
||||
UseShellExecute = false,
|
||||
Arguments = args.ToString()
|
||||
}).Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenRepository()
|
||||
{
|
||||
Process.Start("https://github.com/pypy-vrc/VRCX").Close();
|
||||
}
|
||||
|
||||
public void ShowVRForm()
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user