public NikonMakerNote(TIFFBinaryReader buffer, uint offset, bool compression) { //read the header buffer.BaseStream.Position = offset; stringMagic = ""; this.offset = offset; for (int i = 0; i < 6; i++) { stringMagic += buffer.ReadChar(); } version = buffer.ReadUInt16(); buffer.BaseStream.Position = 2 + offset; //jump the padding header = new Header(buffer, 0); //0 car beggining of the stream if (header.byteOrder == 0x4D4D) { buffer = new TIFFBinaryReaderRE(buffer.BaseStream); //TODO see if need to move } ifd = new IFD(buffer, header.TIFFoffset + getOffset(), true, true); //ifd = new IFD(buffer, (uint)buffer.BaseStream.Position, true, true); Tag previewOffsetTag; if (ifd.tags.TryGetValue(17, out previewOffsetTag)) { preview = new IFD(buffer, (uint)previewOffsetTag.data[0] + getOffset(), true, false); } else { preview = null; //no preview in this file } }
public override void Parse(Stream file) { //Open a binary stream on the file fileStream = new TIFFBinaryReader(file); //read the first bit to get the endianness of the file if (fileStream.ReadUInt16() == 0x4D4D) { //File is in reverse bit order // fileStream.Dispose(); //DO NOT dispose, because it remove the filestream not the reader and crash the parse fileStream = new TIFFBinaryReaderRE(file); } //read the header header = new Header(fileStream, 0); //Read the IFD ifd = new IFD(fileStream, header.TIFFoffset, true, false); }
int stuffed = 0; // How many bytes has been stuffed? /*** Used for entropy encoded sections ***/ BitPumpJPEG(ref TIFFBinaryReader s) { buffer = s.getData(); size = s.getRemainSize() + sizeof(UInt32); init(); }