Exemplo n.º 1
0
        private int checkClose()
        {
            //check the exe every tick, if it is not running then murder the f*****g sys
            Process[] pname = Process.GetProcessesByName("GenshinImpact"); // get processes that match given name
            if (pname.Length == 0)                                         // if we have no results
            {
                //u ded now bucko, game is closed and your usefulness is at an end
                //knife.png
                sc.Stop();                                         // stop the service
                sc.WaitForStatus(ServiceControllerStatus.Stopped); // ensure the damn thing is dead
                if (!silentMode)
                {
                    IconMain.ShowBalloonTip(3000, "Service Stopped", "mhyprot2.sys has been stopped.", ToolTipIcon.Info);
                }                                                             // toast
                if (closeLauncher)                                            // if the close flag is up
                {
                    Process[] items = Process.GetProcessesByName("launcher"); // get processes that match given name
                    foreach (Process proc in items)                           // launcher is kinda common so we're going to double check before murdering
                    {
                        if (proc.MainModule.FileName.Contains(installPath))   // if the exe exists in the installation path of the game
                        {
                            proc.Kill();                                      // safe to say we got the right man. Get spaced - 0 processes remain.
                        }
                    }
                }
                return(0); // return state for next check to switch
            }

            return(1); // return current state for switch
        }
Exemplo n.º 2
0
 private void Dispose(bool disposing)
 {
     if (IconMain != null)
     {
         IconMain.Dispose();
     }
     if (IconMoney != null)
     {
         IconMoney.Dispose();
     }
     if (LabelMain != null)
     {
         LabelMain.Dispose();
     }
     if (LabelMoney != null)
     {
         LabelMoney.Dispose();
     }
 }
Exemplo n.º 3
0
        private int checkRun()
        {
            sc = new ServiceController("mhyprot2");                // get handle for system service
            try                                                    // we use try in case the sys is not running atm
            {
                sc.WaitForStatus(ServiceControllerStatus.Running); // wait until it's running (in case state is STARTING)
                if (!silentMode)
                {
                    IconMain.ShowBalloonTip(3000, "Genshin Impact Launched", "I'll just chill until it closes...", ToolTipIcon.Info);
                }                                     // toast
                return(1);                            // return state for next check to switch
            }
            catch (System.InvalidOperationException)  // sole error case
            {
                Console.WriteLine("Sys not running"); // no need to inform the user tbh
            }

            return(0); // return current state for switch
        }
Exemplo n.º 4
0
        public override void Draw(GameTime gameTime, Renderer renderer)
        {
            base.Draw(gameTime, renderer);

            if (IconMain != null)
            {
                IconMain.Draw(gameTime, renderer);
            }
            if (LabelMain != null)
            {
                LabelMain.Draw(gameTime, renderer);
            }
            if (IconMoney != null)
            {
                IconMoney.Draw(gameTime, renderer);
            }
            if (LabelMoney != null)
            {
                LabelMoney.Draw(gameTime, renderer);
            }
        }
Exemplo n.º 5
0
        public override void Update(GameTime gameTime)
        {
            if (IconMain != null)
            {
                IconMain.Update(gameTime);
            }
            if (LabelMain != null)
            {
                LabelMain.Update(gameTime);
            }
            if (IconMoney != null)
            {
                IconMoney.Update(gameTime);
            }
            if (LabelMoney != null)
            {
                LabelMoney.Update(gameTime);
            }

            // always update ourself first because our base will clear the Clicked flag once it has processed
            base.Update(gameTime);
        }
Exemplo n.º 6
0
 private void quitApp()
 {
     t.Abort();           // kill our thread
     IconMain.Dispose();  // kill our tray icon
     Environment.Exit(0); // graceful termination with 0=>success
 }