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

Contents of /trunk/gr2lib_UnitTest/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 65 - (show annotations) (download)
Thu Jul 15 08:37:02 2010 UTC (9 years, 6 months ago) by william
File size: 2113 byte(s)
add support for passing file on commandline

1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 using gr2lib.core;
6 using gr2lib.core.apiversion;
7 using gr2lib.core.exceptions;
8
9 namespace gr2lib_UnitTest
10 {
11
12 class Program
13 {
14 static void Main(string[] args)
15 {
16 string GrannyFilename = shared.GRANNY_TEST_FILE;
17 try
18 {
19 // Setup access to check loaded Granny2 API Version
20 granny2apiversion apiversion = new granny2apiversion(shared.EXPECTED_API_VERSION);
21
22 // Check if the Loaded API Version Matches
23 if (!apiversion.apiversionsmatch)
24 {
25 // the loaded version does not match
26 Console.WriteLine("Warning:\n" +
27 "\t Loaded Granny2 DLL Version: " + apiversion.apiversion.version + "\n" +
28 "\t Expected Version: " + apiversion.expectedapiversion.version);
29 // return from void to exit application
30 return;
31 }
32 else
33 {
34 // the loaded version matches
35 Console.WriteLine("Loaded granny2.dll: " + apiversion.apiversion.version);
36 }
37
38 // parse commandline
39 if (args.Length == 2)
40 {
41 GrannyFilename = args[1];
42 }
43
44 if (System.IO.File.Exists(GrannyFilename))
45 {
46 Console.WriteLine("Using Granny2 File: " + GrannyFilename);
47 }
48 else
49 {
50 throw new System.IO.FileNotFoundException("Unable to find: " + GrannyFilename);
51 }
52
53
54
55
56 }
57 catch (granny2apiloadexception ex)
58 {
59 Console.WriteLine(ex.ToString());
60 }
61 catch (Exception ex)
62 {
63 Console.WriteLine(ex.ToString());
64 }
65 }
66 }
67 }

  ViewVC Help
Powered by ViewVC 1.1.22