use string.F() extension method everywhere possible; fix various small issues in error messages
This commit is contained in:
@@ -48,17 +48,17 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public bool Contains<T>()
|
||||
{
|
||||
return dataSingular.ContainsKey( typeof( T ) ) || dataMultiple.ContainsKey( typeof( T ) );
|
||||
return dataSingular.ContainsKey(typeof(T)) || dataMultiple.ContainsKey(typeof(T));
|
||||
}
|
||||
|
||||
public T Get<T>()
|
||||
{
|
||||
if( dataMultiple.ContainsKey( typeof( T ) ) )
|
||||
throw new InvalidOperationException( string.Format( "TypeDictionary contains multiple instance of type `{0}`", typeof( T ) ) );
|
||||
if (dataMultiple.ContainsKey(typeof(T)))
|
||||
throw new InvalidOperationException("TypeDictionary contains multiple instance of type `{0}`".F(typeof(T)));
|
||||
|
||||
object ret;
|
||||
if( !dataSingular.TryGetValue( typeof( T ), out ret ) )
|
||||
throw new InvalidOperationException(string.Format("TypeDictionary does not contain instance of type `{0}`", typeof(T)));
|
||||
if (!dataSingular.TryGetValue(typeof(T), out ret))
|
||||
throw new InvalidOperationException("TypeDictionary does not contain instance of type `{0}`".F(typeof(T)));
|
||||
return (T)ret;
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public object GetOrDefault(Type t)
|
||||
{
|
||||
if( dataMultiple.ContainsKey(t) )
|
||||
throw new InvalidOperationException( string.Format( "TypeDictionary contains multiple instance of type `{0}`", t ) );
|
||||
if (dataMultiple.ContainsKey(t))
|
||||
throw new InvalidOperationException("TypeDictionary contains multiple instances of type `{0}`".F(t));
|
||||
|
||||
object ret;
|
||||
if( !dataSingular.TryGetValue(t, out ret ) )
|
||||
if (!dataSingular.TryGetValue(t, out ret))
|
||||
return null;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user