remove some duplication in Utility

This commit is contained in:
Chris Forbes
2011-02-05 11:22:52 +13:00
parent 2fa4285281
commit c3c16c4fd8
2 changed files with 41 additions and 50 deletions

View File

@@ -17,7 +17,9 @@ namespace OpenRA
{
Dictionary<string, string> args = new Dictionary<string, string>();
public Arguments(IEnumerable<string> src)
public static Arguments Empty { get { return new Arguments(); } }
public Arguments(params string[] src)
{
Regex regex = new Regex("([^=]+)=(.*)");
foreach (string s in src)
@@ -26,7 +28,7 @@ namespace OpenRA
if (m == null || !m.Success)
continue;
args.Add(m.Groups[1].Value, m.Groups[2].Value);
args[m.Groups[1].Value] = m.Groups[2].Value;
}
}