From 3c85ae6f6445a2844192a102c62cacb484939091 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Mon, 3 Apr 2023 15:50:35 +0100 Subject: [PATCH] refactor: move old exception messages from Resources.resx (#27) --- X10D/Resource.Designer.cs | 81 ---------------- X10D/Resource.resx | 126 ------------------------- X10D/X10D.csproj | 9 -- X10D/src/ExceptionMessages.Designer.cs | 18 ++++ X10D/src/ExceptionMessages.resx | 6 ++ X10D/src/Text/StringExtensions.cs | 2 +- 6 files changed, 25 insertions(+), 217 deletions(-) delete mode 100644 X10D/Resource.Designer.cs delete mode 100644 X10D/Resource.resx diff --git a/X10D/Resource.Designer.cs b/X10D/Resource.Designer.cs deleted file mode 100644 index 2ac3a68..0000000 --- a/X10D/Resource.Designer.cs +++ /dev/null @@ -1,81 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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", "17.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 deleted file mode 100644 index 3a48c16..0000000 --- a/X10D/Resource.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 98db042..2afcbcb 100644 --- a/X10D/X10D.csproj +++ b/X10D/X10D.csproj @@ -68,11 +68,6 @@ - - True - True - Resource.resx - True True @@ -81,10 +76,6 @@ - - ResXFileCodeGenerator - Resource.Designer.cs - ResXFileCodeGenerator ExceptionMessages.Designer.cs diff --git a/X10D/src/ExceptionMessages.Designer.cs b/X10D/src/ExceptionMessages.Designer.cs index 208b385..da0bc9f 100644 --- a/X10D/src/ExceptionMessages.Designer.cs +++ b/X10D/src/ExceptionMessages.Designer.cs @@ -113,6 +113,24 @@ namespace X10D { } } + /// + /// 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); + } + } + /// /// Looks up a localized string similar to HashAlgorithm's Create method returned null reference.. /// diff --git a/X10D/src/ExceptionMessages.resx b/X10D/src/ExceptionMessages.resx index 1b91b9b..556a96f 100644 --- a/X10D/src/ExceptionMessages.resx +++ b/X10D/src/ExceptionMessages.resx @@ -132,6 +132,12 @@ The end index must be less than the list count. + + Must specify valid information for parsing in the string. + + + Type provided must be an Enum. + {0} is not a class. diff --git a/X10D/src/Text/StringExtensions.cs b/X10D/src/Text/StringExtensions.cs index 28d7693..b697c6e 100644 --- a/X10D/src/Text/StringExtensions.cs +++ b/X10D/src/Text/StringExtensions.cs @@ -414,7 +414,7 @@ public static class StringExtensions if (string.IsNullOrWhiteSpace(value)) { - throw new ArgumentException(Resource.EnumParseEmptyStringException, nameof(value)); + throw new ArgumentException(ExceptionMessages.EnumParseEmptyStringException, nameof(value)); } return Enum.Parse(value, ignoreCase);