From beefe18ca5fcb59aacafdf9e4f8a6581a22ab962 Mon Sep 17 00:00:00 2001 From: Hellhake Date: Thu, 1 Jan 2015 23:09:34 +0100 Subject: [PATCH 1/5] Fix StyleCop warnings in OpenRA.Editor --- OpenRA.Editor/Form1.cs | 4 ++-- OpenRA.Editor/PropertiesDialog.Designer.cs | 18 +++++++++--------- OpenRA.Editor/Surface.cs | 1 + 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index 10920b9019..1cfef73fbb 100644 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -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()); } } diff --git a/OpenRA.Editor/PropertiesDialog.Designer.cs b/OpenRA.Editor/PropertiesDialog.Designer.cs index 465294649f..5344cd73cb 100644 --- a/OpenRA.Editor/PropertiesDialog.Designer.cs +++ b/OpenRA.Editor/PropertiesDialog.Designer.cs @@ -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; } } diff --git a/OpenRA.Editor/Surface.cs b/OpenRA.Editor/Surface.cs index cfb22b35d8..6ec1c46f5d 100644 --- a/OpenRA.Editor/Surface.cs +++ b/OpenRA.Editor/Surface.cs @@ -319,6 +319,7 @@ namespace OpenRA.Editor ControlPaint.DrawGrid(g, rect, new Size(ts.Width, ts.Height), Color.Red); } } + return bitmap; } From bce017494d966c19d868d211b0788ed10958234b Mon Sep 17 00:00:00 2001 From: Hellhake Date: Thu, 1 Jan 2015 23:10:12 +0100 Subject: [PATCH 2/5] Fix StyleCop warnings in OpenRA.Renderer.Sdl2 --- OpenRA.Renderer.Sdl2/ErrorHandler.cs | 7 +++++-- OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs | 2 ++ OpenRA.Renderer.Sdl2/Texture.cs | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenRA.Renderer.Sdl2/ErrorHandler.cs b/OpenRA.Renderer.Sdl2/ErrorHandler.cs index e3c1b49f7e..6af34a7762 100644 --- a/OpenRA.Renderer.Sdl2/ErrorHandler.cs +++ b/OpenRA.Renderer.Sdl2/ErrorHandler.cs @@ -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)); diff --git a/OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs b/OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs index 084e10073c..dc8ac14999 100755 --- a/OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs +++ b/OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs @@ -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(); } diff --git a/OpenRA.Renderer.Sdl2/Texture.cs b/OpenRA.Renderer.Sdl2/Texture.cs index 3e3ae2bd7a..6daf52db84 100644 --- a/OpenRA.Renderer.Sdl2/Texture.cs +++ b/OpenRA.Renderer.Sdl2/Texture.cs @@ -34,6 +34,7 @@ namespace OpenRA.Renderer.Sdl2 { return scaleFilter; } + set { if (scaleFilter == value) From 90c948ebc34525df26c82ecef1ef19d46dad82cb Mon Sep 17 00:00:00 2001 From: Hellhake Date: Thu, 1 Jan 2015 23:10:29 +0100 Subject: [PATCH 3/5] Fix StyleCop warnings in OpenRA.Utility --- OpenRA.Utility/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index 8b79d8f580..e15ee6f45a 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -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) From 311d154bd69ee2fd311cec38c4d732859ff89a42 Mon Sep 17 00:00:00 2001 From: Hellhake Date: Thu, 1 Jan 2015 23:10:43 +0100 Subject: [PATCH 4/5] Fix StyleCop warnings in OpenRA.Test --- OpenRA.Test/OpenRA.Game/ActorInfoTest.cs | 9 ++++----- OpenRA.Test/OpenRA.Game/MiniYamlTest.cs | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/OpenRA.Test/OpenRA.Game/ActorInfoTest.cs b/OpenRA.Test/OpenRA.Game/ActorInfoTest.cs index aab659686c..2a8312a63a 100644 --- a/OpenRA.Test/OpenRA.Game/ActorInfoTest.cs +++ b/OpenRA.Test/OpenRA.Game/ActorInfoTest.cs @@ -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 (actorInfo.TraitsInConstructOrder()); + var i = new List(actorInfo.TraitsInConstructOrder()); Assert.That(i[0], Is.InstanceOf()); Assert.That(i[1], Is.InstanceOf()); @@ -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"); } diff --git a/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs b/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs index dd6e626a12..02c0358a1e 100644 --- a/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs +++ b/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs @@ -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 { From 7f06c4123a526f6482f77c8e72ae9629200b2484 Mon Sep 17 00:00:00 2001 From: Hellhake Date: Fri, 2 Jan 2015 16:40:55 +0100 Subject: [PATCH 5/5] Enable stylecop clean projects for make check --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 13ab5d1b09..99f3ed67bf 100644 --- a/Makefile +++ b/Makefile @@ -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')