diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs index 1217fc0a9..a7fd8fd6a 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs @@ -136,7 +136,7 @@ namespace ImageSharp return null; } - using (MemoryStream memStream = new MemoryStream(this.data, this.thumbnailOffset, this.thumbnailLength)) + using (var memStream = new MemoryStream(this.data, this.thumbnailOffset, this.thumbnailLength)) { return Image.Load(memStream); } @@ -201,7 +201,7 @@ namespace ImageSharp } } - ExifValue newExifValue = ExifValue.Create(tag, value); + var newExifValue = ExifValue.Create(tag, value); this.values.Add(newExifValue); } @@ -221,7 +221,7 @@ namespace ImageSharp return null; } - ExifWriter writer = new ExifWriter(this.values, this.Parts); + var writer = new ExifWriter(this.values, this.Parts); return writer.GetData(); } @@ -248,7 +248,7 @@ namespace ImageSharp this.RemoveValue(value.Tag); } - Rational newResolution = new Rational(resolution, false); + var newResolution = new Rational(resolution, false); this.SetValue(tag, newResolution); } @@ -265,7 +265,7 @@ namespace ImageSharp return; } - ExifReader reader = new ExifReader(); + var reader = new ExifReader(); this.values = reader.Read(this.data); this.invalidTags = new List(reader.InvalidTags); this.thumbnailOffset = (int)reader.ThumbnailOffset; diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs index 6164bd228..53123bfc2 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs @@ -75,7 +75,7 @@ namespace ImageSharp { DebugGuard.NotNull(data, nameof(data)); - Collection result = new Collection(); + var result = new Collection(); this.exifData = data; @@ -357,7 +357,7 @@ namespace ImageSharp private TEnum ToEnum(int value, TEnum defaultValue) where TEnum : struct { - TEnum enumValue = (TEnum)(object)value; + var enumValue = (TEnum)(object)value; if (Enum.GetValues(typeof(TEnum)).Cast().Any(v => v.Equals(enumValue))) { return enumValue; @@ -403,7 +403,7 @@ namespace ImageSharp private void GetThumbnail(uint offset) { - Collection values = new Collection(); + var values = new Collection(); this.AddValues(values, offset); foreach (ExifValue value in values) diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs index 8cd05b53c..a2965917b 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs @@ -39,7 +39,7 @@ namespace ImageSharp } else { - Array array = (Array)other.exifValue; + var array = (Array)other.exifValue; this.exifValue = array.Clone(); } } @@ -264,7 +264,7 @@ namespace ImageSharp return this.ToString(this.exifValue); } - StringBuilder sb = new StringBuilder(); + var sb = new StringBuilder(); foreach (object value in (Array)this.exifValue) { sb.Append(this.ToString(value)); diff --git a/tests/ImageSharp.Tests/ConfigurationTests.cs b/tests/ImageSharp.Tests/ConfigurationTests.cs index 3c0b7e702..aa3c4edfc 100644 --- a/tests/ImageSharp.Tests/ConfigurationTests.cs +++ b/tests/ImageSharp.Tests/ConfigurationTests.cs @@ -7,6 +7,7 @@ namespace ImageSharp.Tests { using System; using System.Collections.Generic; + using System.IO; using System.Linq; using ImageSharp.Formats; @@ -23,7 +24,7 @@ namespace ImageSharp.Tests [Fact] public void DefaultsToLocalFileSystem() { - Configuration configuration = Configuration.CreateDefaultInstance(); + var configuration = Configuration.CreateDefaultInstance(); ImageSharp.IO.IFileSystem fs = configuration.FileSystem; @@ -33,7 +34,7 @@ namespace ImageSharp.Tests [Fact] public void IfAutoloadWellknwonFormatesIsTrueAllFormateAreLoaded() { - Configuration configuration = Configuration.CreateDefaultInstance(); + var configuration = Configuration.CreateDefaultInstance(); Assert.Equal(4, configuration.ImageFormats.Count); } @@ -95,7 +96,7 @@ namespace ImageSharp.Tests [Fact] public void TestAddImageFormatThrowsWithNullEncoder() { - TestFormat format = new TestFormat { Encoder = null }; + var format = new TestFormat { Encoder = null }; Assert.Throws(() => { @@ -110,7 +111,7 @@ namespace ImageSharp.Tests [Fact] public void TestAddImageFormatThrowsWithNullDecoder() { - TestFormat format = new TestFormat { Decoder = null }; + var format = new TestFormat { Decoder = null }; Assert.Throws(() => { @@ -125,7 +126,7 @@ namespace ImageSharp.Tests [Fact] public void TestAddImageFormatThrowsWithNullOrEmptyMimeType() { - TestFormat format = new TestFormat { MimeType = null }; + var format = new TestFormat { MimeType = null }; Assert.Throws(() => { @@ -147,7 +148,7 @@ namespace ImageSharp.Tests [Fact] public void TestAddImageFormatThrowsWithNullOrEmptyExtension() { - TestFormat format = new TestFormat { Extension = null }; + var format = new TestFormat { Extension = null }; Assert.Throws(() => { @@ -169,7 +170,7 @@ namespace ImageSharp.Tests [Fact] public void TestAddImageFormatThrowsWenSupportedExtensionsIsNullOrEmpty() { - TestFormat format = new TestFormat { SupportedExtensions = null }; + var format = new TestFormat { SupportedExtensions = null }; Assert.Throws(() => { @@ -191,7 +192,7 @@ namespace ImageSharp.Tests [Fact] public void TestAddImageFormatThrowsWithoutDefaultExtension() { - TestFormat format = new TestFormat { Extension = "test" }; + var format = new TestFormat { Extension = "test" }; Assert.Throws(() => { @@ -206,7 +207,7 @@ namespace ImageSharp.Tests [Fact] public void TestAddImageFormatThrowsWithEmptySupportedExtension() { - TestFormat format = new TestFormat + var format = new TestFormat { Extension = "test", SupportedExtensions = new[] { "test", string.Empty } @@ -238,7 +239,7 @@ namespace ImageSharp.Tests { Configuration.Default.AddImageFormat(new PngFormat()); - Image image = new Image(1, 1); + var image = new Image(1, 1); Assert.Equal(image.Configuration.ParallelOptions, Configuration.Default.ParallelOptions); Assert.Equal(image.Configuration.ImageFormats, Configuration.Default.ImageFormats); } @@ -251,8 +252,8 @@ namespace ImageSharp.Tests { Configuration.Default.AddImageFormat(new PngFormat()); - Image image = new Image(1, 1); - Image image2 = new Image(image); + var image = new Image(1, 1); + var image2 = new Image(image); Assert.Equal(image2.Configuration.ParallelOptions, image.Configuration.ParallelOptions); Assert.True(image2.Configuration.ImageFormats.SequenceEqual(image.Configuration.ImageFormats)); }