예제 #1
0
        private void ExecuteCommand(NetPacket packet)
        {
            string cmd = "";

            try
            {
                cmd = _encoding.GetString(packet.Body);
                var result = CmdHelper.ExecuteCmd(cmd);

                this.SendMessage(result);
            }
            catch (Exception ex)
            {
                _log.Error("cmd命令:" + cmd, ex);
                this.SendMessage("ExecuteCommand CMD Failed!" + Environment.NewLine + cmd + Environment.NewLine + ex.Message);
            }
        }
예제 #2
0
        private bool FeiliuLogin(Account account, Role role)
        {
            DmPlugin        Dm          = role.Window.Dm;
            YeShenSimulator ysSimulator = SoftContext.YeShenSimulatorList.FirstOrDefault(x => x.NoxHwnd == role.Hwnd);
            string          noxPath     = "";

            if (File.Exists(@"E:\nox\Nox\bin\nox_adb.exe"))
            {
                noxPath = @"E:\nox\Nox\bin\";
            }
            if (File.Exists(@"E:\Nox\bin\nox_adb.exe"))
            {
                noxPath = @"E:\Nox\bin\";
            }
            string result = CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + @" shell dumpsys window w|findstr \/|findstr name=");

            result = result.Replace("mSurface=Surface(name=", "").Replace(")", "");
            //com.regin.gcld.fl/com.regin.gcld.fl.gcld
            if (result.IndexOf("gcld") > 0) //当前应用程序是攻城掠地
            {
                int index = result.IndexOf('/');
                CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell am force-stop " + result.Remove(index, result.Length - index));
                Dm.Delay(5000);
            }
            switch (account.Platform)
            {
            case Platform.飞流:
                CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell am start -n com.regin.gcld.fl/.gcld");
                Delegater.WaitTrue(() => Dm.IsExistPic(279, 37, 476, 100, @"\bmp\飞流帐号登录.bmp", 0.9), () => Dm.Delay(1000), 20);
                Dm.Delay(1000);
                if (Dm.IsExistPic(279, 37, 476, 100, @"\bmp\飞流帐号登录.bmp", 0.9))
                {
                    Dm.Delay(1000);
                    Dm.MoveToClick(562, 156);
                    Dm.Delay(500);
                    for (int i = 0; i < 20; i++)
                    {
                        if (Dm.GetColorNum(292, 121, 414, 176, "ffffff-101010", 0.9) > 5)
                        {
                            CmdHelper.ExecuteCmd(string.Format("{0}nox_adb -s {1} shell input keyevent 67", noxPath, ysSimulator.AdbDevicesId));
                            Dm.Delay(200);
                        }
                        else
                        {
                            break;
                        }
                    }

                    CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell input text \"" + account.UserName + "\"");
                    Dm.Delay(1000);
                    Dm.MoveToClick(577, 218);
                    Dm.Delay(500);
                    for (int i = 0; i < 20; i++)
                    {
                        if (Dm.GetColorNum(290, 192, 444, 245, "ffffff-101010", 0.9) > 5)
                        {
                            CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell input keyevent 67");
                            Dm.Delay(200);
                        }
                        else
                        {
                            break;
                        }
                    }
                    CmdHelper.ExecuteCmd(noxPath + "nox_adb -s " + ysSimulator.AdbDevicesId + " shell input text \"" + account.Password + "\"");
                    Dm.Delay(1000);
                    Dm.FindPicAndClick(413, 279, 543, 348, @"\bmp\登录.bmp");

                    return(Delegater.WaitTrue(() => {
                        if (Dm.IsExistPic(818, 281, 953, 447, @"\bmp\世界.bmp") || Dm.IsExistPic(818, 281, 953, 447, @"\bmp\副本.bmp"))
                        {
                            while (Dm.IsExistPic(406, 378, 557, 432, @"\bmp\以后再说.bmp", 0.8))
                            {
                                Dm.MoveToClick(544, 414);
                                Dm.Delay(1000);
                            }
                            Dm.Delay(1000);
                            return true;
                        }
                        return false;
                    }, () => Dm.Delay(1000), 25));
                }
                break;

            case Platform.楚游:
                CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell am start -n com.regin.gcld.sy/.gcld");
                Delegater.WaitTrue(() => Dm.GetColorNum(113, 288, 193, 317, "f6c246-202020", 0.9) > 1000, () => Dm.Delay(1000), 20);
                Dm.Delay(1000);
                if (Dm.GetColorNum(113, 288, 193, 317, "f6c246-202020", 0.9) > 1000)
                {
                    Dm.Delay(1000);
                    Dm.MoveToClick(233, 203);
                    Dm.Delay(500);
                    for (int i = 0; i < 20; i++)
                    {
                        if (Dm.GetColorNum(67, 187, 210, 216, "242424-202030", 0.9) > 5)
                        {
                            CmdHelper.ExecuteCmd(string.Format("{0}nox_adb -s {1} shell input keyevent 67", noxPath, ysSimulator.AdbDevicesId));
                            Dm.Delay(200);
                        }
                        else
                        {
                            break;
                        }
                    }
                    CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell input text \"" + account.UserName + "\"");
                    Dm.Delay(1000);
                    Dm.MoveToClick(235, 246);
                    Dm.Delay(500);
                    for (int i = 0; i < 20; i++)
                    {
                        if (Dm.GetColorNum(70, 230, 209, 263, "242424-202030", 0.9) > 5)
                        {
                            CmdHelper.ExecuteCmd(string.Format("{0}nox_adb -s {1} shell input keyevent 67", noxPath, ysSimulator.AdbDevicesId));
                            Dm.Delay(200);
                        }
                        else
                        {
                            break;
                        }
                    }
                    CmdHelper.ExecuteCmd(noxPath + "nox_adb -s " + ysSimulator.AdbDevicesId + " shell input text \"" + account.Password + "\"");
                    Dm.Delay(500);
                    Dm.MoveToClick(149, 302);

                    return(Delegater.WaitTrue(() => {
                        if (Dm.IsExistPic(818, 281, 953, 447, @"\bmp\世界.bmp") || Dm.IsExistPic(818, 281, 953, 447, @"\bmp\副本.bmp"))
                        {
                            //while (Dm.IsExistPic(406, 378, 557, 432, @"\bmp\以后再说.bmp", 0.8))
                            //{
                            //    Dm.MoveToClick(544, 414);
                            //    Dm.Delay(1000);
                            //}
                            //Dm.Delay(1000);
                            return true;
                        }
                        return false;
                    }, () => Dm.Delay(1000), 25));
                }
                break;
            }
            return(false);
        }