// 定时查询是否激活 防止破解 private void TimerQueryActivation(object sender, EventArgs e) { String activationCode = INIHelper.Read("Info", "ActivationCode", "", BaseConfig.CONFIG_PATH); if (string.IsNullOrEmpty(activationCode) || string.IsNullOrWhiteSpace(activationCode)) { Application.Current.Shutdown(); } else { ValiCode(_globalParam.m_Handle, activationCode); // 验证失败直接关闭应用 if (_valiCode >= 3) { YouyiSdk.M_Close(_globalParam.m_Handle); if (!showMessageBox) { showMessageBox = true; MessageBox.Show("卡密不正确,请重新激活!"); } INIHelper.DeleteKey("Info", "ActivationCode", BaseConfig.CONFIG_PATH); DelegeteShutDownApp(); } } }
// D5puPvS6GzfOsdaW6Kjwle63AUeLFVVc private void SetSn(IntPtr m_Handle, string codeStr) { int resLen = 256; byte[] res = new byte[resLen]; int v = YouyiSdk.M_GetDevSn(m_Handle, ref resLen, ref res[0]); if (v == 0) { byte[] sec = new UTF8Encoding().GetBytes(BaseConfig.AC_SECRET); byte[] newRes = new byte[resLen]; Array.Copy(res, newRes, resLen); LogHelper.ShowLog("设备SN:{0}", new UTF8Encoding().GetString(Hex.Encode(newRes))); // 验证激活码与SN byte[] md = new byte[32]; byte[] code = Encoding.Default.GetBytes(codeStr); byte[] bt = new byte[resLen + sec.Length + code.Length]; newRes.CopyTo(bt, 0); sec.CopyTo(bt, newRes.Length); code.CopyTo(bt, bt.Length - code.Length); SM3Digest sm3 = new SM3Digest(); sm3.BlockUpdate(bt, 0, bt.Length); sm3.DoFinal(md, 0); string s = new UTF8Encoding().GetString(Hex.Encode(md)); LogHelper.ShowLog("摘要加密:{0} 长度:{1}", s.ToUpper(), s.Length); YouyiSdk.M_SetUserData(m_Handle, md.Length, ref md[0]); } }
public static void AutoShoot() { GlobalParam globalParam = GlobalParam.GetGlobalParam(); Player player = Player.GetPlay(); while (player.autoShoot) { YouyiSdk.M_LeftClick(globalParam.m_Handle, 1); Thread.Sleep(10); YouyiSdk.M_MoveR2(globalParam.m_Handle, 0, 15); } }
/** * 注册各类监听事件 * **/ private void RegisterHookEven() { LogHelper.ShowLog("开始注册事件"); try { int mvid = Convert.ToInt32(BaseConfig.YOUXI_VID, 16); int mpid = Convert.ToInt32(BaseConfig.YOUXI_PID, 16); IntPtr m_Handle = YouyiSdk.M_Open_VidPid(mvid, mpid); //IntPtr m_Handle = YouyiSdk.aeBGGOyo4(3); int check = YouyiSdk.M_ResolutionUsed(m_Handle, (int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight); if ((int)m_Handle == -1) { LogHelper.ShowLog("打开设备失败,请检查USB设备是否已经插入"); var result = MessageBoxX.Show("请检查USB设备是否已经插入", "提示", Application.Current.MainWindow, MessageBoxButton.OK, new MessageBoxXConfigurations() { MessageBoxIcon = MessageBoxIcon.Error, ButtonBrush = "#FF4C4C".ToColor().ToBrush(), }); this.Shutdown(); } else { globalParam.m_Handle = m_Handle; LogHelper.ShowLog("打开设备成功 m_Handle: {0} check: {1}", m_Handle, check); } // 注册鼠标事件 mh = new MouseHook(); mh.SetHook(); MouseEvens evens = new MouseEvens(m_Handle); mh.MouseDownEvent += evens.mh_MouseDownEvent; mh.MouseUpEvent += evens.mh_MouseUpEvent; //注册键盘事件 k_hook = new KeyboardHook(); KeyboardEvens keyEvens = new KeyboardEvens(); k_hook.KeyDownEvent += new System.Windows.Forms.KeyEventHandler(keyEvens.Hook_KeyDown); //按键按下 k_hook.KeyUpEvent += new System.Windows.Forms.KeyEventHandler(keyEvens.Hook_KeyUp); //按键松开 k_hook.KeyPressEvent += keyEvens.K_hook_KeyPressEvent; k_hook.Start(); } catch (DllNotFoundException e) { LogHelper.ShowLog("调用动态链接库异常 {0}", e.Message); MessageBox.Show("软件资源损坏,请重新下载安装 \n" + e.Message); this.Shutdown(); } }
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // 关闭芯片 YouyiSdk.M_Close(_globalParam.m_Handle); // 删除武器识别图片 if (!BaseConfig.DEBUG) { if (System.IO.File.Exists(_globalParam.IdenWeaponImgName)) { System.IO.File.Delete(_globalParam.IdenWeaponImgName); } } CreateDeskTopLnk(); Application.Current.Shutdown(); }
private void ValiCode(object sender, EventArgs e) { string codeStr = _ActivationCode; int resLen = 256; byte[] res = new byte[resLen]; int v = YouyiSdk.M_GetDevSn(_globalParam.m_Handle, ref resLen, ref res[0]); if (v == 0) { byte[] sec = new UTF8Encoding().GetBytes(BaseConfig.AC_SECRET); byte[] newRes = new byte[resLen]; Array.Copy(res, newRes, resLen); LogHelper.ShowLog("设备SN:{0}", new UTF8Encoding().GetString(Hex.Encode(newRes))); // 验证激活码与SN byte[] md = new byte[32]; byte[] code = Encoding.Default.GetBytes(codeStr); byte[] bt = new byte[resLen + sec.Length + code.Length]; newRes.CopyTo(bt, 0); sec.CopyTo(bt, newRes.Length); code.CopyTo(bt, bt.Length - code.Length); SM3Digest sm3 = new SM3Digest(); sm3.BlockUpdate(bt, 0, bt.Length); sm3.DoFinal(md, 0); //string s = new UTF8Encoding().GetString(Hex.Encode(md)); //LogHelper.ShowLog("摘要加密:{0} 长度:{1}", s.ToUpper(), s.Length); // 验证自定义数据 int vali = YouyiSdk.M_VerifyUserData(_globalParam.m_Handle, md.Length, ref md[0]); LogHelper.ShowLog("验证结果:{0}", vali); Loading = false; if (vali != 0) { // 失败信息 MessageBox.Show("卡密不正确,请联系客服处理!"); _window.DelegeteShutDown(); } else { // 写入激活码 INIHelper.Write("Info", "ActivationCode", codeStr, BaseConfig.CONFIG_PATH); _window.DelegeteClose(); } } }
// codeStr:D5puPvS6GzfOsdaW6Kjwle63AUeLFVVc private void ValiCode(IntPtr m_Handle, string codeStr) { int resLen = 256; byte[] res = new byte[resLen]; int v = YouyiSdk.M_GetDevSn(m_Handle, ref resLen, ref res[0]); if (v == 0) { byte[] sec = new UTF8Encoding().GetBytes(BaseConfig.AC_SECRET); byte[] newRes = new byte[resLen]; Array.Copy(res, newRes, resLen); LogHelper.ShowLog("设备SN:{0}", new UTF8Encoding().GetString(Hex.Encode(newRes))); // 验证激活码与SN byte[] md = new byte[32]; byte[] code = Encoding.Default.GetBytes(codeStr); byte[] bt = new byte[resLen + sec.Length + code.Length]; newRes.CopyTo(bt, 0); sec.CopyTo(bt, newRes.Length); code.CopyTo(bt, bt.Length - code.Length); SM3Digest sm3 = new SM3Digest(); sm3.BlockUpdate(bt, 0, bt.Length); sm3.DoFinal(md, 0); // 验证自定义数据 int vali = YouyiSdk.M_VerifyUserData(m_Handle, md.Length, ref md[0]); LogHelper.ShowLog("验证结果:{0}", vali); if (vali != 0) { _valiCode += 1; } else { if (_valiCode != 0) { _valiCode = 0; } } } else { _valiCode += 1; } }
private static void XueWu() { AppInfo appInfo = AppInfo.GetAppInfo(); GlobalParam globalParam = GlobalParam.GetGlobalParam(); Bitmap image = new Bitmap(140, 60); Point cutPoint = new Point(((int)appInfo.screenWidth / 2 - (image.Width / 2)), ((int)appInfo.screenHeight / 2) - (image.Height / 2)); Graphics imgGraphics = Graphics.FromImage(image); imgGraphics.CopyFromScreen(cutPoint, new Point(0, 0), new Size(image.Width, image.Height)); //第一个参数是截图开始坐标,第二个参数是要拷贝到的Bitmap的开始位置,保持不变,最后是图片大小 if (BaseConfig.DEBUG) { image.Save("cut.png"); } int interval = 8; int x = 0; int y = 0; Color pixel;//颜色匹对 Color color = ColorTranslator.FromHtml("#B50D6B"); for (int i = 0; i < image.Width; i++) { for (int j = 0; j < image.Height; j++) { pixel = image.GetPixel(i, j); if (Math.Abs(pixel.R - color.R) < interval && Math.Abs(pixel.G - color.G) < interval && Math.Abs(pixel.B - color.B) < interval) { x = (cutPoint.X + i) - ((int)appInfo.screenWidth / 2); //y = ((int)appInfo.screenHeight / 2) - (cutPoint.Y + j); LogHelper.ShowLog("get Xuewu X: {0} Y: {1}", x, y); YouyiSdk.M_MoveR2(globalParam.m_Handle, x, 0); return; } } } }
public MainWindow() { InitializeComponent(); this._mainWindowViewModel = MainWindowViewModel.GetMainWindowViewModel(); base.DataContext = _mainWindowViewModel; _globalParam = GlobalParam.GetGlobalParam(); _globalParam.MainWindow = this; this.Closing += MainWindow_Closing; //QueryProcess(); // 查询是否激活 String activationCode = INIHelper.Read("Info", "ActivationCode", "", BaseConfig.CONFIG_PATH); if (string.IsNullOrEmpty(activationCode) || string.IsNullOrWhiteSpace(activationCode)) { // 填写激活码 ActivationWindow activation = new ActivationWindow(); activation.ShowDialog(); } // 进入首次验证 TimerQueryActivation(null, null); if (_valiCode == 1) { YouyiSdk.M_Close(_globalParam.m_Handle); if (!showMessageBox) { showMessageBox = true; MessageBox.Show("卡密不正确,请重新激活!"); } INIHelper.DeleteKey("Info", "ActivationCode", BaseConfig.CONFIG_PATH); DelegeteShutDownApp(); } // 定时查询激活 timer = new Timer(); timer.Elapsed += new ElapsedEventHandler(TimerQueryActivation); timer.Interval = 1000 * 60 * 3; timer.Enabled = true; timer.AutoReset = true; }
// 分段移动到指定值 public static void OpenFire() { Player player = Player.GetPlay(); GunsViewModel gunsViewModel = GunsViewModel.GetGunsViewModel(); JichuViewModel jichuViewModel = JichuViewModel.GetJichuViewModel(); bool _HasAmmo = true; GlobalParam globalParam = GlobalParam.GetGlobalParam(); MouseStatus mouseStatus = MouseStatus.GetMouseStatus(); AppInfo appInfo = AppInfo.GetAppInfo(); if (player.runLogic && player.isShoot && !player.useMissiles && !string.IsNullOrEmpty(player.useWeapon.weapon) && !player.useWeapon.weapon.Equals("空")) { string[] str = player.useWeapon.modelData.datas.Split('|'); double[] datas = Array.ConvertAll(str, double.Parse); int x = 0, y = 0; int count = (int)datas[6]; int magNum = 40; int logicTime = (int)(datas[7] / datas[6] - 1); Task.Run(() => { ValiAmmo(ref _HasAmmo); }); if (!player.runXueWuLogic && jichuViewModel.XueWu) { player.runXueWuLogic = true; Task.Run(() => { ExecLogic(player); }); } int index = 0; while (mouseStatus.leftDown && _HasAmmo && player.isShoot) { DateTime startTime = DateTime.Now; // 判断是否没有子弹 double j = 0; if (magNum == 40) { j = datas[0]; index = 0; } else if (magNum < 40 && magNum >= 34) { j = datas[1]; index = 1; } else if (magNum < 34 && magNum >= 27) { j = datas[2]; index = 2; } else if (magNum < 27 && magNum >= 19) { j = datas[3]; index = 3; } else if (magNum < 19 && magNum >= 9) { j = datas[4]; index = 4; } else { j = datas[5]; index = 5; } for (int i = 0; i < count; i++) { if (_HasAmmo && player.isShoot) { YouyiSdk.M_MoveR2(globalParam.m_Handle, 0, (int)j); Task.Run(() => { if (index != globalParam.DataIndex) { globalParam.DataIndex = index; gunsViewModel.RaisePropertyChanged("Datas"); } LogHelper.ShowLog("压枪耗时 {0} 压枪幅度:{1} 步进:{2}", 0, j, i); }); Thread.Sleep(logicTime); } } magNum -= 1; Task.Run(() => { ValiAmmo(ref _HasAmmo); Task.Run(() => { ValiShoot(globalParam, player); }); }); } } }