示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileExFatDirectoryEntry"/> class.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        public FileExFatDirectoryEntry(Buffer buffer) : base(buffer)
        {
            // the raw
            SecondaryCount           = new BufferUInt8(buffer, 1);
            SetChecksum              = new BufferUInt16(buffer, 2);
            FileAttributes           = new EnumValueProvider <ExFatFileAttributes, UInt16>(new BufferUInt16(buffer, 4));
            CreationTimeStamp        = new BufferUInt32(buffer, 8);
            LastWriteTimeStamp       = new BufferUInt32(buffer, 12);
            LastAccessTimeStamp      = new BufferUInt32(buffer, 16);
            Creation10msIncrement    = new BufferUInt8(buffer, 20);
            LastWrite10msIncrement   = new BufferUInt8(buffer, 21);
            CreationTimeZoneOffset   = new BufferUInt8(buffer, 22);
            LastWriteTimeZoneOffset  = new BufferUInt8(buffer, 23);
            LastAccessTimeZoneOffset = new BufferUInt8(buffer, 24);

            // the cooked
            CreationTime   = new EntryDateTime(CreationTimeStamp, Creation10msIncrement);
            LastWriteTime  = new EntryDateTime(LastWriteTimeStamp, LastWrite10msIncrement);
            LastAccessTime = new EntryDateTime(LastAccessTimeStamp);

            CreationTimeOffset   = new EntryTimeZone(CreationTimeZoneOffset);
            LastWriteTimeOffset  = new EntryTimeZone(LastWriteTimeZoneOffset);
            LastAccessTimeOffset = new EntryTimeZone(LastAccessTimeZoneOffset);

            CreationDateTimeOffset   = new EntryDateTimeOffset(CreationTime, CreationTimeOffset);
            LastWriteDateTimeOffset  = new EntryDateTimeOffset(LastWriteTime, LastWriteTimeOffset);
            LastAccessDateTimeOffset = new EntryDateTimeOffset(LastAccessTime, LastAccessTimeOffset);
        }
示例#2
0
        private static ExFatDirectoryEntry Create(Buffer buffer)
        {
            switch ((ExFatDirectoryEntryType)(buffer[0] & (byte)~ExFatDirectoryEntryType.InUse))
            {
            case 0:
                return(null);

            case ExFatDirectoryEntryType.AllocationBitmap:
                return(new AllocationBitmapExFatDirectoryEntry(buffer));

            case ExFatDirectoryEntryType.UpCaseTable:
                return(new UpCaseTableExFatDirectoryEntry(buffer));

            case ExFatDirectoryEntryType.VolumeLabel:
                return(new VolumeLabelExFatDirectoryEntry(buffer));

            case ExFatDirectoryEntryType.File:
                return(new FileExFatDirectoryEntry(buffer));

            case ExFatDirectoryEntryType.Stream:
                return(new StreamExtensionExFatDirectoryEntry(buffer));

            case ExFatDirectoryEntryType.FileName:
                return(new FileNameExtensionExFatDirectoryEntry(buffer));

            default:
                // unhandled entries
                return(new ExFatDirectoryEntry(buffer));
            }
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StreamExtensionExFatDirectoryEntry"/> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 public StreamExtensionExFatDirectoryEntry(Buffer buffer) : base(buffer)
 {
     GeneralSecondaryFlags = new EnumValueProvider <ExFatGeneralSecondaryFlags, Byte>(new BufferUInt8(buffer, 1));
     NameLength            = new BufferUInt8(buffer, 3);
     NameHash        = new BufferUInt16(buffer, 4);
     ValidDataLength = new BufferUInt64(buffer, 8);
     FirstCluster    = new BufferUInt32(buffer, 20);
     DataLength      = new BufferUInt64(buffer, 24);
 }
示例#4
0
        /// <summary>
        /// Creates a <see cref="ExFatDirectoryEntry" /> given a buffer.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="directoryPosition">The directory position.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public static ExFatDirectoryEntry Create(Buffer buffer, long directoryPosition)
        {
            var entry = Create(buffer);

            if (entry != null)
            {
                entry.DirectoryPosition = directoryPosition;
            }
            return(entry);
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExFatBootSector"/> class.
        /// </summary>
        internal ExFatBootSector(byte[] bytes)
        {
            _bytes = bytes;
            var buffer = new Buffer(_bytes);

            JmpBoot              = new BufferBytes(buffer, 0, 3);
            OemName              = new BufferByteString(buffer, 3, 8);
            VolumeLengthSectors  = new BufferUInt64(buffer, 72);
            FatOffsetSector      = new BufferUInt32(buffer, 80);
            FatLengthSectors     = new BufferUInt32(buffer, 84);
            ClusterOffsetSector  = new BufferUInt32(buffer, 88);
            ClusterCount         = new BufferUInt32(buffer, 92);
            RootDirectoryCluster = new BufferUInt32(buffer, 96);
            VolumeSerialNumber   = new BufferUInt32(buffer, 100);
            FileSystemRevision   = new BufferUInt16(buffer, 104);
            VolumeFlags          = new BufferUInt16(buffer, 106);
            BytesPerSector       = new CacheValueProvider <uint>(new ShiftValueProvider(new BufferUInt8(buffer, 108)));
            SectorsPerCluster    = new ShiftValueProvider(new BufferUInt8(buffer, 109));
            NumberOfFats         = new BufferUInt8(buffer, 110);
            DriveSelect          = new BufferUInt8(buffer, 111);
            PercentInUse         = new BufferUInt8(buffer, 112);
        }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VolumeLabelExFatDirectoryEntry"/> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 public VolumeLabelExFatDirectoryEntry(Buffer buffer) : base(buffer)
 {
     CharacterCount = new BufferUInt8(buffer, 1);
     AllVolumeLabel = new BufferWideString(buffer, 2, 11);
 }
示例#7
0
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ExFat.Partition.Entries.AllocationBitmapExFatDirectoryEntry" /> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 public AllocationBitmapExFatDirectoryEntry(Buffer buffer) : base(buffer)
 {
     BitmapFlags  = new EnumValueProvider <AllocationBitmapFlags, Byte>(new BufferUInt8(buffer, 1));
     FirstCluster = new BufferUInt32(buffer, 20);
     DataLength   = new BufferUInt64(buffer, 24);
 }
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ExFat.Partition.Entries.FileNameExtensionExFatDirectoryEntry" /> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 public FileNameExtensionExFatDirectoryEntry(Buffer buffer) : base(buffer)
 {
     GeneralSecondaryFlags = new EnumValueProvider <ExFatGeneralSecondaryFlags, Byte>(new BufferUInt8(buffer, 1));
     FileName = new BufferWideString(buffer, 2, 15);
 }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExFatDirectoryEntry"/> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 protected ExFatDirectoryEntry(Buffer buffer)
 {
     Buffer    = buffer;
     EntryType = new EnumValueProvider <ExFatDirectoryEntryType, Byte>(new BufferUInt8(buffer, 0));
 }
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ExFat.Partition.Entries.UpCaseTableExFatDirectoryEntry" /> class.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 public UpCaseTableExFatDirectoryEntry(Buffer buffer) : base(buffer)
 {
     TableChecksum = new BufferUInt32(buffer, 4);
     FirstCluster  = new BufferUInt32(buffer, 20);
     DataLength    = new BufferUInt64(buffer, 24);
 }