From bb031f553b940d21fa89f319d294745484c2234e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 8 May 2014 16:26:20 -0400 Subject: fix portable and 3.5 project references --- MediaBrowser.Model/Drawing/DrawingUtils.cs | 83 +----------------------------- MediaBrowser.Model/Drawing/ImageSize.cs | 83 ++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 82 deletions(-) create mode 100644 MediaBrowser.Model/Drawing/ImageSize.cs (limited to 'MediaBrowser.Model/Drawing') diff --git a/MediaBrowser.Model/Drawing/DrawingUtils.cs b/MediaBrowser.Model/Drawing/DrawingUtils.cs index ae483b6f67..7f679a826b 100644 --- a/MediaBrowser.Model/Drawing/DrawingUtils.cs +++ b/MediaBrowser.Model/Drawing/DrawingUtils.cs @@ -1,6 +1,4 @@ -using System.Globalization; - -namespace MediaBrowser.Model.Drawing +namespace MediaBrowser.Model.Drawing { /// /// Class DrawingUtils @@ -145,83 +143,4 @@ namespace MediaBrowser.Model.Drawing return scaleFactor; } } - - /// - /// Struct ImageSize - /// - public struct ImageSize - { - private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - - private double _height; - private double _width; - - /// - /// Gets or sets the height. - /// - /// The height. - public double Height - { - get - { - return _height; - } - set - { - _height = value; - } - } - - /// - /// Gets or sets the width. - /// - /// The width. - public double Width - { - get { return _width; } - set { _width = value; } - } - - public bool Equals(ImageSize size) - { - return Width.Equals(size.Width) && Height.Equals(size.Height); - } - - public override string ToString() - { - return string.Format("{0}-{1}", Width, Height); - } - - public ImageSize(string value) - { - _width = 0; - - _height = 0; - - ParseValue(value); - } - - private void ParseValue(string value) - { - if (!string.IsNullOrEmpty(value)) - { - string[] parts = value.Split('-'); - - if (parts.Length == 2) - { - double val; - - if (double.TryParse(parts[0], NumberStyles.Any, UsCulture, out val)) - { - _width = val; - } - - if (double.TryParse(parts[1], NumberStyles.Any, UsCulture, out val)) - { - _height = val; - } - } - } - } - } } diff --git a/MediaBrowser.Model/Drawing/ImageSize.cs b/MediaBrowser.Model/Drawing/ImageSize.cs new file mode 100644 index 0000000000..acc245938b --- /dev/null +++ b/MediaBrowser.Model/Drawing/ImageSize.cs @@ -0,0 +1,83 @@ +using System.Globalization; + +namespace MediaBrowser.Model.Drawing +{ + /// + /// Struct ImageSize + /// + public struct ImageSize + { + private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); + + private double _height; + private double _width; + + /// + /// Gets or sets the height. + /// + /// The height. + public double Height + { + get + { + return _height; + } + set + { + _height = value; + } + } + + /// + /// Gets or sets the width. + /// + /// The width. + public double Width + { + get { return _width; } + set { _width = value; } + } + + public bool Equals(ImageSize size) + { + return Width.Equals(size.Width) && Height.Equals(size.Height); + } + + public override string ToString() + { + return string.Format("{0}-{1}", Width, Height); + } + + public ImageSize(string value) + { + _width = 0; + + _height = 0; + + ParseValue(value); + } + + private void ParseValue(string value) + { + if (!string.IsNullOrEmpty(value)) + { + string[] parts = value.Split('-'); + + if (parts.Length == 2) + { + double val; + + if (double.TryParse(parts[0], NumberStyles.Any, UsCulture, out val)) + { + _width = val; + } + + if (double.TryParse(parts[1], NumberStyles.Any, UsCulture, out val)) + { + _height = val; + } + } + } + } + } +} \ No newline at end of file -- cgit v1.2.3