Пример #1
0
        static void Main()
        {
            if (!CurrentUser.IsAdministrator())
            {
                MessageBox.Show("ImpostUs needs administrator permissions!");
                return;
            }

            new Thread(() =>
            {
                Thread.Sleep(2000);

                RunOnUiThread(() => Controller.GUI.StatusText.Text = "Waiting for Process...");
                if (ImpostUsHook.Hook())
                {
                    RunOnUiThread(() => Controller.GUI.StatusText.Text = "Hooked");
                    ImpostUsHook.ObserveShipStatus(x =>
                    {
                        playerDatas.ForEach(playerData => playerData.StopObserveState());
                        playerDatas = ImpostUsHook.GetAllPlayers();
                        playerDatas.ForEach(playerData => playerData.StartObserveState());
                    });
                    new Thread(RunTick).Start();
                }
                else
                {
                    RunOnUiThread(() => Controller.GUI.StatusText.Text = "Process not found! Restart to retry.");
                }
            }).Start();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new ImpostUsUi());
        }
Пример #2
0
 static void _ObserveShipStatus()
 {
     while (Tokens.ContainsKey("ObserveShipStatus") && Tokens["ObserveShipStatus"].IsCancellationRequested == false)
     {
         Thread.Sleep(250);
         shipStatus = ImpostUsHook.GetShipStatus();
         if (prevShipStatus.OwnerId != shipStatus.OwnerId)
         {
             prevShipStatus = shipStatus;
             onChangeShipStatus?.Invoke(shipStatus.Type);
         }
     }
 }