Example #1
0
 private bool InstallUsePnPUtil_SysNative(string fileName)
 {
     try
     {
         var winDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
         var result = new ProcessBasedCommand($"{winDir}\\sysnative\\pnputil", $"-i -a {fileName}").Execute();
         return(result.ExitCode == 0);
     }
     catch (Exception ex)
     {
         Logger.Warn("failed", ex);
         return(false);
     }
 }
        protected sealed override int VisualMain()
        {
            WriteWaitingForUser();
            if (!OnWarnUser())
            {
                return(ERR_CANCELED_BY_USER);
            }
            ProcessBasedCommand        command = null;
            IProcessBasedCommandResult result  = null;

            WriteInitInfo();
            GodPower = new GodPower(this, TargetDevice);

            WriteLineAndSetTip(Res("EGodPowerExtractingApk"));
            GodPower.Extract();
            ThrowIfCanceled();

            WriteLineAndSetTip(Res("EGodPowerPushingApk"));
            command = GodPower.GetPushCommand();
            CmdStation.Register(command);
            result = command
                     .To(OutputPrinter)
                     .Execute();

            WriteLineAndSetTip(Res("EGodPowerRmUser"));
            command = GodPower.GetRemoveUserCommand();
            CmdStation.Register(command);
            result = command
                     .To(OutputPrinter)
                     .Execute();
            ThrowIfCanceled();

            WriteLineAndSetTip(Res("EGodPowerRmAcc"));
            command = GodPower.GetRemoveAccountCommnad();
            CmdStation.Register(command);
            result = command
                     .To(OutputPrinter)
                     .Execute();
            ThrowIfCanceled();

            return(SetReciverAsDpm());
        }