/// <summary> /// 将刚截的图保存到PC端 /// </summary> /// <param name="saveFile"></param> public void SaveToPC(FileInfo saveFile) { CmdStation.GetAdbCommand(Device, $"pull {TmpPath} {saveFile.FullName}") .To(RaiseOutput) .Execute(). ThrowIfExitCodeNotEqualsZero(); }
public void PushToDevice() { DirectoryInfo dirInfo = context.Tmp.DirInfo; string path = Path.Combine(dirInfo.FullName, PATH_OF_TMP_APK); CmdStation .GetAdbCommand($"push \"{path}\" {PATH_OF_ATMP_APK}") .To(RaiseOutput) .Execute() .ThrowIfExitCodeNotEqualsZero(); }
private void Install(List <FileInfo> files) { WriteInitInfo(); int successed = 0; int error = 0; int currentInstalling = 1; int totalCount = files.Count; SetTip(currentInstalling, totalCount); foreach (var file in files) { try { var result = CmdStation .GetAdbCommand(TargetDevice, $"install \"{file.FullName}\"") .To(OutputLogger) .Execute(); ThrowIfCanceled(); if (result.ExitCode == 0) { successed++; } else { error++; } } catch (Exception ex) { Logger.Warn("install apk failed", ex); error++; } if (currentInstalling < totalCount) { currentInstalling++; SetTip(currentInstalling, totalCount); } } ; string fmtString = Res("EAppInstallerFinishedFmt"); WriteLine(string.Format(fmtString, successed, error, totalCount)); }
protected override int VisualMain() { var enableRootResult = CmdStation .GetAdbCommand(TargetDevice, $"root") .To(OutputPrinter) .Execute(); if (enableRootResult.ExitCode != 0) { return(enableRootResult.ExitCode); } Thread.Sleep(300); var result = CmdStation .GetAdbCommand(TargetDevice, $"disable-verity") .To(OutputPrinter) .Execute(); return(result.ExitCode); }
protected override int VisualMain() { bool? dialogResult = null; string seleFile = null; App.RunOnUIThread(() => { Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog(); fileDialog.Reset(); fileDialog.Title = Res("EFilePusherSelectingTitle"); fileDialog.Filter = Res("EFilePusherSelectingFilter"); fileDialog.Multiselect = false; dialogResult = fileDialog.ShowDialog(); seleFile = fileDialog.FileName; }); if (dialogResult != true) { return(ERR_CANCELED_BY_USER); } try { return(CmdStation.GetAdbCommand(TargetDevice, $"push \"{seleFile}\" /sdcard/") .To(OutputPrinter) .Execute() .ExitCode); } catch (Exception ex) { Logger.Warn("file pushing failed", ex); WriteLineAndSetTip(Res("EFilePusherFailed")); FinishedTip = "EFilePusherFailed"; return(ERR); } }
public AdbCommand GetPushCommand() { return(CmdStation.GetAdbCommand(Device, $"push \"{file.FullName}\" {GODPOWER_APK_ON_DEVICE}")); }