diff --git a/OpenRA.FileFormats/FileFormats/Format80.cs b/OpenRA.FileFormats/FileFormats/Format80.cs index c21c70499c..ad2b97b6d8 100644 --- a/OpenRA.FileFormats/FileFormats/Format80.cs +++ b/OpenRA.FileFormats/FileFormats/Format80.cs @@ -45,7 +45,7 @@ namespace OpenRA.FileFormats static void ReplicatePrevious( byte[] dest, int destIndex, int srcIndex, int count ) { if( srcIndex > destIndex ) - throw new NotImplementedException( string.Format( "srcIndex > destIndex {0} {1}", srcIndex, destIndex ) ); + throw new NotImplementedException("srcIndex > destIndex {0} {1}".F(srcIndex, destIndex)); if( destIndex - srcIndex == 1 ) { @@ -105,7 +105,7 @@ namespace OpenRA.FileFormats int count = ctx.ReadWord(); int srcIndex = ctx.ReadWord(); if( srcIndex >= destIndex ) - throw new NotImplementedException( string.Format( "srcIndex >= destIndex {0} {1}", srcIndex, destIndex ) ); + throw new NotImplementedException("srcIndex >= destIndex {0} {1}".F(srcIndex, destIndex)); for( int end = destIndex + count ; destIndex < end ; destIndex++ ) dest[ destIndex ] = dest[ srcIndex++ ]; @@ -116,7 +116,7 @@ namespace OpenRA.FileFormats int count = count3 + 3; int srcIndex = ctx.ReadWord(); if( srcIndex >= destIndex ) - throw new NotImplementedException( string.Format( "srcIndex >= destIndex {0} {1}", srcIndex, destIndex ) ); + throw new NotImplementedException("srcIndex >= destIndex {0} {1}".F(srcIndex, destIndex)); for( int end = destIndex + count ; destIndex < end ; destIndex++ ) dest[ destIndex ] = dest[ srcIndex++ ]; diff --git a/OpenRA.FileFormats/Filesystem/FileSystem.cs b/OpenRA.FileFormats/Filesystem/FileSystem.cs index ad4c9089b3..daafff5ce9 100644 --- a/OpenRA.FileFormats/Filesystem/FileSystem.cs +++ b/OpenRA.FileFormats/Filesystem/FileSystem.cs @@ -148,7 +148,7 @@ namespace OpenRA.FileFormats return folder.GetContent(filename + ext); } - throw new FileNotFoundException( string.Format( "File not found: {0}", filename ), filename ); + throw new FileNotFoundException("File not found: {0}".F(filename), filename); } public static bool Exists(string filename) { return mountedFolders.Any(f => f.Exists(filename)); } diff --git a/OpenRA.FileFormats/Graphics/ShpReader.cs b/OpenRA.FileFormats/Graphics/ShpReader.cs index 7ad21a4fe1..736ff4a216 100644 --- a/OpenRA.FileFormats/Graphics/ShpReader.cs +++ b/OpenRA.FileFormats/Graphics/ShpReader.cs @@ -97,7 +97,7 @@ namespace OpenRA.FileFormats else if( h.Format == Format.Format40 ) { if( !offsets.TryGetValue( h.RefOffset, out h.RefImage ) ) - throw new InvalidDataException( string.Format( "Reference doesnt point to image data {0}->{1}", h.Offset, h.RefOffset ) ); + throw new InvalidDataException( "Reference doesnt point to image data {0}->{1}".F(h.Offset, h.RefOffset) ); } } diff --git a/OpenRA.FileFormats/Map/SmudgeReference.cs b/OpenRA.FileFormats/Map/SmudgeReference.cs index be712a7c9d..8c5d4dddb2 100644 --- a/OpenRA.FileFormats/Map/SmudgeReference.cs +++ b/OpenRA.FileFormats/Map/SmudgeReference.cs @@ -15,6 +15,7 @@ namespace OpenRA.FileFormats public readonly string Type; public readonly int2 Location; public readonly int Depth; + public SmudgeReference( string type, int2 location, int depth ) { Type = type; @@ -22,10 +23,9 @@ namespace OpenRA.FileFormats Depth = depth; } - public override string ToString () + public override string ToString() { - return string.Format("{0} {1},{2} {3}", Type, Location.X,Location.Y, Depth); + return "{0} {1},{2} {3}".F(Type, Location.X, Location.Y, Depth); } - } } diff --git a/OpenRA.FileFormats/PackageEntry.cs b/OpenRA.FileFormats/PackageEntry.cs index d9a1e42eea..8e32d98c48 100644 --- a/OpenRA.FileFormats/PackageEntry.cs +++ b/OpenRA.FileFormats/PackageEntry.cs @@ -46,9 +46,9 @@ namespace OpenRA.FileFormats { string filename; if (Names.TryGetValue(Hash, out filename)) - return string.Format("{0} - offset 0x{1:x8} - length 0x{2:x8}", filename, Offset, Length); + return "{0} - offset 0x{1:x8} - length 0x{2:x8}".F(filename, Offset, Length); else - return string.Format("0x{0:x8} - offset 0x{1:x8} - length 0x{2:x8}", Hash, Offset, Length); + return "0x{0:x8} - offset 0x{1:x8} - length 0x{2:x8}".F(Hash, Offset, Length); } public static uint HashFilename(string name) diff --git a/OpenRA.FileFormats/Primitives/float2.cs b/OpenRA.FileFormats/Primitives/float2.cs index ac9e5000cb..ea4ec5febb 100644 --- a/OpenRA.FileFormats/Primitives/float2.cs +++ b/OpenRA.FileFormats/Primitives/float2.cs @@ -92,7 +92,7 @@ namespace OpenRA public static float Dot(float2 a, float2 b) { return a.X * b.X + a.Y * b.Y; } public float2 Round() { return new float2((float)Math.Round(X), (float)Math.Round(Y)); } - public override string ToString() { return string.Format("({0},{1})", X, Y); } + public override string ToString() { return "({0},{1})".F(X, Y); } public int2 ToInt2() { return new int2((int)X, (int)Y); } public static float2 Max(float2 a, float2 b) { return new float2(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y)); } diff --git a/OpenRA.FileFormats/Primitives/int2.cs b/OpenRA.FileFormats/Primitives/int2.cs index 6b6575be55..c40d4c67fe 100644 --- a/OpenRA.FileFormats/Primitives/int2.cs +++ b/OpenRA.FileFormats/Primitives/int2.cs @@ -55,7 +55,7 @@ namespace OpenRA public PointF ToPointF() { return new PointF(X, Y); } public float2 ToFloat2() { return new float2(X, Y); } - public override string ToString() { return string.Format("{0},{1}", X, Y); } + public override string ToString() { return "{0},{1}".F(X, Y); } // Change endianness of a uint32 public static uint Swap(uint orig) diff --git a/OpenRA.FileFormats/TypeDictionary.cs b/OpenRA.FileFormats/TypeDictionary.cs index c279345c30..596600fc11 100644 --- a/OpenRA.FileFormats/TypeDictionary.cs +++ b/OpenRA.FileFormats/TypeDictionary.cs @@ -48,17 +48,17 @@ namespace OpenRA.FileFormats public bool Contains() { - return dataSingular.ContainsKey( typeof( T ) ) || dataMultiple.ContainsKey( typeof( T ) ); + return dataSingular.ContainsKey(typeof(T)) || dataMultiple.ContainsKey(typeof(T)); } public T Get() { - 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; } diff --git a/OpenRA.Game/TraitDictionary.cs b/OpenRA.Game/TraitDictionary.cs index 162f24a2b0..1c382db161 100755 --- a/OpenRA.Game/TraitDictionary.cs +++ b/OpenRA.Game/TraitDictionary.cs @@ -57,28 +57,28 @@ namespace OpenRA public bool Contains( Actor actor ) { if( actor.Destroyed ) - throw new InvalidOperationException( "Attempted to get trait from destroyed object ({0})".F( actor.ToString() ) ); + throw new InvalidOperationException("Attempted to get trait from destroyed object ({0})".F(actor)); return ( (TraitContainer)InnerGet( typeof( T ) ) ).GetMultiple( actor.ActorID ).Count() != 0; } public T Get( Actor actor ) { if( actor.Destroyed ) - throw new InvalidOperationException( "Attempted to get trait from destroyed object ({0})".F( actor.ToString() ) ); + throw new InvalidOperationException("Attempted to get trait from destroyed object ({0})".F(actor)); return ( (TraitContainer)InnerGet( typeof( T ) ) ).Get( actor.ActorID ); } public T GetOrDefault( Actor actor ) { if( actor.Destroyed ) - throw new InvalidOperationException( "Attempted to get trait from destroyed object ({0})".F( actor.ToString() ) ); + throw new InvalidOperationException("Attempted to get trait from destroyed object ({0})".F(actor)); return ( (TraitContainer)InnerGet( typeof( T ) ) ).GetOrDefault( actor.ActorID ); } public IEnumerable WithInterface( Actor actor ) { if( actor.Destroyed ) - throw new InvalidOperationException( "Attempted to get trait from destroyed object ({0})".F( actor.ToString() ) ); + throw new InvalidOperationException("Attempted to get trait from destroyed object ({0})".F(actor)); return ( (TraitContainer)InnerGet( typeof( T ) ) ).GetMultiple( actor.ActorID ); } @@ -121,9 +121,9 @@ namespace OpenRA ++queries; var index = actors.BinarySearchMany( actor ); if( index >= actors.Count || actors[ index ].ActorID != actor ) - throw new InvalidOperationException( string.Format( "TraitDictionary does not contain instance of type `{0}`", typeof( T ) ) ); + throw new InvalidOperationException("TraitDictionary does not contain instance of type `{0}`".F(typeof(T))); else if( index + 1 < actors.Count && actors[ index + 1 ].ActorID == actor ) - throw new InvalidOperationException( string.Format( "TraitDictionary contains multiple instance of type `{0}`", typeof( T ) ) ); + throw new InvalidOperationException("TraitDictionary contains multiple instance of type `{0}`".F(typeof(T))); else return traits[ index ]; } @@ -135,7 +135,7 @@ namespace OpenRA if( index >= actors.Count || actors[ index ].ActorID != actor ) return default( T ); else if( index + 1 < actors.Count && actors[ index + 1 ].ActorID == actor ) - throw new InvalidOperationException( string.Format( "TraitDictionary contains multiple instance of type `{0}`", typeof( T ) ) ); + throw new InvalidOperationException("TraitDictionary contains multiple instance of type `{0}`".F(typeof(T))); else return traits[ index ]; } diff --git a/OpenRA.Renderer.Cg/Shader.cs b/OpenRA.Renderer.Cg/Shader.cs index 5ca8df7092..22173a144e 100644 --- a/OpenRA.Renderer.Cg/Shader.cs +++ b/OpenRA.Renderer.Cg/Shader.cs @@ -35,7 +35,7 @@ namespace OpenRA.Renderer.Cg var err = Tao.Cg.Cg.cgGetErrorString(Tao.Cg.Cg.cgGetError()); var results = Tao.Cg.Cg.cgGetLastListing(dev.cgContext); throw new InvalidOperationException( - string.Format("Cg compile failed ({0}):\n{1}", err, results)); + "Cg compile failed ({0}):\n{1}".F(err, results)); } technique = Tao.Cg.Cg.cgGetFirstTechnique(effect);