Exemplo n.º 1
0
Arquivo: Tag.cs Projeto: dgm9704/TIFF
        internal static Tag Read(byte[] data, int startPosition)
        {
            var tag = new Tag
            {
                TagType     = (TagType)BitConverter.ToUInt16(data, startPosition),
                FieldType   = (FieldType)BitConverter.ToUInt16(data, startPosition + 2),
                ValueCount  = BitConverter.ToUInt32(data, startPosition + 4),
                ValueOffset = BitConverter.ToUInt32(data, startPosition + 8),
            };

            byte[] valuebytes = GetValueBytes(data, tag);
            tag.Values = Tif.ReadValues(valuebytes, tag.FieldType, (int)tag.ValueCount);

            return(tag);
        }
Exemplo n.º 2
0
Arquivo: Tag.cs Projeto: dgm9704/TIFF
        internal static Tag ReadMM(byte[] data, int startPosition)
        {
            var tag = new Tag
            {
                TagType    = (TagType)(ushort)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(data, startPosition)),
                FieldType  = (FieldType)(ushort)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(data, startPosition + 2)),
                ValueCount = (uint)IPAddress.NetworkToHostOrder(BitConverter.ToInt32(data, startPosition + 4)),
            };

            tag.ValueOffset = GetValueOffset(data, startPosition, tag.ValueCount, tag.FieldType);

            byte[] valuebytes = Tif.SwitchEndian(GetValueBytes(data, tag), Tif.ValueLength[tag.FieldType]);

            tag.Values = Tif.ReadValues(valuebytes, tag.FieldType, (int)tag.ValueCount);

            return(tag);
        }