[msvc] Update csproj files (#4221)
[mono.git] / mcs / tools / genxs / genxs.cs
1 // 
2 // genxs.cs
3 //
4 // Author:
5 //   Lluis Sanchez Gual (lluis@ximian.com)
6 //
7 // Copyright (C) 2003 Ximian, Inc.
8 //
9
10 using System;
11 using System.Xml.Serialization;
12 using System.IO;
13 using System.Reflection;
14
15 public class Driver
16 {
17         static void Main (string[] args)
18         {
19                 if (args.Length == 0 || args[0] == "--help")
20                 {
21                         Console.WriteLine ("Mono Xml Serializer Generator Tool");
22                         Console.WriteLine ("Usage: genxs ConfigFileName [DestinationPath]");
23                         Console.WriteLine ();
24                         return;
25                 }
26
27                 try
28                 {
29                         Type t = Type.GetType ("System.Xml.Serialization.SerializationCodeGenerator, System.Xml");
30                         if (t == null) throw new Exception ("This runtime does not support generation of serializers");
31                 
32                         MethodInfo met = t.GetMethod ("Generate", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
33                         met.Invoke (null, new object[] {args[0], (args.Length > 1) ? args[1] : null} );
34                 }
35                 catch (Exception ex)
36                 {
37                         Console.WriteLine ("An error occurred while generating serializers: " + ex);
38                 }
39         }
40 }