aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common/Utilities/EmbeddedResources.cs
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2023-01-11 01:29:22 +0100
committerGitHub <noreply@github.com>2023-01-11 01:29:22 +0100
commit2355c2af62282ff36e56106495c09ed5cfcc3672 (patch)
tree34247874f3676ab6567c198e1a427a9bb3ed72d8 /Ryujinx.Common/Utilities/EmbeddedResources.cs
parent5e0f8e873857ce3ca3f532aff0936beb28e412c8 (diff)
ava: Generate Locale menu automatically (#4243)1.1.537
Currently in `MenuMainBarView.axaml` we list all available languages and hardcode the language name with the language key. It's a bit bad beause if we want to add a new language, we have to edit the `csproj` and the `axaml` with the translated language name and the language code. I've put all translations in their respective locale files, add code into `MainMenuBarView` constructor to generate the menu automatically. Now we just have to edit the `csproj` if we want to add a new language.
Diffstat (limited to 'Ryujinx.Common/Utilities/EmbeddedResources.cs')
-rw-r--r--Ryujinx.Common/Utilities/EmbeddedResources.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Ryujinx.Common/Utilities/EmbeddedResources.cs b/Ryujinx.Common/Utilities/EmbeddedResources.cs
index 286d2c5c..e7c8d7d7 100644
--- a/Ryujinx.Common/Utilities/EmbeddedResources.cs
+++ b/Ryujinx.Common/Utilities/EmbeddedResources.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
@@ -127,6 +128,13 @@ namespace Ryujinx.Common
return stream;
}
+ public static string[] GetAllAvailableResources(string path, string ext = "")
+ {
+ return ResolveManifestPath(path).Item1.GetManifestResourceNames()
+ .Where(r => r.EndsWith(ext))
+ .ToArray();
+ }
+
private static (Assembly, string) ResolveManifestPath(string filename)
{
var segments = filename.Split('/', 2, StringSplitOptions.RemoveEmptyEntries);