private void ReadIfds(IIoStream stream, uint ifdOffset) { var ptr = ifdOffset; while (ptr > 0 && ptr < stream.Length) { try { var ifd = new ImageFileDirectory(ptr); var buffer = new byte[12]; stream.Read(buffer, 2, ptr); var offset = ptr + 2; var size = _bit.ToInt16(buffer, 0); for (var i = 0; i < size; i++) { var currOffset = offset + i * 12; stream.Read(buffer, 12, currOffset); ifd.AddTag(buffer, _bit, stream); } stream.Read(buffer, 4, offset + size * 12); ptr = _bit.ToUInt32(buffer, 0); if (ifd.Tags.Any()) { _ifds.Add(ifd); } } catch (Exception) { break; } } }
public TagInfo(byte[] buffer, BitConvert bit) { TagId = bit.ToUInt16(buffer, 0); TagType = (TagType)(bit.ToInt16(buffer, 2)); Count = bit.ToUInt32(buffer, 4); ValuePointer = bit.ToUInt32(buffer, 8); }
public override bool Resolve(TagInfo info, IIoStream imageStream, BitConvert bit) { var buffer = new byte[8]; imageStream.Read(buffer, buffer.Length, info.ValuePointer); Value = (decimal)bit.ToUInt32(buffer, 0) / (decimal)bit.ToUInt32(buffer, 4); return(true); }
private void ReadIfds(IIoStream stream, uint ifdOffset) { var ptr = ifdOffset; while (ptr > 0) { var ifd = new ImageFileDirectory(ptr); _ifds.Add(ifd); var buffer = new byte[12]; stream.Read(buffer, 2, ptr); var offset = ptr + 2; var size = _bit.ToInt16(buffer, 0); for (var i = 0; i < size; i++) { var currOffset = offset + i * 12; stream.Read(buffer, 12, currOffset); ifd.AddTag(buffer, _bit, stream); } stream.Read(buffer, 4, offset + size * 12); ptr = _bit.ToUInt32(buffer, 0); } }