-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.cs
93 lines (83 loc) · 2.27 KB
/
Main.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using UnityEngine;
using System.Diagnostics;
using System.Threading.Tasks;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using System.Net;
using System.Text;
#if MELONLOADER
using MelonLoader;
[assembly: MelonInfo(typeof(CvrRestartKeybind.MainML), $"{AsInfo.Title}", $"{AsInfo.Version}", $"{AsInfo.Dev}")]
[assembly: MelonColor(System.ConsoleColor.DarkMagenta)]
[assembly: MelonAuthorColor(System.ConsoleColor.Magenta)]
#endif
namespace CvrRestartKeybind
{
#if BEPINEX
using BepInEx;
using BepInEx.Logging;
[BepInPlugin("com.mezque.cvr.plugin.CvrRestartKeybind", $"{AsInfo.Title}", $"{AsInfo.Version}")]
[BepInProcess("ChilloutVR.exe")]
internal class MainBiE : BaseUnityPlugin
{
internal void Awake()
{
Logger.LogMessage($"{AsInfo.Title}: V{AsInfo.Version} Started");
}
internal void Update()
{
keybinds.Keys();
}
}
}
#endif
#if MELONLOADER
internal class MainML : MelonMod
{
public override void OnApplicationStart()
{
LoggerInstance.Msg(ConsoleColor.DarkMagenta,$"{AsInfo.Title}: V{AsInfo.Version} Started");
}
public override void OnUpdate()
{
keybinds.Keys();
}
internal class MLprefs
{
internal static readonly MelonPreferences_Category CvrRB = MelonPreferences.CreateCategory("CvrRestartBinds");
internal static MelonPreferences_Entry<string> PreviousInstance = (MelonPreferences_Entry<string>)CvrRB.CreateEntry("PreviousInstance", "null", "PreviousInstance", true);
}
}
}
#endif
internal class keybinds
{
internal static void Keys()
{
if (Input.GetKey(KeyCode.LeftControl) && (Input.GetKeyDown(KeyCode.Insert)))
{
Restarts.RestartGame();
}
}
}
internal class Restarts
{
internal static void RestartGame()
{
#if MELONLOADER
#endif
#if BEPINEX
#endif
Process.Start("steam://rungameid/661130");
Process.GetCurrentProcess().Kill();
}
}
internal struct AsInfo
{
internal const string Version = "1.2.0.0";
internal const string DevBuild = "0";
internal const string Dev = "Mezque";
internal const string Title = "Cvr Restart Keybinds";
}