expose appropriate *Inits, and make them work in editor

This commit is contained in:
Chris Forbes
2011-11-06 18:15:56 +13:00
parent 772734d032
commit 6cb8ee1f9f
17 changed files with 332 additions and 28 deletions

View File

@@ -64,13 +64,18 @@ namespace OpenRA.FileFormats
public T GetOrDefault<T>()
{
if( dataMultiple.ContainsKey( typeof( T ) ) )
throw new InvalidOperationException( string.Format( "TypeDictionary contains multiple instance of type `{0}`", typeof( T ) ) );
return (T)GetOrDefault(typeof(T));
}
public object GetOrDefault(Type t)
{
if( dataMultiple.ContainsKey(t) )
throw new InvalidOperationException( string.Format( "TypeDictionary contains multiple instance of type `{0}`", t ) );
object ret;
if( !dataSingular.TryGetValue( typeof( T ), out ret ) )
return default( T );
return (T)ret;
if( !dataSingular.TryGetValue(t, out ret ) )
return null;
return ret;
}
public IEnumerable<T> WithInterface<T>()