コード例 #1
0
ファイル: CmdsThread.cs プロジェクト: ouyanghy/android-tool
        private void flashThread(Object obj)
        {
            CmdOption option = (CmdOption)obj;

            int  index = option.index;
            bool ret   = false;

            switch (index)
            {
            case (Enums.PartitionIndex.ABOOT):
                mProgress.showProgress(option);
                ret             = mCmd.excuteCmdFlashAboot(option.path[0]);
                option.state[0] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;
                break;

            case Enums.PartitionIndex.BOOT:
                mProgress.showProgress(option);
                ret             = mCmd.excuteCmdFlashBoot(option.path[0]);
                option.state[0] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;
                break;

            case Enums.PartitionIndex.SYSTEM:
                mProgress.showProgress(option);
                ret             = mCmd.excuteCmdFlashSystem(option.path[0]);
                option.state[0] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;
                break;

            case Enums.PartitionIndex.MODEM:
                mProgress.showProgress(option);
                ret             = mCmd.excuteCmdFlashModem(option.path[0]);
                option.state[0] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;
                break;

            case (Enums.PartitionIndex.SPLASH):
                mProgress.showProgress(option);
                ret             = mCmd.excuteCmdFlashSplash(option.path[0]);
                option.state[0] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;
                break;

            case (Enums.PartitionIndex.USERDATA):
                mProgress.showProgress(option);
                ret             = mCmd.excuteCmdFlashUserdata(option.path[0]);
                option.state[0] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;
                break;

            case (Enums.PartitionIndex.RECOVERY):
                mProgress.showProgress(option);
                ret             = mCmd.excuteCmdFlashRecovery(option.path[0]);
                option.state[0] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;
                break;

            case (Enums.PartitionIndex.ALL):
                ret = true;
                mProgress.showProgress(option);
                ret            &= mCmd.excuteCmdFlashAboot(option.path[0]);
                option.state[0] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;

                ret            &= mCmd.excuteCmdFlashBoot(option.path[1]);
                option.state[1] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;

                ret            &= mCmd.excuteCmdFlashSystem(option.path[2]);
                option.state[2] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;

                ret            &= mCmd.excuteCmdFlashModem(option.path[3]);
                option.state[3] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;

                ret            &= mCmd.excuteCmdFlashSplash(option.path[4]);
                option.state[4] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;

                ret            &= mCmd.excuteCmdFlashUserdata(option.path[5]);
                option.state[5] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;

                ret            &= mCmd.excuteCmdFlashRecovery(option.path[6]);
                option.state[6] = ret == true ? (int)Enums.WorkState.SUCC : (int)Enums.WorkState.ERROR;
                break;
            }

            mIntfResult.setResult(Enums.CmdType.FASTBOOT, ret);
            Thread.Sleep(1000);
            mProgress.dismissProgress(0);
        }