This repository has been archived by the owner on Dec 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
56 lines (49 loc) · 1.76 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace BSUtils
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
if (!File.Exists("C:\\Program Files\\Oculus\\Support\\oculus-diagnostics\\OculusDebugToolCLI.exe"))
AswButton.Enabled = false;
}
private void PriorityButton_Click(object sender, EventArgs e)
{
// https://stackoverflow.com/q/13944554
Process[] pname = Process.GetProcessesByName("Beat Saber");
if (pname.Length == 0)
MessageBox.Show("Failed to find Beat Saber's process. Is Beat Saber Open?");
else
{
pname[0].PriorityClass = ProcessPriorityClass.High;
MessageBox.Show("Beat Saber Priority Has Successfully Been Set To High!");
priorityButton.Enabled = false;
}
}
private void AswButton_Click(object sender, EventArgs e)
{
string TempAswPath = $"{Path.GetTempPath()}aswDisableCmds.txt";
if(!File.Exists(TempAswPath))
{
string[] aswDisableLines = { "server:asw.Off", "exit" };
File.WriteAllLines(TempAswPath, aswDisableLines);
}
Process.Start("C:\\Program Files\\Oculus\\Support\\oculus-diagnostics\\OculusDebugToolCLI.exe", $"-f {TempAswPath}");
AswButton.Enabled = false;
}
private void ReenableButton_Click(object sender, EventArgs e)
{
// it works
AswButton.Enabled = true;
priorityButton.Enabled = true;
}
}
}