public void LoadHeaders(string filename)
        {
            try
            {
                this.Filename = filename;
                footer        = new Footer();
                footer.FromFile(filename);

                if (footer.DataOffset > 0)
                {
                    dynamicHeader = new DynamicHeader();
                    dynamicHeader.FromFile(filename, (int)footer.DataOffset);
                    blockAllocationTable = new BlockAllocationTable(dynamicHeader.TableOffset, dynamicHeader.BlockSize, dynamicHeader.MaxTableEntries);
                    blockAllocationTable.FromFile(filename);
                    masterBootRecord = new MasterBootRecord(blockAllocationTable);
                    // ShowUsage();
                    // ShowDetailedUsage();
                }
                else
                {
                    masterBootRecord = new MasterBootRecord(filename, 0);
                    // MessageBox.Show("So far all the good stuff involves Dynamic VHDs, so all you get is this pretty box really.", "Fixed VHD", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (VhdReadException ex)
            {
                this.vhdReadException = ex;
            }
        }
        public PartitionRoundedPanel(int Partition, int PartitionCount, PartitionController Controller)
        {
            Number          = Partition;
            ChildCount      = PartitionCount;
            this.controller = Controller;

            // this.Margin = new Padding(5);
            // this.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5);

            InitializeComponent();

            if (Controller.vhd.vhdReadException != null)
            {
                this.vhdReadException   = Controller.vhd.vhdReadException;
                greenPartitionView1.Hue = 0.2F;
            }
            // If we're checking this AFTER InitializeComponent and it appears to be working fine, we need to check when the actual bitmaps
            // and other complex drawing routines actually trigger.
            //
            // ... hmmm, apparently this is causing the MyLabel2's to draw (and request parent draw)
            // before we adjust our width.

            if (Number == 0)
            {
                greenPartitionView1.ShadowLeft = true;
            }

            if (Number == ChildCount - 1)
            {
                greenPartitionView1.ShadowRight = true;
            }

            if (controller.ClusterBitArray != null)
            {
                greenPartitionView1.ProgressBar = true;
                // greenPartitionView1.ClusterUsage = controller.ClusterBitArray;
            }

            // QuickTip.Add(UsedSpaceBar, "Used space");
            // QuickTip.Add(blackProgressBar1, "Used space");
            //using (Bitmap b = new Bitmap(Properties.Resources.MagnifyingGlass_96_64_centered))
            //{
            //    Cursor c = new Cursor(b.GetHicon());
            //    blackProgressBar1.Cursor = c;
            //}

            ResizeRedraw = true;

            //this.BackColor = Color.LightGreen;
            // this.RectangleFillColor = Color.WhiteSmoke;
            // this.Dock = System.Windows.Forms.DockStyle.Fill;

            //this.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)
            //            | System.Windows.Forms.AnchorStyles.Left)
            //            )));
        }
 public VirtualHardDisk(string filename, VhdReadException ex)
 {
     this.Filename         = filename;
     this.vhdReadException = ex;
 }