Ejemplo n.º 1
0
        public async Task Execute(string partitionDescriptor, string gptTypeString)
        {
            var partition = await fileSystem.GetPartitionFromDescriptor(partitionDescriptor);

            var gptType = PartitionType.FromString(gptTypeString);
            await partition.SetGptType(gptType);
        }
		/// <summary>
		/// Reads the File Allocation Table of a FAT filesystem.
		/// </summary>
		public FileAllocationTable(IFileSystemStore store, long fatOffset, long fatSizeInBytes, PartitionType type) {
			_store = store;
			_fatOffset = fatOffset;
			_fatSizeInBytes = fatSizeInBytes;
			if (type == PartitionType.FAT16) {
				_entrySize = 2;
			} else { // FAT32
				_entrySize = 4;
			}
			_numEntries = (int)(fatSizeInBytes / _entrySize);

			// If the FAT is small enough, just load it into memory.
			// Otherwise, we'll read from the disk on demand.
			if (fatSizeInBytes < 100 * 1024 * 1024) { // < 100 MB
				_fatEntries = new uint[_numEntries];
				int i = 0;
				for (long offset = 0; offset < fatSizeInBytes; offset += _entrySize) {
					_fatEntries[i] = (uint)Util.GetArbitraryUInt(store, (ulong)(fatOffset + offset), (int)_entrySize);
					++i;
				}
				_inMemory = true;
			} else {
				_inMemory = false;
			}
		}
Ejemplo n.º 3
0
        public void Given_PartitionType_Then_It_Should_Return_Result(PartitionType collection)
        {
            var entity = new UrlItemEntity();

            entity.PartitionKey.Should().Be(collection.ToString());
            entity.PartitionKeyPath.Should().Be("/collection");
        }
Ejemplo n.º 4
0
 internal WiiPartitionInfo(PartitionType type, long offset, int table, long tablePos)
 {
     DiscOffset  = SrcDiscOffset = offset;
     Table       = table;
     Type        = type;
     TableOffset = tablePos;
 }
Ejemplo n.º 5
0
        protected PrimitiveService Partition(Type key, PartitionType type, int partitionCount = 1)
        {
            PartitionKey   = key;
            PartitionType  = type;
            PartitionCount = partitionCount;

            return(this);
        }
Ejemplo n.º 6
0
        private static void SetPartition(byte[] buffer, ushort part, PartitionType type, uint start, uint length)
        {
            var offset = PartStart + part * PartLength;

            SetValue(buffer, (byte)type, offset + TypeOffset);
            SetValue(buffer, start, offset + StartOffset);
            SetValue(buffer, length, offset + LengthOffset);
        }
Ejemplo n.º 7
0
        public static List <int> Sort(IList <int> list, PartitionType partitionType)
        {
            if (list?.Any() != true)
            {
                return(new List <int>());
            }

            return(QuickSort(list.ToList(), 0, list.Count - 1, partitionType));
        }
Ejemplo n.º 8
0
        private static PartitionType[] GetPartitionTypes(byte[] buffer)
        {
            var types = new PartitionType[PartCount];

            for (var i = 0; i < PartCount; i++)
            {
                types[i] = (PartitionType)buffer[PartStart + i * PartLength + TypeOffset];
            }
            return(types);
        }
        public async Task <string> Execute(int diskNumber, string partitionType, string label = "")
        {
            var disk = await fileSystem.GetDisk(diskNumber);

            var partition = await disk.CreatePartition(PartitionType.FromString(partitionType), label);

            var descriptor = FileSystemMixin.GetDescriptor(partition);

            return(await descriptor);
        }
Ejemplo n.º 10
0
        private static List <int> QuickSort(List <int> list, int lo, int hi, PartitionType partitionType)
        {
            if (lo < hi)
            {
                var middle = Partitions[partitionType](list, lo, hi);

                QuickSort(list, lo, middle - 1, partitionType);
                QuickSort(list, middle + 1, hi, partitionType);
            }

            return(list);
        }
