/[gr2lib]/trunk/gr2lib_UnitTest/Program.cs
ViewVC logotype

Diff of /trunk/gr2lib_UnitTest/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/gr2lib_UnitTest/Program.cs	2010/07/16 21:26:08	83
+++ trunk/gr2lib_UnitTest/Program.cs	2010/07/16 23:35:21	86
@@ -8,6 +8,7 @@
 using gr2lib.core.exceptions;
 using gr2lib.core.helpers;
 using gr2lib.core.coretypes.implementation;
+using System.Runtime.CompilerServices;
 
 namespace gr2lib_UnitTest
 {
@@ -61,8 +62,7 @@
                 #endregion
 
                 #region Read Granny2 Data
-                unsafe
-                {
+
                     grnfileinfo info = grnfileinfo.ReadFromFile(GrannyFilename);
 
                     #region Read FromFileName
@@ -157,6 +157,23 @@
                             Console.WriteLine("\t\t\tBytes Per Pixel: " + t.Layout.BytesPerPixel);
                             Console.WriteLine("\t\t\tShiftForComponent: " + new arraytostring<int, int[]>(t.Layout.ShiftForComponent));
                             Console.WriteLine("\t\t\tBitsForComponent: " + new arraytostring<int, int[]>(t.Layout.BitsForComponent));
+
+
+                            Console.WriteLine("\t\t\tImage List:");
+                            foreach (Image img in t.Images)
+                            {
+                                foreach (MIPLevel mip in img.MIPLevels)
+                                {
+                                    Console.WriteLine("\t\t\t\tMipLevel Stride: " + mip.Stride);
+                                    if (mip.Pixels.Count > 0)
+                                    {
+                                        Console.WriteLine("\t\t\t\tMipLevel Pixel: " + "{Pixel Data " + "[" + mip.Pixels.Count + "]}");
+                                        //// export image
+                                        //mip.Pixels.Export(@"exported_images\" + t.FromFileName.Name, t.Width, t.Height, mip.Stride);
+                                    }
+                                }
+                            }
+
                             Console.WriteLine("\t\t\tExtendedData: " + t.ExtendedData);
                             Console.WriteLine();
                         }
@@ -191,18 +208,22 @@
                 }
                 #endregion
 
-            }
+           
             catch (granny2apiloadexception ex)
             {
                 Console.WriteLine(ex.Message);
             }
             catch (Exception ex)
             {
-                Console.WriteLine(ex.Message);
-            }
-            catch
-            {
-                Console.WriteLine("Unknown Error");
+                RuntimeWrappedException rwe = ex as RuntimeWrappedException;
+                if (rwe != null)
+                {
+                    Console.WriteLine(rwe.ToString());
+                }
+                else
+                {
+                    Console.WriteLine(ex.Message);
+                }
             }
         }
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22