Пример #1
0
        private void button_Write_Click(object sender, EventArgs e)
        {
            if (comboBox_Disk.SelectedIndex == -1)
            {
                MessageBox.Show("Please sectet the disk at fisrt!", "Warning!");
                return;
            }

            if ((manual_data_buffer == null) ||
                (manual_data_buffer.Length != Convert.ToInt32(textBox_PaddingLength.Text.Trim()))
                )
            {
                MessageBox.Show("Please fullfill the data buffer before write", "Warning!");
                return;
            }

            int max_lba = Convert.ToInt32(textBox_Sector.Text) - 1;

            T = new Zgke.DriverLoader(comboBox_Disk.SelectedItem.ToString(), max_lba);

            int lba    = Convert.ToInt32(textBox_lba.Text);
            int length = Convert.ToInt32(textBox_Length.Text);

            T.WritSector(manual_data_buffer, lba, length);
            T.Close();
        }
Пример #2
0
        private void button_CheckRealSize_Click(object sender, EventArgs e)
        {
            if (comboBox_Disk.SelectedIndex == -1)
            {
                MessageBox.Show("Please sectet the disk at fisrt!", "Warning!");
                return;
            }

            long tmp_max_lba = Convert.ToInt64(textBox_Sector.Text);

            T = new Zgke.DriverLoader(comboBox_Disk.SelectedItem.ToString(), tmp_max_lba * 2);

            tmp_max_lba = tmp_max_lba / 8 * 8;
            while (true)
            {
                Console.WriteLine("Check lba:{0}", tmp_max_lba);

                manual_data_buffer = T.ReadSector(tmp_max_lba, 8);
                if (manual_data_buffer == null)
                {
                    break;
                }
                tmp_max_lba += 8;
            }

            textBox_Progress.Text = "Check lba:" + tmp_max_lba.ToString();

            textBox_Byte.Text   = (tmp_max_lba * 512).ToString();
            textBox_Sector.Text = tmp_max_lba.ToString();
            textBox_GB.Text     = ((tmp_max_lba * 512) / 1024 / 1024 / 1024).ToString();

            T.Close();
        }
Пример #3
0
        private void button_Read_Click(object sender, EventArgs e)
        {
            if (comboBox_Disk.SelectedIndex == -1)
            {
                MessageBox.Show("Please sectet the disk at fisrt!", "Warning!");
                return;
            }

            int max_lba = Convert.ToInt32(textBox_Sector.Text) - 1;

            T = new Zgke.DriverLoader(comboBox_Disk.SelectedItem.ToString(), max_lba);

            int lba    = Convert.ToInt32(textBox_lba.Text);
            int length = Convert.ToInt32(textBox_Length.Text);

            manual_data_buffer = T.ReadSector(lba, length);
            T.Close();

            textBox_Data.Text = T.GetString(manual_data_buffer);
        }