From 531167454ca6575c29a8ed9b57b5eb830bcbbbf5 Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Wed, 27 Dec 2017 08:30:36 +0000 Subject: [PATCH 1/2] Fix StyleCop issues in GLControl --- src/OpenTK.GLControl/Agl.cs | 18 +++++++++--------- src/OpenTK.GLControl/AglContext.cs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/OpenTK.GLControl/Agl.cs b/src/OpenTK.GLControl/Agl.cs index 7a747598..3b1636b5 100644 --- a/src/OpenTK.GLControl/Agl.cs +++ b/src/OpenTK.GLControl/Agl.cs @@ -333,7 +333,7 @@ namespace OpenTK.Platform.MacOS ** Context functions */ [DllImport(agl)] internal static extern AGLContext aglCreateContext(AGLPixelFormat pix, AGLContext share); - [DllImport(agl,EntryPoint="aglDestroyContext")] + [DllImport(agl, EntryPoint="aglDestroyContext")] private static extern byte _aglDestroyContext(AGLContext ctx); internal static bool aglDestroyContext(AGLContext context) { @@ -348,7 +348,7 @@ namespace OpenTK.Platform.MacOS ** Current state functions */ - [DllImport(agl,EntryPoint="aglSetCurrentContext")] + [DllImport(agl, EntryPoint="aglSetCurrentContext")] private static extern byte _aglSetCurrentContext(AGLContext ctx); internal static bool aglSetCurrentContext(IntPtr context) { @@ -370,7 +370,7 @@ namespace OpenTK.Platform.MacOS /* ** Drawable Functions */ - [DllImport(agl,EntryPoint="aglSetDrawable")] + [DllImport(agl, EntryPoint="aglSetDrawable")] private static extern byte _aglSetDrawable(AGLContext ctx, AGLDrawable draw); internal static void aglSetDrawable(AGLContext ctx, AGLDrawable draw) @@ -458,8 +458,8 @@ namespace OpenTK.Platform.MacOS /* ** Error functions */ - [DllImport(agl,EntryPoint="aglGetError")] internal static extern AglError GetError(); - [DllImport(agl,EntryPoint="aglErrorString")] + [DllImport(agl, EntryPoint="aglGetError")] internal static extern AglError GetError(); + [DllImport(agl, EntryPoint="aglErrorString")] private static extern IntPtr _aglErrorString(AglError code); internal static string ErrorString(AglError code) { @@ -476,7 +476,7 @@ namespace OpenTK.Platform.MacOS ** Surface texture function */ [DllImport(agl)] - private static extern void aglSurfaceTexture (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext) ; + private static extern void aglSurfaceTexture (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext); /* ** PBuffer functions @@ -494,15 +494,15 @@ namespace OpenTK.Platform.MacOS ** Pbuffer Drawable Functions */ [DllImport(agl)] - private static extern byte aglSetPBuffer (AGLContext ctx, AGLPbuffer pbuffer, int face, int level, int screen) ; + private static extern byte aglSetPBuffer (AGLContext ctx, AGLPbuffer pbuffer, int face, int level, int screen); [DllImport(agl)] - private static extern byte aglGetPBuffer (AGLContext ctx, AGLPbuffer *pbuffer, int *face, int *level, int *screen) ; + private static extern byte aglGetPBuffer (AGLContext ctx, AGLPbuffer *pbuffer, int *face, int *level, int *screen); /* ** CGL functions */ [DllImport(agl)] - private static extern byte aglGetCGLContext(AGLContext ctx, void **cgl_ctx) ; + private static extern byte aglGetCGLContext(AGLContext ctx, void **cgl_ctx); [DllImport(agl)] private static extern byte aglGetCGLPixelFormat(AGLPixelFormat pix, void **cgl_pix); diff --git a/src/OpenTK.GLControl/AglContext.cs b/src/OpenTK.GLControl/AglContext.cs index e54662c9..5d438546 100644 --- a/src/OpenTK.GLControl/AglContext.cs +++ b/src/OpenTK.GLControl/AglContext.cs @@ -127,7 +127,7 @@ namespace OpenTK.Platform.MacOS dummyContext = new GraphicsContext(Context, GetAddress, - delegate() + delegate { return new ContextHandle(Agl.aglGetCurrentContext()); }); From 3971e8af7889338494fe5e37367995155c5133ec Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Wed, 27 Dec 2017 08:03:29 +0000 Subject: [PATCH 2/2] Add ability to disable/enable stylecop rules --- build/StyleCop.props | 19 +++++++++++++++++++ src/Generator.Bind/Generator.Bind.csproj | 11 +---------- .../Generator.Convert.csproj | 11 +---------- .../Generator.Rewrite.csproj | 11 +---------- src/OpenTK.GLControl/OpenTK.GLControl.csproj | 4 +--- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 11 +---------- src/OpenTK/OpenTK.Android.csproj | 11 +---------- src/OpenTK/OpenTK.csproj | 11 +---------- src/OpenTK/OpenTK.iOS.csproj | 11 +---------- 9 files changed, 27 insertions(+), 73 deletions(-) create mode 100644 build/StyleCop.props diff --git a/build/StyleCop.props b/build/StyleCop.props new file mode 100644 index 00000000..8fc33438 --- /dev/null +++ b/build/StyleCop.props @@ -0,0 +1,19 @@ + + + + true + + + true + ..\..\stylecop.ruleset + + + + + True + + + True + + + diff --git a/src/Generator.Bind/Generator.Bind.csproj b/src/Generator.Bind/Generator.Bind.csproj index 8c937e98..9086fdc3 100644 --- a/src/Generator.Bind/Generator.Bind.csproj +++ b/src/Generator.Bind/Generator.Bind.csproj @@ -41,8 +41,6 @@ false true true - true - ..\..\stylecop.ruleset 285212672 @@ -275,12 +273,5 @@ - - - True - - - True - - + \ No newline at end of file diff --git a/src/Generator.Converter/Generator.Convert.csproj b/src/Generator.Converter/Generator.Convert.csproj index 91a56148..57eccbf1 100644 --- a/src/Generator.Converter/Generator.Convert.csproj +++ b/src/Generator.Converter/Generator.Convert.csproj @@ -40,8 +40,6 @@ false true true - true - ..\..\stylecop.ruleset 285212672 @@ -157,14 +155,7 @@ - - - True - - - True - - + diff --git a/src/Generator.Rewrite/Generator.Rewrite.csproj b/src/Generator.Rewrite/Generator.Rewrite.csproj index 38c3389a..16c4591a 100644 --- a/src/Generator.Rewrite/Generator.Rewrite.csproj +++ b/src/Generator.Rewrite/Generator.Rewrite.csproj @@ -14,8 +14,6 @@ 12.0.0 2.0 true - true - ..\..\stylecop.ruleset AnyCPU @@ -202,14 +200,7 @@ - - - True - - - True - - + diff --git a/src/OpenTK.GLControl/OpenTK.GLControl.csproj b/src/OpenTK.GLControl/OpenTK.GLControl.csproj index 6f753a06..8de9957b 100644 --- a/src/OpenTK.GLControl/OpenTK.GLControl.csproj +++ b/src/OpenTK.GLControl/OpenTK.GLControl.csproj @@ -41,7 +41,6 @@ false true true - true True @@ -57,7 +56,6 @@ False False 4 - ..\..\stylecop.ruleset full @@ -73,7 +71,6 @@ False False 4 - ..\..\stylecop.ruleset pdbonly @@ -169,6 +166,7 @@ + diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index c82f52bd..f457222a 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -43,8 +43,6 @@ true 7 - true - ..\..\stylecop.ruleset True @@ -173,12 +171,5 @@ - - - True - - - True - - + \ No newline at end of file diff --git a/src/OpenTK/OpenTK.Android.csproj b/src/OpenTK/OpenTK.Android.csproj index a7575c4d..c99fe1f4 100644 --- a/src/OpenTK/OpenTK.Android.csproj +++ b/src/OpenTK/OpenTK.Android.csproj @@ -16,8 +16,6 @@ False OpenTK true - true - ..\..\stylecop.ruleset true @@ -269,12 +267,5 @@ - - - True - - - True - - + \ No newline at end of file diff --git a/src/OpenTK/OpenTK.csproj b/src/OpenTK/OpenTK.csproj index 9577d761..4a213b6b 100644 --- a/src/OpenTK/OpenTK.csproj +++ b/src/OpenTK/OpenTK.csproj @@ -41,8 +41,6 @@ false true true - true - ..\..\stylecop.ruleset True @@ -825,12 +823,5 @@ - - - True - - - True - - + \ No newline at end of file diff --git a/src/OpenTK/OpenTK.iOS.csproj b/src/OpenTK/OpenTK.iOS.csproj index efc9795e..19b4eb70 100644 --- a/src/OpenTK/OpenTK.iOS.csproj +++ b/src/OpenTK/OpenTK.iOS.csproj @@ -12,8 +12,6 @@ 8.0.30703 2.0 true - true - ..\..\stylecop.ruleset true @@ -252,12 +250,5 @@ - - - True - - - True - - + \ No newline at end of file