move WithDefault onto Exts

This commit is contained in:
Chris Forbes
2011-10-04 22:33:52 +13:00
parent 49a758f031
commit 8174e7fffb
2 changed files with 7 additions and 7 deletions

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Utility
try
{
var action = WithDefault( null, () => actions[args[0]]);
var action = Exts.WithDefault( null, () => actions[args[0]]);
if (action == null)
PrintUsage();
else
@@ -61,12 +61,6 @@ namespace OpenRA.Utility
Console.WriteLine(" --extract MOD[,MOD]* FILES Extract files from mod packages");
}
static T WithDefault<T>(T def, Func<T> f)
{
try { return f(); }
catch { return def; }
}
static string GetNamedArg(string[] args, string arg)
{
if (args.Length < 2)