示例#1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                ProcessDataDirs();
                return;
            }

            if (args.Length < 2)
            {
                Console.Error.WriteLine("Expected --driver <file> or --vehicle <file> [output file]");
                return;
            }

            DataFile proc = null;

            if (args[0] == "--driver")
            {
                proc = DriverCardDataFile.Create();
            }

            if (args[0] == "--vehicle")
            {
                proc = VehicleUnitDataFile.Create();
            }

            if (proc == null)
            {
                Console.Error.WriteLine("Expected --driver <file> or --vehicle <file> [output file]");
                return;
            }


            proc.LogLevel = LogLevel.DEBUG;
            var xtw = args.Length > 2 ? new XmlTextWriter(args[2], Encoding.UTF8) : new XmlTextWriter(Stream.Null, Encoding.UTF8);

            try
            {
                xtw.Formatting = Formatting.Indented;
                proc.Process(args[1], xtw);
            }
            finally
            {
                xtw.Close();
            }
        }
示例#2
0
 private static void ProcessDataDirs()
 {
     ProcessDataDir("driver", () => DriverCardDataFile.Create());
     ProcessDataDir("vehicle", () => VehicleUnitDataFile.Create());
 }