mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-16 02:01:29 -07:00
System for better management of enum names
eradicates all those redundant translations
This commit is contained in:
parent
f99978b4c0
commit
cc4c380c10
@ -34,9 +34,9 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<converters:ResourceConverter x:Key="ResourceConverter" />
|
||||
<converters:StringFormatConverter x:Key="StringFormatConverter" />
|
||||
<converters:RangeConverter x:Key="RangeConverter" />
|
||||
<converters:EnumNameConverter x:Key="EnumNameConverter" />
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
@ -2,14 +2,21 @@
|
||||
{
|
||||
public enum BootstrapperIcon
|
||||
{
|
||||
[EnumName(StaticName = "Bloxstrap")]
|
||||
IconBloxstrap,
|
||||
[EnumName(StaticName = "2008")]
|
||||
Icon2008,
|
||||
[EnumName(StaticName = "2011")]
|
||||
Icon2011,
|
||||
IconEarly2015,
|
||||
IconLate2015,
|
||||
[EnumName(StaticName = "2017")]
|
||||
Icon2017,
|
||||
[EnumName(StaticName = "2019")]
|
||||
Icon2019,
|
||||
[EnumName(StaticName = "2022")]
|
||||
Icon2022,
|
||||
[EnumName(FromTranslation = "Common.Custom")]
|
||||
IconCustom
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
ProgressDialog,
|
||||
ClassicFluentDialog,
|
||||
ByfronDialog,
|
||||
[EnumName(StaticName = "Bloxstrap")]
|
||||
FluentDialog,
|
||||
FluentAeroDialog
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
{
|
||||
public enum CursorType
|
||||
{
|
||||
[EnumName(FromTranslation = "Common.Default")]
|
||||
Default,
|
||||
From2006,
|
||||
From2013
|
||||
|
@ -2,6 +2,7 @@
|
||||
{
|
||||
public enum InGameMenuVersion
|
||||
{
|
||||
[EnumName(FromTranslation = "Common.Default")]
|
||||
Default,
|
||||
V1,
|
||||
V2,
|
||||
|
@ -2,9 +2,13 @@
|
||||
{
|
||||
public enum MSAAMode
|
||||
{
|
||||
[EnumName(FromTranslation = "Common.Automatic")]
|
||||
Default,
|
||||
[EnumName(StaticName = "1x")]
|
||||
x1,
|
||||
[EnumName(StaticName = "2x")]
|
||||
x2,
|
||||
[EnumName(StaticName = "4x")]
|
||||
x4
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
namespace Bloxstrap.Enums.FlagPresets
|
||||
{
|
||||
public enum MaterialVersion
|
||||
{
|
||||
Default,
|
||||
Old,
|
||||
New
|
||||
}
|
||||
}
|
@ -2,10 +2,11 @@
|
||||
{
|
||||
public enum RenderingMode
|
||||
{
|
||||
[EnumName(FromTranslation = "Common.Automatic")]
|
||||
Default,
|
||||
Vulkan,
|
||||
// Vulkan,
|
||||
D3D11,
|
||||
D3D10,
|
||||
OpenGL
|
||||
// OpenGL
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
{
|
||||
public enum TextureQuality
|
||||
{
|
||||
[EnumName(FromTranslation = "Common.Automatic")]
|
||||
Default,
|
||||
Level0,
|
||||
Level1,
|
||||
|
@ -2,6 +2,7 @@
|
||||
{
|
||||
public enum Theme
|
||||
{
|
||||
[EnumName(FromTranslation = "Common.SystemDefault")]
|
||||
Default,
|
||||
Light,
|
||||
Dark
|
||||
|
@ -12,7 +12,7 @@ namespace Bloxstrap
|
||||
|
||||
public static readonly Dictionary<string, string> SupportedLocales = new()
|
||||
{
|
||||
{ "nil", Strings.Enums_Theme_Default }, // /shrug
|
||||
{ "nil", Strings.Common_SystemDefault },
|
||||
{ "en", "English" },
|
||||
{ "en-US", "English (United States)" },
|
||||
{ "ar", "العربية" },
|
||||
@ -55,13 +55,9 @@ namespace Bloxstrap
|
||||
|
||||
public static List<string> GetLanguages()
|
||||
{
|
||||
var languages = new List<string>()
|
||||
{
|
||||
Strings.Enums_Theme_Default,
|
||||
"English",
|
||||
"English (United States)"
|
||||
};
|
||||
|
||||
var languages = new List<string>();
|
||||
|
||||
languages.AddRange(SupportedLocales.Values.Take(3));
|
||||
languages.AddRange(SupportedLocales.Values.Where(x => !languages.Contains(x)).OrderBy(x => x));
|
||||
|
||||
return languages;
|
||||
|
14
Bloxstrap/Models/Attributes/EnumNameAttribute.cs
Normal file
14
Bloxstrap/Models/Attributes/EnumNameAttribute.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bloxstrap.Models.Attributes
|
||||
{
|
||||
class EnumNameAttribute : Attribute
|
||||
{
|
||||
public string? StaticName { get; set; }
|
||||
public string? FromTranslation { get; set; }
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ namespace Bloxstrap.Models
|
||||
public class BootstrapperIconEntry
|
||||
{
|
||||
public BootstrapperIcon IconType { get; set; }
|
||||
public string Name => IconType.ToString();
|
||||
public ImageSource ImageSource => IconType.GetIcon().GetImageSource();
|
||||
}
|
||||
}
|
||||
|
234
Bloxstrap/Resources/Strings.Designer.cs
generated
234
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -314,6 +314,15 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Automatic.
|
||||
/// </summary>
|
||||
public static string Common_Automatic {
|
||||
get {
|
||||
return ResourceManager.GetString("Common.Automatic", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Browse.
|
||||
/// </summary>
|
||||
@ -341,6 +350,24 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Custom.
|
||||
/// </summary>
|
||||
public static string Common_Custom {
|
||||
get {
|
||||
return ResourceManager.GetString("Common.Custom", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default.
|
||||
/// </summary>
|
||||
public static string Common_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Common.Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete.
|
||||
/// </summary>
|
||||
@ -458,6 +485,15 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to System default.
|
||||
/// </summary>
|
||||
public static string Common_SystemDefault {
|
||||
get {
|
||||
return ResourceManager.GetString("Common.SystemDefault", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Value.
|
||||
/// </summary>
|
||||
@ -738,69 +774,6 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2008.
|
||||
/// </summary>
|
||||
public static string Enums_BootstrapperIcon_Icon2008 {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.BootstrapperIcon.Icon2008", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2011.
|
||||
/// </summary>
|
||||
public static string Enums_BootstrapperIcon_Icon2011 {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.BootstrapperIcon.Icon2011", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2017.
|
||||
/// </summary>
|
||||
public static string Enums_BootstrapperIcon_Icon2017 {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.BootstrapperIcon.Icon2017", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2019.
|
||||
/// </summary>
|
||||
public static string Enums_BootstrapperIcon_Icon2019 {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.BootstrapperIcon.Icon2019", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2022.
|
||||
/// </summary>
|
||||
public static string Enums_BootstrapperIcon_Icon2022 {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.BootstrapperIcon.Icon2022", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bloxstrap.
|
||||
/// </summary>
|
||||
public static string Enums_BootstrapperIcon_IconBloxstrap {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.BootstrapperIcon.IconBloxstrap", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Custom.
|
||||
/// </summary>
|
||||
public static string Enums_BootstrapperIcon_IconCustom {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.BootstrapperIcon.IconCustom", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Early 2015.
|
||||
/// </summary>
|
||||
@ -846,15 +819,6 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bloxstrap.
|
||||
/// </summary>
|
||||
public static string Enums_BootstrapperStyle_FluentDialog {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.BootstrapperStyle.FluentDialog", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Legacy (2008 - 2011).
|
||||
/// </summary>
|
||||
@ -891,15 +855,6 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default.
|
||||
/// </summary>
|
||||
public static string Enums_CursorType_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.CursorType.Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2006 (Cartoony).
|
||||
/// </summary>
|
||||
@ -963,15 +918,6 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_InGameMenuVersion_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.InGameMenuVersion.Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2015 (V1).
|
||||
/// </summary>
|
||||
@ -1044,69 +990,6 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Chosen by game.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_MaterialVersion_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.MaterialVersion.Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New (2022).
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_MaterialVersion_New {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.MaterialVersion.New", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Old (Pre-2022).
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_MaterialVersion_Old {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.MaterialVersion.Old", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Automatic.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_MSAAMode_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.MSAAMode.Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 1x.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_MSAAMode_x1 {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.MSAAMode.x1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2x.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_MSAAMode_x2 {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.MSAAMode.x2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 4x.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_MSAAMode_x4 {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.MSAAMode.x4", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Direct3D 10.
|
||||
/// </summary>
|
||||
@ -1125,42 +1008,6 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Automatic.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_RenderingMode_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.RenderingMode.Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to OpenGL.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_RenderingMode_OpenGL {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.RenderingMode.OpenGL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Vulkan.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_RenderingMode_Vulkan {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.RenderingMode.Vulkan", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default.
|
||||
/// </summary>
|
||||
public static string Enums_FlagPresets_TextureQuality_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.FlagPresets.TextureQuality.Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Level 0 (Lowest).
|
||||
/// </summary>
|
||||
@ -1233,15 +1080,6 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to System default.
|
||||
/// </summary>
|
||||
public static string Enums_Theme_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Enums.Theme.Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Light.
|
||||
/// </summary>
|
||||
|
@ -333,25 +333,7 @@ Click for more information</value>
|
||||
<data name="Dialog.Exception.Title" xml:space="preserve">
|
||||
<value>Bloxstrap Exception</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperIcon.Icon2008" xml:space="preserve">
|
||||
<value>2008</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperIcon.Icon2011" xml:space="preserve">
|
||||
<value>2011</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperIcon.Icon2017" xml:space="preserve">
|
||||
<value>2017</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperIcon.Icon2019" xml:space="preserve">
|
||||
<value>2019</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperIcon.Icon2022" xml:space="preserve">
|
||||
<value>2022</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperIcon.IconBloxstrap" xml:space="preserve">
|
||||
<value>Bloxstrap</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperIcon.IconCustom" xml:space="preserve">
|
||||
<data name="Common.Custom" xml:space="preserve">
|
||||
<value>Custom</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperIcon.IconEarly2015" xml:space="preserve">
|
||||
@ -369,9 +351,6 @@ Click for more information</value>
|
||||
<data name="Enums.BootstrapperStyle.FluentAeroDialog" xml:space="preserve">
|
||||
<value>Bloxstrap (Glass)</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperStyle.FluentDialog" xml:space="preserve">
|
||||
<value>Bloxstrap</value>
|
||||
</data>
|
||||
<data name="Enums.BootstrapperStyle.LegacyDialog2008" xml:space="preserve">
|
||||
<value>Legacy (2008 - 2011)</value>
|
||||
</data>
|
||||
@ -384,9 +363,6 @@ Click for more information</value>
|
||||
<data name="Enums.BootstrapperStyle.VistaDialog" xml:space="preserve">
|
||||
<value>Vista (2008 - 2011)</value>
|
||||
</data>
|
||||
<data name="Enums.CursorType.Default" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="Enums.CursorType.From2006" xml:space="preserve">
|
||||
<value>2006 (Cartoony)</value>
|
||||
</data>
|
||||
@ -408,9 +384,6 @@ Click for more information</value>
|
||||
<data name="Enums.EmojiType.Windows8" xml:space="preserve">
|
||||
<value>Windows 8</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.InGameMenuVersion.Default" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.InGameMenuVersion.V1" xml:space="preserve">
|
||||
<value>2015 (V1)</value>
|
||||
</data>
|
||||
@ -432,42 +405,12 @@ Click for more information</value>
|
||||
<data name="Enums.FlagPresets.LightingMode.Voxel" xml:space="preserve">
|
||||
<value>Voxel (Phase 1)</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.MaterialVersion.Default" xml:space="preserve">
|
||||
<value>Chosen by game</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.MaterialVersion.New" xml:space="preserve">
|
||||
<value>New (2022)</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.MaterialVersion.Old" xml:space="preserve">
|
||||
<value>Old (Pre-2022)</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.MSAAMode.Default" xml:space="preserve">
|
||||
<value>Automatic</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.MSAAMode.x1" xml:space="preserve">
|
||||
<value>1x</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.MSAAMode.x2" xml:space="preserve">
|
||||
<value>2x</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.MSAAMode.x4" xml:space="preserve">
|
||||
<value>4x</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.RenderingMode.D3D10" xml:space="preserve">
|
||||
<value>Direct3D 10</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.RenderingMode.D3D11" xml:space="preserve">
|
||||
<value>Direct3D 11</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.RenderingMode.Default" xml:space="preserve">
|
||||
<value>Automatic</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.RenderingMode.OpenGL" xml:space="preserve">
|
||||
<value>OpenGL</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.RenderingMode.Vulkan" xml:space="preserve">
|
||||
<value>Vulkan</value>
|
||||
</data>
|
||||
<data name="Enums.ServerType.Private" xml:space="preserve">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
@ -480,9 +423,6 @@ Click for more information</value>
|
||||
<data name="Enums.Theme.Dark" xml:space="preserve">
|
||||
<value>Dark</value>
|
||||
</data>
|
||||
<data name="Enums.Theme.Default" xml:space="preserve">
|
||||
<value>System default</value>
|
||||
</data>
|
||||
<data name="Enums.Theme.Light" xml:space="preserve">
|
||||
<value>Light</value>
|
||||
</data>
|
||||
@ -1033,9 +973,6 @@ Selecting 'No' will ignore this warning and continue installation.</value>
|
||||
<data name="Menu.FastFlags.Presets.TextureQuality.Title" xml:space="preserve">
|
||||
<value>Texture quality</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.TextureQuality.Default" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="Enums.FlagPresets.TextureQuality.Level0" xml:space="preserve">
|
||||
<value>Level 0 (Lowest)</value>
|
||||
</data>
|
||||
@ -1082,4 +1019,13 @@ Selecting 'No' will ignore this warning and continue installation.</value>
|
||||
<data name="Logger.NoWriteMode" xml:space="preserve">
|
||||
<value>No log file will be written for this launch because Bloxstrap is unable to write to the folder at '{0}'</value>
|
||||
</data>
|
||||
<data name="Common.Default" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="Common.Automatic" xml:space="preserve">
|
||||
<value>Automatic</value>
|
||||
</data>
|
||||
<data name="Common.SystemDefault" xml:space="preserve">
|
||||
<value>System default</value>
|
||||
</data>
|
||||
</root>
|
51
Bloxstrap/UI/Converters/EnumNameConverter.cs
Normal file
51
Bloxstrap/UI/Converters/EnumNameConverter.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Bloxstrap.UI.Converters
|
||||
{
|
||||
class EnumNameConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
// https://stackoverflow.com/a/28672015/11852173
|
||||
|
||||
var enumVal = (Enum)value;
|
||||
var stringVal = enumVal.ToString();
|
||||
|
||||
var type = enumVal.GetType();
|
||||
var typeName = type.FullName!;
|
||||
var attributes = type.GetMember(stringVal)[0].GetCustomAttributes(typeof(EnumNameAttribute), false);
|
||||
|
||||
if (attributes.Length > 0)
|
||||
{
|
||||
var attribute = (EnumNameAttribute)attributes[0];
|
||||
|
||||
if (attribute is not null)
|
||||
{
|
||||
if (attribute.StaticName is not null)
|
||||
return attribute.StaticName;
|
||||
|
||||
if (attribute.FromTranslation is not null)
|
||||
return Resources.Strings.ResourceManager.GetStringSafe(attribute.FromTranslation);
|
||||
}
|
||||
}
|
||||
|
||||
return Resources.Strings.ResourceManager.GetStringSafe(String.Format(
|
||||
"{0}.{1}",
|
||||
typeName.Substring(typeName.IndexOf('.', StringComparison.Ordinal) + 1),
|
||||
stringVal
|
||||
));
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Bloxstrap.UI.Converters
|
||||
{
|
||||
internal class ResourceConverter : IValueConverter
|
||||
{
|
||||
// parameter is the resource namespace prefix
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is null)
|
||||
return "";
|
||||
|
||||
if (parameter is null)
|
||||
return value.ToString()!;
|
||||
|
||||
string valueStr = value.ToString()!;
|
||||
string parameterStr = parameter.ToString()!;
|
||||
string resourceName = parameterStr + valueStr;
|
||||
|
||||
return Resources.Strings.ResourceManager.GetStringSafe(resourceName);
|
||||
}
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException(nameof(ConvertBack));
|
||||
}
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@
|
||||
<ComboBox Width="200" Padding="10,5,10,5" ItemsSource="{Binding Themes, Mode=OneTime}" Text="{Binding Theme, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.Theme.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
@ -59,7 +59,7 @@
|
||||
<ComboBox Width="200" Padding="10,5,10,5" ItemsSource="{Binding Dialogs, Mode=OneTime}" Text="{Binding Dialog, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.BootstrapperStyle.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
@ -78,7 +78,7 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Height="16" Source="{Binding ImageSource, Mode=OneWay}" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
<TextBlock Grid.Column="1" Margin="8,0,0,0" Text="{Binding Name, Mode=OneWay, Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.BootstrapperIcon.'}" />
|
||||
<TextBlock Grid.Column="1" Margin="8,0,0,0" Text="{Binding Path=IconType, Converter={StaticResource EnumNameConverter}}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
|
@ -60,7 +60,7 @@
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding MSAALevels.Keys, Mode=OneTime}" Text="{Binding SelectedMSAALevel, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.FlagPresets.MSAAMode.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
@ -96,7 +96,7 @@
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding LightingModes.Keys, Mode=OneTime}" Text="{Binding SelectedLightingMode, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.FlagPresets.LightingMode.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
@ -114,7 +114,7 @@
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding RenderingModes.Keys, Mode=OneTime}" Text="{Binding SelectedRenderingMode, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.FlagPresets.RenderingMode.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
@ -125,7 +125,7 @@
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding TextureQualities.Keys, Mode=OneTime}" Text="{Binding SelectedTextureQuality, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.FlagPresets.TextureQuality.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
@ -159,7 +159,7 @@
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding IGMenuVersions.Keys, Mode=OneTime}" Text="{Binding SelectedIGMenuVersion, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.FlagPresets.InGameMenuVersion.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
@ -75,7 +75,7 @@
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding CursorTypes, Mode=OneTime}" Text="{Binding SelectedCursorType, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.CursorType.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
@ -99,7 +99,7 @@
|
||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="220" ItemsSource="{Binding EmojiTypes, Mode=OneTime}" Text="{Binding SelectedEmojiType, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource ResourceConverter}, ConverterParameter='Enums.EmojiType.'}" />
|
||||
<TextBlock Text="{Binding Path=., Converter={StaticResource EnumNameConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
Loading…
Reference in New Issue
Block a user