Merge pull request #7245 from Hellhake/stylecop-rest

Fix StyleCop warnings in Editor, Renderer.Sdl2, Utility, Test
This commit is contained in:
Matthias Mailänder
2015-01-02 16:53:22 +01:00
10 changed files with 37 additions and 21 deletions

View File

@@ -191,6 +191,16 @@ check:
@mono --debug OpenRA.Utility.exe cnc --check-code-style OpenRA.Mods.D2k
@echo "Checking for code style violations in OpenRA.Mods.TS..."
@mono --debug OpenRA.Utility.exe cnc --check-code-style OpenRA.Mods.TS
@echo "Checking for code style violations in OpenRA.Editor..."
@mono --debug OpenRA.Utility.exe cnc --check-code-style OpenRA.Editor
@echo "Checking for code style violations in OpenRA.Renderer.Sdl2..."
@mono --debug OpenRA.Utility.exe cnc --check-code-style OpenRA.Renderer.Sdl2
@echo "Checking for code style violations in OpenRA.Utility..."
@mono --debug OpenRA.Utility.exe cnc --check-code-style OpenRA.Utility
@echo "Checking for code style violations in OpenRA.Test..."
@mono --debug OpenRA.Utility.exe cnc --check-code-style OpenRA.Test
@echo "Checking for code style violations in OpenRA.TilesetBuilder..."
@mono --debug OpenRA.Utility.exe cnc --check-code-style OpenRA.TilesetBuilder
# Builds and exports tilesets from a bitmap
tsbuild_SRCS := $(shell find OpenRA.TilesetBuilder/ -iname '*.cs')

View File

@@ -426,7 +426,7 @@ namespace OpenRA.Editor
pd.TitleBox.Text = surface1.Map.Title;
pd.DescBox.Text = surface1.Map.Description;
pd.AuthorBox.Text = surface1.Map.Author;
pd.mapVisibilityComboBox.SelectedIndex = pd.mapVisibilityComboBox.FindStringExact(Enum.GetName(typeof(MapVisibility), surface1.Map.Visibility));
pd.MapVisibilityComboBox.SelectedIndex = pd.MapVisibilityComboBox.FindStringExact(Enum.GetName(typeof(MapVisibility), surface1.Map.Visibility));
if (DialogResult.OK != pd.ShowDialog())
return;
@@ -434,7 +434,7 @@ namespace OpenRA.Editor
surface1.Map.Title = pd.TitleBox.Text;
surface1.Map.Description = pd.DescBox.Text;
surface1.Map.Author = pd.AuthorBox.Text;
surface1.Map.Visibility = (MapVisibility)Enum.Parse(typeof(MapVisibility), pd.mapVisibilityComboBox.SelectedItem.ToString());
surface1.Map.Visibility = (MapVisibility)Enum.Parse(typeof(MapVisibility), pd.MapVisibilityComboBox.SelectedItem.ToString());
}
}

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Editor
this.DescBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.AuthorBox = new System.Windows.Forms.TextBox();
this.mapVisibilityComboBox = new System.Windows.Forms.ComboBox();
this.MapVisibilityComboBox = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
@@ -122,15 +122,15 @@ namespace OpenRA.Editor
//
// mapVisibilityComboBox
//
this.mapVisibilityComboBox.FormattingEnabled = true;
this.mapVisibilityComboBox.Items.AddRange(new object[] {
this.MapVisibilityComboBox.FormattingEnabled = true;
this.MapVisibilityComboBox.Items.AddRange(new object[] {
"Lobby",
"Shellmap",
"MissionSelector"});
this.mapVisibilityComboBox.Location = new System.Drawing.Point(150, 137);
this.mapVisibilityComboBox.Name = "mapVisibilityComboBox";
this.mapVisibilityComboBox.Size = new System.Drawing.Size(121, 21);
this.mapVisibilityComboBox.TabIndex = 19;
this.MapVisibilityComboBox.Location = new System.Drawing.Point(150, 137);
this.MapVisibilityComboBox.Name = "mapVisibilityComboBox";
this.MapVisibilityComboBox.Size = new System.Drawing.Size(121, 21);
this.MapVisibilityComboBox.TabIndex = 19;
//
// label4
//
@@ -148,7 +148,7 @@ namespace OpenRA.Editor
this.CancelButton = this.button1;
this.ClientSize = new System.Drawing.Size(370, 228);
this.Controls.Add(this.label4);
this.Controls.Add(this.mapVisibilityComboBox);
this.Controls.Add(this.MapVisibilityComboBox);
this.Controls.Add(this.AuthorBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.DescBox);
@@ -176,7 +176,7 @@ namespace OpenRA.Editor
public System.Windows.Forms.TextBox DescBox;
private System.Windows.Forms.Label label3;
public System.Windows.Forms.TextBox AuthorBox;
public System.Windows.Forms.ComboBox mapVisibilityComboBox;
public System.Windows.Forms.ComboBox MapVisibilityComboBox;
private System.Windows.Forms.Label label4;
}
}