Ejemplo n.º 11
0
        internal Table(byte[] gptBuffer, uint bytesPerSector)
        {
            this.gptBuffer = gptBuffer;
            var tempHeaderOffset = ByteOperations.FindAscii(gptBuffer, "EFI PART");

            if (tempHeaderOffset == null)
            {
                throw new Exception("Bad GPT");
            }

            headerOffset      = (uint)tempHeaderOffset;
            headerSize        = ByteOperations.ReadUInt32(gptBuffer, headerOffset + 0x0C);
            tableOffset       = headerOffset + 0x200;
            FirstUsableSector = ByteOperations.ReadUInt64(gptBuffer, headerOffset + 0x28);
            LastUsableSector  = ByteOperations.ReadUInt64(gptBuffer, headerOffset + 0x30);
            var maxPartitions = ByteOperations.ReadUInt32(gptBuffer, headerOffset + 0x50);

            partitionEntrySize = ByteOperations.ReadUInt32(gptBuffer, headerOffset + 0x54);
            tableSize          = maxPartitions * partitionEntrySize;
            if (tableOffset + tableSize > gptBuffer.Length)
            {
                throw new Exception("Bad GPT");
            }

            var partitionOffset = tableOffset;

            uint number = 1;

            while (partitionOffset < tableOffset + tableSize)
            {
                var name = ByteOperations.ReadUnicodeString(gptBuffer, partitionOffset + 0x38, 0x48)
                           .TrimEnd((char)0, ' ');
                if (name.Length == 0)
                {
                    break;
                }

                var partitionTypeGuid = ByteOperations.ReadGuid(gptBuffer, partitionOffset + 0x00);
                var partitionType     = PartitionType.FromGuid(partitionTypeGuid);

                var currentPartition = new Partition(name, partitionType, bytesPerSector)
                {
                    FirstSector = ByteOperations.ReadUInt64(gptBuffer, partitionOffset + 0x20),
                    LastSector  = ByteOperations.ReadUInt64(gptBuffer, partitionOffset + 0x28),
                    Guid        = ByteOperations.ReadGuid(gptBuffer, partitionOffset + 0x10),
                    Attributes  = ByteOperations.ReadUInt64(gptBuffer, partitionOffset + 0x30)
                };
                Partitions.Add(currentPartition);
                partitionOffset += partitionEntrySize;
                number++;
            }
        }
Ejemplo n.º 12
0
        public static void QuickSort <T>(this T[] data, PartitionType partition = PartitionType.Lomuto) where T : IComparable
        {
            switch (partition)
            {
            case PartitionType.Lomuto:
                data.QuickSortLomutoPartition(0, data.Length);
                break;

            case PartitionType.Hoare:
                data.QuickSortHoarePartition(0, data.Length - 1);
                break;
            }
        }
Ejemplo n.º 13
0
        private static Partition ToPartition(Disk disk, object partition)
        {
            string guid          = (string)partition.GetPropertyValue("GptType");
            var    partitionType = guid != null?PartitionType.FromGuid(Guid.Parse(guid)) : null;

            return(new Partition(disk)
            {
                Number = (uint)partition.GetPropertyValue("PartitionNumber"),
                Id = (string)partition.GetPropertyValue("UniqueId"),
                Letter = (char?)partition.GetPropertyValue("DriveLetter"),
                PartitionType = partitionType,
            });
        }
        public static string AsString(this PartitionType @this)
        {
            switch (@this)
            {
            case PartitionType.Partition1:
                return("Partition1");

            case PartitionType.Partition2:
                return("Partition2");

            default:
                throw new ArgumentOutOfRangeException(nameof(@this), @this, null);
            }
        }
Ejemplo n.º 15
0
        public async Task <IPartition> CreatePartition(ByteSize size, PartitionType partitionType, string name = "")
        {
            if (size.Equals(ByteSize.MaxValue))
            {
                await PowerShellMixin.ExecuteScript($"New-Partition -DiskNumber {Number} -UseMaximumSize");
            }
            else
            {
                await PowerShellMixin.ExecuteScript($"New-Partition -DiskNumber {Number} -Size {size.Bytes}");
            }

            var partitions = await GetPartitions();

            return(partitions.Last());
        }
Ejemplo n.º 16
0
        public Task SetPartitionType(Partition partition, PartitionType partitionType)
        {
            ps.Commands.Clear();
            var cmd = $@"Set-Partition -PartitionNumber {partition.Number} -DiskNumber {partition.Disk.Number} -GptType ""{{{partitionType.Guid}}}""";

            ps.AddScript(cmd);

            var result = Task.Factory.FromAsync(ps.BeginInvoke(), x => ps.EndInvoke(x));

            if (ps.HadErrors)
            {
                Throw($"Cannot set the partition type {partitionType} to {partition}");
            }

            return(result);
        }
