static int Main(string[] args) { if (!ParseCommandLineArguments(args)) { Console.WriteLine(USAGE); return(-1); } try { dtbook = Path.Combine(Directory.GetCurrentDirectory(), dtbook); output = Path.Combine(Directory.GetCurrentDirectory(), output); XmlInstanceGenerator gen = new XmlInstanceGenerator(dtbook); gen.Progress += new XmlInstanceGeneratorProgressEventDelegate(gen_Progress); XmlDocument instanceDoc = gen.GenerateInstanceXml(true, true); XmlTextWriter wr = new XmlTextWriter(output, System.Text.Encoding.UTF8); wr.Indentation = 1; wr.IndentChar = ' '; wr.Formatting = Formatting.Indented; instanceDoc.WriteTo(wr); wr.Close(); } catch (Exception e) { Console.WriteLine( "An exception occured:\n{0}\nStack Trace:\n{1}", e.Message, e.StackTrace); while (e.InnerException != null) { e = e.InnerException; Console.WriteLine( "Exception {0}:\n{1}", e.GetType().ToString(), e.Message); } return(-1); } return(0); }
private static void gen_Progress(XmlInstanceGenerator o, ProgressEventArgs e) { Console.WriteLine(e.Message); }