updateStatus() публичный статический Метод

public static updateStatus ( String text ) : void
text String
Результат void
        private Boolean FormatDataPartition(String FilePath)
        {
            Log.updateStatus("Status: initialize Data.img... Please wait");
            Log.write("-Initialize Data.img");
            string ExecutablePath = Environment.CurrentDirectory + @"\mke2fs.exe";
            string ExecutableArgs = String.Format("-F -t ext4 \"{0}\\data.img\"", FilePath);

            if (!ExecuteCLICommand(ExecutablePath, ExecutableArgs))
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        private bool UnMountFirmwarePartition()
        {
            Log.updateStatus("UnMounting EFI Partition...");
            Log.write("-UnMounting EFI Partition...");
            string UNMOUNT_EXE = @"C:\Windows\System32\mountvol.exe";
            string UNMOUNT_CMD = String.Format(" Z: /D");

            if (!ExecuteCLICommand(UNMOUNT_EXE, UNMOUNT_CMD))
            {
                return(false);
            }

            return(true);
        }
        private Boolean CreateDataParition(String directory, String Size)
        {
            Log.updateStatus("Status: Create Data.img... Please wait");
            Log.write("-Create Data.img");

            string ExecutablePath = Environment.CurrentDirectory + @"\dd.exe";
            string ExecutableArgs = String.Format(@"if=/dev/zero of={0}\data.img count={1}", directory, Size.ToString());

            if (!ExecuteCLICommand(ExecutablePath, ExecutableArgs))
            {
                return(false);
            }

            return(true);
        }
        private Boolean ExtractSFS(String SFSPath)
        {
            //7z.exe x android-x86-4.4-r2.img "efi" "kernel" "ramdisk.img" "initrd.img" "system.sfs" -o"C:\Users\ExtremeGTX\Desktop\installer_test\extracted\"
            string ExecutablePath = Environment.CurrentDirectory + @"\7z.exe";
            string ExecutableArgs = String.Format(" x {0}\\system.sfs \"system.img\" -o{0}", SFSPath);

            //
            //Extracting System.sfs
            //
            Log.updateStatus("Status: Extract SFS... Please wait");
            Log.write("-Extract SFS");
            if (!ExecuteCLICommand(ExecutablePath, ExecutableArgs))
            {
                return(false);
            }

            return(true);
        }
        private Boolean ExtractISO(String ISOFilePath, String ExtractDirectory)
        {
            //7z.exe x android-x86-4.4-r2.img "efi" "kernel" "ramdisk.img" "initrd.img" "system.sfs" -o"C:\Users\ExtremeGTX\Desktop\installer_test\extracted\"
            string ExecutablePath = Environment.CurrentDirectory + @"\7z.exe";
            string ExecutableArgs = String.Format(" x \"{0}\" \"kernel\" \"ramdisk.img\" \"initrd.img\" \"system.*\" -o{1}", ISOFilePath, ExtractDirectory);    //{0} ISO Filename, {1} extraction dir

            //
            //Extracting ISO Contents
            //
            Log.updateStatus("Status: Extract ISO... Please wait");
            Log.write("-Extract ISO");
            if (!ExecuteCLICommand(ExecutablePath, ExecutableArgs))
            {
                return(false);
            }

            return(true);
        }
        public void Uninstall(String InstallDrive = "0")
        {
            String InstallDirectory = String.Format(config.INSTALL_DIR, InstallDrive);

            Log.write(String.Format("====Uninstall Started on {0}====", DateTime.Now));

            InstallDrive = SearchForPreviousInstallation(config.INSTALL_FOLDER);
            if (InstallDrive != "0")
            {
                cleanup(String.Format(config.INSTALL_DIR, InstallDrive));
            }
            else
            {
                Log.write("Android Installation Not Found");
            }
            FirmwarePrivilege.Enable();
            UnInstallBootObjects(null);
            FirmwarePrivilege.Revert();
            Log.updateStatus("Cleanup complete!");
            Log.write("==========================================");
        }
        private Boolean DetectAndroidVariant(String ISOFilePath, String ExtractDirectory)
        {
            //Extract grub.cfg
            //Check for androidboot.hardware value
            //Set config.remixos

            string ExecutablePath = Environment.CurrentDirectory + @"\7z.exe";
            string ExecutableArgs = String.Format(" e \"{0}\" \"boot\\grub\\grub.cfg\" -o{1}", ISOFilePath, ExtractDirectory);

            Log.updateStatus("Status: Check Android variant type...");
            if (!ExecuteCLICommand(ExecutablePath, ExecutableArgs))
            {
                return(false);
            }

            if (!File.Exists(ExtractDirectory + @"\grub.cfg"))
            {
                return(false);
            }

            String grubcfg = File.ReadAllText(ExtractDirectory + @"\grub.cfg");

            int idx = grubcfg.IndexOf("remix");

            if (idx <= 0)
            {
                config.RemixOS_Found = false;
            }
            else
            {
                Log.write("RemixOS Found");
                config.RemixOS_Found = true;
            }

            File.Delete(ExtractDirectory + @"\grub.cfg");
            return(true);
        }
        public virtual Boolean Install(String ISOFilePath, String InstallDrive, String UserDataSize)
        {
            String InstallDirectory = String.Format(config.INSTALL_DIR, InstallDrive);

            Log.write(String.Format("====Install Started on {0}====", DateTime.Now));
            Log.write("-ISO File: " + ISOFilePath);
            Log.write("-TargetDrive: " + InstallDrive);
            Log.write("-UserData: " + UserDataSize);

            String OtherInstall = SearchForPreviousInstallation(config.INSTALL_FOLDER);

            if (OtherInstall != "0")
            {
                Log.write("Another Installation found on: " + OtherInstall + @":\");
                return(false);
            }

            if (!SetupDirectories(InstallDirectory))
            {
                return(false);
            }

            if (!ExtractISO(ISOFilePath, InstallDirectory))
            {
                goto cleanup;
            }

            /*
             * System.sfs found extract it
             * System.sfs included in Androidx86 dist and not found with RemixOS
             */
            if (File.Exists(InstallDirectory + @"\system.sfs"))
            {
                if (!ExtractSFS(InstallDirectory))
                {
                    goto cleanup;
                }
            }

            if (!DetectAndroidVariant(ISOFilePath, InstallDirectory))
            {
                goto cleanup;
            }

            String[] FileList = { InstallDirectory + @"\kernel",
                                  InstallDirectory + @"\initrd.img",
                                  InstallDirectory + @"\ramdisk.img",
                                  InstallDirectory + @"\system.img", };
            if (!VerifyFiles(FileList))
            {
                goto cleanup;
            }

            if (!CreateDataParition(InstallDirectory, UserDataSize))
            {
                goto cleanup;
            }

            if (!FormatDataPartition(InstallDirectory))
            {
                goto cleanup;
            }

            if (!WriteAndroidIDFile(InstallDirectory))
            {
                goto cleanup;
            }

            if (!InstallBootObjects(null))
            {
                goto cleanup;
            }

            Log.write("==========================================");
            Log.updateStatus("Installation finished!");
            return(true);

cleanup:
            Log.updateStatus("Installation failed, Rolling back");
            Log.write("==============Revert Installation==============");
            cleanup(InstallDirectory);
            UnInstallBootObjects(null);
            Log.write("==========================================");
            Log.updateStatus("Nothing happend");
            return(false);
        }