private void ContinueButton_Click(object sender, EventArgs e) { InstallerSettings.InstallDirectory = Path.GetFullPath(InstallDirectoryTextBox.Text); InstallerSettings.DownloadDirectory = Path.GetFullPath(DownloadDirectoryTextBox.Text); InstallerSettings.ConfigurationUrl = ConfigurationUrlTextBox.Text; // change download directory when install & download directory // are the same if (InstallerSettings.InstallDirectory == InstallerSettings.DownloadDirectory) { InstallerSettings.DownloadDirectory = Path.Combine(InstallerSettings.DownloadDirectory, "temporary_download_cache"); } // make sure the installation directory is empty if (!IsDirectoryEmpty(InstallerSettings.InstallDirectory)) { MessageBox.Show("Please choose an empty installation directory", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // ask the user if they want to create the download & install directory // if they don't exist yet if (!AskCreateDirectory("Temporary Download", InstallerSettings.DownloadDirectory) || !AskCreateDirectory("Project64 Install", InstallerSettings.InstallDirectory)) { return; } // fetch configuration file #if !DEBUG try { #endif if (InstallerComponents == null || InstallerSettings.DeveloperMode) { InstallerComponents = JsonConvert.DeserializeObject <InstallerComponents>( new WebClient().DownloadString( InstallerSettings.ConfigurationUrl)); } #if !DEBUG } catch (Exception) { MessageBox.Show("Failed to fetch configuration file!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #endif this.Hide(); new SelectInstallComponents(InstallerComponents) { StartPosition = FormStartPosition.Manual, Location = this.Location }.Show(); }
public SelectInstallComponents(InstallerComponents installerComponents) { InitializeComponent(); // we sadly need InstallerComponents really early // so we set it here this.InstallerComponents = installerComponents; // readonly 'placeholder' item InstallComponentsList.Items.Add("Project64", CheckState.Indeterminate); DescriptionList.Add("N64 Emulator"); foreach (InstallerComponent component in InstallerComponents.Components) { InstallComponentsList.Items.Add(component.Name, component.Enabled); DescriptionList.Add(component.Description); } }
public SelectInstallComponents(InstallerComponents installerComponents) { InitializeComponent(); // we sadly need InstallerComponents really early // so we set it here this.InstallerComponents = installerComponents; foreach (InstallerComponent component in InstallerComponents.Components) { int componentIndex = InstallComponentsList.Items.Add(component.Name, component.Enabled); if (component.ReadOnly) { InstallComponentsList.SetItemCheckState(componentIndex, CheckState.Indeterminate); } DescriptionList.Add(component.Description); } }