Beispiel #1
0
        public void upgradeSpell(int indice)
        {
            Point coords = new Point();

            switch (indice)
            {
            case 1:
                coords = new Point(826, 833);
                break;

            case 2:
                coords = new Point(875, 833);
                break;

            case 3:
                coords = new Point(917, 833);
                break;

            case 4:
                coords = new Point(967, 833);
                break;

            default:
                CMDOutput.Write("Unknown spell indice :" + indice, CMDMessage.warrning);
                return;
            }
            InputHelper.LeftClick(coords.X, coords.Y);
            CMDHelper.DelayInput();
        }
Beispiel #2
0
        async void ShowConnectedDevices()
        {
            await CMDHelper.Adb_KillServer();

            UsbRegDeviceList allDevices = UsbDevice.AllDevices;

            m_log.Add($"find devices {allDevices.Count}");
            for (int index = 0; index < allDevices.Count; index++)
            {
                var device = (WinUsbRegistry)allDevices[index];

                UsbDevice usbDevice;
                if (device.Open(out usbDevice))
                {
                    //lbl_deviceInfo.Text += device.DeviceID + "\r\n";
                    lbl_deviceInfo.Text += "Serial Number: " + usbDevice.Info.SerialString + "\r\n";
                    string[] locationPaths = (string[])device.DeviceProperties["LocationPaths"];

                    P_ID p_id = P_ID.NULL;
                    V_ID v_id = V_ID.NULL;
                    Enum.TryParse <P_ID>(device.Pid.ToString(), out p_id);
                    Enum.TryParse <V_ID>(device.Vid.ToString(), out v_id);
                    DeviceManufactory man = new DeviceManufactory();
                    man.p_id             = p_id;
                    man.v_id             = v_id;
                    man.company_name     = device.FullName;
                    lbl_deviceInfo.Text += "USB Port: " + filterUsbPort(locationPaths[0], man) + "\r\n";
                    lbl_deviceInfo.Text += "\r\n";
                }
            }
        }
Beispiel #3
0
        public void buyItem(int indice)
        {
            Point coords = new Point(0, 0);

            switch (indice)
            {
            case 1:
                coords = new Point(577, 337);
                break;

            case 2:
                coords = new Point(782, 336);
                break;

            case 3:
                coords = new Point(595, 557);
                break;

            case 4:
                coords = new Point(600, 665);
                break;

            case 5:
                coords = new Point(760, 540);
                break;

            default:
                CMDOutput.Write("Unknown item indice " + indice + ". Skipping", CMDMessage.warrning);
                return;
            }
            InputHelper.RightClick(coords.X, coords.Y);

            CMDHelper.DelayInput();
        }
