From 883575893b3f4a4224f920e8c143a9edefca13e4 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 26 Jan 2019 13:16:47 +0100 Subject: Change image dimentions from double to int Rename ImageSize -> ImageDimensions --- MediaBrowser.Model/Drawing/ImageSize.cs | 63 ++++----------------------------- 1 file changed, 7 insertions(+), 56 deletions(-) (limited to 'MediaBrowser.Model/Drawing/ImageSize.cs') diff --git a/MediaBrowser.Model/Drawing/ImageSize.cs b/MediaBrowser.Model/Drawing/ImageSize.cs index 87764bbf4..75591d83d 100644 --- a/MediaBrowser.Model/Drawing/ImageSize.cs +++ b/MediaBrowser.Model/Drawing/ImageSize.cs @@ -1,36 +1,23 @@ -using System.Globalization; - namespace MediaBrowser.Model.Drawing { /// /// Struct ImageSize /// - public struct ImageSize + public struct ImageDimensions { - private double _height; - private double _width; - /// /// Gets or sets the height. /// /// The height. - public double Height - { - get => _height; - set => _height = value; - } + public int Height { get; set; } /// /// Gets or sets the width. /// /// The width. - public double Width - { - get => _width; - set => _width = value; - } + public int Width { get; set; } - public bool Equals(ImageSize size) + public bool Equals(ImageDimensions size) { return Width.Equals(size.Width) && Height.Equals(size.Height); } @@ -40,46 +27,10 @@ namespace MediaBrowser.Model.Drawing return string.Format("{0}-{1}", Width, Height); } - public ImageSize(string value) + public ImageDimensions(int width, int height) { - _width = 0; - - _height = 0; - - ParseValue(value); - } - - public ImageSize(int width, int height) - { - _width = width; - _height = height; - } - - public ImageSize(double width, double height) - { - _width = width; - _height = height; - } - - private void ParseValue(string value) - { - if (!string.IsNullOrEmpty(value)) - { - string[] parts = value.Split('-'); - - if (parts.Length == 2) - { - if (double.TryParse(parts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out var val)) - { - _width = val; - } - - if (double.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out val)) - { - _height = val; - } - } - } + Width = width; + Height = height; } } } -- cgit v1.2.3