Beispiel #1
0
        public CommonVolumeDescriptor(byte[] src, int offset, Encoding enc)
            : base(src, offset)
        {
            CharacterEncoding = enc;

            SystemIdentifier               = IsoUtilities.ReadChars(src, offset + 8, 32, CharacterEncoding);
            VolumeIdentifier               = IsoUtilities.ReadChars(src, offset + 40, 32, CharacterEncoding);
            VolumeSpaceSize                = IsoUtilities.ToUInt32FromBoth(src, offset + 80);
            VolumeSetSize                  = IsoUtilities.ToUInt16FromBoth(src, offset + 120);
            VolumeSequenceNumber           = IsoUtilities.ToUInt16FromBoth(src, offset + 124);
            LogicalBlockSize               = IsoUtilities.ToUInt16FromBoth(src, offset + 128);
            PathTableSize                  = IsoUtilities.ToUInt32FromBoth(src, offset + 132);
            TypeLPathTableLocation         = Utilities.ToUInt32LittleEndian(src, offset + 140);
            OptionalTypeLPathTableLocation = Utilities.ToUInt32LittleEndian(src, offset + 144);
            TypeMPathTableLocation         = Utilities.BitSwap(Utilities.ToUInt32LittleEndian(src, offset + 148));
            OptionalTypeMPathTableLocation = Utilities.BitSwap(Utilities.ToUInt32LittleEndian(src, offset + 152));
            DirectoryRecord.ReadFrom(src, offset + 156, CharacterEncoding, out RootDirectory);
            VolumeSetIdentifier         = IsoUtilities.ReadChars(src, offset + 190, 318 - 190, CharacterEncoding);
            PublisherIdentifier         = IsoUtilities.ReadChars(src, offset + 318, 446 - 318, CharacterEncoding);
            DataPreparerIdentifier      = IsoUtilities.ReadChars(src, offset + 446, 574 - 446, CharacterEncoding);
            ApplicationIdentifier       = IsoUtilities.ReadChars(src, offset + 574, 702 - 574, CharacterEncoding);
            CopyrightFileIdentifier     = IsoUtilities.ReadChars(src, offset + 702, 739 - 702, CharacterEncoding);
            AbstractFileIdentifier      = IsoUtilities.ReadChars(src, offset + 739, 776 - 739, CharacterEncoding);
            BibliographicFileIdentifier = IsoUtilities.ReadChars(src, offset + 776, 813 - 776, CharacterEncoding);
            CreationDateAndTime         = IsoUtilities.ToDateTimeFromVolumeDescriptorTime(src, offset + 813);
            ModificationDateAndTime     = IsoUtilities.ToDateTimeFromVolumeDescriptorTime(src, offset + 830);
            ExpirationDateAndTime       = IsoUtilities.ToDateTimeFromVolumeDescriptorTime(src, offset + 847);
            EffectiveDateAndTime        = IsoUtilities.ToDateTimeFromVolumeDescriptorTime(src, offset + 864);
            FileStructureVersion        = src[offset + 881];
        }
Beispiel #2
0
        private static int WriteMember(BuildDirectoryMember m, string nameOverride, Encoding nameEnc, byte[] buffer, int offset, Dictionary <BuildDirectoryMember, uint> locationTable, Encoding dataEnc)
        {
            DirectoryRecord dr = new DirectoryRecord();

            dr.FileIdentifier       = m.PickName(nameOverride, nameEnc);
            dr.LocationOfExtent     = locationTable[m];
            dr.DataLength           = (uint)m.GetDataSize(dataEnc);
            dr.RecordingDateAndTime = m.CreationTime;
            dr.Flags = (m is BuildDirectoryInfo) ? FileFlags.Directory : FileFlags.None;
            return(dr.WriteTo(buffer, offset, nameEnc));
        }
Beispiel #3
0
        public CommonVolumeDescriptor(
            VolumeDescriptorType type,
            byte version,
            uint volumeSpaceSize,
            uint pathTableSize,
            uint typeLPathTableLocation,
            uint typeMPathTableLocation,
            uint rootDirExtentLocation,
            uint rootDirDataLength,
            DateTime buildTime,
            Encoding enc)
            : base(type, version)
        {
            CharacterEncoding = enc;

            SystemIdentifier       = string.Empty;
            VolumeIdentifier       = string.Empty;
            VolumeSpaceSize        = volumeSpaceSize;
            VolumeSetSize          = 1;
            VolumeSequenceNumber   = 1;
            LogicalBlockSize       = IsoUtilities.SectorSize;
            PathTableSize          = pathTableSize;
            TypeLPathTableLocation = typeLPathTableLocation;
            ////OptionalTypeLPathTableLocation = 0;
            TypeMPathTableLocation = typeMPathTableLocation;
            ////OptionalTypeMPathTableLocation = 0;
            RootDirectory = new DirectoryRecord();
            RootDirectory.ExtendedAttributeRecordLength = 0;
            RootDirectory.LocationOfExtent     = rootDirExtentLocation;
            RootDirectory.DataLength           = rootDirDataLength;
            RootDirectory.RecordingDateAndTime = buildTime;
            RootDirectory.Flags                = FileFlags.Directory;
            RootDirectory.FileUnitSize         = 0;
            RootDirectory.InterleaveGapSize    = 0;
            RootDirectory.VolumeSequenceNumber = 1;
            RootDirectory.FileIdentifier       = "\0";
            VolumeSetIdentifier                = string.Empty;
            PublisherIdentifier                = string.Empty;
            DataPreparerIdentifier             = string.Empty;
            ApplicationIdentifier              = string.Empty;
            CopyrightFileIdentifier            = string.Empty;
            AbstractFileIdentifier             = string.Empty;
            BibliographicFileIdentifier        = string.Empty;
            CreationDateAndTime                = buildTime;
            ModificationDateAndTime            = buildTime;
            ExpirationDateAndTime              = DateTime.MinValue;
            EffectiveDateAndTime               = buildTime;
            FileStructureVersion               = 1; // V1
        }
Beispiel #4
0
        public static int ReadFrom(byte[] src, int offset, Encoding enc, out DirectoryRecord record)
        {
            int length = src[offset + 0];

            record = new DirectoryRecord();
            record.ExtendedAttributeRecordLength = src[offset + 1];
            record.LocationOfExtent     = IsoUtilities.ToUInt32FromBoth(src, offset + 2);
            record.DataLength           = IsoUtilities.ToUInt32FromBoth(src, offset + 10);
            record.RecordingDateAndTime = IsoUtilities.ToUTCDateTimeFromDirectoryTime(src, offset + 18);
            record.Flags                = (FileFlags)src[offset + 25];
            record.FileUnitSize         = src[offset + 26];
            record.InterleaveGapSize    = src[offset + 27];
            record.VolumeSequenceNumber = IsoUtilities.ToUInt16FromBoth(src, offset + 28);
            byte lengthOfFileIdentifier = src[offset + 32];

            record.FileIdentifier = IsoUtilities.ReadChars(src, offset + 33, lengthOfFileIdentifier, enc);

            return(length);
        }
 internal uint GetDirectoryRecordSize(Encoding enc)
 {
     return(DirectoryRecord.CalcLength(PickName(null, enc), enc));
 }
Beispiel #6
0
 public File(IsoContext context, DirectoryRecord dirEntry)
 {
     _context  = context;
     _dirEntry = dirEntry;
 }
Beispiel #7
0
 internal static bool IsSpecialDirectory(DirectoryRecord r)
 {
     return(r.FileIdentifier == "\0" || r.FileIdentifier == "\x01");
 }