Core - Update ConsolePlatform & AppLanguage for readability

This commit is contained in:
miku-666
2025-12-20 12:03:21 +01:00
parent 89eccba1eb
commit 1eddf2808a
7 changed files with 50 additions and 52 deletions

View File

@@ -80,9 +80,6 @@
<setting name="Platform" serializeAs="String">
<value>Unknown</value>
</setting>
<setting name="UserLanguage" serializeAs="String">
<value>SystemDefault</value>
</setting>
</PckStudio.Properties.Settings>
</userSettings>
</configuration>

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;
using MetroFramework.Controls;
using PckStudio.Controls;
@@ -85,16 +86,16 @@ namespace PckStudio.Forms
Theme = MetroFramework.MetroThemeStyle.Dark,
Style = MetroFramework.MetroColorStyle.Silver,
};
object[] values = Enum.GetNames(type);
object[] values = Enum.GetNames(type).Skip(type == typeof(ConsolePlatform) ? 1: 0).Select(s => s.Replace("_", " ")).ToArray();
control.Items.AddRange(values);
control.Text = propertyValue.PropertyValue.ToString();
control.SelectedItem = propertyValue.PropertyValue;
control.Text = propertyValue.PropertyValue.ToString().Replace("_", " ");
control.SelectedItem = propertyValue.PropertyValue.ToString().Replace("_", " ");
void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (sender is ComboBox comboBox && comboBox.Tag is string settingsKey && settings[settingsKey].GetType() == type)
{
settings[settingsKey] = Enum.Parse(type, (string)comboBox.SelectedItem, true);
settings[settingsKey] = Enum.Parse(type, ((string)comboBox.SelectedItem).Replace(" ", "_"), true);
}
}

View File

@@ -38,9 +38,9 @@ namespace PckStudio
if (Settings.Default.Platform == Core.ConsolePlatform.Unknown)
{
MessageBox.Show("Please choose on which console you're playing on.", "Select Platform", MessageBoxButtons.OK, MessageBoxIcon.Question);
var platformChooser = new ItemSelectionPopUp(Enum.GetNames(typeof(Core.ConsolePlatform)).Skip(1).ToArray());
if (platformChooser.ShowDialog() == DialogResult.OK && Enum.IsDefined(typeof(ConsolePlatform), platformChooser.SelectedItem))
Settings.Default.Platform = (Core.ConsolePlatform)Enum.Parse(typeof(ConsolePlatform), platformChooser.SelectedItem);
var platformChooser = new ItemSelectionPopUp(Enum.GetNames(typeof(Core.ConsolePlatform)).Skip(1).Select(s => s.Replace("_", " ")).ToArray());
if (platformChooser.ShowDialog() == DialogResult.OK && Enum.IsDefined(typeof(ConsolePlatform), platformChooser.SelectedItem.Replace(" ", "_")))
Settings.Default.Platform = (Core.ConsolePlatform)Enum.Parse(typeof(ConsolePlatform), platformChooser.SelectedItem.Replace(" ", "_"));
}
ApplicationScope.Initialize();

View File

@@ -129,7 +129,7 @@ namespace PckStudio.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("SystemDefault")]
[global::System.Configuration.DefaultSettingValueAttribute("System_Default")]
public global::PckStudio.Core.App.AppLanguage UserLanguage {
get {
return ((global::PckStudio.Core.App.AppLanguage)(this["UserLanguage"]));

View File

@@ -30,7 +30,7 @@
<Value Profile="(Default)">Unknown</Value>
</Setting>
<Setting Name="UserLanguage" Type="PckStudio.Core.AppLanguage" Scope="User">
<Value Profile="(Default)">SystemDefault</Value>
<Value Profile="(Default)">System_Default</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -8,45 +8,45 @@ namespace PckStudio.Core.App
{
public enum AppLanguage : int
{
SystemDefault,
CzechCzechia,
System_Default,
Czech_Czechia,
Czechia,
Danish,
DenmarkDanish,
GermanAustria,
Denmark_Danish,
German_Austria,
German,
GreekGreece,
Greek_Greece,
Greece,
EnglishAustralia,
EnglishCanada,
English_Australia,
English_Canada,
English,
EnglishUnitedKingdom,
EnglishIreland,
EnglishNewZealand,
EnglishUnitedStatesOfAmerica,
SpanishSpain,
SpanishMexico,
FinnishFinland,
FrenchFrance,
FrenchCanada,
ItalianItaly,
JapaneseJapan,
KoreanSouthKorea,
English_UnitedKingdom,
English_Ireland,
English_NewZealand,
English_USA,
Spanish_Spain,
Spanish_Mexico,
Finnish_Finland,
French_France,
French_Canada,
Italian_Italy,
Japanese_Japan,
Korean_South_Korea,
Latin,
NorwegianNorway,
NorwegianBokmålNorway,
DutchNetherlands,
DutchBelgium,
PolishPoland,
PortugueseBrazil,
PortuguesePortugal,
RussianRussia,
SlovakSlovakia,
SwedishSweden,
TurkishTurkey,
ChineseChina,
ChineseHongKong,
ChineseSingapore,
ChineseTaiwan,
Norwegian_Norway,
Norwegian_Bokmål_Norway,
Dutch_Netherlands,
Dutch_Belgium,
Polish_Poland,
Portuguese_Brazil,
Portuguese_Portugal,
Russian_Russia,
Slovak_Slovakia,
Swedish_Sweden,
Turkish_Turkey,
Chinese_China,
Chinese_HongKong,
Chinese_Singapore,
Chinese_Taiwan,
}
}

View File

@@ -3,12 +3,12 @@
public enum ConsolePlatform
{
Unknown,
Xbox360,
XboxOne,
PS3,
PS4,
PSVita,
WiiU,
Xbox_360,
Xbox_One,
PS_3,
PS_4,
PS_Vita,
Wii_U,
Switch
}
}