private static void AddException(string[] args, FirewallHelper fwHelper) { string appName; if (args.Length == 2) { string appPath = args[1] == "-g" ? PickAFile() : Path.GetFullPath(args[1]); if (appPath != null) { appName = Path.GetFileNameWithoutExtension(appPath); fwHelper.GrantRule(Path.GetFullPath(appPath), appName, Resources.description); } else { return; } } else if (args.Length == 3) { string appPath = args[1]; appName = args[2]; fwHelper.GrantRule(Path.GetFullPath(appPath), appName, Resources.description); } else { throw new ArgumentOutOfRangeException("-a just has 1 or 2 options."); } Console.WriteLine("Added {0} to exceptions list.", appName); }