Example #1
0
 public MasterBootBlock(IDiskDevice diskDevice)
 {
     this.diskDevice = diskDevice;
     this.valid      = false;            // needs to be read first
     partitions      = new GenericPartition[MaxMBRPartitions];
     code            = null;
     ReadMasterBootBlock();
 }
Example #2
0
		public MasterBootBlock (IDiskDevice diskDevice)
		{
			this.diskDevice = diskDevice;
			this.valid = false;	// needs to be read first
			partitions = new GenericPartition[MaxMBRPartitions];
			code = null;
			ReadMasterBootBlock ();
		}
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MasterBootBlock"/> class.
 /// </summary>
 /// <param name="diskDevice">The disk device.</param>
 public MasterBootBlock(IDiskDevice diskDevice)
 {
     this.diskDevice = diskDevice;
     Partitions      = new GenericPartition[MaxMBRPartitions];
     for (uint i = 0; i < MaxMBRPartitions; i++)
     {
         Partitions[i] = new GenericPartition(i);
     }
     Read();
 }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PartitionDevice"/> class.
        /// </summary>
        /// <param name="diskDevice">The disk device.</param>
        /// <param name="partition">The partition.</param>
        /// <param name="readOnly">if set to <c>true</c> [read only].</param>
        public PartitionDevice(IDiskDevice diskDevice, GenericPartition partition, bool readOnly)
        {
            this.diskDevice = diskDevice;
            startBlock      = partition.StartLBA;
            blockCount      = partition.TotalBlocks;
            this.readOnly   = readOnly;

            base.Parent       = diskDevice as Device;
            base.Name         = base.Parent.Name + "/Partition" + (partition.Index + 1).ToString();     // need to give it a unique name
            base.DeviceStatus = DeviceStatus.Online;
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PartitionDevice"/> class.
        /// </summary>
        /// <param name="diskDevice">The disk device.</param>
        /// <param name="readOnly">if set to <c>true</c> [read only].</param>
        public PartitionDevice(IDiskDevice diskDevice, bool readOnly)
        {
            this.diskDevice = diskDevice;
            startBlock      = 0;
            blockCount      = diskDevice.TotalBlocks;
            this.readOnly   = readOnly;

            base.Parent       = diskDevice as Device;
            base.Name         = base.Parent.Name + "/Raw";      // need to give it a unique name
            base.DeviceStatus = DeviceStatus.Online;
        }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PartitionDevice"/> class.
        /// </summary>
        /// <param name="diskDevice">The disk device.</param>
        /// <param name="partition">The partition.</param>
        /// <param name="readOnly">if set to <c>true</c> [read only].</param>
        public PartitionDevice(IDiskDevice diskDevice, GenericPartition partition, bool readOnly)
        {
            this.diskDevice = diskDevice;
            this.startBlock = partition.StartLBA;
            this.blockCount = partition.TotalBlocks;
            this.readOnly = readOnly;

            base.parent = diskDevice as Device;
            base.name = base.parent.Name + "/Partition" + (partition.Index + 1).ToString();	// need to give it a unique name
            base.deviceStatus = DeviceStatus.Online;
        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PartitionDevice"/> class.
        /// </summary>
        /// <param name="diskDevice">The disk device.</param>
        /// <param name="readOnly">if set to <c>true</c> [read only].</param>
        public PartitionDevice(IDiskDevice diskDevice, bool readOnly)
        {
            this.diskDevice = diskDevice;
            this.startBlock = 0;
            this.blockCount = diskDevice.TotalBlocks;
            this.readOnly = readOnly;

            base.parent = diskDevice as Device;
            base.name = base.parent.Name + "/Raw";	// need to give it a unique name
            base.deviceStatus = DeviceStatus.Online;
        }
Example #8
0
        public static unsafe void Init(IDiskDevice dev)
        {
            SharedDisk = dev;

            var port = Serial.COM2;

            Serial.SetupPort(port);

            //var path = "os/App.Shell.bin";
            //StartProcess(path);
        }
Example #9
0
        public PartitionDevice(GenericPartition partition, IDiskDevice diskDevice, bool readOnly)
        {
            this.diskDevice = diskDevice;
            this.start      = partition.StartLBA;
            this.blockCount = partition.TotalBlocks;
            this.readOnly   = readOnly;

            base.parent       = diskDevice as Device;
            base.name         = base.parent.Name + "/Partition" + (partition.Index + 1).ToString(); // need to give it a unique name
            base.deviceStatus = DeviceStatus.Online;

            DeviceManager.Add(this);
        }
        public override void Initialize()
        {
            var configuration = Device.Configuration as DiskPartitionConfiguration;

            StartBlock = configuration.StartLBA;
            BlockCount = configuration.TotalBlocks;
            ReadOnly   = configuration.ReadOnly;

            diskDevice = Device.Parent.DeviceDriver as IDiskDevice;
            BlockSize  = diskDevice.BlockSize;

            Device.ComponentID = StartBlock;

            if (StartBlock == 0)
            {
                Device.Name = Device.Parent.Name + "/Raw";
            }
            else
            {
                Device.Name = Device.Parent.Name + "/Partition" + (configuration.Index + 1).ToString();
            }
        }
        /// <summary>
        /// Creates the partition devices.
        /// </summary>
        public void CreatePartitionDevices()
        {
            // FIXME: Do not create multiple partition devices if this method executed more than once

            // Find all online disk devices
            foreach (IDevice device in deviceManager.GetDevices(new FindDevice.IsDiskDevice(), new FindDevice.IsOnline()))
            {
                IDiskDevice diskDevice = device as IDiskDevice;

                MasterBootBlock mbr = new MasterBootBlock(diskDevice);

                if (mbr.Valid)
                {
                    for (uint i = 0; i < MasterBootBlock.MaxMBRPartitions; i++)
                    {
                        if (mbr.Partitions[i].PartitionType != PartitionType.Empty)
                        {
                            deviceManager.Add(new PartitionDevice(diskDevice, mbr.Partitions[i], false));
                        }
                    }
                }
            }
        }
Example #12
0
        public T GetCustomDevice <T> (T device) where T : class, IDevice
        {
            IDiskDevice disk_device = device as IDiskDevice;
            IVolume     volume      = device as IVolume;

            if (volume != null && CheckStorageCaps(volume.Parent) && CheckVolume(volume))
            {
                return(AsPodSleuthDevice <T> (volume, device));
            }
            else if (disk_device == null || !CheckStorageCaps(device))
            {
                return(device);
            }

            foreach (IVolume child_volume in disk_device.Volumes)
            {
                if (CheckVolume(child_volume))
                {
                    return(AsPodSleuthDevice <T> (child_volume, device));
                }
            }

            return(device);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GUIDPartitionTable"/> class.
 /// </summary>
 /// <param name="diskDevice">The disk device.</param>
 public GUIDPartitionTable(IDiskDevice diskDevice)
 {
     this.diskDevice = diskDevice;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GUIDPartitionTable"/> class.
 /// </summary>
 /// <param name="diskDevice">The disk device.</param>
 public GUIDPartitionTable(IDiskDevice diskDevice)
 {
     this.diskDevice = diskDevice;
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MasterBootBlock"/> class.
 /// </summary>
 /// <param name="diskDevice">The disk device.</param>
 public MasterBootBlock(IDiskDevice diskDevice)
 {
     this.diskDevice = diskDevice;
     Partitions = new GenericPartition[MaxMBRPartitions];
     for (uint i = 0; i < MaxMBRPartitions; i++)
         Partitions[i] = new GenericPartition(i);
     Read();
 }
Example #16
0
 public DiskReplaceRecommendation(IDiskDevice disk, string explanation)
 {
     _source     = disk;
     Explanation = explanation;
 }