static void Main(string[] args) { try { File.OpenText(Environment.CurrentDirectory + "\\spawn.txt"); } catch { Console.WriteLine("File doesn't exist"); Console.WriteLine("^F[^1ERROR^F]: ^CSpawn position is not set!^R"); return; } try { string[] buf = File.ReadAllText(Environment.CurrentDirectory + "\\spawn.txt").Split(';'); spawnPosition = new OakVec3(float.Parse(buf[0]), float.Parse(buf[1]), float.Parse(buf[2])); } catch { Console.WriteLine("Something f****d up"); Console.WriteLine("^F[^1ERROR^F]: ^CSpawn position is not set!^R"); return; } var iStdOut = GetStdHandle(STD_OUTPUT_HANDLE); if (!GetConsoleMode(iStdOut, out uint outConsoleMode)) { Console.WriteLine("Failed to get output console mode"); SysCon.ReadKey(); return; } outConsoleMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING | DISABLE_NEWLINE_AUTO_RETURN; if (!SetConsoleMode(iStdOut, outConsoleMode)) { Console.WriteLine($"Failed to set output console mode, error code: {GetLastError()}"); SysCon.ReadKey(); return; } OakwoodEvents.OnLog += OnLog; OakwoodEvents.OnPlayerConnect += OnPlayerConnect; OakwoodEvents.OnPlayerDisconnect += OnPlayerDisconnect; OakwoodEvents.OnPlayerDeath += OnPlayerDeath; OakwoodEvents.OnPlayerChat += OnPlayerChat; OakwoodEvents.OnPlayerKeyDown += OnPlayerKeyDown; Console.WriteLine($"^9Oakwood ^Fposition tool^R"); Console.WriteLine($"^FMade by ^ESevenisko^R"); SysCon.WriteLine(); Thread clThread = new Thread(() => Oakwood.CreateClient("ipc://oakwood-inbound", "ipc://oakwood-outbound")); clThread.Start(); }
private static void OnLog(DateTime time, string source, string message) { Console.WriteLine($"^F[^9{time.ToString("HH:mm:ss")} ^F- ^A{source}^F]: ^5{message}^R"); }