Ejemplo n.º 17
0
        public static async Task EnsureBootPartitionIs(this IDevice device, PartitionType partitionType)
        {
            Partition partition = await GetBootPartition(device);

            if (partition == null)
            {
                partition = (await device.GetBootVolume())?.Partition;
            }

            if (partition == null)
            {
                throw new InvalidOperationException("Cannot get the boot partition");
            }

            await partition.SetGptType(partitionType);
        }
Ejemplo n.º 18
0
        private static WmiPartition ToWmiPartition(object partition)
        {
            var guid          = (string)partition.GetPropertyValue("GptType");
            var partitionType = guid != null?PartitionType.FromGuid(Guid.Parse(guid)) : null;

            var driveLetter = (char)partition.GetPropertyValue("DriveLetter");

            return(new WmiPartition
            {
                Number = (uint)partition.GetPropertyValue("PartitionNumber"),
                UniqueId = (string)partition.GetPropertyValue("UniqueId"),
                Guid = Guid.Parse((string)partition.GetPropertyValue("Guid")),
                Root = driveLetter != 0 ? PathExtensions.GetRootPath(driveLetter) : null,
                PartitionType = partitionType,
                Size = new ByteSize(Convert.ToUInt64(partition.GetPropertyValue("Size"))),
            });
        }
Ejemplo n.º 19
0
        public VolumeRecord(List <DatabaseRecordFragment> fragments) : base(fragments)
        {
            // Data begins at 0x10 (VBLK header is at 0x00)
            int offset = 0x00; // relative to Data

            ReadCommonFields(this.Data, ref offset);
            if (RecordRevision != 5)
            {
                throw new NotImplementedException("Unsupported record revision");
            }
            VolumeTypeString = ReadVarString(this.Data, ref offset);
            DisableDriverLetterAssignmentString = ReadVarString(this.Data, ref offset);
            StateString          = ByteReader.ReadAnsiString(this.Data, ref offset, 14).Trim('\0');
            ReadPolicy           = (ReadPolicyName)ByteReader.ReadByte(this.Data, ref offset);
            VolumeNumber         = ReadVarUInt(this.Data, ref offset);
            VolumeFlags          = (VolumeFlags)BigEndianReader.ReadUInt32(this.Data, ref offset);
            NumberOfComponents   = ReadVarUInt(this.Data, ref offset);
            CommitTransactionID  = BigEndianReader.ReadUInt64(this.Data, ref offset);
            UnknownTransactionID = BigEndianReader.ReadUInt64(this.Data, ref offset);

            SizeLBA       = ReadVarULong(this.Data, ref offset);
            offset       += 4;
            PartitionType = (PartitionType)ByteReader.ReadByte(this.Data, ref offset);
            VolumeGuid    = BigEndianReader.ReadGuid(this.Data, ref offset);

            if (HasUnknownID1Flag)
            {
                UnknownID1 = ReadVarULong(this.Data, ref offset);
            }

            if (HasUnknownID2Flag)
            {
                UnknownID2 = ReadVarULong(this.Data, ref offset);
            }

            if (HasColumnSizeFlag)
            {
                ColumnSizeLBA = ReadVarULong(this.Data, ref offset);
            }

            if (HasMountHintFlag)
            {
                MountHint = ReadVarString(this.Data, ref offset);
            }
        }
Ejemplo n.º 20
0
 public void Parse( Byte[] buffer, UInt32 offset )
 {
     bootable = buffer[ offset + 0 ];
     switch ( (PartitionType)buffer[ offset + 4 ] )
     {
         case PartitionType.Ext:
             type = PartitionType.Ext;
             break;
         case PartitionType.Extended:
             type = PartitionType.Extended;
             break;
         default:
             type = PartitionType.Unknown;
             break;
     }
     Utils.LoadLE32( out start_lba, buffer, offset + 8 );
     Utils.LoadLE32( out size_lba, buffer, offset + 12 );
 }
Ejemplo n.º 21
0
 public void Parse( Byte[] buffer, UInt32 offset )
 {
     bootable = buffer[ offset + 0 ];
     switch ( (PartitionType)buffer[ offset + 4 ] )
     {
         case PartitionType.Ext:
             type = PartitionType.Ext;
             break;
         case PartitionType.Extended:
             type = PartitionType.Extended;
             break;
         default:
             type = PartitionType.Unknown;
             break;
     }
     Utils.LoadLE32( out start_lba, buffer, offset + 8 );
     Utils.LoadLE32( out size_lba, buffer, offset + 12 );
 }
