示例#1
0
        protected override int VisualMain()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Reset();
            fileDialog.Title       = Res("EFlashRecoverySelectingTitle");
            fileDialog.Filter      = Res("EFlashRecoverySelectingFilter");
            fileDialog.Multiselect = false;
            if (fileDialog.ShowDialog() != true)
            {
                return(ERR_CANCELED_BY_USER);
            }
            fileDialog = null;

            var result = CmdStation
                         .GetFastbootCommand(TargetDevice,
                                             $"flash recovery \"{fileDialog.FileName}\"")
                         .To(OutputPrinter)
                         .Execute();

            if (result.ExitCode == 0)
            {
                CmdStation
                .GetFastbootCommand(TargetDevice,
                                    $"boot \"{fileDialog.FileName}\"")
                .To(OutputPrinter)
                .Execute();
            }

            WriteExitCode(result.ExitCode);
            return(result.ExitCode);
        }
示例#2
0
        protected override int VisualMain()
        {
            WriteInitInfo();
            var result = CmdStation.GetFastbootCommand(TargetDevice, "oem lock")
                         .To(OutputPrinter)
                         .Execute();

            WriteExitCode(result.ExitCode);
            return(result.ExitCode);
        }
示例#3
0
        protected override int VisualMain()
        {
            if (!Ux.Agree(Res("EOemLockWarn")))
            {
                return(ERR_CANCELED_BY_USER);
            }
            if (!Ux.Agree(Res("EOemLockWarnAgain")))
            {
                return(ERR_CANCELED_BY_USER);
            }
            WriteInitInfo();
            var result = CmdStation.GetFastbootCommand(TargetDevice, "oem lock")
                         .To(OutputPrinter)
                         .Execute();

            WriteExitCode(result.ExitCode);
            return(result.ExitCode);
        }
        /// <summary>
        /// 获取Product信息
        /// </summary>
        /// <returns></returns>
        public string GetProduct()
        {
            var text = CmdStation
                       .GetFastbootCommand(Device, "getvar product")
                       .To(RaiseOutput)
                       .Execute()
                       .Output
                       .ToString();
            var match = Regex.Match(text, resultPattern);

            if (match.Success)
            {
                return(match.Result("${result}"));
            }
            else
            {
                return(null);
            }
        }