From b86798d6d6420bde4f6a89044b961b3e78777d81 Mon Sep 17 00:00:00 2001 From: CatmanFan Date: Tue, 27 Feb 2024 03:53:43 +0100 Subject: [PATCH] ONGOING --- .gitignore | 3 + FriishProduce/FriishProduce.csproj | 9 + FriishProduce/InjectorForm.cs | 25 ++- FriishProduce/MainForm.Designer.cs | 9 + FriishProduce/MainForm.cs | 5 + FriishProduce/MainForm.resx | 212 +++++++++++------- .../Properties/Resources.Designer.cs | 26 --- FriishProduce/Properties/Resources.resx | 3 - FriishProduce/Strings/en.xml | 2 +- FriishProduce/Strings/fr.xml | 2 +- FriishProduce/Subforms/About.cs | 4 +- FriishProduce/Subforms/SettingsForm.cs | 10 +- FriishProduce/_classes/Injectors/WiiVC.cs | 4 +- FriishProduce/_classes/Injectors/WiiVC/N64.cs | 12 +- .../_classes/Injectors/WiiVC/SEGA.cs | 6 +- .../_classes/Injectors/WiiVC/SNES.cs | 2 +- FriishProduce/_classes/Language.cs | 13 +- FriishProduce/_classes/LibRetroDB.cs | 2 +- FriishProduce/_classes/MessageBox.cs | 16 +- FriishProduce/_classes/ROM.cs | 2 +- FriishProduce/_classes/TitleImage.cs | 2 +- 21 files changed, 209 insertions(+), 160 deletions(-) diff --git a/.gitignore b/.gitignore index 6726b3d7..bcfada8f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ legacy/ /FriishProduce/Database_Test.xml /FriishProduce/Strings/Original /FriishProduce/_classes/LanguageRESX.cs +/FriishProduce/LanguageEditor.cs +/FriishProduce/LanguageEditor.Designer.cs +/FriishProduce/LanguageEditor.resx diff --git a/FriishProduce/FriishProduce.csproj b/FriishProduce/FriishProduce.csproj index 924336dc..de81c65b 100644 --- a/FriishProduce/FriishProduce.csproj +++ b/FriishProduce/FriishProduce.csproj @@ -135,6 +135,12 @@ BannerPreviewForm.cs + + Form + + + LanguageEditor.cs + Form @@ -154,6 +160,9 @@ BannerPreviewForm.cs + + LanguageEditor.cs + MainForm.cs diff --git a/FriishProduce/InjectorForm.cs b/FriishProduce/InjectorForm.cs index 8a81a014..62bd2382 100644 --- a/FriishProduce/InjectorForm.cs +++ b/FriishProduce/InjectorForm.cs @@ -56,10 +56,13 @@ public partial class InjectorForm : Form public void RefreshForm() { + // ---------------------------- + if (DesignMode) return; + // ---------------------------- Language.Localize(this); // Change title text to untitled string - Untitled = string.Format(Language.Get("Untitled"), Language.Get($"Platform_{Enum.GetName(typeof(Console), Console)}")); + Untitled = string.Format(Language.Get("Untitled"), Language.Get(Enum.GetName(typeof(Console), Console), "Platforms")); Text = string.IsNullOrWhiteSpace(ChannelTitle.Text) ? Untitled : ChannelTitle.Text; SetROMDataText(); @@ -72,7 +75,7 @@ public void RefreshForm() // Selected index properties imageintpl.Items.Clear(); imageintpl.Items.Add(Language.Get("ByDefault")); - imageintpl.Items.AddRange(Language.GetArray("List_ImageInterpolation")); + imageintpl.Items.AddRange(Language.GetArray("List.ImageInterpolation")); imageintpl.SelectedIndex = Properties.Settings.Default.ImageInterpolation; if (Properties.Settings.Default.ImageFitAspectRatio) radioButton2.Checked = true; else radioButton1.Checked = true; @@ -222,7 +225,7 @@ private void isClosing(object sender, FormClosingEventArgs e) public bool CheckUnsaved() { if (Tag != null && Tag.ToString() == "dirty") - if (MessageBox.Show(Text, Language.Get("Message001"), MessageBoxButtons.YesNo, 0, true) == DialogResult.No) + if (MessageBox.Show(Text, Language.Get("Message.001"), MessageBoxButtons.YesNo, 0, true) == DialogResult.No) return false; return true; } @@ -365,7 +368,7 @@ public bool LoadWAD(string path) Failed: System.Media.SystemSounds.Beep.Play(); - MessageBox.Show(string.Format(Language.Get("Message005"), Reader.UpperTitleID)); + MessageBox.Show(string.Format(Language.Get("Message.005"), Reader.UpperTitleID)); return false; } @@ -393,7 +396,7 @@ public void LoadManual(string path) if (validFiles < 2) { - MessageBox.Show(Language.Get("Message007"), MessageBoxButtons.OK, Ookii.Dialogs.WinForms.TaskDialogIcon.Warning); + MessageBox.Show(Language.Get("Message.007"), MessageBoxButtons.OK, Ookii.Dialogs.WinForms.TaskDialogIcon.Warning); Manual = null; return; } @@ -466,7 +469,7 @@ public bool LoadImage(Bitmap src) } catch { - MessageBox.Show(Language.Get("Error001")); + MessageBox.Show(Language.Get("Error.001")); return false; } } @@ -486,7 +489,7 @@ public void LoadROM(string ROMpath, bool UseLibRetro = true) case Console.PCE: if (!ROM.CheckValidity(File.ReadAllBytes(ROMpath))) { - MessageBox.Show(Language.Get("Message008"), 0, Ookii.Dialogs.WinForms.TaskDialogIcon.Warning); + MessageBox.Show(Language.Get("Message.008"), 0, Ookii.Dialogs.WinForms.TaskDialogIcon.Warning); return; } break; @@ -496,7 +499,7 @@ public void LoadROM(string ROMpath, bool UseLibRetro = true) // **************** if (!ROM.CheckZIPValidity(ROMpath, new string[] { "c1", "c2", "m1", "p1", "s1", "v1" }, true, true)) { - MessageBox.Show(Language.Get("Message008"), 0, Ookii.Dialogs.WinForms.TaskDialogIcon.Warning); + MessageBox.Show(Language.Get("Message.008"), 0, Ookii.Dialogs.WinForms.TaskDialogIcon.Warning); return; } break; @@ -565,7 +568,7 @@ public async void LoadLibRetroData() // Show message if partially failed to retrieve data if (Retrieved && (LibRetro.GetTitle() == null || LibRetro.GetPlayers() == null || LibRetro.GetYear() == null || LibRetro.GetImgURL() == null)) - MessageBox.Show(Language.Get("Message004")); + MessageBox.Show(Language.Get("Message.004")); else if (!Retrieved) System.Media.SystemSounds.Beep.Play(); } @@ -609,11 +612,11 @@ public bool CreateInject() if (Properties.Settings.Default.AutoOpenFolder) System.Diagnostics.Process.Start("explorer.exe", $"/select, \"{Creator.Out}\""); else - MessageBox.Show(string.Format(Language.Get("Message003"), Creator.Out), MessageBoxButtons.OK, Ookii.Dialogs.WinForms.TaskDialogIcon.Information); + MessageBox.Show(string.Format(Language.Get("Message.003"), Creator.Out), MessageBoxButtons.OK, Ookii.Dialogs.WinForms.TaskDialogIcon.Information); return true; } - else throw new Exception(Language.Get("Error006")); + else throw new Exception(Language.Get("Error.006")); } catch (Exception ex) diff --git a/FriishProduce/MainForm.Designer.cs b/FriishProduce/MainForm.Designer.cs index df6d340a..9e9868c0 100644 --- a/FriishProduce/MainForm.Designer.cs +++ b/FriishProduce/MainForm.Designer.cs @@ -72,6 +72,7 @@ private void InitializeComponent() this.ToolStrip_CloseTab = new System.Windows.Forms.ToolStripButton(); this.ToolStrip_Settings = new System.Windows.Forms.ToolStripButton(); this.ToolStrip_Tutorial = new System.Windows.Forms.ToolStripButton(); + this.languageEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MenuStrip.SuspendLayout(); this.MainPanel.SuspendLayout(); this.ToolStrip.SuspendLayout(); @@ -249,6 +250,7 @@ private void InitializeComponent() // this.MenuItem_Help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.MenuItem_Tutorial, + this.languageEditorToolStripMenuItem, this.toolStripSeparator5, this.MenuItem_About}); this.MenuItem_Help.Name = "MenuItem_Help"; @@ -400,6 +402,12 @@ private void InitializeComponent() this.ToolStrip_Tutorial.Name = "ToolStrip_Tutorial"; this.ToolStrip_Tutorial.Click += new System.EventHandler(this.Tutorial_Click); // + // languageEditorToolStripMenuItem + // + this.languageEditorToolStripMenuItem.Name = "languageEditorToolStripMenuItem"; + resources.ApplyResources(this.languageEditorToolStripMenuItem, "languageEditorToolStripMenuItem"); + this.languageEditorToolStripMenuItem.Click += new System.EventHandler(this.languageEditorToolStripMenuItem_Click); + // // MainForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -467,6 +475,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripButton ToolStrip_Tutorial; private System.Windows.Forms.Label PointToTutorial; private System.Windows.Forms.Button Welcome_DoNotShow; + private System.Windows.Forms.ToolStripMenuItem languageEditorToolStripMenuItem; } } diff --git a/FriishProduce/MainForm.cs b/FriishProduce/MainForm.cs index 996a25bd..a1e0f077 100644 --- a/FriishProduce/MainForm.cs +++ b/FriishProduce/MainForm.cs @@ -340,5 +340,10 @@ private void TabContextMenu_Opening(object sender, CancelEventArgs e) private void About_Click(object sender, EventArgs e) => new About().ShowDialog(); private void MenuItem_Exit_Click(object sender, EventArgs e) => Application.Exit(); + + private void languageEditorToolStripMenuItem_Click(object sender, EventArgs e) + { + new LanguageEditor().Show(); + } } } diff --git a/FriishProduce/MainForm.resx b/FriishProduce/MainForm.resx index 4dfb7b5b..28ef4c13 100644 --- a/FriishProduce/MainForm.resx +++ b/FriishProduce/MainForm.resx @@ -179,6 +179,42 @@ Project + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAhVJREFUOE+1Uk1rE1EUzU/IT5ifUBRcuMrS5aANZBnBRRcqwYUEQRwKQjCoESka + LJ2xKjaS6mxqx2jtiLa2iHSwVmMbkmmJmjbT9OlU6YfmeO+bwFhqERceOLz73rxz7nmXifwXTMz6uFVa + QeZ2Db0D8+grVjDy4iM6n/fGm+oGCuMt6KVluM0tfFnfhvC3qN7ExUIZGd1B6eXSn41YfM9eg/etDdsB + tCFAzQTk2nYEqmttnOubxMizym4T7rz6vQ3DBmJpwLAAsQEJVwCp63wmUCOTU9knOw0m3q7j4UxLdmYx + X2aYU0AyF6xsFksLqgV06x3yhVehyZ3HTXwSP2TUWCqInTOBLqqVHoFUjiIQVE0gmXEwX/Vx9MxwaJC9 + uyQHpmqBqKsnoEJMkpi722UBRbWhJGw0PB8H4ldDg/M3qzTtbRk/ENLlpKAkQWfTpj0Jo6pJq4lG8yv2 + qZdDg/z9Gha9TXp7IFQSrmRuKDCIqg4xMFDTNsqVOrpPGKHB6ORnWI4nB8TCaIIFDj3JpbnQnsWHTEnD + cjFszeHCjbHQgJEdnMWC95O6dgRErmWCjlgzHHxY8XDkuL5TzBibrqM3P41qi/4F6qJqjnw3k2s+W6iv + Ik7RB4pTuw0Yo89rOH1pHMaj95iZW8QyTbvR9OWbOXY3ddb3Ev+O/uJrHDv7AAcT17D/8BXETw4i2//0 + 78J/RyTyC53a8qzC7E1mAAAAAElFTkSuQmCC + + + + 180, 22 + + + Tutorial + + + 180, 22 + + + Language Editor + + + 177, 6 + + + 180, 22 + + + About + 40, 20 @@ -211,22 +247,22 @@ 2 - 113, 22 + 180, 22 New... - 113, 22 + 180, 22 Settings - 110, 6 + 177, 6 - 113, 22 + 180, 22 Exit @@ -235,76 +271,106 @@ False - 67, 22 + 180, 22 False - 67, 22 + 180, 22 False - 67, 22 + 180, 22 - 64, 6 + 177, 6 False - 67, 22 + 180, 22 - 64, 6 + 177, 6 False - 67, 22 + 180, 22 - 64, 6 + 177, 6 False - 67, 22 + 180, 22 - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAhVJREFUOE+1Uk1rE1EUzU/IT5ifUBRcuMrS5aANZBnBRRcqwYUEQRwKQjCoESka - LJ2xKjaS6mxqx2jtiLa2iHSwVmMbkmmJmjbT9OlU6YfmeO+bwFhqERceOLz73rxz7nmXifwXTMz6uFVa - QeZ2Db0D8+grVjDy4iM6n/fGm+oGCuMt6KVluM0tfFnfhvC3qN7ExUIZGd1B6eXSn41YfM9eg/etDdsB - tCFAzQTk2nYEqmttnOubxMizym4T7rz6vQ3DBmJpwLAAsQEJVwCp63wmUCOTU9knOw0m3q7j4UxLdmYx - X2aYU0AyF6xsFksLqgV06x3yhVehyZ3HTXwSP2TUWCqInTOBLqqVHoFUjiIQVE0gmXEwX/Vx9MxwaJC9 - uyQHpmqBqKsnoEJMkpi722UBRbWhJGw0PB8H4ldDg/M3qzTtbRk/ENLlpKAkQWfTpj0Jo6pJq4lG8yv2 - qZdDg/z9Gha9TXp7IFQSrmRuKDCIqg4xMFDTNsqVOrpPGKHB6ORnWI4nB8TCaIIFDj3JpbnQnsWHTEnD - cjFszeHCjbHQgJEdnMWC95O6dgRErmWCjlgzHHxY8XDkuL5TzBibrqM3P41qi/4F6qJqjnw3k2s+W6iv - Ik7RB4pTuw0Yo89rOH1pHMaj95iZW8QyTbvR9OWbOXY3ddb3Ev+O/uJrHDv7AAcT17D/8BXETw4i2//0 - 78J/RyTyC53a8qzC7E1mAAAAAElFTkSuQmCC - + + Welcome_DoNotShow - - 110, 22 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Tutorial + + MainPanel - - 107, 6 + + 0 - - 110, 22 + + PointToTutorial - - About + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + MainPanel + + + 1 + + + Welcome + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + MainPanel + + + 2 + + + Fill + + + 0, 45 + + + 1044, 535 + + + 6 + + + MainPanel + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 Popup @@ -401,35 +467,35 @@ Before getting started, please be sure to familiarise yourself with this program 2 - - Fill + + 525, 17 + + + False - - 0, 45 + + 0, 20 - - 1044, 535 + + 0, 0, 0, 0 - - 6 + + 1044, 25 - - MainPanel + + 7 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ToolStrip - - $this + + System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0 + + $this - - 525, 17 - - - False + + 1 False @@ -506,30 +572,6 @@ Before getting started, please be sure to familiarise yourself with this program 23, 22 - - 0, 20 - - - 0, 0, 0, 0 - - - 1044, 25 - - - 7 - - - ToolStrip - - - System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - True @@ -3154,6 +3196,12 @@ Before getting started, please be sure to familiarise yourself with this program System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + languageEditorToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + MainForm diff --git a/FriishProduce/Properties/Resources.Designer.cs b/FriishProduce/Properties/Resources.Designer.cs index a4970e70..7c3bed5d 100644 --- a/FriishProduce/Properties/Resources.Designer.cs +++ b/FriishProduce/Properties/Resources.Designer.cs @@ -218,32 +218,6 @@ public static System.Drawing.Bitmap door_open { } } - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8" ?> - ///<language> - /// <Metadata> - /// <Author>CatmanFan</Author> - /// <AppTitle>FriishProduce</AppTitle> - /// </Metadata> - /// - /// <Platforms> - /// <PlatformGroup0>Nintendo</PlatformGroup0> - /// <PlatformGroup1>SEGA</PlatformGroup1> - /// <C64>Commodore 64</C64> - /// <Flash>Macromedia/Adobe Flash</Flash> - /// <GBA>Game Boy Advance</GBA> - /// <MSX>Microsoft MSX/MSX2</MSX> - /// <N64>Nintendo 64</N64> - /// <NeoGeo>SNK NEO-GEO</NeoGeo> - /// <PCE>TurboGrafx-16/PC Engine</PCE> - /// <PCECD>TurboGrafx-16 CD/PC Engin [rest of string was truncated]";. - /// - public static string English { - get { - return ResourceManager.GetString("English", resourceCulture); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/FriishProduce/Properties/Resources.resx b/FriishProduce/Properties/Resources.resx index 5900fe7b..c2ec53bf 100644 --- a/FriishProduce/Properties/Resources.resx +++ b/FriishProduce/Properties/Resources.resx @@ -280,7 +280,4 @@ ..\database.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - ..\Strings\en.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - \ No newline at end of file diff --git a/FriishProduce/Strings/en.xml b/FriishProduce/Strings/en.xml index bd606a9f..9238a8aa 100644 --- a/FriishProduce/Strings/en.xml +++ b/FriishProduce/Strings/en.xml @@ -1,7 +1,7 @@  - CatmanFan + CatmanFan FriishProduce diff --git a/FriishProduce/Strings/fr.xml b/FriishProduce/Strings/fr.xml index 339ab123..e46dcd20 100644 --- a/FriishProduce/Strings/fr.xml +++ b/FriishProduce/Strings/fr.xml @@ -1,7 +1,7 @@  - CatmanFan + CatmanFan FriishProduce diff --git a/FriishProduce/Subforms/About.cs b/FriishProduce/Subforms/About.cs index abb3f157..9f33c72f 100644 --- a/FriishProduce/Subforms/About.cs +++ b/FriishProduce/Subforms/About.cs @@ -14,13 +14,13 @@ partial class About : Form public About() { InitializeComponent(); - this.Text = string.Format(Language.Get("About"), Language.Get("_AppTitle")); + this.Text = string.Format(Language.Get("About"), Language.Get("AppTitle")); this.labelProductName.Text = AssemblyProduct; this.labelVersion.Text = string.Format("v{0}", AssemblyVersion); this.labelCopyright.Text = AssemblyCopyright; this.labelCompanyName.Text = AssemblyCompany; this.textBoxDescription.Text = AssemblyDescription; - okButton.Text = Language.Get("Button_Close"); + okButton.Text = Language.Get("B.Close"); } #region Assembly Attribute Accessors diff --git a/FriishProduce/Subforms/SettingsForm.cs b/FriishProduce/Subforms/SettingsForm.cs index 82a59d44..b361ab9d 100644 --- a/FriishProduce/Subforms/SettingsForm.cs +++ b/FriishProduce/Subforms/SettingsForm.cs @@ -36,9 +36,9 @@ public void RefreshForm() { Language.Localize(this); Text = Language.Get("Settings"); - TreeView.Nodes[1].Nodes[0].Text = Language.Get("Platform_NES"); - TreeView.Nodes[1].Nodes[1].Text = Language.Get("Platform_N64"); - TreeView.Nodes[1].Nodes[2].Text = Language.Get("PlatformGroup_1"); + TreeView.Nodes[1].Nodes[0].Text = Language.Get(Console.NES.ToString()); + TreeView.Nodes[1].Nodes[1].Text = Language.Get(Console.N64.ToString(), "Platforms"); + TreeView.Nodes[1].Nodes[2].Text = Language.Get("Group1", "Platforms"); TreeView.SelectedNode = TreeView.Nodes[0]; // ----------------------------- @@ -48,7 +48,7 @@ public void RefreshForm() DefaultImageInterpolation.Items.Clear(); DefaultImageInterpolation.Items.Add(Language.Get("ByDefault")); - DefaultImageInterpolation.Items.AddRange(Language.GetArray("List_ImageInterpolation")); + DefaultImageInterpolation.Items.AddRange(Language.GetArray("List.ImageInterpolation")); DefaultImageInterpolation.SelectedIndex = Default.ImageInterpolation; AutoLibRetro.Checked = Default.AutoLibRetro; @@ -119,7 +119,7 @@ private void OK_Click(object sender, EventArgs e) // ------------------------------------------- if (isDirty) { - if (MessageBox.Show(Language.Get("Message000"), ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) + if (MessageBox.Show(Language.Get("Message.000"), ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { Default.Save(); Application.Restart(); diff --git a/FriishProduce/_classes/Injectors/WiiVC.cs b/FriishProduce/_classes/Injectors/WiiVC.cs index 2fab2ecf..4de3a0ab 100644 --- a/FriishProduce/_classes/Injectors/WiiVC.cs +++ b/FriishProduce/_classes/Injectors/WiiVC.cs @@ -51,7 +51,7 @@ protected virtual void Load() Paths.WorkingFolder, "/u content1.app content1.dec" ); - if (!File.Exists(Paths.WorkingFolder + "content1.dec")) throw new Exception(Language.Get("Error002")); + if (!File.Exists(Paths.WorkingFolder + "content1.dec")) throw new Exception(Language.Get("Error.002")); Contents[1] = File.ReadAllBytes(Paths.WorkingFolder + "content1.dec"); } @@ -186,7 +186,7 @@ public virtual WAD Write() Paths.WorkingFolder, "/cr content1.app content1.dec content1.new" ); - if (!File.Exists(Paths.WorkingFolder + "content1.new")) throw new Exception(Language.Get("Error002")); + if (!File.Exists(Paths.WorkingFolder + "content1.new")) throw new Exception(Language.Get("Error.002")); byte[] Recompressed = File.ReadAllBytes(Paths.WorkingFolder + "content1.new"); diff --git a/FriishProduce/_classes/Injectors/WiiVC/N64.cs b/FriishProduce/_classes/Injectors/WiiVC/N64.cs index 0f0a1a0f..c9a4e323 100644 --- a/FriishProduce/_classes/Injectors/WiiVC/N64.cs +++ b/FriishProduce/_classes/Injectors/WiiVC/N64.cs @@ -120,7 +120,7 @@ protected override void ReplaceROM() // Check if converted file exists // **************** File.Delete(Paths.WorkingFolder + "rom"); - if (!File.Exists(Paths.WorkingFolder + "romc")) throw new Exception(Language.Get("Error002")); + if (!File.Exists(Paths.WorkingFolder + "romc")) throw new Exception(Language.Get("Error.002")); // Convert to bytes and replace at "romc" // **************** @@ -214,22 +214,22 @@ protected override void ModifyEmulatorSettings() { if (SettingParse(0)) { - if (!ShadingFix()) failed.Add(Language.GetArray("List_N64Options")[0]); + if (!ShadingFix()) failed.Add(Language.GetArray("List.N64Options")[0]); } if (SettingParse(1) && (EmuType <= 1)) { - if (!CrashesFix()) failed.Add(Language.GetArray("List_N64Options")[1]); + if (!CrashesFix()) failed.Add(Language.GetArray("List.N64Options")[1]); } if (SettingParse(2)) { - if (!ExtendedRAM()) failed.Add(Language.GetArray("List_N64Options")[2]); + if (!ExtendedRAM()) failed.Add(Language.GetArray("List.N64Options")[2]); } if (SettingParse(3) && (EmuType <= 1)) { - if (!AllocateROM()) { failed.Add(Language.GetArray("List_N64Options")[3]); Allocate = false; } + if (!AllocateROM()) { failed.Add(Language.GetArray("List.N64Options")[3]); Allocate = false; } } if (failed.Count > 0) @@ -238,7 +238,7 @@ protected override void ModifyEmulatorSettings() foreach (var item in failed) failedList += "- " + item + Environment.NewLine; - System.Windows.Forms.MessageBox.Show(string.Format(Language.Get("Error004"), failedList)); + System.Windows.Forms.MessageBox.Show(string.Format(Language.Get("Error.004"), failedList)); } } catch (Exception ex) diff --git a/FriishProduce/_classes/Injectors/WiiVC/SEGA.cs b/FriishProduce/_classes/Injectors/WiiVC/SEGA.cs index 30e4be53..6478b366 100644 --- a/FriishProduce/_classes/Injectors/WiiVC/SEGA.cs +++ b/FriishProduce/_classes/Injectors/WiiVC/SEGA.cs @@ -109,7 +109,7 @@ private void GetCCF(int CCFApp = 1) (File.Exists(Paths.DataCCF + "Opera.arc") && File.ReadAllBytes(Paths.DataCCF + "Opera.arc").Length == 0))) { if (CCFApp != 1) { CCFApp = 1; goto RunApp; } - else throw new Exception(Language.Get("Error002")); + else throw new Exception(Language.Get("Error.002")); } // Get Misc.ccf @@ -295,7 +295,7 @@ private byte[] RunCCFArc(string dir, int type, bool AlternateMethod = false) // If not data.ccf or already using legacy app, there is no other option // **************** if (type < 2) throw new InvalidOperationException(); - else if (type >= 3 && Failsafe) throw new Exception(Language.Get("Error002")); + else if (type >= 3 && Failsafe) throw new Exception(Language.Get("Error.002")); // Start application // **************** @@ -317,7 +317,7 @@ private byte[] RunCCFArc(string dir, int type, bool AlternateMethod = false) } if (!Failsafe) { Failsafe = true; goto RunApp; } - else throw new Exception(Language.Get("Error002")); + else throw new Exception(Language.Get("Error.002")); } #endregion diff --git a/FriishProduce/_classes/Injectors/WiiVC/SNES.cs b/FriishProduce/_classes/Injectors/WiiVC/SNES.cs index 1fc14f4c..a4c6ad5c 100644 --- a/FriishProduce/_classes/Injectors/WiiVC/SNES.cs +++ b/FriishProduce/_classes/Injectors/WiiVC/SNES.cs @@ -56,7 +56,7 @@ protected override void ReplaceROM() Paths.WorkingFolder, "/cr LZ77orig.rom rom LZ77out.rom" ); - if (!File.Exists(Paths.WorkingFolder + "LZ77out.rom")) throw new Exception(Language.Get("Error002")); + if (!File.Exists(Paths.WorkingFolder + "LZ77out.rom")) throw new Exception(Language.Get("Error.002")); MainContent.ReplaceFile(MainContent.GetNodeIndex(Target), Paths.WorkingFolder + "LZ77out.rom"); diff --git a/FriishProduce/_classes/Language.cs b/FriishProduce/_classes/Language.cs index bf7ccdfa..24379d60 100644 --- a/FriishProduce/_classes/Language.cs +++ b/FriishProduce/_classes/Language.cs @@ -25,8 +25,8 @@ public static CultureInfo Current } } - private static XmlNode EnglishXML { get; set; } - private static XmlNode XML { get; set; } + public static XmlNode EnglishXML { get; private set; } + public static XmlNode XML { get; private set; } private static SortedDictionary _list; @@ -222,9 +222,11 @@ public static string Get(string name, string sectionName = null, bool isForm = f foreach (XmlNode item in section.ChildNodes) if (item.Name == name) { - if (item.InnerText.StartsWith("\r\n")) return item.InnerText.Substring(2, 0).Replace('\t', '\0'); - else if (item.InnerText.StartsWith("\n")) return item.InnerText.Substring(1, 0).Replace('\t', '\0'); - else return item.InnerText.Replace('\t', '\0'); + string returned = item.InnerText.Replace("\t", ""); + + if (item.InnerText.StartsWith("\r\n")) return returned.Substring(2).Trim(); + else if (item.InnerText.StartsWith("\n")) return returned.Substring(1).Trim(); + else return returned.Trim(); } if (!useEnglish) @@ -318,7 +320,6 @@ private static void GetControl(Control x, Form parent, bool customStrings = true } } - if (!string.IsNullOrWhiteSpace(x.Name) && Get(x.Name, parent) != "undefined") x.Text = Get(x.Name, parent); diff --git a/FriishProduce/_classes/LibRetroDB.cs b/FriishProduce/_classes/LibRetroDB.cs index 13cc8a33..b50d189c 100644 --- a/FriishProduce/_classes/LibRetroDB.cs +++ b/FriishProduce/_classes/LibRetroDB.cs @@ -35,7 +35,7 @@ public static void InternetTest() } catch (WebException ex) { - throw new Exception(string.Format(Language.Get("Error000"), ex.Message + (ex.Message[ex.Message.Length - 1] != '.' ? "." : string.Empty))); + throw new Exception(string.Format(Language.Get("Error.000"), ex.Message + (ex.Message[ex.Message.Length - 1] != '.' ? "." : string.Empty))); } } diff --git a/FriishProduce/_classes/MessageBox.cs b/FriishProduce/_classes/MessageBox.cs index 6894241a..c813150a 100644 --- a/FriishProduce/_classes/MessageBox.cs +++ b/FriishProduce/_classes/MessageBox.cs @@ -14,7 +14,7 @@ public static DialogResult Show(string mainText, string description, MessageBoxB { using (TaskDialog t = new TaskDialog() { - WindowTitle = Language.Get("_AppTitle"), + WindowTitle = Language.Get("AppTitle"), MainInstruction = mainText, Content = description, ButtonStyle = isLinkStyle ? TaskDialogButtonStyle.CommandLinks : TaskDialogButtonStyle.Standard, @@ -33,10 +33,10 @@ public static DialogResult Show(string mainText, string description, MessageBoxB t.Content = string.Join("\n", secondary.ToArray()); } - var O = new TaskDialogButton { Text = Language.Get("Button_OK") }; - var C = new TaskDialogButton { Text = Language.Get("Button_Cancel") }; - var Y = new TaskDialogButton { Text = Language.Get("Button_Yes") }; - var N = new TaskDialogButton { Text = Language.Get("Button_No") }; + var O = new TaskDialogButton { Text = Language.Get("B.OK") }; + var C = new TaskDialogButton { Text = Language.Get("B.Cancel") }; + var Y = new TaskDialogButton { Text = Language.Get("B.Yes") }; + var N = new TaskDialogButton { Text = Language.Get("B.No") }; switch (buttons) { @@ -80,9 +80,9 @@ public static DialogResult Show(string mainText, string description, MessageBoxB if (t.IsVerificationChecked && dontShow >= 0) { Properties.Settings.Default[$"DoNotShow_{dontShow:000}"] = true; Properties.Settings.Default.Save(); } - if (text == Language.Get("Button_Cancel")) return DialogResult.Cancel; - if (text == Language.Get("Button_Yes")) return DialogResult.Yes; - if (text == Language.Get("Button_No")) return DialogResult.No; + if (text == Language.Get("B.Cancel")) return DialogResult.Cancel; + if (text == Language.Get("B.Yes")) return DialogResult.Yes; + if (text == Language.Get("B.No")) return DialogResult.No; return DialogResult.OK; } } diff --git a/FriishProduce/_classes/ROM.cs b/FriishProduce/_classes/ROM.cs index 8b78cbfe..060b6ed9 100644 --- a/FriishProduce/_classes/ROM.cs +++ b/FriishProduce/_classes/ROM.cs @@ -83,7 +83,7 @@ public bool CheckSize(int length) if (Bytes.Length > length) { bool isMB = length >= 1048576; - throw new Exception(string.Format(Language.Get("Error003"), + throw new Exception(string.Format(Language.Get("Error.003"), Math.Round((double)length / (isMB ? 1048576 : 1024), 2).ToString(), isMB ? Language.Get("Abbreviation_Megabytes") : Language.Get("Abbreviation_Kilobytes"))); } diff --git a/FriishProduce/_classes/TitleImage.cs b/FriishProduce/_classes/TitleImage.cs index 87d62659..4bc8e47c 100644 --- a/FriishProduce/_classes/TitleImage.cs +++ b/FriishProduce/_classes/TitleImage.cs @@ -530,7 +530,7 @@ public void ReplaceSaveWTE() } catch { - throw new Exception(Language.Get("Error002")); + throw new Exception(Language.Get("Error.002")); } // Cleanup