static void Main(string[] args) { var options = new Options(); if (new Parser(settings => { settings.MutuallyExclusive = true; settings.HelpWriter = Console.Error; }).ParseArguments(args, options)) { var inputFile = options.InputFile; if (inputFile == null && options.Host == null) { Console.Error.WriteLine("Error: either an input file or a host name has to be specified."); Console.Error.WriteLine(options.GetUsage()); return; } if (inputFile != null && !File.Exists(inputFile)) { Console.Error.WriteLine("Error: input file not found."); return; } var rawFile = options.RawFile; if (rawFile != null && !ValidateOutputFile(rawFile)) { Console.Error.WriteLine("Error: invalid output file name for raw data."); return; } var gameobjectsFile = options.GameobjectsFile; if (gameobjectsFile != null && !ValidateOutputFile(gameobjectsFile)) { Console.Error.WriteLine("Error: invalid output file name for gameobjects."); } try { Dump(options); } catch (Exception e) { Console.Error.WriteLine("Unexpected error: " + e.Message); } } }
static void Main(string[] args) { var options = new Options(); if (new Parser(settings => { settings.MutuallyExclusive = true; settings.HelpWriter = Console.Error; }).ParseArguments(args, options)) { var inputFile = options.InputFile; if (inputFile == null && options.Host == null) { Console.Error.WriteLine("Error: either an input file or a host name has to be specified."); Console.Error.WriteLine(options.GetUsage()); return; } if (inputFile != null && !File.Exists(inputFile)) { Console.Error.WriteLine("Error: input file not found."); return; } var rawFile = options.RawFile; if (rawFile != null && !ValidateOutputFile(rawFile)) { Console.Error.WriteLine("Error: invalid output file name for raw data."); return; } var gameobjectsFile = options.GameobjectsFile; if (gameobjectsFile != null && !ValidateOutputFile(gameobjectsFile)) { Console.Error.WriteLine("Error: invalid output file name for gameobjects."); } try { Dump(options); } catch (Exception e) { Console.Error.WriteLine("Unexpected error: " + e.Message); } } }