-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
94 lines (78 loc) · 2.96 KB
/
Program.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
94
// /*
// *
// * Zuxi.OSC - Program.cs
// * Copyright 2023 - 2024 Zuxi and contributors
// * https://zuxi.dev
// *
// */
using BuildSoft.VRChat.Osc;
using Zuxi.OSC.HeartRate;
using Zuxi.OSC.Modules;
using Zuxi.OSC.Modules.FriendRequests;
using Zuxi.OSC.utility;
namespace Zuxi.OSC;
internal class Program
{
public static bool NormalChatbox = true;
public static bool HeartRate = true;
private static void Main(string[] args)
{
try
{
// Register Ctrl + C
Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress!);
// Call some modules early to ensure they get the correct info and arent null durring console loop
Console.WriteLine(ActiveWindow.Get());
Console.WriteLine(MediaPlayback.GetCurrentSong());
Console.WriteLine(MediaPlayback.getProgressVisual());
// Set the current directory to %appdata%/zuxi/apps/Zuxi.OSC
Directory.SetCurrentDirectory(FileUtils.GetAppFolder());
// Load Config ie AuthToken.
Config.GetInstance();
Console.ForegroundColor = ConsoleColor.Cyan;
// Set the VRChat port
OscConnectionSettings.SendPort = Config.GetInstance().VRChatOSCPort;
// launch arg checks
if (Environment.CommandLine.ToLower().Contains("--zreqo"))
{
Console.WriteLine("Normal chat box Disabled...");
NormalChatbox = false;
}
if (Environment.CommandLine.ToLower().Contains("--zhro"))
{
Console.WriteLine("Heartrate Disabled...");
HeartRate = false;
}
else
{
// Start HeartBeat provider on new non blocking thread
new Task ( () => { HeartBeat.CreateHeartRate(); } ) .Start();
}
// Check if in VR then start chatbox & friend request Module
ChatboxManager.IsInVR = GeneralUtils.IsInVR();
ChatboxManager.AddNewMessageToChatboxQue("Hello World! OSC Ready...");
ChatboxManager.Start();
// Completely Safe to init on main thread
FriendsMain.Initialize();
while (true)
{
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex}");
ChatboxManager.UpdateChatboxFunc();
ChatboxManager.AddNewMessageToChatboxQue("⚠️ Error in chat box Alert Zuxi! ⚠️");
while (ChatboxManager.ChatboxQue.Count < 100)
ChatboxManager.AddNewMessageToChatboxQue("⚠️ Error in Chat box Alert Zuxi! ⚠️");
Console.ReadLine();
}
}
private static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
Console.WriteLine("Application closing...");
ChatboxManager.SendToChatBox("", true);
Thread.Sleep(1000);
Environment.Exit(0);
}
}