コード例 #1
0
        protected override int VisualMain()
        {
            string       savePath     = null;
            DialogResult dialogResult = DialogResult.No;

            App.RunOnUIThread(() =>
            {
                FolderBrowserDialog fbd = new FolderBrowserDialog
                {
                    Description = "请选择保存路径"
                };
                dialogResult = fbd.ShowDialog();
                savePath     = fbd.SelectedPath;
            });

            var finder = new DeviceImageFinder(TargetDevice);

            WriteLineAndSetTip("寻找Boot文件中");
            var path = finder.PathOf(DeviceImage.Boot);

            if (path == null)
            {
                WriteLineAndSetTip("寻找路径失败");
                return(ERR);
            }
            else
            {
                WriteLine("寻找成功:" + path);
            }
            WriteLineAndSetTip("正在复制到临时目录");
            var tmpPath  = $"{Adb.AdbTmpPathOnDevice}/tmp.img";
            var cpResult = new SuCommand(TargetDevice, $"cp {path} {tmpPath}")
                           .To(OutputPrinter)
                           .Execute();
            var pullResult = new AdbCommand(TargetDevice, $"pull {tmpPath} \"{Path.Combine(savePath,"boot.img")}\"")
                             .To(OutputPrinter)
                             .Execute();

            return(OK);
        }