private static string ParseDriverFileCad(string webRootPath, string path) { var xmlFile = $@"\uploads\result-xml-{DateTime.Now:yyMMddHHmm}.xml"; DataFile vudf = DriverCardDataFile.Create(); var xtw = new XmlTextWriter(string.Concat(webRootPath, $@"\uploads\result-xml-{DateTime.Now:yyMMddHHmm}.xml"), Encoding.UTF8); vudf.Process(path, xtw); xtw.Close(); xtw.Dispose(); return(xmlFile); }
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(); } }
private static void ProcessDataDirs() { ProcessDataDir("driver", () => DriverCardDataFile.Create()); ProcessDataDir("vehicle", () => VehicleUnitDataFile.Create()); }