Пример #1
0
 /**
  * Disable HackBGRT, restore the original boot loader.
  */
 protected void Disable()
 {
     if (MsLoader.Type != BootLoaderType.MS)
     {
         if (!MsLoader.ReplaceWith(MsLoaderBackup))
         {
             throw new SetupException("Couldn't restore the old MS loader.");
         }
     }
     Console.WriteLine(MsLoader.Path + " has been restored.");
 }
Пример #2
0
 /**
  * Install files and replace the MsLoader with our own.
  */
 protected void Install(bool showEditors = true)
 {
     try {
         if (!Directory.Exists(Destination))
         {
             Directory.CreateDirectory(Destination);
         }
     } catch {
         throw new SetupException("Failed to copy files to ESP!");
     }
     if (MsLoader.Type == BootLoaderType.MS)
     {
         if (!MsLoaderBackup.ReplaceWith(MsLoader))
         {
             throw new SetupException("Failed to backup MS boot loader!");
         }
     }
     if (MsLoaderBackup.Type != BootLoaderType.MS)
     {
         // Duplicate check, but better to be sure...
         throw new SetupException("Failed to detect MS boot loader!");
     }
     if (!NewLoader.ReplaceWith(NewLoaderSource))
     {
         throw new SetupException("Couldn't copy new HackBGRT to ESP.");
     }
     if (!File.Exists(Config))
     {
         Copy(Source + "\\config.txt", Config);
     }
     if (!File.Exists(Splash))
     {
         Copy(Source + "\\splash.bmp", Splash);
     }
     if (showEditors)
     {
         Configure();
     }
     if (!MsLoader.ReplaceWith(NewLoader))
     {
         MsLoader.ReplaceWith(MsLoaderBackup);
         throw new SetupException("Couldn't copy new HackBGRT over the MS loader (bootmgfw.efi).");
     }
     Console.WriteLine("HackBGRT is now installed.");
 }