示例#1
0
        public MembootTasks(MembootTaskType type, string[] hmodsInstall = null, string[] hmodsUninstall = null, string dumpPath = null)
        {
            fel = new Fel();
            List <TaskFunc> taskList = new List <TaskFunc>();

            taskList.Add(WaitForFelOrMembootableShell);
            taskList.Add(Memboot);
            taskList.Add(Tasker.WaitIf(!hakchi.MinimalMemboot, WaitDelay, Resources.PleaseWait));
            taskList.Add(WaitForShell);
            taskList.Add(ShellTasks.ShowSplashScreen);

            switch (type)
            {
            case MembootTaskType.InstallHakchi:
                taskList.AddRange(new TaskFunc[]
                {
                    HandleHakchi(HakchiTasks.Install),
                    ModTasks.TransferBaseHmods("/hakchi/transfer"),
                    BootHakchi
                });
                break;

            case MembootTaskType.ResetHakchi:
                taskList.AddRange(new TaskFunc[]
                {
                    HandleHakchi(HakchiTasks.Reset),
                    ModTasks.TransferBaseHmods("/hakchi/transfer"),
                    BootHakchi
                });
                break;

            case MembootTaskType.UninstallHakchi:
                taskList.AddRange(new TaskFunc[] {
                    GetStockKernel,
                    FlashStockKernel,
                    HandleHakchi(HakchiTasks.Uninstall),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.FactoryReset:
                taskList.AddRange(new TaskFunc[] {
                    GetStockKernel,
                    FlashStockKernel,
                    ProcessNand(null, NandTasks.FormatNandC),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.DumpNand:
                taskList.AddRange(new TaskFunc[]
                {
                    ProcessNand(dumpPath, NandTasks.DumpNand),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.DumpNandB:
                taskList.AddRange(new TaskFunc[]
                {
                    ProcessNand(dumpPath, NandTasks.DumpNandB),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.DumpNandC:
                taskList.AddRange(new TaskFunc[]
                {
                    ProcessNand(dumpPath, NandTasks.DumpNandC),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.FlashNandB:
                taskList.AddRange(new TaskFunc[]
                {
                    ProcessNand(dumpPath, NandTasks.FlashNandB),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.FlashNandC:
                taskList.AddRange(new TaskFunc[]
                {
                    ProcessNand(dumpPath, NandTasks.FlashNandC),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.FormatNandC:
                taskList.AddRange(new TaskFunc[]
                {
                    ProcessNand(dumpPath, NandTasks.FormatNandC),
                    HandleHakchi(HakchiTasks.Install),
                    ModTasks.TransferBaseHmods("/hakchi/transfer"),
                    BootHakchi
                });
                break;

            case MembootTaskType.ProcessMods:
                taskList.AddRange(new ModTasks(hmodsInstall, hmodsUninstall).Tasks);
                break;

            case MembootTaskType.FlashNormalUboot:
                taskList.AddRange(new TaskFunc[]
                {
                    FlashUboot(Fel.UbootType.Normal),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.FlashSDUboot:
                taskList.AddRange(new TaskFunc[]
                {
                    FlashUboot(Fel.UbootType.SD),
                    ShellTasks.Reboot
                });
                break;

            case MembootTaskType.Memboot:
                taskList.Add(BootHakchi);
                break;

            case MembootTaskType.MembootRecovery: break;

            case MembootTaskType.MembootOriginal:
                taskList.AddRange(new TaskFunc[]
                {
                    GetStockKernel,
                    Memboot
                });
                break;
            }
            Tasks = taskList.ToArray();
        }