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

prettyPrintField() private method

private prettyPrintField ( Stream fd, TiffTag tag, int value_count, object raw_data ) : bool
fd Stream
tag TiffTag
value_count int
raw_data object
return bool
        private bool prettyPrintField(Stream fd, TiffTag tag, int value_count, object raw_data)
        {
            FieldValue value = new FieldValue(raw_data);
            short[] sdata = value.ToShortArray();
            float[] fdata = value.ToFloatArray();
            double[] ddata = value.ToDoubleArray();

            switch (tag)
            {
                case TiffTag.INKSET:
                    if (sdata != null)
                    {
                        fprintf(fd, "  Ink Set: ");
                        switch ((InkSet)sdata[0])
                        {
                            case InkSet.CMYK:
                                fprintf(fd, "CMYK\n");
                                break;

                            default:
                                fprintf(fd, "{0} (0x{1:x})\n", sdata[0], sdata[0]);
                                break;
                        }
                        return true;
                    }
                    return false;

                case TiffTag.DOTRANGE:
                    if (sdata != null)
                    {
                        fprintf(fd, "  Dot Range: {0}-{1}\n", sdata[0], sdata[1]);
                        return true;
                    }
                    return false;

                case TiffTag.WHITEPOINT:
                    if (fdata != null)
                    {
                        fprintf(fd, "  White Point: {0:G}-{1:G}\n", fdata[0], fdata[1]);
                        return true;
                    }
                    return false;

                case TiffTag.REFERENCEBLACKWHITE:
                    if (fdata != null)
                    {
                        fprintf(fd, "  Reference Black/White:\n");
                        for (short i = 0; i < 3; i++)
                            fprintf(fd, "    {0,2:D}: {1,5:G} {2,5:G}\n", i, fdata[2 * i + 0], fdata[2 * i + 1]);
                        return true;
                    }
                    return false;

                case TiffTag.XMLPACKET:
                    string s = raw_data as string;
                    if (s != null)
                    {
                        fprintf(fd, "  XMLPacket (XMP Metadata):\n");
                        fprintf(fd, s.Substring(0, value_count));
                        fprintf(fd, "\n");
                        return true;
                    }
                    return false;

                case TiffTag.RICHTIFFIPTC:
                    // XXX: for some weird reason RichTIFFIPTC tag defined
                    // as array of LONG values.
                    fprintf(fd, "  RichTIFFIPTC Data: <present>, {0} bytes\n", value_count * 4);
                    return true;

                case TiffTag.PHOTOSHOP:
                    fprintf(fd, "  Photoshop Data: <present>, {0} bytes\n", value_count);
                    return true;

                case TiffTag.ICCPROFILE:
                    fprintf(fd, "  ICC Profile: <present>, {0} bytes\n", value_count);
                    return true;

                case TiffTag.STONITS:
                    if (ddata != null)
                    {
                        fprintf(fd, "  Sample to Nits conversion factor: {0:e4}\n", ddata[0]);
                        return true;
                    }
                    return false;
            }

            return false;
        }
Tiff