diff --git a/OpenRA.FileFormats/Exts.cs b/OpenRA.FileFormats/Exts.cs index df7b60fb64..7a379663d5 100755 --- a/OpenRA.FileFormats/Exts.cs +++ b/OpenRA.FileFormats/Exts.cs @@ -24,6 +24,12 @@ namespace OpenRA return string.Format(fmt, args); } + public static T WithDefault(T def, Func f) + { + try { return f(); } + catch { return def; } + } + public static void Do(this IEnumerable e, Action fn) { foreach (var ee in e) diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index e9fcc04e32..dda992a4ac 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -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 def, Func f) - { - try { return f(); } - catch { return def; } - } - static string GetNamedArg(string[] args, string arg) { if (args.Length < 2)