BitMiracle.LibTiff.Classic.Tiff.fetchString C# (CSharp) Method

fetchString() private method

Fetches an ASCII item from the file.
private fetchString ( TiffDirEntry dir, string &cp ) : int
dir TiffDirEntry
cp string
return int
        private int fetchString(TiffDirEntry dir, out string cp)
        {
            byte[] bytes = null;

            if (dir.tdir_count <= 4)
            {
                int l = (int)dir.tdir_offset;
                if ((m_flags & TiffFlags.SWAB) == TiffFlags.SWAB)
                    SwabLong(ref l);

                bytes = new byte[sizeof(int)];
                writeInt(l, bytes, 0);
                cp = Latin1Encoding.GetString(bytes, 0, dir.tdir_count);
                return 1;
            }

            bytes = new byte[dir.tdir_count];
            int res = fetchData(dir, bytes);
            cp = Latin1Encoding.GetString(bytes, 0, dir.tdir_count);
            return res;
        }
Tiff