/// <summary> /// Defines the entry point of the application. /// </summary> private static async Task Main() { PUBG.Initialize(); PUBG.Attach(); PUBG.EnableEvents(); if (IsChecking && PUBG.IsAttached == false) { Logging.Info(typeof(Program), "Waiting for PUBG to start..."); while (PUBG.IsAttached != true) { await Task.Delay(500); } await Task.Delay(2500); } Logging.Info(typeof(PUBG), "PUBG is started, ready to proceed."); // ... var Radar = new Radar(RadarMode.UseNetwork); Radar.Start(); // ... Console.ReadKey(false); }
/// <summary> /// Runs this instance. /// </summary> internal static async Task Run() { while (true) { if (PUBG.IsAttached) { if (EventHandlers.IsAttached == false) { EventHandlers.IsAttached = true; EventHandlers.IsDetached = false; var Event = new PubgAttachedEvent(); if (EventHandlers.OnPubgAttached != null) { EventHandlers.OnPubgAttached.Invoke(null, Event); } } } else if (PUBG.IsDetached) { if (EventHandlers.IsDetached == false) { EventHandlers.IsAttached = false; EventHandlers.IsDetached = true; var Event = new PubgDetachedEvent(); if (EventHandlers.OnPubgDetached != null) { EventHandlers.OnPubgDetached.Invoke(null, Event); } } else { PUBG.Attach(); } } if (PUBG.IsAttached) { if (PUBG.IsMaximized) { if (EventHandlers.IsMaximized == false) { EventHandlers.IsMaximized = true; EventHandlers.IsMinimized = false; var Event = new WindowsMaximizedEvent(); if (EventHandlers.OnWindowsMaximized != null) { EventHandlers.OnWindowsMaximized.Invoke(null, Event); } } } if (PUBG.IsMinimized) { if (EventHandlers.IsMinimized == false) { EventHandlers.IsMaximized = false; EventHandlers.IsMinimized = true; var Event = new WindowsMinimizedEvent(); if (EventHandlers.OnWindowsMinimized != null) { EventHandlers.OnWindowsMinimized.Invoke(null, Event); } } } if (PUBG.IsOnScreen) { if (EventHandlers.IsOnScreen == false) { EventHandlers.IsOnScreen = true; var Event = new WindowsOnScreenEvent(); if (EventHandlers.OnWindowsShowed != null) { EventHandlers.OnWindowsShowed.Invoke(null, Event); } } } else { if (EventHandlers.IsOnScreen) { EventHandlers.IsOnScreen = false; var Event = new WindowsNotOnScreenEvent(); if (EventHandlers.OnWindowsNotShowed != null) { EventHandlers.OnWindowsNotShowed.Invoke(null, Event); } } } } await Task.Delay(250); } }