diff --git a/X10D/Resource.Designer.cs b/X10D/Resource.Designer.cs new file mode 100644 index 0000000..02e56e9 --- /dev/null +++ b/X10D/Resource.Designer.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace X10D { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resource { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resource() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("X10D.Resource", typeof(Resource).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Must specify valid information for parsing in the string.. + /// + internal static string EnumParseEmptyStringException { + get { + return ResourceManager.GetString("EnumParseEmptyStringException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type provided must be an Enum.. + /// + internal static string EnumParseNotEnumException { + get { + return ResourceManager.GetString("EnumParseNotEnumException", resourceCulture); + } + } + } +} diff --git a/X10D/Resource.resx b/X10D/Resource.resx new file mode 100644 index 0000000..3a48c16 --- /dev/null +++ b/X10D/Resource.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Must specify valid information for parsing in the string. + + + Type provided must be an Enum. + + \ No newline at end of file diff --git a/X10D/X10D.csproj b/X10D/X10D.csproj index c5c7ac4..85c4f69 100644 --- a/X10D/X10D.csproj +++ b/X10D/X10D.csproj @@ -39,4 +39,19 @@ + + + True + True + Resource.resx + + + + + + ResXFileCodeGenerator + Resource.Designer.cs + + + \ No newline at end of file diff --git a/X10D/src/StringExtensions.cs b/X10D/src/StringExtensions.cs index a81b880..d4145d3 100644 --- a/X10D/src/StringExtensions.cs +++ b/X10D/src/StringExtensions.cs @@ -59,16 +59,16 @@ value = value.Trim(); - if (value.Length == 0) + if (string.IsNullOrWhiteSpace(value)) { - throw new ArgumentException("Must specify valid information for parsing in the string.", nameof(value)); + throw new ArgumentException(Resource.EnumParseEmptyStringException, nameof(value)); } Type t = typeof(T); if (!t.IsEnum) { - throw new ArgumentException("Type provided must be an Enum."); + throw new ArgumentException(Resource.EnumParseNotEnumException); } return (T)Enum.Parse(t, value, ignoreCase);