change customtheme error strings namespace

This commit is contained in:
bluepilledgreat 2025-03-11 19:07:28 +00:00
parent 19c82c66d0
commit 800f49b0c8
6 changed files with 122 additions and 122 deletions

View File

@ -973,15 +973,6 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Custom dialog has already been initialised.
/// </summary>
public static string CustomTheme_DialogAlreadyInitialised {
get {
return ResourceManager.GetString("CustomTheme.DialogAlreadyInitialised", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save changes to {0}?.
/// </summary>
@ -1045,129 +1036,147 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Custom dialog has already been initialised.
/// </summary>
public static string CustomTheme_Errors_DialogAlreadyInitialised {
get {
return ResourceManager.GetString("CustomTheme.Errors.DialogAlreadyInitialised", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}.{1} uses blacklisted scheme {2}.
/// </summary>
public static string CustomTheme_ElementAttributeBlacklistedUriScheme {
public static string CustomTheme_Errors_ElementAttributeBlacklistedUriScheme {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeBlacklistedUriScheme", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeBlacklistedUriScheme", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has invalid {1}: {2}.
/// </summary>
public static string CustomTheme_ElementAttributeConversionError {
public static string CustomTheme_Errors_ElementAttributeConversionError {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeConversionError", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeConversionError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} {1} is not a valid {2}.
/// </summary>
public static string CustomTheme_ElementAttributeInvalidType {
public static string CustomTheme_Errors_ElementAttributeInvalidType {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeInvalidType", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeInvalidType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Element {0} is missing the {1} attribute.
/// </summary>
public static string CustomTheme_ElementAttributeMissing {
public static string CustomTheme_Errors_ElementAttributeMissing {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeMissing", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeMissing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}.{1} is missing it&apos;s child.
/// </summary>
public static string CustomTheme_ElementAttributeMissingChild {
public static string CustomTheme_Errors_ElementAttributeMissingChild {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeMissingChild", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeMissingChild", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}.{1} can only have one child.
/// </summary>
public static string CustomTheme_ElementAttributeMultipleChildren {
public static string CustomTheme_Errors_ElementAttributeMultipleChildren {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeMultipleChildren", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeMultipleChildren", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} can only have one {1} defined.
/// </summary>
public static string CustomTheme_ElementAttributeMultipleDefinitions {
public static string CustomTheme_Errors_ElementAttributeMultipleDefinitions {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeMultipleDefinitions", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeMultipleDefinitions", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} {1} must be larger than {2}.
/// </summary>
public static string CustomTheme_ElementAttributeMustBeLargerThanMin {
public static string CustomTheme_Errors_ElementAttributeMustBeLargerThanMin {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeMustBeLargerThanMin", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeMustBeLargerThanMin", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} {1} must be smaller than {2}.
/// </summary>
public static string CustomTheme_ElementAttributeMustBeSmallerThanMax {
public static string CustomTheme_Errors_ElementAttributeMustBeSmallerThanMax {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeMustBeSmallerThanMax", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeMustBeSmallerThanMax", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}.{1} could not be parsed into a {2}.
/// </summary>
public static string CustomTheme_ElementAttributeParseError {
public static string CustomTheme_Errors_ElementAttributeParseError {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeParseError", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeParseError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}.{1} {2} is null.
/// </summary>
public static string CustomTheme_ElementAttributeParseErrorNull {
public static string CustomTheme_Errors_ElementAttributeParseErrorNull {
get {
return ResourceManager.GetString("CustomTheme.ElementAttributeParseErrorNull", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementAttributeParseErrorNull", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} cannot have a child of {1}.
/// </summary>
public static string CustomTheme_ElementInvalidChild {
public static string CustomTheme_Errors_ElementInvalidChild {
get {
return ResourceManager.GetString("CustomTheme.ElementInvalidChild", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementInvalidChild", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} can only have one child.
/// </summary>
public static string CustomTheme_ElementMultipleChildren {
public static string CustomTheme_Errors_ElementMultipleChildren {
get {
return ResourceManager.GetString("CustomTheme.ElementMultipleChildren", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementMultipleChildren", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} failed to create {1}: {2}.
/// </summary>
public static string CustomTheme_ElementTypeCreationFailed {
public static string CustomTheme_Errors_ElementTypeCreationFailed {
get {
return ResourceManager.GetString("CustomTheme.ElementTypeCreationFailed", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.ElementTypeCreationFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Theme XML root is not {0}.
/// </summary>
public static string CustomTheme_Errors_InvalidRoot {
get {
return ResourceManager.GetString("CustomTheme.Errors.InvalidRoot", resourceCulture);
}
}
@ -1190,84 +1199,75 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Theme XML root is not {0}.
/// </summary>
public static string CustomTheme_InvalidRoot {
get {
return ResourceManager.GetString("CustomTheme.InvalidRoot", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Custom bootstrappers can only have a maximum of {0} elements, got {1}..
/// </summary>
public static string CustomTheme_TooManyElements {
public static string CustomTheme_Errors_TooManyElements {
get {
return ResourceManager.GetString("CustomTheme.TooManyElements", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.TooManyElements", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unknown element {0}.
/// </summary>
public static string CustomTheme_UnknownElement {
public static string CustomTheme_Errors_UnknownElement {
get {
return ResourceManager.GetString("CustomTheme.UnknownElement", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.UnknownElement", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} Unknown {1} {2}.
/// </summary>
public static string CustomTheme_UnknownEnumValue {
public static string CustomTheme_Errors_UnknownEnumValue {
get {
return ResourceManager.GetString("CustomTheme.UnknownEnumValue", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.UnknownEnumValue", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} version is not a number.
/// </summary>
public static string CustomTheme_VersionNotNumber {
public static string CustomTheme_Errors_VersionNotNumber {
get {
return ResourceManager.GetString("CustomTheme.VersionNotNumber", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.VersionNotNumber", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} version {1} is not recognised.
/// </summary>
public static string CustomTheme_VersionNotRecognised {
public static string CustomTheme_Errors_VersionNotRecognised {
get {
return ResourceManager.GetString("CustomTheme.VersionNotRecognised", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.VersionNotRecognised", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} version is not set.
/// </summary>
public static string CustomTheme_VersionNotSet {
public static string CustomTheme_Errors_VersionNotSet {
get {
return ResourceManager.GetString("CustomTheme.VersionNotSet", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.VersionNotSet", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} version {1} is no longer supported.
/// </summary>
public static string CustomTheme_VersionNotSupported {
public static string CustomTheme_Errors_VersionNotSupported {
get {
return ResourceManager.GetString("CustomTheme.VersionNotSupported", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.VersionNotSupported", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to parse the theme file: {0}.
/// </summary>
public static string CustomTheme_XMLParseFailed {
public static string CustomTheme_Errors_XMLParseFailed {
get {
return ResourceManager.GetString("CustomTheme.XMLParseFailed", resourceCulture);
return ResourceManager.GetString("CustomTheme.Errors.XMLParseFailed", resourceCulture);
}
}

View File

@ -1294,76 +1294,76 @@ Please close any applications that may be using Roblox's files, and relaunch.</v
<data name="Enums.CustomThemeTemplate.Simple" xml:space="preserve">
<value>Simple</value>
</data>
<data name="CustomTheme.InvalidRoot" xml:space="preserve">
<data name="CustomTheme.Errors.InvalidRoot" xml:space="preserve">
<value>Theme XML root is not {0}</value>
</data>
<data name="CustomTheme.DialogAlreadyInitialised" xml:space="preserve">
<data name="CustomTheme.Errors.DialogAlreadyInitialised" xml:space="preserve">
<value>Custom dialog has already been initialised</value>
</data>
<data name="CustomTheme.TooManyElements" xml:space="preserve">
<data name="CustomTheme.Errors.TooManyElements" xml:space="preserve">
<value>Custom bootstrappers can only have a maximum of {0} elements, got {1}.</value>
</data>
<data name="CustomTheme.VersionNotSet" xml:space="preserve">
<data name="CustomTheme.Errors.VersionNotSet" xml:space="preserve">
<value>{0} version is not set</value>
</data>
<data name="CustomTheme.VersionNotNumber" xml:space="preserve">
<data name="CustomTheme.Errors.VersionNotNumber" xml:space="preserve">
<value>{0} version is not a number</value>
</data>
<data name="CustomTheme.VersionNotSupported" xml:space="preserve">
<data name="CustomTheme.Errors.VersionNotSupported" xml:space="preserve">
<value>{0} version {1} is no longer supported</value>
</data>
<data name="CustomTheme.VersionNotRecognised" xml:space="preserve">
<data name="CustomTheme.Errors.VersionNotRecognised" xml:space="preserve">
<value>{0} version {1} is not recognised</value>
</data>
<data name="CustomTheme.ElementInvalidChild" xml:space="preserve">
<data name="CustomTheme.Errors.ElementInvalidChild" xml:space="preserve">
<value>{0} cannot have a child of {1}</value>
</data>
<data name="CustomTheme.UnknownElement" xml:space="preserve">
<data name="CustomTheme.Errors.UnknownElement" xml:space="preserve">
<value>Unknown element {0}</value>
</data>
<data name="CustomTheme.XMLParseFailed" xml:space="preserve">
<data name="CustomTheme.Errors.XMLParseFailed" xml:space="preserve">
<value>Failed to parse the theme file: {0}</value>
</data>
<data name="CustomTheme.ElementAttributeConversionError" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeConversionError" xml:space="preserve">
<value>{0} has invalid {1}: {2}</value>
</data>
<data name="CustomTheme.ElementAttributeMissing" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeMissing" xml:space="preserve">
<value>Element {0} is missing the {1} attribute</value>
</data>
<data name="CustomTheme.ElementAttributeInvalidType" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeInvalidType" xml:space="preserve">
<value>{0} {1} is not a valid {2}</value>
</data>
<data name="CustomTheme.ElementAttributeMustBeLargerThanMin" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeMustBeLargerThanMin" xml:space="preserve">
<value>{0} {1} must be larger than {2}</value>
</data>
<data name="CustomTheme.ElementAttributeMustBeSmallerThanMax" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeMustBeSmallerThanMax" xml:space="preserve">
<value>{0} {1} must be smaller than {2}</value>
</data>
<data name="CustomTheme.UnknownEnumValue" xml:space="preserve">
<data name="CustomTheme.Errors.UnknownEnumValue" xml:space="preserve">
<value>{0} Unknown {1} {2}</value>
</data>
<data name="CustomTheme.ElementAttributeMultipleDefinitions" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeMultipleDefinitions" xml:space="preserve">
<value>{0} can only have one {1} defined</value>
</data>
<data name="CustomTheme.ElementAttributeMultipleChildren" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeMultipleChildren" xml:space="preserve">
<value>{0}.{1} can only have one child</value>
</data>
<data name="CustomTheme.ElementMultipleChildren" xml:space="preserve">
<data name="CustomTheme.Errors.ElementMultipleChildren" xml:space="preserve">
<value>{0} can only have one child</value>
</data>
<data name="CustomTheme.ElementAttributeMissingChild" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeMissingChild" xml:space="preserve">
<value>{0}.{1} is missing it's child</value>
</data>
<data name="CustomTheme.ElementAttributeParseError" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeParseError" xml:space="preserve">
<value>{0}.{1} could not be parsed into a {2}</value>
</data>
<data name="CustomTheme.ElementAttributeParseErrorNull" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeParseErrorNull" xml:space="preserve">
<value>{0}.{1} {2} is null</value>
</data>
<data name="CustomTheme.ElementAttributeBlacklistedUriScheme" xml:space="preserve">
<data name="CustomTheme.Errors.ElementAttributeBlacklistedUriScheme" xml:space="preserve">
<value>{0}.{1} uses blacklisted scheme {2}</value>
</data>
<data name="CustomTheme.ElementTypeCreationFailed" xml:space="preserve">
<data name="CustomTheme.Errors.ElementTypeCreationFailed" xml:space="preserve">
<value>{0} failed to create {1}: {2}</value>
</data>
<data name="CustomTheme.Editor.Title" xml:space="preserve">

View File

@ -38,7 +38,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
}
catch (Exception ex)
{
throw new CustomThemeException(ex, "CustomTheme.ElementAttributeConversionError", xmlElement.Name, attributeName, ex.Message);
throw new CustomThemeException(ex, "CustomTheme.Errors.ElementAttributeConversionError", xmlElement.Name, attributeName, ex.Message);
}
}
@ -83,7 +83,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
}
catch (Exception ex)
{
throw new CustomThemeException(ex, "CustomTheme.ElementAttributeConversionError", element.Name, attributeName, ex.Message);
throw new CustomThemeException(ex, "CustomTheme.Errors.ElementAttributeConversionError", element.Name, attributeName, ex.Message);
}
}
}

View File

@ -59,11 +59,11 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
private static T HandleXml<T>(CustomDialog dialog, XElement xmlElement) where T : class
{
if (!_elementHandlerMap.ContainsKey(xmlElement.Name.ToString()))
throw new CustomThemeException("CustomTheme.UnknownElement", xmlElement.Name);
throw new CustomThemeException("CustomTheme.Errors.UnknownElement", xmlElement.Name);
var element = _elementHandlerMap[xmlElement.Name.ToString()](dialog, xmlElement);
if (element is not T)
throw new CustomThemeException("CustomTheme.ElementInvalidChild", xmlElement.Parent!.Name, xmlElement.Name);
throw new CustomThemeException("CustomTheme.Errors.ElementInvalidChild", xmlElement.Parent!.Name, xmlElement.Name);
return (T)element;
}
@ -81,34 +81,34 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
private static void AssertThemeVersion(string? versionStr)
{
if (string.IsNullOrEmpty(versionStr))
throw new CustomThemeException("CustomTheme.VersionNotSet", "BloxstrapCustomBootstrapper");
throw new CustomThemeException("CustomTheme.Errors.VersionNotSet", "BloxstrapCustomBootstrapper");
if (!uint.TryParse(versionStr, out uint version))
throw new CustomThemeException("CustomTheme.VersionNotNumber", "BloxstrapCustomBootstrapper");
throw new CustomThemeException("CustomTheme.Errors.VersionNotNumber", "BloxstrapCustomBootstrapper");
switch (version)
{
case Version:
break;
case 0: // Themes made between Oct 19, 2024 to Mar 11, 2025 (on the feature/custom-bootstrappers branch)
throw new CustomThemeException("CustomTheme.VersionNotSupported", "BloxstrapCustomBootstrapper", version);
throw new CustomThemeException("CustomTheme.Errors.VersionNotSupported", "BloxstrapCustomBootstrapper", version);
default:
throw new CustomThemeException("CustomTheme.VersionNotRecognised", "BloxstrapCustomBootstrapper", version);
throw new CustomThemeException("CustomTheme.Errors.VersionNotRecognised", "BloxstrapCustomBootstrapper", version);
}
}
private void HandleXmlBase(XElement xml)
{
if (_initialised)
throw new CustomThemeException("CustomTheme.DialogAlreadyInitialised");
throw new CustomThemeException("CustomTheme.Errors.DialogAlreadyInitialised");
if (xml.Name != "BloxstrapCustomBootstrapper")
throw new CustomThemeException("CustomTheme.InvalidRoot", "BloxstrapCustomBootstrapper");
throw new CustomThemeException("CustomTheme.Errors.InvalidRoot", "BloxstrapCustomBootstrapper");
AssertThemeVersion(xml.Attribute("Version")?.Value);
if (xml.Descendants().Count() > MaxElements)
throw new CustomThemeException("CustomTheme.TooManyElements", MaxElements, xml.Descendants().Count());
throw new CustomThemeException("CustomTheme.Errors.TooManyElements", MaxElements, xml.Descendants().Count());
_initialised = true;
@ -134,7 +134,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
}
catch (Exception ex)
{
throw new CustomThemeException(ex, "CustomTheme.XMLParseFailed", ex.Message);
throw new CustomThemeException(ex, "CustomTheme.Errors.XMLParseFailed", ex.Message);
}
HandleXmlBase(xml);

View File

@ -150,7 +150,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
}
catch (Exception ex)
{
throw new CustomThemeException(ex, "CustomTheme.ElementTypeCreationFailed", "Image", "BitmapImage", ex.Message);
throw new CustomThemeException(ex, "CustomTheme.Errors.ElementTypeCreationFailed", "Image", "BitmapImage", ex.Message);
}
imageBrush.ImageSource = bitmapImage;
@ -217,7 +217,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
var first = brushElement.FirstNode as XElement;
if (first == null)
throw new CustomThemeException("CustomTheme.ElementAttributeMissingChild", xmlElement.Name, name);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMissingChild", xmlElement.Name, name);
var brush = HandleXml<Brush>(dialog, first);
uiElement.SetValue(dependencyProperty, brush);
@ -620,7 +620,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
}
catch (Exception ex)
{
throw new CustomThemeException(ex, "CustomTheme.ElementTypeCreationFailed", "Image", "BitmapImage", ex.Message);
throw new CustomThemeException(ex, "CustomTheme.Errors.ElementTypeCreationFailed", "Image", "BitmapImage", ex.Message);
}
image.Source = bitmapImage;
@ -693,7 +693,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
if (element.Name == "Grid.RowDefinitions")
{
if (rowsSet)
throw new CustomThemeException("CustomTheme.ElementAttributeMultipleDefinitions", "Grid", "RowDefinitions");
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMultipleDefinitions", "Grid", "RowDefinitions");
rowsSet = true;
HandleXmlElement_Grid_RowDefinitions(grid, dialog, element);
@ -701,7 +701,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
else if (element.Name == "Grid.ColumnDefinitions")
{
if (columnsSet)
throw new CustomThemeException("CustomTheme.ElementAttributeMultipleDefinitions", "Grid", "ColumnDefinitions");
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMultipleDefinitions", "Grid", "ColumnDefinitions");
columnsSet = true;
HandleXmlElement_Grid_ColumnDefinitions(grid, dialog, element);
@ -760,7 +760,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
if (children.Any())
{
if (children.Count() > 1)
throw new CustomThemeException("CustomTheme.ElementMultipleChildren", "Border");
throw new CustomThemeException("CustomTheme.Errors.ElementMultipleChildren", "Border");
border.Child = HandleXml<UIElement>(dialog, children.First());
}

View File

@ -26,7 +26,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
if (defaultValue != null)
return defaultValue;
throw new CustomThemeException("CustomTheme.ElementAttributeMissing", element.Name, attributeName);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMissing", element.Name, attributeName);
}
return attribute.Value.ToString();
@ -41,12 +41,12 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
if (defaultValue != null)
return (T)defaultValue;
throw new CustomThemeException("CustomTheme.ElementAttributeMissing", element.Name, attributeName);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMissing", element.Name, attributeName);
}
T? parsed = ConvertValue<T>(attribute.Value);
if (parsed == null)
throw new CustomThemeException("CustomTheme.ElementAttributeInvalidType", element.Name, attributeName, typeof(T).Name);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeInvalidType", element.Name, attributeName, typeof(T).Name);
return (T)parsed;
}
@ -63,7 +63,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
T? parsed = ConvertValue<T>(attribute.Value);
if (parsed == null)
throw new CustomThemeException("CustomTheme.ElementAttributeInvalidType", element.Name, attributeName, typeof(T).Name);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeInvalidType", element.Name, attributeName, typeof(T).Name);
return (T)parsed;
}
@ -71,17 +71,17 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
private static void ValidateXmlElement(string elementName, string attributeName, int value, int? min = null, int? max = null)
{
if (min != null && value < min)
throw new CustomThemeException("CustomTheme.ElementAttributeMustBeLargerThanMin", elementName, attributeName, min);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMustBeLargerThanMin", elementName, attributeName, min);
if (max != null && value > max)
throw new CustomThemeException("CustomTheme.ElementAttributeMustBeSmallerThanMax", elementName, attributeName, max);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMustBeSmallerThanMax", elementName, attributeName, max);
}
private static void ValidateXmlElement(string elementName, string attributeName, double value, double? min = null, double? max = null)
{
if (min != null && value < min)
throw new CustomThemeException("CustomTheme.ElementAttributeMustBeLargerThanMin", elementName, attributeName, min);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMustBeLargerThanMin", elementName, attributeName, min);
if (max != null && value > max)
throw new CustomThemeException("CustomTheme.ElementAttributeMustBeSmallerThanMax", elementName, attributeName, max);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMustBeSmallerThanMax", elementName, attributeName, max);
}
// You can't do numeric only generics in .NET 6. The feature is exclusive to .NET 7+.
@ -136,7 +136,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
return FontWeights.UltraBlack;
default:
throw new CustomThemeException("CustomTheme.UnknownEnumValue", element.Name, "FontWeight", value);
throw new CustomThemeException("CustomTheme.Errors.UnknownEnumValue", element.Name, "FontWeight", value);
}
}
@ -158,7 +158,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
return FontStyles.Oblique;
default:
throw new CustomThemeException("CustomTheme.UnknownEnumValue", element.Name, "FontStyle", value);
throw new CustomThemeException("CustomTheme.Errors.UnknownEnumValue", element.Name, "FontStyle", value);
}
}
@ -183,7 +183,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
return TextDecorations.Underline;
default:
throw new CustomThemeException("CustomTheme.UnknownEnumValue", element.Name, "TextDecorations", value);
throw new CustomThemeException("CustomTheme.Errors.UnknownEnumValue", element.Name, "TextDecorations", value);
}
}
@ -219,13 +219,13 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
path = GetFullPath(dialog, path)!;
if (!Uri.TryCreate(path, UriKind.RelativeOrAbsolute, out Uri? result))
throw new CustomThemeException("CustomTheme.ElementAttributeParseError", xmlElement.Name, name, "Uri");
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeParseError", xmlElement.Name, name, "Uri");
if (result == null)
throw new CustomThemeException("CustomTheme.ElementAttributeParseErrorNull", xmlElement.Name, name, "Uri");
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeParseErrorNull", xmlElement.Name, name, "Uri");
if (result.Scheme != "file")
throw new CustomThemeException("CustomTheme.ElementAttributeBlacklistedUriScheme", xmlElement.Name, name, result.Scheme);
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeBlacklistedUriScheme", xmlElement.Name, name, result.Scheme);
return new GetImageSourceDataResult { Uri = result };
}
@ -235,7 +235,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
var contentAttr = xmlElement.Attribute("Content");
var contentElement = xmlElement.Element($"{xmlElement.Name}.Content");
if (contentAttr != null && contentElement != null)
throw new CustomThemeException("CustomTheme.ElementAttributeMultipleDefinitions", xmlElement.Name, "Content");
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMultipleDefinitions", xmlElement.Name, "Content");
if (contentAttr != null)
return GetTranslatedText(contentAttr.Value);
@ -245,11 +245,11 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
var children = contentElement.Elements();
if (children.Count() > 1)
throw new CustomThemeException("CustomTheme.ElementAttributeMultipleChildren", xmlElement.Name, "Content");
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMultipleChildren", xmlElement.Name, "Content");
var first = contentElement.FirstNode as XElement;
if (first == null)
throw new CustomThemeException("CustomTheme.ElementAttributeMissingChild", xmlElement.Name, "Content");
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMissingChild", xmlElement.Name, "Content");
var uiElement = HandleXml<UIElement>(dialog, first);
return uiElement;
@ -263,7 +263,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
var children = effectElement.Elements();
if (children.Count() > 1)
throw new CustomThemeException("CustomTheme.ElementAttributeMultipleChildren", xmlElement.Name, "Effect");
throw new CustomThemeException("CustomTheme.Errors.ElementAttributeMultipleChildren", xmlElement.Name, "Effect");
var child = children.FirstOrDefault();
if (child == null)