View File

@@ -319,6 +319,7 @@ namespace OpenRA.Editor
ControlPaint.DrawGrid(g, rect, new Size(ts.Width, ts.Height), Color.Red);
}
}
return bitmap;
}

View File

@@ -56,9 +56,12 @@ namespace OpenRA.Renderer.Sdl2
Log.Write("graphics", "Vendor: {0}", GL.GetString(StringName.Vendor));
if (GL.GetString(StringName.Vendor).Contains("Microsoft"))
{
Log.Write("graphics", "Note: The default driver provided by Microsoft does not include full OpenGL support.\n"
+ "Please install the latest drivers from your graphics card manufacturer's website.\n");
var msg = "";
msg += "Note: The default driver provided by Microsoft does not include full OpenGL support.\n";
msg += "Please install the latest drivers from your graphics card manufacturer's website.\n";
Log.Write("graphics", msg);
}
Log.Write("graphics", "Renderer: {0}", GL.GetString(StringName.Renderer));
Log.Write("graphics", "GL Version: {0}", GL.GetString(StringName.Version));
Log.Write("graphics", "Shader Version: {0}", GL.GetString(StringName.ShadingLanguageVersion));

View File

@@ -157,11 +157,13 @@ namespace OpenRA.Renderer.Sdl2
SDL.SDL_GL_DeleteContext(context);
context = IntPtr.Zero;
}
if (window != IntPtr.Zero)
{
SDL.SDL_DestroyWindow(window);
window = IntPtr.Zero;
}
SDL.SDL_Quit();
}

View File

@@ -34,6 +34,7 @@ namespace OpenRA.Renderer.Sdl2
{
return scaleFilter;
}
set
{
if (scaleFilter == value)

View File

@@ -10,11 +10,11 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
using System.Text.RegularExpressions;
using NUnit.Framework;
using OpenRA.GameRules;
using OpenRA.Traits;
using NUnit.Framework;
namespace OpenRA.Test
{
@@ -48,7 +48,7 @@ namespace OpenRA.Test
actorInfo.Traits.Add(new MockB());
actorInfo.Traits.Add(new MockA());
var i = new List<ITraitInfo> (actorInfo.TraitsInConstructOrder());
var i = new List<ITraitInfo>(actorInfo.TraitsInConstructOrder());
Assert.That(i[0], Is.InstanceOf<MockA>());
Assert.That(i[1], Is.InstanceOf<MockB>());
@@ -93,8 +93,7 @@ namespace OpenRA.Test
var count = (
new Regex("MockD").Matches(e.Message).Count +
new Regex("MockE").Matches(e.Message).Count +
new Regex("MockF").Matches(e.Message).Count
) / 3.0;
new Regex("MockF").Matches(e.Message).Count) / 3.0;
Assert.That(count, Is.EqualTo(Math.Floor(count)), "Should be symmetrical");
}

View File

@@ -10,11 +10,11 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
using System.Text.RegularExpressions;
using NUnit.Framework;
using OpenRA.GameRules;
using OpenRA.Traits;
using NUnit.Framework;
namespace OpenRA.Test
{

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Utility
try
{
var action = Exts.WithDefault((a,b) => PrintUsage(actions), () => actions[args[0]]);
var action = Exts.WithDefault((a, b) => PrintUsage(actions), () => actions[args[0]]);
action(modData, args);
}
catch (Exception e)