Beispiel #4
0
        public void RepairDatabase()
        {
            var local = (ConnectionString.Contains("localhost") || ConnectionString.Contains("127.0.0.1"));

            if (local == false)
            {
                throw new Exception(GlobalHelper.Get("key_74"));
            }

            if (LocalDBLocation == null)
            {
                throw new Exception(GlobalHelper.Get("mongo_connect_error"));
            }
            var mydir = new DirectoryInfo(LocalDBLocation);
            var file  = mydir.GetFiles().FirstOrDefault(d => d.Name == "mongod.lock");

            if (file == null)
            {
                throw new Exception(GlobalHelper.Get("key_76"));
            }
            try
            {
                File.Delete(file.FullName);
                var str = CMDHelper.Execute("net start MongoDB");
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #5
0
 public void waitProcessOpen(string processName)
 {
     while (!Mouse.IsProcessOpen(processName))
     {
         CMDHelper.Sleep(1000);
     }
 }
Beispiel #6
0
        public int gameMinute()
        {
            int minute = TextHelper.GetTextFromImage(1426, 171, 16, 16);

            CMDHelper.Log("Game is on minute " + minute.ToString());
            return(minute);
        }
Beispiel #7
0
        public void RepairDatabase()
        {
            bool local = (ConnectionString.Contains("localhost") || ConnectionString.Contains("127.0.0.1"));

            if (local == false)
            {
                throw new Exception("MongoDB数据库不在本地,无法启动自动数据库修复");
            }

            if (LocalDBLocation == null)
            {
                throw new Exception("数据库连接失败,请检查数据库配置,或手动设定MongoDB数据库的安装路径以方便自动修复");
            }
            var      mydir = new DirectoryInfo(LocalDBLocation);
            FileInfo file  = mydir.GetFiles().FirstOrDefault(d => d.Name == "mongod.lock");

            if (file == null)
            {
                throw new Exception("修复失败,您是否没有安装MongoDB数据库");
            }
            try
            {
                File.Delete(file.FullName);
                string str = CMDHelper.Execute("net start MongoDB");
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #8
0
        public void castSpell(int indice, int x, int y)
        {
            string key = "D" + indice;

            InputHelper.MoveMouse(x, y);
            InputHelper.PressKey(key);
            CMDHelper.DelayInput();
        }
Beispiel #9
0
 public void processSpellToEnemyChampions()
 {
     tryCastSpellToEnemyChampion(1);
     tryCastSpellToEnemyChampion(3);
     CMDHelper.Sleep(550);
     tryCastSpellToEnemyChampion(3);
     tryCastSpellToEnemyChampion(4);
 }
Beispiel #10
0
        public void lockAlly(int allyIndice)
        {
            string key = "F" + allyIndice;

            InputHelper.KeyUp(key);
            CMDHelper.DelayInput();
            InputHelper.KeyDown(key);
            CMDHelper.DelayInput();
        }
Beispiel #11
0
 public bool tryMoveLightArea(int X, int Y, string color)
 {
     if (ImageHelper.GetColor(X, Y) == color)
     {
         InputHelper.RightClick(X, Y);
         CMDHelper.DelayInput();
         return(true);
     }
     return(false);
 }
Beispiel #12
0
 public void fixItemsInShop()
 {
     if (ImageHelper.ImageExist("Game/toggleshopitems.png"))
     {
         CMDHelper.DelayInput();
         InputHelper.LeftClick(1050, 240, 150);
         CMDHelper.Log("Items in Shop Fixed!");
         CMDHelper.DelayInput();
     }
 }
Beispiel #13
0
        private void RestartService(string serviceName)
        {
            CMDHelper cmd = CMDHelper.GetInstance();
            cmd.OnErrorDataReceived += (obj, e) =>
            {
                throw (new Exception(e.Data));
            };
            cmd.SendCommand($"sc stop {serviceName}");
            cmd.SendCommand($"sc start {serviceName}");

        }
Beispiel #14
0
        public void justMoveAway()
        {
            Point go = Values.EnemyChampion();

            if (go.X == 0 && go.Y == 0)
            {
                return;
            }

            InputHelper.RightClick(780, 600);
            CMDHelper.Sleep(1000);
        }
Beispiel #15
0
        /// <summary>
        /// 搜索o文件
        /// </summary>
        /// <returns>o文件的个数</returns>
        public int SearchFiles()
        {
            if (string.IsNullOrWhiteSpace(Folder) || !Directory.Exists(Folder))
            {
                //Message.Error("工作文件夹不存在:" + Folder);
                return(-1);
            }

            FilePaths = new List <string>();

            DirectoryInfo dir = new DirectoryInfo(Folder);

            //// 1.扫描Z压缩文件
            string unzipCmd = "7z.exe x \"{0}\" -o\"{1}\" -y |exit";

            foreach (var file in dir.GetFiles("*d.Z"))
            {
                string cmd = string.Format(unzipCmd, file.FullName, dir.FullName);
                try
                {
                    CMDHelper.ExecuteThenWait(cmd);
                }
                catch
                {
                    //Message.Warning("解压文件失败:" + file.FullName);
                }
            }

            //// 2.扫描d文件
            string transCmd = "crx2rnx.exe \"{0}\" |exit";

            foreach (var file in dir.GetFiles("*.??d"))
            {
                string cmd = string.Format(transCmd, file.FullName);
                try
                {
                    CMDHelper.ExecuteThenWait(cmd);
                }
                catch
                {
                    //Message.Warning("解压文件失败:" + file.FullName);
                }
            }

            //// 3.扫描o文件
            foreach (var file in dir.GetFiles("*.??o"))
            {
                FilePaths.Add(file.Name);
            }

            return(FilePaths.Count);
        }
Beispiel #16
0
        private static Task Rebuild(Method method)
        {
            string destBatFileName = Path.Combine(AppConfig.TempRoot, AppConfig.BuildScriptFileName);

            $"Dest bat FileName:{destBatFileName}".LogWarning();
            string sourceFileName = Path.Combine(AppDir, AppConfig.BuildScriptFileName);

            $"Source bat FileName:{sourceFileName}".LogWarning();
            File.Copy(sourceFileName, destBatFileName, true);
            CMDHelper.RunCMdAndDontWait($"{destBatFileName} {Environment.ProcessId}");
            Environment.Exit(0);
            return(Task.CompletedTask);
        }
Beispiel #17
0
        public void allyCreepPosition()
        {
            Point go = Values.AllyCreepPosition();

            if (go.X == 0 && go.Y == 0)
            {
                return;
            }

            InputHelper.MoveMouse(go.X - 40, go.Y + 135);
            CMDHelper.Sleep(350);
            InputHelper.PressKey("A");
        }
Beispiel #18
0
        private void HomeGroupBtn_Click(object sender, EventArgs e)
        {
            Enabled = false;
            if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                CMDHelper.RunCommand(@"sc config ""HomeGroupProvider"" start= disabled"); // stop autorun
                CMDHelper.RunCommand(@"sc stop ""HomeGroupProvider""");                   // stop process now
                Log("HomeGroup disabled!");

                MessageBox.Show("OK!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            Enabled = true;
        }
Beispiel #19
0
        public void moveAwayFromCreep()
        {
            Point go = Values.EnemyCreepPosition();

            if (go.X == 0 && go.Y == 0)
            {
                return;
            }

            InputHelper.RightClick(780, 600);
            CMDHelper.Sleep(1100);
            InputHelper.MoveMouse(970, 540);
            InputHelper.PressKey("A");
        }
Beispiel #20
0
        public void tryCastSpellToEnemyChampion(int indice)
        {
            Point go = Values.EnemyChampion();

            if (go.X == 0 && go.Y == 0)
            {
                return;
            }

            InputHelper.MoveMouse(go.X + 39, go.Y + 129);

            string key = "D" + indice;

            InputHelper.PressKey(key.ToString());
            CMDHelper.Sleep(50);
        }
Beispiel #21
0
        public void tryCastSpellToCreep(int indice)
        {
            Point go = Values.EnemyCreepPosition();

            if (go.X == 0 && go.Y == 0)
            {
                return;
            }

            InputHelper.MoveMouse(go.X + 28, go.Y + 42);

            string key = "D" + indice;

            InputHelper.PressKey(key.ToString());
            CMDHelper.Sleep(65);
        }
Beispiel #22
0
        public void talkInGame(string message)
        {
            Keyboard.KeyPress(Keys.Enter, 150);

            CMDHelper.Sleep(100);

            foreach (var character in message)
            {
                Keys key = KeyboardInput.GetKey(character);
                Keyboard.KeyPress(key, 150);
                CMDHelper.Sleep(100);
            }
            CMDHelper.DelayInput();
            Keyboard.KeyPress(Keys.Enter, 150);
            CMDHelper.DelayInput();
        }
Beispiel #23
0
        public void talkInChampSelect(string message)
        {
            InputHelper.LeftClick(390, 940, 200);

            CMDHelper.Sleep(100);

            foreach (var character in message)
            {
                Keys key = KeyboardInput.GetKey(character);
                Keyboard.KeyPress(key, 150);
                CMDHelper.Sleep(100);
            }
            CMDHelper.DelayInput();
            Keyboard.KeyPress(Keys.Enter, 150);
            CMDHelper.DelayInput();
        }
Beispiel #24
0
        public async Task <string> FindArrivaledDevice(string serialNumber)
        {
            int count = 0;

            while (count <= config_inc.CMD_REPEAT_MAX_TIME)
            {
                UsbRegDeviceList allDevices = UsbDevice.AllDevices;
                common.m_log.Add_Debug($"find devices {allDevices.Count}");
                await CMDHelper.Adb_KillServer();

                for (int index = 0; index < allDevices.Count; index++)
                {
                    var       device = (WinUsbRegistry)allDevices[index];
                    UsbDevice usbDevice;
                    bool      result = device.Open(out usbDevice);
                    common.m_log.Add_Debug($"open device registry info page:{result}");
                    if (result)
                    {
                        if (serialNumber == usbDevice.Info.SerialString)
                        {
                            string[] locationPaths = (string[])device.DeviceProperties["LocationPaths"];
                            usbDevice.Close();
                            CMDHelper.Adb_StartServer();

                            P_ID p_id = P_ID.NULL;
                            V_ID v_id = V_ID.NULL;
                            Enum.TryParse <P_ID>(device.Pid.ToString(), out p_id);
                            Enum.TryParse <V_ID>(device.Vid.ToString(), out v_id);

                            DeviceManufactory man = new DeviceManufactory();
                            man.p_id         = p_id;
                            man.v_id         = v_id;
                            man.company_name = device.FullName;
                            return(filterUsbPort(locationPaths[0], man));
                        }
                    }
                    if (usbDevice != null)
                    {
                        usbDevice.Close();
                    }
                }
                count++;
                await Task.Delay(500);
            }
            CMDHelper.Adb_StartServer();
            return(String.Empty);
        }
Beispiel #25
0
        public async Task <List <UsbDeviceInfoEx> > GetAllDevices()
        {
            List <UsbDeviceInfoEx> device_list = new List <UsbDeviceInfoEx>();
            UsbRegDeviceList       allDevices  = UsbDevice.AllDevices;
            await CMDHelper.Adb_KillServer();

            common.m_log.Add_Debug($"find devices {allDevices.Count}");
            for (int index = 0; index < allDevices.Count; index++)
            {
                var       device = (WinUsbRegistry)allDevices[index];
                UsbDevice usbDevice;
                bool      result = device.Open(out usbDevice);
                common.m_log.Add_Debug($"open device registry info page:{result}");
                if (result)
                {
                    string[] locationPaths = (string[])device.DeviceProperties["LocationPaths"];
                    usbDevice.Close();

                    P_ID p_id = P_ID.NULL;
                    V_ID v_id = V_ID.NULL;
                    Enum.TryParse <P_ID>(device.Pid.ToString(), out p_id);
                    Enum.TryParse <V_ID>(device.Vid.ToString(), out v_id);

                    DeviceManufactory man = new DeviceManufactory();
                    man.p_id         = p_id;
                    man.v_id         = v_id;
                    man.company_name = device.FullName;

                    string portNum = filterUsbPort(locationPaths[0], man);

                    UsbDeviceInfoEx deviceInfo = new UsbDeviceInfoEx();
                    deviceInfo.Index        = -1;
                    deviceInfo.Port_Path    = portNum;
                    deviceInfo.SerialNumber = usbDevice.Info.SerialString;
                    device_list.Add(deviceInfo);
                }
                if (usbDevice != null)
                {
                    usbDevice.Close();
                }
            }
            await Task.Delay(config_inc.CMD_REPEAT_WAIT_TIME);

            CMDHelper.Adb_StartServer();
            return(device_list);
        }
Beispiel #26
0
        static void Main(string [] args)
        {
            if (args != null && args.Length == 1)
            {
                if (args[0] == "-A")
                {
                    string file = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Tts.TMusic.Service.exe");
                    if (ServiceHelper.ServiceIsExisted("TMusicService"))
                    {
                        //if (MessageBox.Show("TMusicService 服务已经安装,需要卸载重新安装吗?", "Ary you ok", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
                        //    return;

                        if (ServiceHelper.IsServiceStart("TMusicService"))
                        {
                            ServiceHelper.StopService("TMusicService");
                        }

                        ServiceHelper.UnInstallService(file, "TMusicService");
                    }

                    ServiceHelper.InstallService(null, file, "TMusicService");
                }
                return;
            }
            else if (args != null && args.Length == 2)
            {
                Stopwatch timer = Stopwatch.StartNew();
                CMDHelper.ExecuteCMD(args[1], 0);
                if (timer.ElapsedMilliseconds < 1000)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        System.Threading.Thread.Sleep(999);
                    }
                }
                System.IO.File.Delete(args[1]);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new ServiceAdd());
                return;
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new TMusicSetup());
        }
Beispiel #27
0
        public static BCPExportResult Run(BCPExportInfo pBCPExportInfo)
        {
            string _output = string.Empty;

            try {
                string _exeName = "bcp.exe";

                //_startInfo.FileName = @"C:\TIMOK.DEPLOYMENT\Rbr-v2.0.5.0\Diagrams\205\Init_data\TEST __CDRDb_205_Export_8_Data.bat";
                //bcp "SELECT * FROM CDRDb_205.dbo.CDR WHERE timok_date >= 200421400 AND timok_date < 200424500" queryout "C:\Timok\Rbr\SqlDb\ExportedData\205\CDR_200408_TEST.txt" -c -S(local)\TRBR -T
                string _args = string.Empty;           // + //@"SELECT TOP 70000 * FROM CDRDb_205.dbo.CDR WHERE timok_date >= 200421400 AND timok_date < 200424500" +
                _args += '"' + pBCPExportInfo.SQL + '"';
                _args += " queryout ";                 //@"C:\Timok\Rbr\SqlDb\ExportedData\205\CDR_200408_TEST.txt" +
                _args += '"' + pBCPExportInfo.FilePath + '"';
                if (pBCPExportInfo.Delimeter == null || pBCPExportInfo.Delimeter.Trim().Length == 0)
                {
                    //_args += "-t\t";//default
                }
                else
                {
                    _args += " -t" + pBCPExportInfo.Delimeter;
                }

                _args += @" -c ";
                _args += " -S" + pBCPExportInfo.Server;                 //(local)\TRBR -T";
                if (pBCPExportInfo.TrustedConnection)
                {
                    _args += " -T";
                }
                else
                {
                    _args += " -U" + '"' + pBCPExportInfo.User + '"';                   // -U"Jane Doe"
                    _args += " -P" + '"' + pBCPExportInfo.Pwd + '"';                    // -P"go dba"
                }

                ProcessPriorityClass _priorityClass = ProcessPriorityClass.BelowNormal;

                _output = CMDHelper.Run(_exeName, _args, _priorityClass, pBCPExportInfo.TimeoutSeconds);
            }
            catch (Exception e) {
                throw new ApplicationException("An error occurred running BCP.", e);
            }

            return(processOutput(_output, pBCPExportInfo));
        }
    static void MakeAtlas(string name, string pathSrc, string pathDst, string args)
    {
        pathSrc = string.Format("\"{0}\"", pathSrc);
        string fullPathDst          = string.Format("\"{0}/{1}\"", pathDst, name);
        string TexturePackerBatPath = GetTexturePackerBatPath("maker");

        if (string.IsNullOrEmpty(TexturePackerBatPath))
        {
            return;
        }
        args = string.Format("{0} {1} {2}", pathSrc, fullPathDst, args);
        string error = CMDHelper.ProcessCommand(TexturePackerBatPath, args);

        if (!string.IsNullOrEmpty(error))
        {
            Debug.LogError(string.Format("Make Atlas Error. name:{0}, msg:{1}", name, error));
        }
        AssetDatabase.Refresh();
    }
Beispiel #29
0
        public void Execute(IJobExecutionContext context)
        {
            if (IsExec)
            {
                return;
            }
            IsExec = true;

            try
            {
                if (TMusic._config == null)
                {
                    return;
                }
                System.Net.HttpWebRequest request = System.Net.HttpWebRequest.CreateHttp(TMusic._config.LastVersionAddr);
                using (var rsponse = request.GetResponse())
                {
                    var stream = rsponse.GetResponseStream();
                    using (System.IO.StreamReader reader = new System.IO.StreamReader(stream))
                    {
                        string  version = reader.ReadToEnd();
                        Version netVer  = Version.Parse(version);
                        if (this.GetType().Assembly.GetName().Version < netVer)
                        {
                            string startInfo = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Updates", "Tts.TMusic.Service.Updates.exe");
                            CMDHelper.ExecuteCMD("start \"Update\" \"" + startInfo + "\"", 0);

                            return; //不在执行检察
                            //UpdateForm form = new UpdateForm();
                            //form.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ILog log = LogManager.GetLogger(typeof(UpdateJob));
                log.Error("UpdateJob", ex);
            }

            IsExec = false;
        }
Beispiel #30
0
        public virtual string Execute(Project pro)
        {
            var sb = new StringBuilder();

            foreach (var cmd in CommandList)
            {
                var(realCMD, isCmd) = ExecuteMethodFromCommand(cmd, pro);
                sb.AppendLine(realCMD);
                if (isCmd)
                {
                    var isJump = realCMD.StartsWith("cd");
                    if (isJump)
                    {
                        Path = realCMD.Split(" ")[1];
                    }
                    sb.AppendLine(CMDHelper.RunCmd(Path, realCMD));
                }
            }
            return(sb.ToString());
        }