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

Annotation of /trunk/gr2lib_UnitTest/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (hide annotations) (download)
Thu Jul 15 13:07:44 2010 UTC (9 years, 6 months ago) by william
File size: 4807 byte(s)
enable reading of ExporterInfo

1 william 9 using System;
2     using System.Collections.Generic;
3     using System.Text;
4    
5 william 16 using gr2lib.core;
6 william 70 //using gr2lib.core.coretypes;
7 william 16 using gr2lib.core.apiversion;
8 william 50 using gr2lib.core.exceptions;
9 william 69 using gr2lib.core.helpers;
10 william 70 using gr2lib.core.coretypes.implementation;
11 william 16
12 william 9 namespace gr2lib_UnitTest
13     {
14 william 58
15 william 9 class Program
16     {
17     static void Main(string[] args)
18     {
19 william 65 string GrannyFilename = shared.GRANNY_TEST_FILE;
20 william 50 try
21     {
22 william 70 #region Check Granny2 API Version
23 william 50 // Setup access to check loaded Granny2 API Version
24 william 58 granny2apiversion apiversion = new granny2apiversion(shared.EXPECTED_API_VERSION);
25 william 16
26 william 50 // Check if the Loaded API Version Matches
27     if (!apiversion.apiversionsmatch)
28     {
29     // the loaded version does not match
30     Console.WriteLine("Warning:\n" +
31     "\t Loaded Granny2 DLL Version: " + apiversion.apiversion.version + "\n" +
32     "\t Expected Version: " + apiversion.expectedapiversion.version);
33     // return from void to exit application
34     return;
35     }
36     else
37     {
38     // the loaded version matches
39     Console.WriteLine("Loaded granny2.dll: " + apiversion.apiversion.version);
40     }
41 william 70 #endregion
42    
43     #region Parse Commandline
44 william 69 if (args.Length == 1)
45 william 65 {
46 william 69 GrannyFilename = args[0];
47 william 65 }
48 william 69 else if (args.Length > 1)
49     {
50     throw new InvalidOperationException("ERROR: Recieved Invalid Commandline: " + new arraytostring<string,string[]>(args));
51     }
52 william 61
53 william 65 if (System.IO.File.Exists(GrannyFilename))
54     {
55     Console.WriteLine("Using Granny2 File: " + GrannyFilename);
56     }
57     else
58     {
59     throw new System.IO.FileNotFoundException("Unable to find: " + GrannyFilename);
60     }
61 william 70 #endregion
62 william 61
63 william 70 #region test
64     unsafe
65     {
66 william 61
67    
68 william 70 grnfileinfo info = grnfileinfo.ReadFromFile(GrannyFilename);
69    
70 william 71 #region Read ArtToolInfo
71 william 70 Console.WriteLine();
72     Console.WriteLine("Art Tool Data:");
73     Console.WriteLine("\tTool Name: " + info.ArtToolInfo.FromArtToolName);
74     Console.WriteLine("\tTool Version: " + string.Format("{0}.{1}", info.ArtToolInfo.ArtToolMajorRevision, info.ArtToolInfo.ArtToolMinorRevision));
75     Console.WriteLine("\tTool Units Per Meter: " + info.ArtToolInfo.UnitsPerMeter);
76    
77     Console.WriteLine("\tTool Origin: " + string.Format("[{0},{1},{2}]", info.ArtToolInfo.Origin.X, info.ArtToolInfo.Origin.Y, info.ArtToolInfo.Origin.Z));
78     Console.WriteLine("\tTool Right: " + string.Format("[{0},{1},{2}]", info.ArtToolInfo.Right.X, info.ArtToolInfo.Right.Y, info.ArtToolInfo.Right.Z));
79     Console.WriteLine("\tTool Up: " + string.Format("[{0},{1},{2}]", info.ArtToolInfo.Up.X, info.ArtToolInfo.Up.Y, info.ArtToolInfo.Up.Z));
80     Console.WriteLine("\tTool Back: " + string.Format("[{0},{1},{2}]", info.ArtToolInfo.Back.X, info.ArtToolInfo.Back.Y, info.ArtToolInfo.Back.Z));
81    
82     Console.WriteLine("\tTool ExtendedData: " + info.ArtToolInfo.ExtendedData);
83 william 71 #endregion
84    
85     #region Read ExporterInfo
86     Console.WriteLine();
87     Console.WriteLine("Exporter Info:");
88     Console.WriteLine("\tExporter Name: " + info.ExporterInfo.ExporterName);
89    
90     Console.WriteLine("\tExporter Version: " +
91     string.Format("{0}.{1}.{2}.{3}",
92     info.ExporterInfo.ExporterMajorRevision,
93     info.ExporterInfo.ExporterMinorRevision,
94     info.ExporterInfo.ExporterCustomization,
95     info.ExporterInfo.ExporterBuildNumber));
96    
97     Console.WriteLine("\tExporter ExtendedData: " + info.ExporterInfo.ExtendedData);
98     #endregion
99 william 70 }
100     #endregion
101    
102 william 16 }
103 william 50 catch (granny2apiloadexception ex)
104 william 16 {
105 william 69 Console.WriteLine(ex.Message);
106 william 16 }
107 william 58 catch (Exception ex)
108     {
109 william 69 Console.WriteLine(ex.Message);
110 william 58 }
111 william 9 }
112     }
113     }
114 william 70

  ViewVC Help
Powered by ViewVC 1.1.22