Example #1
0
        private string GetMBRItem(int i, int y, Form1.MBR mbr)
        {
            string str = "";

            switch (i)
            {
            case 0:
                str = mbr._status[y] != (byte)128 ? (mbr._status[y] != (byte)0 ? "invalid" : "inactive") : "active or bootable";
                break;

            case 1:
                str = "CHS Adress First ";
                for (int index = 0; index < 3; ++index)
                {
                    str += mbr._chsAdressFirst[y, index].ToString();
                }
                break;

            case 2:
                str = "Partition type " + (object)mbr._type[y];
                break;

            case 3:
                str = "CHS Adress Last ";
                for (int index = 0; index < 3; ++index)
                {
                    str += mbr._chsAdressLast[y, index].ToString();
                }
                break;

            case 4:
                str = "LBA ";
                for (int index = 0; index < 4; ++index)
                {
                    str += mbr._LBA[y, index].ToString();
                }
                break;

            case 5:
                str = "Number of sectors in partition ";
                for (int index = 0; index < 4; ++index)
                {
                    str += mbr._numberOfSectors[y, index].ToString();
                }
                break;
            }
            return(str);
        }
Example #2
0
        private void ShowInfoMBR(Form1.MBR mbr)
        {
            string str = "Boot signature is " + (mbr._flag ? "legal" : "illegal");

            this.mbrListView.Items.Clear();
            for (int i = 0; i < 6; ++i)
            {
                ListViewItem listViewItem = new ListViewItem()
                {
                    Text = i == 0 ? str : ""
                };
                for (int y = 0; y < 4; ++y)
                {
                    listViewItem.SubItems.Add(this.GetMBRItem(i, y, mbr));
                }
                this.mbrListView.Items.Add(listViewItem);
            }
        }