static int Main(string[] args) { _args = new Arguments(); try { CommandLineDictionary cmdlineDict = CommandLineDictionary.FromArguments(args, '-', ':'); _args.ParseArguments(args, cmdlineDict); } catch (Exception e) { return Usage("Oops. Something bad happened with the parameters that you gave me.\n\n" + e.Message); } if (_args.Usage) return Usage(); if (string.IsNullOrEmpty(_args.Target)) return Usage("Must specify a target to connect to. Use: [emulator|xde]/[device|phone]"); if (string.IsNullOrEmpty(_args.App) && string.IsNullOrEmpty(_args.Xap)) return Usage("Must specify one of either -app or -xap"); if (!string.IsNullOrEmpty(_args.App) && !string.IsNullOrEmpty(_args.Xap)) return Usage("Confused me, you have. Should I use -app or -xap?"); if (!_args.Install && !_args.Update && !_args.Launch && !_args.UnInstall && string.IsNullOrEmpty(_args.Get) && string.IsNullOrEmpty(_args.Put)) return Usage("Yawn. You haven't asked me to install, update or launch the app, so what do you want me to do?"); int rv = 0; try { rv = DoWork(); } catch (ConsoleMessageException e) { System.Console.Error.WriteLine(e.Message); rv = 1; } return rv; }