use string.F() extension method everywhere possible; fix various small issues in error messages

This commit is contained in:
Chris Forbes
2011-12-13 23:57:23 +13:00
parent af3d00836a
commit 40029c6688
10 changed files with 28 additions and 28 deletions

View File

@@ -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;
}