private void ShowDetailedUsage() { if (duf == null || duf.IsDisposed) { duf = new DiskUsageForm(); duf.Icon = Icon; } // Sorry, I know it looks like there is a MVC pattern in use, but really it's just // a giant f*****g mess. DiskUsageView duv = new DiskUsageView(); DiskUsageModel dum = new DiskUsageModel(vhd.masterBootRecord.getPartitionRecords()); DiskUsageController duc = new DiskUsageController(); // DiskModel dm = new DiskModel(vhd.footer, vhd.dynamicHeader, vhd.blockAllocationTable, vhd.masterBootRecord); duf.AddDisk(vhd); duf.Show(); //duf.footer = vhd.footer; //duf.dynamicHeader = vhd.dynamicHeader; //duf.blockAllocationTable = vhd.blockAllocationTable; //duf.masterBootRecord = vhd.masterBootRecord; //duf.diskModel = dm; // A duplication of the above 4. //duv.model = dum; //duv.controller = duc; //duf.AddDisk(duv); //duf.Text = filename; //duf.Show(); // duf.AddDisk(vhd); }
private void ShowDetailedUsage() { using (RotateWaitThreaded.Hold("Processing MBR for {0}", vhd.Filename)) { // Sorry, I know it looks like there is a MVC pattern in use, but really it's just // a giant f*****g mess. DiskUsageView duv = new DiskUsageView(); DiskUsageModel dum = new DiskUsageModel(vhd.masterBootRecord.getPartitionRecords()); DiskUsageController duc = new DiskUsageController(); // DiskModel dm = new DiskModel(vhd.footer, vhd.dynamicHeader, vhd.blockAllocationTable, vhd.masterBootRecord); } }
//internal void AddDisk(DiskUsageView duv) //{ // view = duv; // model = view.model; // MakeView(); //} internal void AddDisk(VirtualHardDisk vhd) { // TODO: Handle virtualDIskException //this.footer = vhd.footer; //this.dynamicHeader = vhd.dynamicHeader; //this.blockAllocationTable = vhd.blockAllocationTable; //this.masterBootRecord = vhd.masterBootRecord; this.vhd = vhd; if (vhd.vhdReadException == null) { if (CSharp.cc.Files.CheckIfFileIsBeingUsed(vhd.Filename)) { vhd.IOExceptionMessage = (string)CSharp.cc.Files.LastErrorMessage; } if (vhd.masterBootRecord != null) { this.model = new DiskUsageModel(vhd.masterBootRecord.getPartitionRecords()); } if (CSharp.cc.Files.CheckIfFileIsBeingUsed(vhd.Filename)) { vhd.IOExceptionMessage = (string)CSharp.cc.Files.LastErrorMessage; } } /* * this._disk = new Medo.IO.VirtualDisk(vhd.footer.FileName); * this._disk.Open(Medo.IO.VirtualDisk.NativeMethods.VIRTUAL_DISK_ACCESS_MASK.VIRTUAL_DISK_ACCESS_GET_INFO); * // this._disk.Attach(Medo.IO.VirtualDiskAttachOptions.None); * string _device = this._disk.GetPhysicalPath(); * if (!String.IsNullOrEmpty(_device)) * { * this.vhd.MountedAs = _device; * this.vhd.Partitions = DisksAndPartitions.GetPartitions(_device); * } * this._disk.Close(); * this._disk = null; */ MakeView(); }