Add Dictionary<,> support to FieldSaver
This commit is contained in:
@@ -648,6 +648,7 @@ namespace OpenRA
|
||||
public string YamlName;
|
||||
public string Loader;
|
||||
public bool FromYamlKey;
|
||||
public bool DictionaryFromYamlKey;
|
||||
public bool Required;
|
||||
|
||||
public SerializeAttribute(bool serialize = true, bool required = false)
|
||||
@@ -710,6 +711,17 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
// Special-cases FieldFromYamlKeyAttribute for use with Dictionary<K,V>.
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public sealed class DictionaryFromYamlKeyAttribute : FieldLoader.SerializeAttribute
|
||||
{
|
||||
public DictionaryFromYamlKeyAttribute()
|
||||
{
|
||||
FromYamlKey = true;
|
||||
DictionaryFromYamlKey = true;
|
||||
}
|
||||
}
|
||||
|
||||
// mirrors DescriptionAttribute from System.ComponentModel but we dont want to have to use that everywhere.
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public sealed class DescAttribute : Attribute
|
||||
|
||||
Reference in New Issue
Block a user