protected override void ProcessNewLines(string[] lines)
 {
     for (int i = 0; i < lines.Length; i++)
     {
         LogWrapper.LogInfo(lines[i]);
     }
 }
示例#2
0
        protected void OnUpdateRunning(int current_time_int)
        {
            current_time_int -= m_state_start_time;
            int delta_ms = current_time_int - m_last_update_time;

            if (delta_ms < 0)
            {
                return;
            }
#if UNITY_EDITOR
            if (m_is_first_frame)
            {
                m_is_first_frame = false;
                LogWrapper.LogInfo("CombatClient.OnUpdateRunning, first delta_ms = ", delta_ms);
            }
            if (delta_ms > 100)
            {
                LogWrapper.LogInfo("CombatClient.OnUpdateRunning, delta_ms = ", delta_ms);
            }
#endif
            m_sync_client.Update(current_time_int);
            m_render_world.OnUpdate(current_time_int);
            List <Command> commands = m_sync_client.GetOutputCommands();
            if (commands.Count > 0)
            {
                SendCommands(commands);
                m_sync_client.ClearOutputCommand();
            }
            m_last_update_time = current_time_int;
        }
示例#3
0
        private void button_install_Click_1(object sender, EventArgs e)
        {
            button_install.Enabled = false;
            List <DeviceTask> tasks      = new List <DeviceTask>();
            string            packgeName = "";

            if (radioButton_install.Checked)
            {
                string apkFilePath = textBox_apk.Text;
                var    installTask = new InstallTask(apkFilePath);
                tasks.Add(installTask);
                var info = APKInfo.ParseAPK(apkFilePath);
                packgeName = info.PackgeName;
            }
            else
            {
                packgeName = textBox_apk.Text;
            }

            WeTestTask wtTask = new WeTestTask(textBox_python.Text, textBox_wt.Text, packgeName);

            tasks.Add(wtTask);

            var devices       = DeviceManager.Instance.Devices;
            int complateCount = 0;

            for (int i = 0; i < devices.Length; i++)
            {
                var device = devices[i];
                device.TaskMgr.TaskEnd += (task, result) => {
                    if (device.TaskMgr.RunningTaskIndex == device.TaskMgr.Tasks.Length - 1 || !result.ok)
                    {
                        complateCount++;
                        if (complateCount == devices.Length)
                        {
                            LogWrapper.LogInfo("所有任务已完成");
                            RunInMainthread(() => {
                                button_install.Enabled = true;
                            });
                        }
                    }
                };
                device.TaskMgr.RunTasks(tasks.ToArray());
            }
        }
示例#4
0
        public override TaskResult Run(Managed.Adb.Device adbDevice)
        {
            TaskResult result = new TaskResult();

            //un install
            var apkInfo = APKInfo.ParseAPK(mPackgeLocation);

            try {
                if (adbDevice.PackageManager.Exists(apkInfo.PackgeName))
                {
                    adbDevice.UninstallPackage(apkInfo.PackgeName);
                }
            } catch {
            }

            LogWrapper.LogInfo("CanuSU:" + adbDevice.SerialNumber + ":" + adbDevice.CanSU());
            string          remoteFilePath = adbDevice.SyncPackageToDevice(mPackgeLocation);
            InstallReceiver receiver       = new InstallReceiver();
            String          cmd            = String.Format("pm install {1}{0}", remoteFilePath, true ? "-r " : String.Empty);

            if (adbDevice.CanSU())
            {
                adbDevice.ExecuteRootShellCommand(cmd, receiver);
            }
            else
            {
                adbDevice.ExecuteShellCommand(cmd, receiver);
            }

            if (!String.IsNullOrEmpty(receiver.ErrorMessage))
            {
                result.ok  = false;
                result.Msg = receiver.ErrorMessage;
            }
            return(result);
        }