Beispiel #1
0
 internal override void WriteTo(byte[] buffer, int offset)
 {
     base.WriteTo(buffer, offset);
     IsoUtilities.WriteA1Chars(buffer, offset + 8, 32, SystemIdentifier, CharacterEncoding);
     IsoUtilities.WriteString(buffer, offset + 40, 32, true, VolumeIdentifier, CharacterEncoding, true);
     IsoUtilities.ToBothFromUInt32(buffer, offset + 80, VolumeSpaceSize);
     IsoUtilities.EncodingToBytes(CharacterEncoding, buffer, offset + 88);
     IsoUtilities.ToBothFromUInt16(buffer, offset + 120, VolumeSetSize);
     IsoUtilities.ToBothFromUInt16(buffer, offset + 124, VolumeSequenceNumber);
     IsoUtilities.ToBothFromUInt16(buffer, offset + 128, LogicalBlockSize);
     IsoUtilities.ToBothFromUInt32(buffer, offset + 132, PathTableSize);
     IsoUtilities.ToBytesFromUInt32(buffer, offset + 140, TypeLPathTableLocation);
     IsoUtilities.ToBytesFromUInt32(buffer, offset + 144, OptionalTypeLPathTableLocation);
     IsoUtilities.ToBytesFromUInt32(buffer, offset + 148, Utilities.BitSwap(TypeMPathTableLocation));
     IsoUtilities.ToBytesFromUInt32(buffer, offset + 152, Utilities.BitSwap(OptionalTypeMPathTableLocation));
     RootDirectory.WriteTo(buffer, offset + 156, CharacterEncoding);
     IsoUtilities.WriteD1Chars(buffer, offset + 190, 129, VolumeSetIdentifier, CharacterEncoding);
     IsoUtilities.WriteA1Chars(buffer, offset + 318, 129, PublisherIdentifier, CharacterEncoding);
     IsoUtilities.WriteA1Chars(buffer, offset + 446, 129, DataPreparerIdentifier, CharacterEncoding);
     IsoUtilities.WriteA1Chars(buffer, offset + 574, 129, ApplicationIdentifier, CharacterEncoding);
     IsoUtilities.WriteD1Chars(buffer, offset + 702, 37, CopyrightFileIdentifier, CharacterEncoding);     // FIXME!!
     IsoUtilities.WriteD1Chars(buffer, offset + 739, 37, AbstractFileIdentifier, CharacterEncoding);      // FIXME!!
     IsoUtilities.WriteD1Chars(buffer, offset + 776, 37, BibliographicFileIdentifier, CharacterEncoding); // FIXME!!
     IsoUtilities.ToVolumeDescriptorTimeFromUTC(buffer, offset + 813, CreationDateAndTime);
     IsoUtilities.ToVolumeDescriptorTimeFromUTC(buffer, offset + 830, ModificationDateAndTime);
     IsoUtilities.ToVolumeDescriptorTimeFromUTC(buffer, offset + 847, ExpirationDateAndTime);
     IsoUtilities.ToVolumeDescriptorTimeFromUTC(buffer, offset + 864, EffectiveDateAndTime);
     buffer[offset + 881] = FileStructureVersion;
 }
Beispiel #2
0
        internal int WriteTo(byte[] buffer, int offset, Encoding enc)
        {
            uint length = CalcLength(FileIdentifier, enc);

            buffer[offset]     = (byte)length;
            buffer[offset + 1] = ExtendedAttributeRecordLength;
            IsoUtilities.ToBothFromUInt32(buffer, offset + 2, LocationOfExtent);
            IsoUtilities.ToBothFromUInt32(buffer, offset + 10, DataLength);
            IsoUtilities.ToDirectoryTimeFromUTC(buffer, offset + 18, RecordingDateAndTime);
            buffer[offset + 25] = (byte)Flags;
            buffer[offset + 26] = FileUnitSize;
            buffer[offset + 27] = InterleaveGapSize;
            IsoUtilities.ToBothFromUInt16(buffer, offset + 28, VolumeSequenceNumber);
            byte lengthOfFileIdentifier;

            if (FileIdentifier.Length == 1 && FileIdentifier[0] <= 1)
            {
                buffer[offset + 33]    = (byte)FileIdentifier[0];
                lengthOfFileIdentifier = 1;
            }
            else
            {
                lengthOfFileIdentifier = (byte)IsoUtilities.WriteString(buffer, offset + 33, (int)(length - 33), false, FileIdentifier, enc);
            }

            buffer[offset + 32] = lengthOfFileIdentifier;
            return((int)length);
        }
Beispiel #3
0
        ////public static int ReadFrom(byte[] src, int offset, bool byteSwap, Encoding enc, out PathTableRecord record)
        ////{
        ////    byte directoryIdentifierLength = src[offset + 0];
        ////    record.ExtendedAttributeRecordLength = src[offset + 1];
        ////    record.LocationOfExtent = Utilities.ToUInt32LittleEndian(src, offset + 2);
        ////    record.ParentDirectoryNumber = Utilities.ToUInt16LittleEndian(src, offset + 6);
        ////    record.DirectoryIdentifier = IsoUtilities.ReadChars(src, offset + 8, directoryIdentifierLength, enc);
        ////
        ////    if (byteSwap)
        ////    {
        ////        record.LocationOfExtent = Utilities.BitSwap(record.LocationOfExtent);
        ////        record.ParentDirectoryNumber = Utilities.BitSwap(record.ParentDirectoryNumber);
        ////    }
        ////
        ////    return directoryIdentifierLength + 8 + (((directoryIdentifierLength & 1) == 1) ? 1 : 0);
        ////}

        internal int Write(bool byteSwap, Encoding enc, byte[] buffer, int offset)
        {
            int nameBytes = enc.GetByteCount(DirectoryIdentifier);

            buffer[offset + 0] = (byte)nameBytes;
            buffer[offset + 1] = 0; // ExtendedAttributeRecordLength;
            IsoUtilities.ToBytesFromUInt32(buffer, offset + 2, byteSwap ? Utilities.BitSwap(LocationOfExtent) : LocationOfExtent);
            IsoUtilities.ToBytesFromUInt16(buffer, offset + 6, byteSwap ? Utilities.BitSwap(ParentDirectoryNumber) : ParentDirectoryNumber);
            IsoUtilities.WriteString(buffer, offset + 8, nameBytes, false, DirectoryIdentifier, enc);
            if ((nameBytes & 1) == 1)
            {
                buffer[offset + 8 + nameBytes] = 0;
            }

            return((int)(8 + nameBytes + (((nameBytes & 0x1) == 1) ? 1 : 0)));
        }