Exemple #1
0
        private void GetData(ImageBinaryReader fileStream)
        {
            data = new Object[dataCount];
            for (int j = 0; j < dataCount; j++)
            {
                switch (dataType)
                {
                case TiffDataType.BYTE:
                case TiffDataType.UNDEFINED:
                case TiffDataType.ASCII:
                    data[j] = fileStream.ReadByte();
                    break;

                case TiffDataType.SHORT:
                    data[j] = fileStream.ReadUInt16();
                    break;

                case TiffDataType.LONG:
                case TiffDataType.OFFSET:
                    data[j] = fileStream.ReadUInt32();
                    break;

                case TiffDataType.SBYTE:
                    data[j] = fileStream.ReadSByte();
                    break;

                case TiffDataType.SSHORT:
                    data[j] = fileStream.ReadInt16();
                    //if ( dataOffset == 0 &&  dataCount == 1) fileStream.ReadInt16();
                    break;

                case TiffDataType.SLONG:
                    data[j] = fileStream.ReadInt32();
                    break;

                case TiffDataType.SRATIONAL:
                case TiffDataType.RATIONAL:
                    //Because the nikonmakernote is broken with the tag 0x19 wich is double but offset of zero.
                    if (dataOffset == 0)
                    {
                        data[j] = .0;
                    }
                    else
                    {
                        data[j] = fileStream.ReadRational();
                    }
                    break;

                case TiffDataType.FLOAT:
                    data[j] = fileStream.ReadSingle();
                    break;

                case TiffDataType.DOUBLE:
                    data[j] = fileStream.ReadDouble();
                    break;
                }
            }
        }