From fcec0296e2f8865f5ecdaa72c65a2838688aa8c7 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 08:35:38 +0200 Subject: [PATCH 01/10] Added StyleCop.Analyzers. --- src/ImageSharp/project.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/project.json b/src/ImageSharp/project.json index 50b19c86dc..77dae0b501 100644 --- a/src/ImageSharp/project.json +++ b/src/ImageSharp/project.json @@ -43,7 +43,8 @@ "System.Text.Encoding.Extensions": "4.0.11", "System.Threading": "4.0.11", "System.Threading.Tasks": "4.0.11", - "System.Threading.Tasks.Parallel": "4.0.1" + "System.Threading.Tasks.Parallel": "4.0.1", + "StyleCop.Analyzers": "1.0.0" }, "frameworks": { "netstandard1.1": {} From 4187302a2f75ce68e54be297e878feb3dcee0717 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 09:14:29 +0200 Subject: [PATCH 02/10] Added stylecop.json. --- src/ImageSharp/project.json | 3 ++- src/ImageSharp/stylecop.json | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/ImageSharp/stylecop.json diff --git a/src/ImageSharp/project.json b/src/ImageSharp/project.json index 77dae0b501..44d1173980 100644 --- a/src/ImageSharp/project.json +++ b/src/ImageSharp/project.json @@ -24,7 +24,8 @@ "buildOptions": { "allowUnsafe": true, "debugType": "portable", - "xmlDoc": true + "xmlDoc": true, + "additionalArguments": [ "/additionalfile:stylecop.json" ] }, "dependencies": { "System.Collections": "4.0.11", diff --git a/src/ImageSharp/stylecop.json b/src/ImageSharp/stylecop.json new file mode 100644 index 0000000000..df8f120a5b --- /dev/null +++ b/src/ImageSharp/stylecop.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "documentationRules": { + "companyName": "James Jackson-South", + "copyrightText": "Copyright (c) James Jackson-South and contributors.\nLicensed under the Apache License, Version 2.0." + } + } +} \ No newline at end of file From 51bc2daaf159657546a203f75e42f2585c785c2c Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 09:19:40 +0200 Subject: [PATCH 03/10] Fixed SA1633, SA1636, SA1638. --- src/ImageSharp/Filters/Processors/IImageFilter.cs | 7 ++++++- src/ImageSharp/Image/ImageIOExtensions.cs | 2 +- src/ImageSharp/Image/ImageProcessingExtensions.cs | 2 +- .../Profiles/Exif/ExifTagDescriptionAttribute.cs | 2 +- src/ImageSharp/Properties/AssemblyInfo.cs | 9 +++++++-- src/ImageSharp/Quantizers/Wu/WuQuantizer.cs | 2 +- src/ImageSharp/Samplers/AutoOrient.cs | 2 +- src/ImageSharp/Samplers/Options/Orientation.cs | 2 +- 8 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/ImageSharp/Filters/Processors/IImageFilter.cs b/src/ImageSharp/Filters/Processors/IImageFilter.cs index 722299812b..edef207001 100644 --- a/src/ImageSharp/Filters/Processors/IImageFilter.cs +++ b/src/ImageSharp/Filters/Processors/IImageFilter.cs @@ -1,4 +1,9 @@ -namespace ImageSharp.Processors +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Processors { /// /// Encapsulates methods to alter the pixels of an image. The processor operates on the original source pixels. diff --git a/src/ImageSharp/Image/ImageIOExtensions.cs b/src/ImageSharp/Image/ImageIOExtensions.cs index b4637b4f18..094ab3e328 100644 --- a/src/ImageSharp/Image/ImageIOExtensions.cs +++ b/src/ImageSharp/Image/ImageIOExtensions.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // diff --git a/src/ImageSharp/Image/ImageProcessingExtensions.cs b/src/ImageSharp/Image/ImageProcessingExtensions.cs index b17bdf24b4..e4b9ff3fd1 100644 --- a/src/ImageSharp/Image/ImageProcessingExtensions.cs +++ b/src/ImageSharp/Image/ImageProcessingExtensions.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // diff --git a/src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs b/src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs index f51d7384ef..857f6ec011 100644 --- a/src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs +++ b/src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // diff --git a/src/ImageSharp/Properties/AssemblyInfo.cs b/src/ImageSharp/Properties/AssemblyInfo.cs index 2205073f0a..e09dd594df 100644 --- a/src/ImageSharp/Properties/AssemblyInfo.cs +++ b/src/ImageSharp/Properties/AssemblyInfo.cs @@ -1,7 +1,11 @@ -using System.Resources; +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -28,6 +32,7 @@ // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyInformationalVersion("1.0.0.0")] // Ensure the internals can be tested. [assembly: InternalsVisibleTo("ImageSharp.Benchmarks")] diff --git a/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs b/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs index d3eb3f2255..76029f71fb 100644 --- a/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs +++ b/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs @@ -1,5 +1,5 @@ // -// Copyright © James Jackson-South and contributors. +// Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // diff --git a/src/ImageSharp/Samplers/AutoOrient.cs b/src/ImageSharp/Samplers/AutoOrient.cs index 903308c4b1..6195a2066c 100644 --- a/src/ImageSharp/Samplers/AutoOrient.cs +++ b/src/ImageSharp/Samplers/AutoOrient.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // diff --git a/src/ImageSharp/Samplers/Options/Orientation.cs b/src/ImageSharp/Samplers/Options/Orientation.cs index 5266555c91..dfe57a4b04 100644 --- a/src/ImageSharp/Samplers/Options/Orientation.cs +++ b/src/ImageSharp/Samplers/Options/Orientation.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // From a8342f639786663ddc26f6311b7300d77bf26159 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 23:06:48 +0200 Subject: [PATCH 04/10] Changed type of StyleCop dependency to build only. --- src/ImageSharp/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/project.json b/src/ImageSharp/project.json index 44d1173980..d620bc368c 100644 --- a/src/ImageSharp/project.json +++ b/src/ImageSharp/project.json @@ -45,7 +45,7 @@ "System.Threading": "4.0.11", "System.Threading.Tasks": "4.0.11", "System.Threading.Tasks.Parallel": "4.0.1", - "StyleCop.Analyzers": "1.0.0" + "StyleCop.Analyzers": { "version": "1.0.0", "type": "build" } }, "frameworks": { "netstandard1.1": {} From 2619ca8ee1b2a9b7c52fdfc554461d2193881e73 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 23:21:22 +0200 Subject: [PATCH 05/10] Added missing this. --- src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs | 6 +++--- src/ImageSharp/Image/ImageProperty.cs | 2 +- .../Samplers/Processors/RotateProcessor.cs | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs index f8c372c185..085d3b8366 100644 --- a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs @@ -488,9 +488,9 @@ public void Encode(Image image, Stream stream, int componentCount = 3; // Write the Start Of Image marker. - WriteApplicationHeader((short)image.HorizontalResolution, (short)image.VerticalResolution); + this.WriteApplicationHeader((short)image.HorizontalResolution, (short)image.VerticalResolution); - WriteProfiles(image); + this.WriteProfiles(image); // Write the quantization tables. this.WriteDQT(); @@ -574,7 +574,7 @@ private void WriteProfiles(Image image) where TColor : struct, IPackedPixel where TPacked : struct { - WriteProfile(image.ExifProfile); + this.WriteProfile(image.ExifProfile); } private void WriteProfile(ExifProfile exifProfile) diff --git a/src/ImageSharp/Image/ImageProperty.cs b/src/ImageSharp/Image/ImageProperty.cs index c99cf20fcf..055b3e049e 100644 --- a/src/ImageSharp/Image/ImageProperty.cs +++ b/src/ImageSharp/Image/ImageProperty.cs @@ -94,7 +94,7 @@ public override bool Equals(object obj) { ImageProperty other = obj as ImageProperty; - return Equals(other); + return this.Equals(other); } /// diff --git a/src/ImageSharp/Samplers/Processors/RotateProcessor.cs b/src/ImageSharp/Samplers/Processors/RotateProcessor.cs index f7bf7a8373..38122c1597 100644 --- a/src/ImageSharp/Samplers/Processors/RotateProcessor.cs +++ b/src/ImageSharp/Samplers/Processors/RotateProcessor.cs @@ -39,7 +39,7 @@ protected override void OnApply(ImageBase target, ImageBase target, ImageBase public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY) { - if (OptimizedApply(target, source)) + if (this.OptimizedApply(target, source)) { return; } @@ -93,25 +93,25 @@ public override void Apply(ImageBase target, ImageBase target, ImageBase source) { const float Epsilon = .0001F; - if (Math.Abs(Angle) < Epsilon) + if (Math.Abs(this.Angle) < Epsilon) { target.ClonePixels(target.Width, target.Height, source.Pixels); return true; } - if (Math.Abs(Angle - 90) < Epsilon) + if (Math.Abs(this.Angle - 90) < Epsilon) { this.Rotate90(target, source); return true; } - if (Math.Abs(Angle - 180) < Epsilon) + if (Math.Abs(this.Angle - 180) < Epsilon) { this.Rotate180(target, source); return true; } - if (Math.Abs(Angle - 270) < Epsilon) + if (Math.Abs(this.Angle - 270) < Epsilon) { this.Rotate270(target, source); return true; From efc0470b53fb81b473a62787fd344db4f5ea2c7d Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 23:24:54 +0200 Subject: [PATCH 06/10] Removed unnecessary parenthesis. --- src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs | 6 +++--- src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs | 2 +- src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index 9198d443c2..8aa2c34416 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs @@ -290,7 +290,7 @@ private void ReadRgb16(TColor[] imageData, int width, int heigh byte g = (byte)(((temp & Rgb16GMask) >> 5) * ScaleG); byte b = (byte)((temp & Rgb16BMask) * ScaleR); - int arrayOffset = ((row * width) + x); + int arrayOffset = (row * width) + x; // Stored in b-> g-> r order. TColor packed = default(TColor); @@ -330,7 +330,7 @@ private void ReadRgb24(TColor[] imageData, int width, int heigh for (int x = 0; x < width; x++) { int offset = rowOffset + (x * 3); - int arrayOffset = ((row * width) + x); + int arrayOffset = (row * width) + x; // Stored in b-> g-> r-> a order. TColor packed = default(TColor); @@ -370,7 +370,7 @@ private void ReadRgb32(TColor[] imageData, int width, int heigh for (int x = 0; x < width; x++) { int offset = rowOffset + (x * 4); - int arrayOffset = ((row * width) + x); + int arrayOffset = (row * width) + x; // Stored in b-> g-> r-> a order. TColor packed = default(TColor); diff --git a/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs b/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs index 35e8b025de..e411396d0d 100644 --- a/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs +++ b/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs @@ -196,7 +196,7 @@ protected override void Dispose(bool disposing) this.rawStream.WriteByte((byte)((crc >> 24) & 0xFF)); this.rawStream.WriteByte((byte)((crc >> 16) & 0xFF)); this.rawStream.WriteByte((byte)((crc >> 8) & 0xFF)); - this.rawStream.WriteByte((byte)((crc) & 0xFF)); + this.rawStream.WriteByte((byte)(crc & 0xFF)); } base.Dispose(disposing); diff --git a/src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs b/src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs index 9d0c2f58a3..35406afab5 100644 --- a/src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs +++ b/src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs @@ -119,7 +119,7 @@ public override void Apply(ImageBase target, ImageBase Date: Sat, 29 Oct 2016 23:30:55 +0200 Subject: [PATCH 07/10] Resolved SA1129. --- src/ImageSharp/Common/Helpers/ImageMaths.cs | 4 ++-- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 6 +++--- src/ImageSharp/Formats/Gif/PackedField.cs | 2 +- src/ImageSharp/Profiles/Exif/ExifReader.cs | 4 ++-- .../Processors/Convolution/Convolution2PassFilter.cs | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs index fe487323ed..9a32eb5c1f 100644 --- a/src/ImageSharp/Common/Helpers/ImageMaths.cs +++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs @@ -171,8 +171,8 @@ public static Rectangle GetFilteredBoundingRectangle(ImageBase< const float Epsilon = .00001f; int width = bitmap.Width; int height = bitmap.Height; - Point topLeft = new Point(); - Point bottomRight = new Point(); + Point topLeft = default(Point); + Point bottomRight = default(Point); Func, int, int, float, bool> delegateFunc; diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 5614f62466..cd7e600bbb 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -168,7 +168,7 @@ private void WriteLogicalScreenDescriptor(Image(ImageBase(ImageBase im writer.Write((ushort)image.Width); writer.Write((ushort)image.Height); - PackedField field = new PackedField(); + PackedField field = default(PackedField); field.SetBit(0, true); // 1: Local color table flag = 1 (LCT used) field.SetBit(1, false); // 2: Interlace flag 0 field.SetBit(2, false); // 3: Sort flag 0 diff --git a/src/ImageSharp/Formats/Gif/PackedField.cs b/src/ImageSharp/Formats/Gif/PackedField.cs index 4713a6533a..8c5e59105d 100644 --- a/src/ImageSharp/Formats/Gif/PackedField.cs +++ b/src/ImageSharp/Formats/Gif/PackedField.cs @@ -55,7 +55,7 @@ public byte Byte /// The public static PackedField FromInt(byte value) { - PackedField packed = new PackedField(); + PackedField packed = default(PackedField); packed.SetBits(0, 8, value); return packed; } diff --git a/src/ImageSharp/Profiles/Exif/ExifReader.cs b/src/ImageSharp/Profiles/Exif/ExifReader.cs index 6d18078f7e..6fcf95e1af 100644 --- a/src/ImageSharp/Profiles/Exif/ExifReader.cs +++ b/src/ImageSharp/Profiles/Exif/ExifReader.cs @@ -442,7 +442,7 @@ private Rational ToRational(byte[] data) { if (!this.ValidateArray(data, 8, 4)) { - return new Rational(); + return default(Rational); } uint numerator = BitConverter.ToUInt32(data, 0); @@ -470,7 +470,7 @@ private SignedRational ToSignedRational(byte[] data) { if (!this.ValidateArray(data, 8, 4)) { - return new SignedRational(); + return default(SignedRational); } int numerator = BitConverter.ToInt32(data, 0); diff --git a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs index c9893d62d2..4cab6f0b2a 100644 --- a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs +++ b/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs @@ -85,7 +85,7 @@ private void ApplyConvolution(ImageBase target, ImageBase Date: Sat, 29 Oct 2016 23:33:09 +0200 Subject: [PATCH 08/10] Moved using inside namespace. --- src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs | 2 -- src/ImageSharp/Quantizers/Wu/WuQuantizer.cs | 3 +-- src/ImageSharp/Samplers/Processors/RotateProcessor.cs | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs index 085d3b8366..f26faf2f5f 100644 --- a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs @@ -3,8 +3,6 @@ // Licensed under the Apache License, Version 2.0. // -using System.Numerics; - namespace ImageSharp.Formats { using System; diff --git a/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs b/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs index 76029f71fb..8eabe38e62 100644 --- a/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs +++ b/src/ImageSharp/Quantizers/Wu/WuQuantizer.cs @@ -3,12 +3,11 @@ // Licensed under the Apache License, Version 2.0. // -using System.Numerics; - namespace ImageSharp.Quantizers { using System; using System.Collections.Generic; + using System.Numerics; using System.Threading.Tasks; /// diff --git a/src/ImageSharp/Samplers/Processors/RotateProcessor.cs b/src/ImageSharp/Samplers/Processors/RotateProcessor.cs index 38122c1597..0fdc187bda 100644 --- a/src/ImageSharp/Samplers/Processors/RotateProcessor.cs +++ b/src/ImageSharp/Samplers/Processors/RotateProcessor.cs @@ -3,10 +3,9 @@ // Licensed under the Apache License, Version 2.0. // -using System; - namespace ImageSharp.Processors { + using System; using System.Numerics; using System.Threading.Tasks; From 7bdbbb5223ff1c7de7ee009f3bf79730e5ec2032 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 23:39:33 +0200 Subject: [PATCH 09/10] Resolved SA1001, SA1004, SA1025 and SA1027. --- src/ImageSharp/IO/EndianBitConverter.cs | 2 +- .../Profiles/Exif/ExifTagDescriptionAttribute.cs | 5 ++--- src/ImageSharp/Profiles/Exif/ExifValue.cs | 12 ++++++------ src/ImageSharp/Profiles/Exif/ExifWriter.cs | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/ImageSharp/IO/EndianBitConverter.cs b/src/ImageSharp/IO/EndianBitConverter.cs index 0a53e16665..2ecf202d13 100644 --- a/src/ImageSharp/IO/EndianBitConverter.cs +++ b/src/ImageSharp/IO/EndianBitConverter.cs @@ -325,7 +325,7 @@ public static string ToString(byte[] value, int startIndex, int length) } #endregion - #region Decimal conversions + #region Decimal conversions /// /// Returns a decimal value converted from sixteen bytes /// at a specified position in a byte array. diff --git a/src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs b/src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs index 857f6ec011..90e9562436 100644 --- a/src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs +++ b/src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs @@ -6,7 +6,6 @@ namespace ImageSharp { using System; - using System.Linq; using System.Reflection; /// @@ -18,9 +17,9 @@ internal sealed class ExifTagDescriptionAttribute : Attribute private object value; private string description; - /// + /// /// Initializes a new instance of the ExifTagDescriptionAttribute class. - /// + /// /// The value of the exif tag. /// The description for the value of the exif tag. public ExifTagDescriptionAttribute(object value, string description) diff --git a/src/ImageSharp/Profiles/Exif/ExifValue.cs b/src/ImageSharp/Profiles/Exif/ExifValue.cs index f302ca99c4..d38abc25d6 100644 --- a/src/ImageSharp/Profiles/Exif/ExifValue.cs +++ b/src/ImageSharp/Profiles/Exif/ExifValue.cs @@ -103,10 +103,10 @@ public object Value return !Equals(left, right); } - /// + /// /// Determines whether the specified object is equal to the current exif value. - /// - ///The object to compare this exif value with. + /// + /// The object to compare this exif value with. public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) @@ -117,10 +117,10 @@ public override bool Equals(object obj) return this.Equals(obj as ExifValue); } - /// + /// /// Determines whether the specified exif value is equal to the current exif value. - /// - ///The exif value to compare this exif value with. + /// + /// The exif value to compare this exif value with. public bool Equals(ExifValue other) { if (ReferenceEquals(other, null)) diff --git a/src/ImageSharp/Profiles/Exif/ExifWriter.cs b/src/ImageSharp/Profiles/Exif/ExifWriter.cs index 478d6722d7..b30abf6668 100644 --- a/src/ImageSharp/Profiles/Exif/ExifWriter.cs +++ b/src/ImageSharp/Profiles/Exif/ExifWriter.cs @@ -16,7 +16,7 @@ internal sealed class ExifWriter { ExifTag.ImageWidth, ExifTag.ImageLength, ExifTag.BitsPerSample, ExifTag.Compression, ExifTag.PhotometricInterpretation, ExifTag.Thresholding, ExifTag.CellWidth, - ExifTag.CellLength, ExifTag.FillOrder,ExifTag.ImageDescription, ExifTag.Make, + ExifTag.CellLength, ExifTag.FillOrder, ExifTag.ImageDescription, ExifTag.Make, ExifTag.Model, ExifTag.StripOffsets, ExifTag.Orientation, ExifTag.SamplesPerPixel, ExifTag.RowsPerStrip, ExifTag.StripByteCounts, ExifTag.MinSampleValue, ExifTag.MaxSampleValue, ExifTag.XResolution, ExifTag.YResolution, From 3c026f7bf9772f269b5eabed4624bc3d6a6aa847 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 29 Oct 2016 23:45:12 +0200 Subject: [PATCH 10/10] Resolved SA1110, SA1117, SA1210 and SA1500. --- src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs | 6 ++++-- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 2 +- src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs | 4 ++-- src/ImageSharp/IO/EndianBinaryReader.cs | 3 +-- src/ImageSharp/Profiles/Exif/ExifReader.cs | 3 +-- src/ImageSharp/Properties/AssemblyInfo.cs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs index f26faf2f5f..acc65769a6 100644 --- a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs @@ -49,7 +49,8 @@ internal class JpegEncoderCore /// The values are derived from section K.1 after converting from natural to /// zig-zag order. /// - private readonly byte[,] unscaledQuant = { + private readonly byte[,] unscaledQuant = + { { // Luminance. 16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40, @@ -71,7 +72,8 @@ internal class JpegEncoderCore /// The Huffman encoding specifications. /// This encoder uses the same Huffman encoding for all images. /// - private readonly HuffmanSpec[] theHuffmanSpec = { + private readonly HuffmanSpec[] theHuffmanSpec = + { // Luminance DC. new HuffmanSpec( new byte[] diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index 0915000c46..13aa1f4b1f 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -611,7 +611,7 @@ private void WriteGammaChunk(Stream stream) /// The stream. private void WriteDataChunks(Stream stream) { - byte[] data = this.EncodePixelData(); + byte[] data = this.EncodePixelData(); byte[] buffer; int bufferLength; diff --git a/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs b/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs index e411396d0d..9245cfe834 100644 --- a/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs +++ b/src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs @@ -184,8 +184,8 @@ protected override void Dispose(bool disposing) this.deflateStream.Dispose(); this.deflateStream = null; } - else { - + else + { // Hack: empty input? this.rawStream.WriteByte(3); this.rawStream.WriteByte(0); diff --git a/src/ImageSharp/IO/EndianBinaryReader.cs b/src/ImageSharp/IO/EndianBinaryReader.cs index 2ee577418d..c635fedb6d 100644 --- a/src/ImageSharp/IO/EndianBinaryReader.cs +++ b/src/ImageSharp/IO/EndianBinaryReader.cs @@ -575,8 +575,7 @@ private void ReadInternal(byte[] data, int size) int read = this.BaseStream.Read(data, index, size - index); if (read == 0) { - throw new EndOfStreamException - ( + throw new EndOfStreamException( string.Format( "End of stream reached with {0} byte{1} left to read.", size - index, diff --git a/src/ImageSharp/Profiles/Exif/ExifReader.cs b/src/ImageSharp/Profiles/Exif/ExifReader.cs index 6fcf95e1af..4a60991577 100644 --- a/src/ImageSharp/Profiles/Exif/ExifReader.cs +++ b/src/ImageSharp/Profiles/Exif/ExifReader.cs @@ -361,8 +361,7 @@ private void GetThumbnail(uint offset) } } - private static TDataType[] ToArray(ExifDataType dataType, byte[] data, - ConverterMethod converter) + private static TDataType[] ToArray(ExifDataType dataType, byte[] data, ConverterMethod converter) { int dataTypeSize = (int)ExifValue.GetSize(dataType); int length = data.Length / dataTypeSize; diff --git a/src/ImageSharp/Properties/AssemblyInfo.cs b/src/ImageSharp/Properties/AssemblyInfo.cs index e09dd594df..fd8e0349bf 100644 --- a/src/ImageSharp/Properties/AssemblyInfo.cs +++ b/src/ImageSharp/Properties/AssemblyInfo.cs @@ -3,8 +3,8 @@ // Licensed under the Apache License, Version 2.0. // -using System.Resources; using System.Reflection; +using System.Resources; using System.Runtime.CompilerServices; // General Information about an assembly is controlled through the following