Downgrade to C# 3.0, use shorthand array initialisers where possible.

This commit is contained in:
UnknownShadow200 2015-05-31 08:57:05 +10:00
parent 0cd3f22415
commit ab42202a34
9 changed files with 150 additions and 153 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{BEB1C785-5CAD-48FF-A886-876BF0A318D4}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

View file

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

View file

@ -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,

View file

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

View file

@ -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 ) {

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectGuid>{23B9BDA8-4330-46AB-9012-08D87430391A}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

View file

@ -1,123 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing">
<value>17, 17</value>
</data>
</root>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/></startup>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" /></startup>
</configuration>

View file

@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727" /></startup></configuration>