internal static int Main(string[] args) { var task = new ExtractLambdasFromXaml(); bool argsError = false; foreach (string arg in args) { if (arg.StartsWith("/") || arg.StartsWith("-")) { string[] opt = arg.Substring(1).Split(new[] { ':' }, 2); string optName = opt[0].ToLowerInvariant(); string optArg = opt.Length == 2 ? opt[1] : null; switch (optName) { case "language": { if (optArg != null) { task.Language = optArg; } else { argsError = true; } } break; default: { argsError = true; } break; } } else if (task.InputFileName == null) { task.InputFileName = new TaskItem(arg); } else if (task.OutputFileName == null) { task.OutputFileName = new TaskItem(arg); } else { argsError = true; } } if (argsError || task.InputFileName == null || task.OutputFileName == null) { Console.Error.WriteLine("Usage: {0} <input-file> <output-file> [/language:<language>]", ToolName); return(1); } return(task.Execute() ? 0 : 1); }
internal static int Main(string[] args) { var task = new ExtractLambdasFromXaml(); bool argsError = false; foreach (string arg in args) { if (arg.StartsWith("/") || arg.StartsWith("-")) { string[] opt = arg.Substring(1).Split(new[] { ':' }, 2); string optName = opt[0].ToLowerInvariant(); string optArg = opt.Length == 2 ? opt[1] : null; switch (optName) { case "language": { if (optArg != null) { task.Language = optArg; } else { argsError = true; } } break; default: { argsError = true; } break; } } else if (task.InputFileName == null) { task.InputFileName = new TaskItem(arg); } else if (task.OutputFileName == null) { task.OutputFileName = new TaskItem(arg); } else { argsError = true; } } if (argsError || task.InputFileName == null || task.OutputFileName == null) { Console.Error.WriteLine("Usage: {0} <input-file> <output-file> [/language:<language>]", ToolName); return 1; } return task.Execute() ? 0 : 1; }