Ejemplo n.º 1
0
        public DiskDevice(IDiskControllerDevice diskController, uint driveNbr, bool readOnly)
        {
            base.parent         = (diskController as Device);
            base.name           = base.parent.Name + "/Disk" + driveNbr.ToString();
            base.deviceStatus   = DeviceStatus.Online;
            this.totalSectors   = diskController.GetTotalSectors(driveNbr);
            this.diskController = diskController;
            this.driveNbr       = driveNbr;

            if (readOnly)
            {
                this.readOnly = false;
            }
            else
            {
                this.readOnly = this.diskController.CanWrite(driveNbr);
            }

            mbr = new MasterBootBlock(this);

            if (mbr.Valid)
            {
                for (uint i = 0; i < MasterBootBlock.MaxMBRPartitions; i++)
                {
                    if (mbr[i].PartitionType != PartitionTypes.Empty)
                    {
                        new PartitionDevice(mbr[i], this, readOnly);
                    }
                }
            }
        }
Ejemplo n.º 2
0
		public DiskDevice (IDiskControllerDevice diskController, uint driveNbr, bool readOnly)
		{
			base.parent = (diskController as Device);
			base.name = base.parent.Name + "/Disk" + driveNbr.ToString ();
			base.deviceStatus = DeviceStatus.Online;
			this.totalSectors = diskController.GetTotalSectors (driveNbr);
			this.diskController = diskController;
			this.driveNbr = driveNbr;

			if (readOnly)
				this.readOnly = false;
			else
				this.readOnly = this.diskController.CanWrite (driveNbr);

			mbr = new MasterBootBlock (this);

			if (mbr.Valid)
				for (uint i = 0; i < MasterBootBlock.MaxMBRPartitions; i++)
					if (mbr[i].PartitionType != PartitionTypes.Empty)
						new PartitionDevice (mbr[i], this, readOnly);
		}