Esempio n. 1
0
        private void cmbFormat_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Make sure drive letter is formatted
            formatDriveLetter = cmbFormat.SelectedItem.ToString().Substring(0, 2); // C:

            //Load the info from the selected drive
            txtVolumeLabel.Text = DriveInfoClass.GetDriveLabel(formatDriveLetter);                        // New Volume
            txtDriveSize.Text   = DriveInfoClass.GetDriveSize(formatDriveLetter).ToString("0.0") + " GB"; // 32.0 GB
        }
Esempio n. 2
0
        public bool VerifyFormatData(string driveLetter)
        {
            //Check that the drive selected is not the OS drive
            if (DriveInfoClass.ISOSDrive(driveLetter))
            {
                MessageBox.Show("You cannot format an OS drive!",
                                "ERROR",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            else
            {
                //Make sure that the user knows the repercussions.
                DialogResult result = MessageBox.Show("WARNING: Formatting will erase ALL data on this disk." +
                                                      " To format the disk, click OK. To quit, click CANCEL",
                                                      "Format " + DriveInfoClass.GetDriveLabel(driveLetter) + " " + driveLetter,
                                                      MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result == DialogResult.OK)
                {
                    volumeLabel = txtVolumeLabel.Text;
                    fileSystem  = cmbFileSystem.SelectedItem.ToString();
                    quickFormat = chkQuickFormat.Checked;
                    compression = chkCompression.Checked;

                    //Make sure drive letter is formatted as ex: "C:"
                    driveLetter = cmbFormat.SelectedItem.ToString();
                    driveLetter = driveLetter.Substring(0, 2);

                    //Get Allocation size
                    //Get the number from the text on the combo box
                    string temp = cmbAllocationSize.SelectedItem.ToString();
                    int    pos  = temp.IndexOf(" ");
                    temp = temp.Substring(0, pos);

                    //Check to see if the selected item is above the 4th item
                    if (cmbAllocationSize.SelectedIndex > 4)
                    {
                        clusterSize = Convert.ToInt32(temp) * 1000;
                    }
                    else
                    {
                        clusterSize = Convert.ToInt32(temp);
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }