Example #1
0
        public MainForm()
        {
            if (System.Diagnostics.Process.GetProcessesByName("QTRHacker").Length > 1)
            {
                Environment.Exit(0);
            }

            CreateDirectories();
            LoadConfigs();
#if ENG
            CurrentLanguage = Languages.Processor.GetLanguage("en");
#else
            CurrentLanguage = Languages.Processor.GetLanguage("zh-cn");
#endif

            MainFormInstance = this;

            InitializeComponent();
            BackColor = FormBack;

            QHScriptRuntime = Python.CreateRuntime();
            QHScriptEngine  = QHScriptRuntime.GetEngine("Python");
            var paths = QHScriptEngine.GetSearchPaths();
            paths.Add(Path.GetFullPath(".\\Scripts\\"));
            QHScriptEngine.SetSearchPaths(paths);

            MainPanel           = new Panel();
            MainPanel.BackColor = Color.FromArgb(30, 30, 30);
            MainPanel.Bounds    = new Rectangle(2, 30, this.Width - 4, this.Height - 32);
            this.Controls.Add(MainPanel);

            MinButton             = new PictureBox();
            MinButton.Click      += (s, e) => WindowState = FormWindowState.Minimized;
            MinButton.MouseEnter += (s, e) => MinButton.BackColor = ButtonHoverColor;
            MinButton.MouseLeave += (s, e) => MinButton.BackColor = ButtonNormalColor;
            MinButton.Bounds      = new Rectangle(Width - 64, -1, 32, 32);
            using (Stream st = Assembly.GetExecutingAssembly().GetManifestResourceStream("QTRHacker.NewDimension.Res.Image.min.png"))
                MinButton.Image = Image.FromStream(st);

            CloseButton             = new PictureBox();
            CloseButton.MouseEnter += (s, e) => CloseButton.BackColor = ButtonHoverColor;
            CloseButton.MouseLeave += (s, e) => CloseButton.BackColor = ButtonNormalColor;
            CloseButton.Click      += (s, e) => Dispose();
            CloseButton.Bounds      = new Rectangle(Width - 32, -1, 32, 32);
            using (Stream st = Assembly.GetExecutingAssembly().GetManifestResourceStream("QTRHacker.NewDimension.Res.Image.close.png"))
                CloseButton.Image = Image.FromStream(st);

            Controls.Add(MinButton);
            Controls.Add(CloseButton);

            ButtonsPanel           = new Panel();
            ButtonsPanel.Bounds    = new Rectangle(0, 0, 100, MainPanel.Height);
            ButtonsPanel.BackColor = Color.FromArgb(50, 255, 255, 255);
            MainPanel.Controls.Add(ButtonsPanel);


            WindowsIdentity identity = WindowsIdentity.GetCurrent();
            if (!new WindowsPrincipal(identity).IsInRole(WindowsBuiltInRole.Administrator))
            {
                AdminTipLabel           = new Label();
                AdminTipLabel.Text      = "如果出现报错\n请以管理员权限启动修改器";
                AdminTipLabel.BackColor = Color.Transparent;
                AdminTipLabel.ForeColor = Color.Red;
                AdminTipLabel.Bounds    = new Rectangle(3, 260, 100, 40);
                ButtonsPanel.Controls.Add(AdminTipLabel);
            }

            QQGroupLabel           = new Label();
            QQGroupLabel.Text      = "官方QQ群:453858025";
            QQGroupLabel.BackColor = Color.Transparent;
            QQGroupLabel.ForeColor = Color.White;
            QQGroupLabel.Bounds    = new Rectangle(3, 310, 100, 40);
#if ENG
#else
            ButtonsPanel.Controls.Add(QQGroupLabel);
#endif

            VersionLabel           = new Label();
            VersionLabel.Text      = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            VersionLabel.BackColor = Color.Transparent;
            VersionLabel.ForeColor = Color.White;
            VersionLabel.Bounds    = new Rectangle(3, 350, 100, 20);
            ButtonsPanel.Controls.Add(VersionLabel);


            Image img_MainPage   = null;
            Image img_Basic      = null;
            Image img_Player     = null;
            Image img_Projectile = null;
            Image img_Misc       = null;
            Image img_Scripts    = null;
            Image img_ChatSender = null;
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_171"]))
                img_MainPage = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_990"]))
                img_Basic = Image.FromStream(st);
            using (Stream st = Assembly.GetExecutingAssembly().GetManifestResourceStream("QTRHacker.NewDimension.Res.Image.player.png"))
                img_Player = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_42"]))
                img_Projectile = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_518"]))
                img_Scripts = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_3124"]))
                img_Misc = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_531"]))
                img_ChatSender = Image.FromStream(st);

            ContentPanel        = new Panel();
            ContentPanel.Bounds = new Rectangle(100, 0, MainPanel.Width - 100, MainPanel.Height);
            MainPanel.Controls.Add(ContentPanel);

            MainPagePanel       = new PagePanel_MainPage(MainPanel.Width - 100, MainPanel.Height);
            BasicPagePanel      = new PagePanel_Basic(MainPanel.Width - 100, MainPanel.Height);
            PlayerPagePanel     = new PagePanel_Player(MainPanel.Width - 100, MainPanel.Height);
            ProjectilePagePanel = new PagePanel_Projectile(MainPanel.Width - 100, MainPanel.Height);
            ScriptsPagePanel    = new PagePanel_Scripts(MainPanel.Width - 100, MainPanel.Height);
            MiscPagePanel       = new PagePanel_Misc(MainPanel.Width - 100, MainPanel.Height);
            ChatSenderPanel     = new PagePanel_ChatSender(MainPanel.Width - 100, MainPanel.Height);


            AddButton(CurrentLanguage["Basic"], img_Basic, BasicPagePanel).Enabled                 = false;
            AddButton(CurrentLanguage["Players"], img_Player, PlayerPagePanel).Enabled             = false;
            AddButton(CurrentLanguage["Projectiles"], img_Projectile, ProjectilePagePanel).Enabled = false;
            AddButton(CurrentLanguage["Scripts"], img_Scripts, ScriptsPagePanel).Enabled           = false;
            AddButton(CurrentLanguage["ChatSender"], img_ChatSender, ChatSenderPanel).Enabled      = false;
            AddButton(CurrentLanguage["Miscs"], img_Misc, MiscPagePanel).Enabled = false;


            AddButton(CurrentLanguage["MainPage"], img_MainPage, MainPagePanel).Selected = true;


            Icon = ConvertToIcon(img_Basic, true);
        }
