From ab42202a34a80ffa9e5addbf319b1957bf1da912 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 31 May 2015 08:57:05 +1000 Subject: [PATCH] Downgrade to C# 3.0, use shorthand array initialisers where possible. --- ClassicalSharp.csproj | 2 +- ClassicalSharp.sln | 4 +- GraphicsAPI/DirectXApi.cs | 12 +- GraphicsAPI/IGraphicsApi.cs | 2 +- GraphicsAPI/OpenGLApi.cs | 20 ++- Launcher/Launcher.csproj | 2 +- Launcher/MainForm.resx | 245 ++++++++++++++++++------------------ Launcher/app.config | 10 +- app.config | 6 +- 9 files changed, 150 insertions(+), 153 deletions(-) diff --git a/ClassicalSharp.csproj b/ClassicalSharp.csproj index 249ea1537..84c531be1 100644 --- a/ClassicalSharp.csproj +++ b/ClassicalSharp.csproj @@ -1,5 +1,5 @@  - + {BEB1C785-5CAD-48FF-A886-876BF0A318D4} Debug diff --git a/ClassicalSharp.sln b/ClassicalSharp.sln index 3093c09c6..d8ceec902 100644 --- a/ClassicalSharp.sln +++ b/ClassicalSharp.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 # SharpDevelop 4.4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassicalSharp", "ClassicalSharp.csproj", "{BEB1C785-5CAD-48FF-A886-876BF0A318D4}" EndProject diff --git a/GraphicsAPI/DirectXApi.cs b/GraphicsAPI/DirectXApi.cs index 06444c7a2..bc0954aee 100644 --- a/GraphicsAPI/DirectXApi.cs +++ b/GraphicsAPI/DirectXApi.cs @@ -26,7 +26,7 @@ namespace ClassicalSharp.GraphicsAPI { const int vBufferSize = 2048; MatrixStack viewStack, projStack, texStack; MatrixStack curStack; - PrimitiveType[] modeMappings = new PrimitiveType[] { + PrimitiveType[] modeMappings = { PrimitiveType.TriangleList, PrimitiveType.LineList, PrimitiveType.TriangleStrip, }; @@ -47,7 +47,7 @@ namespace ClassicalSharp.GraphicsAPI { set { device.RenderState.AlphaBlendEnable = value; } } - Compare[] compareFuncs = new Compare[] { + Compare[] compareFuncs = { Compare.Always, Compare.NotEqual, Compare.Never, Compare.Less, Compare.LessEqual, Compare.Equal, Compare.GreaterEqual, Compare.Greater, }; @@ -56,7 +56,7 @@ namespace ClassicalSharp.GraphicsAPI { device.RenderState.ReferenceAlpha = (int)( value * 255f ); } - Blend[] blendFuncs = new Blend[] { + Blend[] blendFuncs = { Blend.Zero, Blend.One, Blend.SourceAlpha, Blend.InvSourceAlpha, Blend.DestinationAlpha, Blend.InvDestinationAlpha, @@ -82,7 +82,7 @@ namespace ClassicalSharp.GraphicsAPI { device.RenderState.FogEnd = value; } - FogMode[] modes = new FogMode[] { FogMode.Linear, FogMode.Exp, FogMode.Exp2 }; + FogMode[] modes = { FogMode.Linear, FogMode.Exp, FogMode.Exp2 }; public override void SetFogMode( Fog mode ) { device.RenderState.FogTableMode = modes[(int)mode]; } @@ -186,14 +186,14 @@ namespace ClassicalSharp.GraphicsAPI { device.DrawUserPrimitives( modeMappings[(int)mode], count, vertices ); } - FillMode[] fillModes = new FillMode[] { FillMode.Point, FillMode.WireFrame, FillMode.Solid }; + FillMode[] fillModes = { FillMode.Point, FillMode.WireFrame, FillMode.Solid }; public override void SetFillType( FillType type ) { device.RenderState.FillMode = fillModes[(int)type]; } #region Vertex buffers - VertexFormats[] formatMapping = new VertexFormats[] { + VertexFormats[] formatMapping = { VertexFormats.Position | VertexFormats.Texture1, VertexFormats.Position | VertexFormats.Diffuse, VertexFormats.Position | VertexFormats.Texture1 | VertexFormats.Diffuse, diff --git a/GraphicsAPI/IGraphicsApi.cs b/GraphicsAPI/IGraphicsApi.cs index 2bcc85307..7ce051de2 100644 --- a/GraphicsAPI/IGraphicsApi.cs +++ b/GraphicsAPI/IGraphicsApi.cs @@ -143,7 +143,7 @@ namespace ClassicalSharp.GraphicsAPI { protected int GetSizeInBytes( int count, VertexFormat format ) { return count * strideSizes[(int)format]; } - protected static int[] strideSizes = new [] { 20, 16, 24 }; + protected static int[] strideSizes = { 20, 16, 24 }; public abstract void SetMatrixMode( MatrixType mode ); diff --git a/GraphicsAPI/OpenGLApi.cs b/GraphicsAPI/OpenGLApi.cs index 63121daf3..28b60dd84 100644 --- a/GraphicsAPI/OpenGLApi.cs +++ b/GraphicsAPI/OpenGLApi.cs @@ -16,9 +16,7 @@ namespace ClassicalSharp.GraphicsAPI { int textureDimensions; const string vboExt = "GL_ARB_vertex_buffer_object"; - BeginMode[] modeMappings = new BeginMode[] { - BeginMode.Triangles, BeginMode.Lines, BeginMode.TriangleStrip, - }; + BeginMode[] modeMappings = { BeginMode.Triangles, BeginMode.Lines, BeginMode.TriangleStrip }; public OpenGLApi() { GL.GetInteger( GetPName.MaxTextureSize, out textureDimensions ); @@ -46,7 +44,7 @@ namespace ClassicalSharp.GraphicsAPI { set { ToggleCap( EnableCap.Blend, value ); } } - AlphaFunction[] alphaFuncs = new AlphaFunction[] { + AlphaFunction[] alphaFuncs = { AlphaFunction.Always, AlphaFunction.Notequal, AlphaFunction.Never, AlphaFunction.Less, AlphaFunction.Lequal, AlphaFunction.Equal, @@ -56,12 +54,12 @@ namespace ClassicalSharp.GraphicsAPI { GL.AlphaFunc( alphaFuncs[(int)func], value ); } - BlendingFactorSrc[] srcBlendFuncs = new BlendingFactorSrc[] { + BlendingFactorSrc[] srcBlendFuncs = { BlendingFactorSrc.Zero, BlendingFactorSrc.One, BlendingFactorSrc.SrcAlpha, BlendingFactorSrc.OneMinusSrcAlpha, BlendingFactorSrc.DstAlpha, BlendingFactorSrc.OneMinusDstAlpha, }; - BlendingFactorDest[] destBlendFuncs = new BlendingFactorDest[] { + BlendingFactorDest[] destBlendFuncs = { BlendingFactorDest.Zero, BlendingFactorDest.One, BlendingFactorDest.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha, BlendingFactorDest.DstAlpha, BlendingFactorDest.OneMinusDstAlpha, @@ -87,7 +85,7 @@ namespace ClassicalSharp.GraphicsAPI { GL.Fog( FogParameter.FogEnd, value ); } - FogMode[] fogModes = new FogMode[] { FogMode.Linear, FogMode.Exp, FogMode.Exp2 }; + FogMode[] fogModes = { FogMode.Linear, FogMode.Exp, FogMode.Exp2 }; public override void SetFogMode( Fog mode ) { GL.Fog( FogParameter.FogMode, (int)fogModes[(int)mode] ); } @@ -163,7 +161,7 @@ namespace ClassicalSharp.GraphicsAPI { GL.ColorMask( red, green, blue, alpha ); } - DepthFunction[] depthFuncs = new DepthFunction[] { + DepthFunction[] depthFuncs = { DepthFunction.Always, DepthFunction.Notequal, DepthFunction.Never, DepthFunction.Less, DepthFunction.Lequal, DepthFunction.Equal, @@ -219,7 +217,7 @@ namespace ClassicalSharp.GraphicsAPI { GL.End(); } - PolygonMode[] fillModes = new PolygonMode[] { PolygonMode.Point, PolygonMode.Line, PolygonMode.Fill }; + PolygonMode[] fillModes = { PolygonMode.Point, PolygonMode.Line, PolygonMode.Fill }; public override void SetFillType( FillType type ) { GL.PolygonMode( MaterialFace.FrontAndBack, fillModes[(int)type] ); } @@ -388,9 +386,7 @@ namespace ClassicalSharp.GraphicsAPI { #region Matrix manipulation MatrixMode lastMode = 0; - MatrixMode[] matrixModes = new MatrixMode[] { - MatrixMode.Projection, MatrixMode.Modelview, MatrixMode.Texture, - }; + MatrixMode[] matrixModes = { MatrixMode.Projection, MatrixMode.Modelview, MatrixMode.Texture }; public override void SetMatrixMode( MatrixType mode ) { MatrixMode glMode = matrixModes[(int)mode]; if( glMode != lastMode ) { diff --git a/Launcher/Launcher.csproj b/Launcher/Launcher.csproj index 48e6ce6bb..2cce4e3d6 100644 --- a/Launcher/Launcher.csproj +++ b/Launcher/Launcher.csproj @@ -1,5 +1,5 @@  - + {23B9BDA8-4330-46AB-9012-08D87430391A} Debug diff --git a/Launcher/MainForm.resx b/Launcher/MainForm.resx index 5cea0f6fc..77dbb1f52 100644 --- a/Launcher/MainForm.resx +++ b/Launcher/MainForm.resx @@ -1,123 +1,124 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + 17, 17 + \ No newline at end of file diff --git a/Launcher/app.config b/Launcher/app.config index 4b7066886..882e8d772 100644 --- a/Launcher/app.config +++ b/Launcher/app.config @@ -1,5 +1,5 @@ - - - - - + + + + + diff --git a/app.config b/app.config index e59af44de..4a71293db 100644 --- a/app.config +++ b/app.config @@ -1,3 +1,3 @@ - - - + + +