private static long[] GetArrayLongShort(TIFFDirectory dir, int tag)
        {
            TIFFField field = dir.GetField(tag);

            if (field == null)
            {
                return(null);
            }
            long[] offset;
            if (field.GetFieldType() == TIFFField.TIFF_LONG)
            {
                offset = field.GetAsLongs();
            }
            else
            {
                // must be short
                char[] temp = field.GetAsChars();
                offset = new long[temp.Length];
                for (int k = 0; k < temp.Length; ++k)
                {
                    offset[k] = temp[k];
                }
            }
            return(offset);
        }
 private void CompareFields(TIFFField cmpField, TIFFField resultField)
 {
     if (cmpField.GetFieldType() == TIFFField.TIFF_LONG)
     {
         NUnit.Framework.Assert.AreEqual(cmpField.GetAsLongs(), resultField.GetAsLongs());
     }
     else
     {
         if (cmpField.GetFieldType() == TIFFField.TIFF_BYTE)
         {
             NUnit.Framework.Assert.AreEqual(cmpField.GetAsBytes(), resultField.GetAsBytes());
         }
         else
         {
             if (cmpField.GetFieldType() == TIFFField.TIFF_SBYTE)
             {
                 NUnit.Framework.Assert.AreEqual(cmpField.GetAsBytes(), resultField.GetAsBytes());
             }
             else
             {
                 if (cmpField.GetFieldType() == TIFFField.TIFF_SHORT)
                 {
                     NUnit.Framework.Assert.AreEqual(cmpField.GetAsChars(), resultField.GetAsChars());
                 }
                 else
                 {
                     if (cmpField.GetFieldType() == TIFFField.TIFF_SLONG)
                     {
                         NUnit.Framework.Assert.AreEqual(cmpField.GetAsInts(), resultField.GetAsInts());
                     }
                     else
                     {
                         if (cmpField.GetFieldType() == TIFFField.TIFF_SSHORT)
                         {
                             NUnit.Framework.Assert.AreEqual(cmpField.GetAsChars(), resultField.GetAsChars());
                         }
                         else
                         {
                             if (cmpField.GetFieldType() == TIFFField.TIFF_UNDEFINED)
                             {
                                 NUnit.Framework.Assert.AreEqual(cmpField.GetAsBytes(), resultField.GetAsBytes());
                             }
                             else
                             {
                                 if (cmpField.GetFieldType() == TIFFField.TIFF_DOUBLE)
                                 {
                                     NUnit.Framework.Assert.AreEqual(cmpField.GetAsDoubles(), resultField.GetAsDoubles());
                                 }
                                 else
                                 {
                                     if (cmpField.GetFieldType() == TIFFField.TIFF_FLOAT)
                                     {
                                         NUnit.Framework.Assert.AreEqual(cmpField.GetAsFloats(), resultField.GetAsFloats());
                                     }
                                     else
                                     {
                                         if (cmpField.GetFieldType() == TIFFField.TIFF_RATIONAL)
                                         {
                                             NUnit.Framework.Assert.AreEqual(cmpField.GetAsRationals(), resultField.GetAsRationals());
                                         }
                                         else
                                         {
                                             if (cmpField.GetFieldType() == TIFFField.TIFF_SRATIONAL)
                                             {
                                                 NUnit.Framework.Assert.AreEqual(cmpField.GetAsSRationals(), resultField.GetAsSRationals());
                                             }
                                             else
                                             {
                                                 if (cmpField.GetFieldType() == TIFFField.TIFF_ASCII)
                                                 {
                                                     NUnit.Framework.Assert.AreEqual(cmpField.GetAsStrings(), resultField.GetAsStrings());
                                                 }
                                                 else
                                                 {
                                                     NUnit.Framework.Assert.AreEqual(cmpField.GetAsBytes(), resultField.GetAsBytes());
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }