Ejemplo n.º 1
0
 public MPEntryValue(byte[] bytes, int startIndex, Endian endian)
 {
     ImageAttr       = (uint)BitConverterEx.ToInt32(bytes, startIndex + 0, endian);
     ImageSize       = (uint)BitConverterEx.ToInt32(bytes, startIndex + 4, endian);
     ImageDataOffset = (uint)BitConverterEx.ToInt32(bytes, startIndex + 8, endian);
     DependentImage1 = (ushort)BitConverterEx.ToInt16(bytes, startIndex + 12, endian);
     DependentImage2 = (ushort)BitConverterEx.ToInt16(bytes, startIndex + 14, endian);
 }
Ejemplo n.º 2
0
        public IFD(byte[] bytes, int o, int offsetStart, Endian endian)
        {
            Tag   = (ushort)BitConverterEx.ToInt16(bytes, o + 0, endian);
            Type  = (IFDType)BitConverterEx.ToInt16(bytes, o + 2, endian);
            Count = (uint)BitConverterEx.ToInt32(bytes, o + 4, endian);

            Offset = new byte[4];
            Array.Copy(bytes, o + 8, Offset, 0, Offset.Length);
            if (BitConverter.IsLittleEndian ^ endian == Endian.Little)
            {
                Array.Reverse(Offset);
            }

            // 長さが4バイトを超えるときは、Valueをオフセットとして扱う
            int typeSize = GetSizeOf(Type);

            if (typeSize * Count > 4)
            {
                Value = new byte[typeSize * Count];
                Array.Copy(bytes, offsetStart + OffsetUInt32, Value, 0, Value.Length);
            }

            //Value = (uint)BitConverterEx.ToInt32(bytes, startIndex + 8, endian);
        }