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;
}