display where duplicate keys in MiniYaml are found

This commit is contained in:
Matthias Mailänder
2013-08-17 23:27:45 +02:00
parent 8c6074a081
commit 018ceb8d82
2 changed files with 6 additions and 6 deletions

View File

@@ -93,7 +93,7 @@ namespace OpenRA.FileFormats
foreach (var y in Nodes)
{
if (ret.ContainsKey(y.Key))
throw new InvalidDataException("Duplicate key `{0}' in MiniYaml".F(y.Key));
throw new InvalidDataException("Duplicate key `{0}' in {1}".F(y.Key, y.Location));
ret.Add(y.Key, y.Value);
}

View File

@@ -20,15 +20,15 @@ namespace OpenRA
{
Dictionary<string, MiniYamlNode> widgets = new Dictionary<string, MiniYamlNode>();
public WidgetLoader( ModData modData )
public WidgetLoader(ModData modData)
{
foreach( var file in modData.Manifest.ChromeLayout.Select( a => MiniYaml.FromFile( a ) ) )
foreach (var file in modData.Manifest.ChromeLayout.Select(a => MiniYaml.FromFile(a)))
foreach( var w in file )
{
var key = w.Key.Substring( w.Key.IndexOf( '@' ) + 1 );
var key = w.Key.Substring( w.Key.IndexOf('@') + 1);
if (widgets.ContainsKey(key))
throw new InvalidDataException("Widget has duplicate Key `{0}`".F(w.Key));
widgets.Add( key, w );
throw new InvalidDataException("Widget has duplicate Key `{0}` at {1}".F(w.Key, w.Location));
widgets.Add(key, w);
}
}