Ejemplo n.º 22
0
 public RecastConfig(PartitionType partitionType, float cellSize, float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, int tileSize)
 {
     this.partitionType          = partitionType;
     this.cs                     = cellSize;
     this.ch                     = cellHeight;
     this.walkableSlopeAngle     = agentMaxSlope;
     this.walkableHeight         = (int)Math.Ceiling(agentHeight / ch);
     this.walkableClimb          = (int)Math.Floor(agentMaxClimb / ch);
     this.walkableRadius         = (int)Math.Ceiling(agentRadius / cs);
     this.maxEdgeLen             = (int)(edgeMaxLen / cellSize);
     this.maxSimplificationError = edgeMaxError;
     this.minRegionArea          = regionMinSize * regionMinSize;     // Note: area = size*size
     this.mergeRegionArea        = regionMergeSize * regionMergeSize; // Note: area = size*size
     this.maxVertsPerPoly        = vertsPerPoly;
     this.detailSampleDist       = detailSampleDist < 0.9f ? 0 : cellSize *detailSampleDist;
     this.detailSampleMaxError   = cellHeight * detailSampleMaxError;
     this.tileSize               = tileSize;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Format the USB drive with suitable parameter supplied
        /// </summary>
        /// <param name="Ftype">FAT32 or NTFS</param>
        /// <param name="Ptype">MBR or GPT</param>
        /// <param name="VolumeLabel">The name of the drive like 'FlashDrive'</param>
        /// <param name="clustersize">4096 (Default) or 8192</param>
        /// <param name="quickformat">If false, program will check for bad sector blocks.</param>
        public void Format(FileSystemType Ftype, PartitionType Ptype, string VolumeLabel, string clustersize = "4096", bool quickformat = true)
        {
            string ftype = "fat32", quick = " quick", ptype = "mbr";

            if (Ftype == FileSystemType.NTFS)
            {
                ftype = "ntfs";
            }
            if (Ptype == PartitionType.GPT)
            {
                ptype = "gpt";
            }
            if (!quickformat)
            {
                quick = "";
            }
            DiskPart(new string[] { $"select volume {VolumeNumber}", "clean", $"convert {ptype}",
                                    "create partition primary", $"format fs={ftype} label=\"{VolumeLabel}\" unit=\"{clustersize}\"{quick}" });
        }
Ejemplo n.º 24
0
        public async Task SetGptType(Partition partition, PartitionType partitionType)
        {
            Log.Verbose("Setting new GPT partition type {Type} to {Partition}", partitionType, partition);

            if (Equals(partition.PartitionType, partitionType))
            {
                return;
            }

            using (var context = await GptContextFactory.Create(partition.Disk.Number, FileAccess.ReadWrite, GptContext.DefaultBytesPerSector, GptContext.DefaultChunkSize))
            {
                var part = context.Find(partition.Guid);
                part.PartitionType = partitionType;
            }

            await partition.Disk.Refresh();

            Log.Verbose("New GPT type set correctly", partitionType, partition);
        }
Ejemplo n.º 25
0
        public async Task SetGptType(PartitionType partitionType)
        {
            Log.Verbose("Setting new GPT partition type {Type} to {Partition}", partitionType, this);

            if (Equals(PartitionType, partitionType))
            {
                return;
            }

            var part = await this.GetPsPartition();

            await PowerShellMixin.ExecuteCommand("Set-Partition",
                                                 ("InputObject", part),
                                                 ("GptType", $"{{{partitionType.Guid}}}")
                                                 );

            await Disk.Refresh();

            Log.Verbose("New GPT type set correctly", partitionType, this);
        }
Ejemplo n.º 26
0
        public void Given_Values_When_Serialised_Then_It_Should_Return_Result(PartitionType collection)
        {
            var entityId = Guid.NewGuid();
            var now      = DateTimeOffset.UtcNow;

            var entity = new FakeItemEntity()
            {
                EntityId      = entityId,
                Collection    = collection,
                DateGenerated = now
            };

            var dateGenerated = JsonConvert.SerializeObject(now);

            var serialised = JsonConvert.SerializeObject(entity);

            serialised.Should().Contain($"\"id\":\"{entityId.ToString()}\"");
            serialised.Should().Contain($"\"collection\":\"{collection.ToString()}\"");
            serialised.Should().Contain($"\"dateGenerated\":{dateGenerated}");
        }
Ejemplo n.º 27
0
        public GraphPartition(IPartitionableGraph <TVertex, IEdge <TVertex> > graph, PartitionType type)
        {
            Graph             = graph ?? throw new ArgumentNullException("The graph cannot be null.");
            _communityManager = new CommunityManager <TVertex>(graph);
            _communities      = new Dictionary <int, ICommunity <TVertex> >();
            switch (type)
            {
            case PartitionType.Singletone:
                int communityNumber = 0;
                foreach (var vertex in Graph.Vertices)
                {
                    _communities.Add(communityNumber, new Community <TVertex>(vertex));
                    communityNumber++;
                }
                break;

            default:
                throw new ArgumentException("Wrong partition type value.");
            }
        }
Ejemplo n.º 28
0
        public FileSystemFAT(IFileSystemStore store, PartitionType type)
        {
            Store = store;
            Type  = type;
            LoadBPB();
            _FATLocation = BPB_RsvdSecCnt * BPB_BytsPerSec;
            // Load the FAT.
            _fileAllocationTable = new FileAllocationTable(store, _FATLocation, FATSize * BytesPerSector, type);
            long rootDirSectors = ((BPB_RootEntCnt * 32) + (BPB_BytsPerSec - 1)) / BPB_BytsPerSec;
            long afterFAT       = _FATLocation + BPB_NumFATs * FATSize * BPB_BytsPerSec;

            _dataLocation = afterFAT + rootDirSectors * BPB_BytsPerSec;
            if (Type == PartitionType.FAT32)
            {
                _rootDirLocation = GetDiskOffsetOfFATCluster(BPB_RootClus);
            }
            else
            {
                _rootDirLocation = afterFAT;
            }
            _root = new FolderFAT(this, _rootDirLocation, 2);
        }
Ejemplo n.º 29
0
        internal static IEnumerable <WiiPartitionInfo> CreatePartitionInfos(MemorySection section, int offset)
        {
            for (int tableIdx = 0; tableIdx < 4; tableIdx++)           //up to 4 partitions on the disk
            {
                uint c = section.ReadUInt32B(offset + (tableIdx * 8)); //count of partitions for tableIdx

                //_log.Message(string.Format("Table {0} - Partitions {1}", tableIdx.ToString(), c.ToString("X8")), 2);
                if (c == 0)
                {
                    continue;
                }
                int tableOffset      = (int)section.ReadUInt32B(offset + (tableIdx * 8) + 4) * 4; //first partition entry for tableIdx
                int adjustReadOffset = offset + (tableOffset - _PartitionTableOffset);
                for (int i = 0; i < c; i++)
                {
                    long          partitionOffset = section.ReadUInt32B(adjustReadOffset + (i * 8)) * 4L;
                    PartitionType partitionType   = (PartitionType)section.ReadUInt32B(adjustReadOffset + (i * 8) + 4);
                    //_log.Message(string.Format("  PartitionOffset Offset {0} - Type {1}", partitionOffset.ToString("X8"), partitionType.ToString()), 2);
                    yield return(new WiiPartitionInfo(partitionType, partitionOffset, tableIdx, tableOffset + (i * 8)));
                    //_log.Message(string.Format("    ID {0}", partitions.Last().ReadStream.Id), 2);
                }
            }
        }
Ejemplo n.º 30
0
 public EntryBuilder(string name, ByteSize size, PartitionType gptType)
 {
     this.name    = name ?? throw new ArgumentNullException(nameof(name));
     this.size    = size;
     this.gptType = gptType;
 }
Ejemplo n.º 31
0
        /// <summary>
        /// Синхронно обновляет данные раздела.
        /// </summary>
        protected internal void UpdateData()
        {
            long size;
            PartitionType type;
            int number;
            bool isProtected;
            bool isSupported;
            bool isSystem;
            string[] mountPoints;

            try
            {
                _computer.Context.PushContext();

                lock (_partitionSync)
                {
                    if (_partition == null)
                        return;

                    size = _partition.Size;
                    type = _partition.Type;
                    number = _partition.Number;
                    isProtected = _partition.IsProtected;
                    isSupported = _partition.IsSupported;
                    isSystem = _partition.IsSystem;
                    mountPoints = _partition.GetMountPoints();
                }

                bool propertyChanged = false;

                lock (this)
                {
                    if (_cachedSize != size ||
                        _cachedType != type ||
                        _cachedNumber != number ||
                        _cachedIsProtected != isProtected ||
                        _cachedIsSupported != isSupported ||
                        _cachedIsSystem != isSystem ||
                        _cachedMountPoints != mountPoints
                        )
                    {
                        propertyChanged = true;

                        // Обновляем данные кеша.
                        _cachedSize = size;
                        _cachedType = type;
                        _cachedNumber = number;
                        _cachedIsProtected = isProtected;
                        _cachedIsSupported = isSupported;
                        _cachedIsSystem = isSystem;
                        _cachedMountPoints = mountPoints;
                    }
                }

                if (propertyChanged)
                    OnPropertyChanged(new PartitionEventArgs());
            }
            catch (System.Security.SecurityException)
            {
            }
            catch (System.Runtime.Remoting.RemotingException)
            {
                _computer.OnDisconnect();
                return;
            }
            catch (System.Net.Sockets.SocketException)
            {
                _computer.OnDisconnect();
                return;
            }
            finally
            {
                _computer.Context.PopContext();
            }
        }
Ejemplo n.º 32
0
        private void PaintPartition(PaintEventArgs e, Rectangle rectPartition, PhysicalDrive.PARTITION_INFORMATION_EX partition, PartitionType partitionType)
        {
            // ensure that a primary or logical partition should be drawn
            System.Diagnostics.Debug.Assert(partitionType != PartitionType.Extended);

            // store the current clipping region
            Region clip = e.Graphics.Clip;

            // draw a black rectangle around the current partition
            Pen penPartition = new Pen(Color.Black, 2.0f);
            Rectangle rectBorder = rectPartition;
            rectBorder.Inflate(-(int)Math.Ceiling(penPartition.Width / 2), -(int)Math.Ceiling(penPartition.Width / 2));
            e.Graphics.DrawRectangle(penPartition, rectBorder);

            // fill the rectangle with white color (partition not selected) or with a hatched brush (partition selected)
            Rectangle rectInner = rectBorder;
            rectInner.Inflate(-(int)Math.Ceiling(penPartition.Width / 2), -(int)Math.Ceiling(penPartition.Width / 2));
            Brush brush;
            if (partition.PartitionNumber == selectedPartitionNumber)
            {
                brush = new HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(230, 230, 230), Color.White);
            }
            else
            {
                brush = new SolidBrush(Color.White);
            }
            e.Graphics.FillRectangle(brush, rectInner);

            // add the title - a box coloured using the partition type color with border which contains the partition number
            Rectangle rectTitle = rectInner;
            rectTitle.Height = 17;
            e.Graphics.FillRectangle(new SolidBrush(GetColor(partitionType)), rectTitle);
            e.Graphics.DrawLine(penPartition, new Point(rectTitle.Left, rectTitle.Bottom), new Point(rectTitle.Right, rectTitle.Bottom));

            // draw further information about the partiton
            e.Graphics.Clip = new Region(rectInner);

            //e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
            Font font = new Font(new FontFamily("Arial"), 9, FontStyle.Regular);
            e.Graphics.DrawString(string.Format("[{0}]", partition.PartitionNumber), font, new SolidBrush(Color.White), rectInner.Left, rectInner.Top);
            string type = PartitionTypes.GetPartitionType(partition.Mbr.PartitionType);
            if (type == null)
            {
                type = "Unknown";
            }
            e.Graphics.DrawString(type, font, new SolidBrush(Color.Black), rectInner.Left, rectInner.Top + 20);
            e.Graphics.DrawString(PhysicalDrive.GetAsBestFitSizeUnit(partition.PartitionLength), font, new SolidBrush(Color.Black), rectInner.Left, rectInner.Top + 40);

            // reset the clipping region
            e.Graphics.Clip = clip;
        }
Ejemplo n.º 33
0
 protected PartitionInfo(PartitionType parType)
 {
     this.m_partitionType = parType;
 }
Ejemplo n.º 34
0
 public static Color GetColor(PartitionType partitionType)
 {
     return partitionTypeColors[(int)partitionType];
 }
Ejemplo n.º 35
0
 public Task <IPartition> CreatePartition(ByteSize desiredSize, PartitionType partitionType, string name)
 {
     throw new NotImplementedException();
 }