private void applyButton_Click(object sender, EventArgs e) { string bootDrive = driveComboBox.GetItemText( driveComboBox.SelectedItem).Split(' ')[0].TrimEnd('\\'); if (!ValidateSettings(bootDrive)) { return; } string networkName = nameTextBox.Text; string username = userTextBox.Text; string password = passwordTextBox.Text; bool shouldEncrypt = encryptCheckBox.Checked; string networkConfig; if (typeComboBox.SelectedIndex == 0) { networkConfig = WpaPersonal.GetConfig(networkName, password, shouldEncrypt); } else { networkConfig = WpaEnterprise.GetConfig(networkName, username, password, shouldEncrypt); } ConfigureImage(bootDrive, networkConfig, sshCheckBox.Checked); MessageBox.Show("SD card image has been configured successfully.", "Info"); }
private void startButton_Click(object sender, EventArgs e) { string bootDrive = driveComboBox.GetItemText( driveComboBox.SelectedItem).Split(' ')[0].TrimEnd('\\'); if (!Directory.Exists(bootDrive)) { MessageBox.Show("The drive you have selected is no longer accessible.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!File.Exists(Path.Combine(bootDrive, "kernel.img"))) { MessageBox.Show("The drive you have selected is not a Raspbian SD card.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (passwordTextBox.Text != passwordTextBox2.Text) { MessageBox.Show("The passwords you have entered do not match.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (typeComboBox.SelectedIndex == 0 && (passwordTextBox.Text.Length < 8 || passwordTextBox.Text.Length > 63)) { MessageBox.Show("Password must be between 8 and 63 characters long.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (typeComboBox.SelectedIndex == 1 && passwordTextBox.Text.Length > 14) { MessageBox.Show("Password cannot exceed 14 characters in length.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string networkName = nameTextBox.Text; string username = userTextBox.Text; string password = passwordTextBox.Text; string networkConfig; if (typeComboBox.SelectedIndex == 0) { networkConfig = WpaPersonal.GetConfig(networkName, password); } else { networkConfig = WpaEnterprise.GetConfig(networkName, username, password); } ConfigureImage(bootDrive, networkConfig, sshCheckBox.Checked); MessageBox.Show("SD card image has been configured successfully.", "Info"); }