public static void InstallTo(Partition efi)
        {
            var path = efi.GetDriveLetter();

            if (path == null)
            {
                efi.AssignDriveLetter();
                path = efi.GetDriveLetter() !;
            }

            var targetPath = DiskScanner.GetBootNextDir(path);

            Directory.CreateDirectory(targetPath);

            var dir = Path.GetDirectoryName(Assembly.GetEntryAssembly() !.Location) !;

            foreach (var file in Directory.GetFiles(Path.Combine(dir, "Resources", "BootNext")))
            {
                if (file == null)
                {
                    continue;
                }

                var fileName = Path.GetFileName(file);
                File.Copy(file, Path.Combine(targetPath, fileName), true);
            }
        }
示例#2
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            var efis   = DiskScanner.FindInstalledEfis().ToList();
            var target = FindTarget(efis);

            if (efis.Count == 0)
            {
                BootMessageBox.Show("BootNext not installed",
                                    "BootNext is not installed yet. You will be taken to the settings dialog.");
            }
            else if (target == null)
            {
                BootMessageBox.Show("Multiple instances found",
                                    "Multiple BootNext instances found. Please select the one you want to use.");
            }

            if (target == null)
            {
                var settings = new SettingsWindow();
                settings.Show();
            }
            else
            {
                Settings.Default.PreferredEFI = target.Guid;
                Settings.Default.Save();

                var bootDir = DiskScanner.GetBootNextDir(target) !;
                var window  = new MainWindow(bootDir);
                window.Show();
            }
        }
示例#3
0
        public SettingsWindow()
        {
            InitializeComponent();

            var efis = DiskScanner.FindEfis().ToList();

            AllEfisList.ItemsSource = efis;

            ReloadInstalled();
        }
示例#4
0
        private void SettingsWindow_OnClosing(object sender, CancelEventArgs e)
        {
            var target = FoundInstallationsList.Items
                         .OfType <InstalledPartition>()
                         .Where(x => x.IsSelected)
                         .Select(x => x.Partition)
                         .FirstOrDefault();

            Debug.WriteLine($"Exiting {target}");

            if (target == null)
            {
                return;
            }

            // build config path
            var bootDir = DiskScanner.GetBootNextDir(target) !;
            // show main window
            var window = new MainWindow(bootDir);

            window.Show();
        }
示例#5
0
 private Partition?FindTarget()
 {
     return(FindTarget(DiskScanner.FindInstalledEfis().ToList()));
 }