Example #2
0
        public MainForm()
        {
            CheckForIllegalCrossThreadCalls = false;

            if (System.Diagnostics.Process.GetProcessesByName("QTRHacker").Length > 1)
            {
                MessageBox.Show("请先关闭已打开的修改器\n如果已关闭且出现此提示,请在任务管理器检查是否有进程QTRHacker.exe滞留");
                Environment.Exit(0);
            }

            CreateDirectoriesAndFiles();
            LoadConfigs();
#if ENG
            CurrentLanguage = Languages.Processor.GetLanguage("en");
#else
            CurrentLanguage = Languages.Processor.GetLanguage("zh-cn");
#endif

            MainFormInstance = this;

            InitializeComponent();
            BackColor = FormBack;

            QHScriptRuntime = Python.CreateRuntime();
            QHScriptEngine  = QHScriptRuntime.GetEngine("Python");
            var paths = QHScriptEngine.GetSearchPaths();
            paths.Add(Path.GetFullPath(".\\Scripts\\"));
            QHScriptEngine.SetSearchPaths(paths);

            MainPanel           = new Panel();
            MainPanel.BackColor = Color.FromArgb(30, 30, 30);
            MainPanel.Bounds    = new Rectangle(2, 30, this.Width - 4, this.Height - 32);
            this.Controls.Add(MainPanel);

            MinButton             = new PictureBox();
            MinButton.Click      += (s, e) => WindowState = FormWindowState.Minimized;
            MinButton.MouseEnter += (s, e) => MinButton.BackColor = ButtonHoverColor;
            MinButton.MouseLeave += (s, e) => MinButton.BackColor = ButtonNormalColor;
            MinButton.Bounds      = new Rectangle(Width - 64, -1, 32, 32);
            using (Stream st = Assembly.GetExecutingAssembly().GetManifestResourceStream("QTRHacker.NewDimension.Res.Image.min.png"))
                MinButton.Image = Image.FromStream(st);

            CloseButton             = new PictureBox();
            CloseButton.MouseEnter += (s, e) => CloseButton.BackColor = ButtonHoverColor;
            CloseButton.MouseLeave += (s, e) => CloseButton.BackColor = ButtonNormalColor;
            CloseButton.Click      += (s, e) => Dispose();
            CloseButton.Bounds      = new Rectangle(Width - 32, -1, 32, 32);
            using (Stream st = Assembly.GetExecutingAssembly().GetManifestResourceStream("QTRHacker.NewDimension.Res.Image.close.png"))
                CloseButton.Image = Image.FromStream(st);

            Controls.Add(MinButton);
            Controls.Add(CloseButton);

            ButtonsPanel           = new Panel();
            ButtonsPanel.Bounds    = new Rectangle(0, 0, ButtonsPanelWidth, MainPanel.Height);
            ButtonsPanel.BackColor = Color.FromArgb(255, 90, 90, 90);
            MainPanel.Controls.Add(ButtonsPanel);



            Image img_MainPage = null, img_Basic = null, img_Player = null,
                  img_Projectile = null, img_Misc = null, img_Scripts = null,
                  img_Sche = null, img_ChatSender = null, img_AimBot = null,
                  img_About = null;
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_171"]))
                img_MainPage = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_990"]))
                img_Basic = Image.FromStream(st);
            using (Stream st = Assembly.GetExecutingAssembly().GetManifestResourceStream("QTRHacker.NewDimension.Res.Image.player.png"))
                img_Player = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_42"]))
                img_Projectile = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_518"]))
                img_Scripts = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_3124"]))
                img_Misc = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_109"]))
                img_About = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_531"]))
                img_ChatSender = Image.FromStream(st);


            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_3"]))
                img_Sche = Image.FromStream(st);
            using (Stream st = new MemoryStream(GameResLoader.ItemImageData["Item_164"]))
                img_AimBot = Image.FromStream(st);

            ContentPanel        = new Panel();
            ContentPanel.Bounds = new Rectangle(ButtonsPanel.Width, 0, MainPanel.Width - ButtonsPanel.Width, MainPanel.Height);
            MainPanel.Controls.Add(ContentPanel);

            int pageWidth = ContentPanel.Width;

            MainPagePanel       = new PagePanel_MainPage(pageWidth, MainPanel.Height);
            AboutPagePanel      = new PagePanel_About(pageWidth, MainPanel.Height);
            BasicPagePanel      = new PagePanel_Basic(pageWidth, MainPanel.Height);
            PlayerPagePanel     = new PagePanel_Player(pageWidth, MainPanel.Height);
            ProjectilePagePanel = new PagePanel_Projectile(pageWidth, MainPanel.Height);
            ScriptsPagePanel    = new PagePanel_Scripts(pageWidth, MainPanel.Height);
            MiscPagePanel       = new PagePanel_Misc(pageWidth, MainPanel.Height);
            ChatSenderPanel     = new PagePanel_ChatSender(pageWidth, MainPanel.Height);


            //SchesPagePanel = new PagePanel_Sches(pageWidth, MainPanel.Height);
            //AimBotPagePanel = new PagePanel_AimBot(pageWidth, MainPanel.Height);


            ExpandedGroup = Group1 = AddGroup();
            Group2        = AddGroup();


            AddButton(Group1, CurrentLanguage["Basic"], img_Basic, BasicPagePanel).Enabled                 = false;
            AddButton(Group1, CurrentLanguage["Players"], img_Player, PlayerPagePanel).Enabled             = false;
            AddButton(Group1, CurrentLanguage["Projectiles"], img_Projectile, ProjectilePagePanel).Enabled = false;
            AddButton(Group1, CurrentLanguage["Scripts"], img_Scripts, ScriptsPagePanel).Enabled           = false;
            AddButton(Group1, CurrentLanguage["ChatSender"], img_ChatSender, ChatSenderPanel).Enabled      = false;
            AddButton(Group1, CurrentLanguage["Miscs"], img_Misc, MiscPagePanel).Enabled = false;
#if ENG
#else
            AddButton(Group1, CurrentLanguage["About"], img_About, AboutPagePanel).Enabled = true;
#endif
            AddButton(Group1, CurrentLanguage["MainPage"], img_MainPage, MainPagePanel).Selected = true;

            //AddButton(Group2, CurrentLanguage["Sches"], img_Sche, SchesPagePanel).Enabled = false;
            //AddButton(Group2, CurrentLanguage["AimBot"], img_AimBot, AimBotPagePanel).Enabled = false;

            Icon = ConvertToIcon(img_Basic, true);
        }