Esempio n. 1
0
        private bool read(raid0 array)
        {       //true - failure, false - OK
            List <sbyte> readHere = new List <sbyte>();

            readTime = array.readFromArray(readHere);
            if (readTime == -1)
            {
                readTime = 0;
                return(true);
            }
            textBox2.Text = readTime.ToString();
            readTime      = 0;
            return(false);
        }
Esempio n. 2
0
        private bool write(raid0 array)
        {       //true - in case of failure; false - in case of success
            List <sbyte> toWrite = new List <sbyte>(textBox1.Text.Length);

            foreach (char ch in textBox1.Text)
            {
                toWrite.Add(Convert.ToSByte(ch));
            }

            writeTime = array.writeToArray(toWrite);
            if (writeTime == -1)
            {
                writeTime = 0;
                return(true);
            }
            textBox3.Text = Convert.ToString(writeTime);
            writeTime     = 0;
            return(false);
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text = "";
            textBox3.Text = "";
            disk hdd;
            if(radioButton7.Checked)
            {
                hdd = new disk(78812649881.6, 16777216, 3.6f, 4);
            }
            else
            {
                if(radioButton6.Checked)
                    hdd = new disk(536870912000,16777216,8.5f,9.5f);
                else
                    hdd = new disk(193273528320,0,1.5f,2f);
            }

            if(radioButton0.Checked)
            {
                raid0 array = new raid0();
                for (int i = 0; i < numericUpDown1.Value; i++)
                    array.addDisk(hdd);
                if (write(array))
                {
                    MessageBox.Show("Ошибка записи в массив!");
                    textBox3.Text = "ERROR";
                }
                if (checkBox1.Checked)
                    array.breakRandDisk();
                if (read(array))
                {
                    textBox2.Text = "ERROR";
                    MessageBox.Show("Ошибка чтения из массива!");
                }
            }
            else
            {
                if (radioButton1.Checked)
                {
                    raid1 array = new raid1();
                    for (int i = 0; i < numericUpDown1.Value; i++)
                        array.addDisk(hdd);
                    if (write(array))
                    {
                        textBox3.Text = "ERROR";
                        MessageBox.Show("Ошибка записи в массив!");
                    }
                    if (checkBox1.Checked)
                        array.breakRandDisk();
                    if (read(array))
                    {
                        textBox2.Text = "ERROR";
                        MessageBox.Show("Ошибка чтения из массива!");
                    }
                }
                else
                {
                    raid5 array = new raid5();
                    for (int i = 0; i < numericUpDown1.Value; i++)
                        array.addDisk(hdd);
                    if (write(array))
                    {
                        textBox3.Text = "ERROR";
                        MessageBox.Show("Ошибка записи в массив!");
                    }
                    if (checkBox1.Checked)
                        array.breakRandDisk();
                    if (read(array))
                    {
                        textBox2.Text = "ERROR";
                        MessageBox.Show("Ошибка чтения из массива!");
                    }
                }
            }
        }
Esempio n. 4
0
        private bool write(raid0 array)
        {
            //true - in case of failure; false - in case of success
            List<sbyte> toWrite = new List<sbyte>(textBox1.Text.Length);
            foreach (char ch in textBox1.Text)
                toWrite.Add(Convert.ToSByte(ch));

            writeTime = array.writeToArray(toWrite);
            if (writeTime == -1)
            {
                writeTime = 0;
                return true;
            }
            textBox3.Text = Convert.ToString(writeTime);
            writeTime = 0;
            return false;
        }
Esempio n. 5
0
 private bool read(raid0 array)
 {
     //true - failure, false - OK
     List<sbyte> readHere = new List<sbyte>();
     readTime = array.readFromArray(readHere);
     if(readTime == -1)
     {
         readTime = 0;
         return true;
     }
     textBox2.Text = readTime.ToString();
     readTime = 0;
     return false;
 }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text = "";
            textBox3.Text = "";
            disk hdd;

            if (radioButton7.Checked)
            {
                hdd = new disk(78812649881.6, 16777216, 3.6f, 4);
            }
            else
            {
                if (radioButton6.Checked)
                {
                    hdd = new disk(536870912000, 16777216, 8.5f, 9.5f);
                }
                else
                {
                    hdd = new disk(193273528320, 0, 1.5f, 2f);
                }
            }

            if (radioButton0.Checked)
            {
                raid0 array = new raid0();
                for (int i = 0; i < numericUpDown1.Value; i++)
                {
                    array.addDisk(hdd);
                }
                if (write(array))
                {
                    MessageBox.Show("Ошибка записи в массив!");
                    textBox3.Text = "ERROR";
                }
                if (checkBox1.Checked)
                {
                    array.breakRandDisk();
                }
                if (read(array))
                {
                    textBox2.Text = "ERROR";
                    MessageBox.Show("Ошибка чтения из массива!");
                }
            }
            else
            {
                if (radioButton1.Checked)
                {
                    raid1 array = new raid1();
                    for (int i = 0; i < numericUpDown1.Value; i++)
                    {
                        array.addDisk(hdd);
                    }
                    if (write(array))
                    {
                        textBox3.Text = "ERROR";
                        MessageBox.Show("Ошибка записи в массив!");
                    }
                    if (checkBox1.Checked)
                    {
                        array.breakRandDisk();
                    }
                    if (read(array))
                    {
                        textBox2.Text = "ERROR";
                        MessageBox.Show("Ошибка чтения из массива!");
                    }
                }
                else
                {
                    raid5 array = new raid5();
                    for (int i = 0; i < numericUpDown1.Value; i++)
                    {
                        array.addDisk(hdd);
                    }
                    if (write(array))
                    {
                        textBox3.Text = "ERROR";
                        MessageBox.Show("Ошибка записи в массив!");
                    }
                    if (checkBox1.Checked)
                    {
                        array.breakRandDisk();
                    }
                    if (read(array))
                    {
                        textBox2.Text = "ERROR";
                        MessageBox.Show("Ошибка чтения из массива!");
                    }
                }
            }
        }