diff --git a/ModAssistant/App.xaml b/ModAssistant/App.xaml index 2b4ab8a6..06d4c88c 100644 --- a/ModAssistant/App.xaml +++ b/ModAssistant/App.xaml @@ -18,7 +18,7 @@ - + diff --git a/ModAssistant/Classes/External Interfaces/Playlists.cs b/ModAssistant/Classes/External Interfaces/Playlists.cs index 14a8e716..99ff6b9f 100644 --- a/ModAssistant/Classes/External Interfaces/Playlists.cs +++ b/ModAssistant/Classes/External Interfaces/Playlists.cs @@ -24,7 +24,7 @@ public static async Task DownloadAll(Uri uri) switch (uri.Host) { case "playlist": - Uri url = new Uri($"{uri.LocalPath.Trim('/')}"); + Uri url = new Uri($"{uri.PathAndQuery.Trim('/')}"); string filename = await Get(url); await DownloadFrom(filename); break; diff --git a/ModAssistant/Classes/Utils.cs b/ModAssistant/Classes/Utils.cs index 27ffafa7..42ba00da 100644 --- a/ModAssistant/Classes/Utils.cs +++ b/ModAssistant/Classes/Utils.cs @@ -32,7 +32,7 @@ public class Constants public const string BeatModsVersions_beatmods = "https://versions.beatmods.com/versions.json"; public const string BeatModsAlias_beatmods = "https://alias.beatmods.com/aliases.json"; public const string WeebCDNAPIURL_beatmods = "https://pat.assistant.moe/api/v1.0/"; - public const string BeatModsTranslation_beatmods = "https://beatmodstranslation.wgzeyu.vip/zh-Hans.json"; + public const string BeatModsTranslation_beatmods = "https://wgzeyu.github.io/BeatSaberModListTranslationRepo/zh-Hans.json"; public const string BeatModsAPIUrl_wgzeyu = "https://beatmods.wgzeyu.com/api/v1/"; public const string TeknikAPIUrl_wgzeyu = "https://beatmods.wgzeyu.com/teknik/v1/"; @@ -321,43 +321,64 @@ public static string GetSteamDir() return null; } - public static string GetVersion() + public static async Task GetVersion() { + string result = string.Empty; + + var versions = await GetAllPossibleVersions(); + string filename = Path.Combine(App.BeatSaberInstallDirectory, "Beat Saber_Data", "globalgamemanagers"); using (var stream = File.OpenRead(filename)) - using (var reader = new BinaryReader(stream, Encoding.UTF8)) + using (var reader = new StreamReader(stream, Encoding.UTF8)) { - const string key = "public.app-category.games"; - int pos = 0; + var line = reader.ReadLine(); - while (stream.Position < stream.Length && pos < key.Length) + while (line != null) { - if (reader.ReadByte() == key[pos]) pos++; - else pos = 0; + foreach (var version in versions) + { + if (line.Contains(version)) + { + result = version; + break; + } + } + if (!string.IsNullOrEmpty(result)) break; + line = reader.ReadLine(); } - if (stream.Position == stream.Length) // we went through the entire stream without finding the key - return null; + ////There is one version ending in "p1" on BeatMods + var filteredVersionMatch = Regex.Match(result, @"[\d]+.[\d]+.[\d]+(p1)?"); + return filteredVersionMatch.Success ? filteredVersionMatch.Value : result; + } + } - while (stream.Position < stream.Length) - { - var current = (char)reader.ReadByte(); - if (char.IsDigit(current)) - break; - } + // TODO: should cache this + public static async Task> GetVersionsList() + { + var resp = await HttpClient.GetAsync(Constants.BeatModsVersions); + var body = await resp.Content.ReadAsStringAsync(); + List versions = JsonSerializer.Deserialize(body).ToList(); + + return versions; + } - var rewind = -sizeof(int) - sizeof(byte); - stream.Seek(rewind, SeekOrigin.Current); // rewind to the string length + // TODO: should cache this + public static async Task> GetAliasDictionary() + { + var resp = await HttpClient.GetAsync(Constants.BeatModsAlias); + var body = await resp.Content.ReadAsStringAsync(); + var aliases = JsonSerializer.Deserialize>(body); - var strlen = reader.ReadInt32(); - var strbytes = reader.ReadBytes(strlen); + return aliases; + } - var version = Encoding.UTF8.GetString(strbytes); + public static async Task> GetAllPossibleVersions() + { + var versions = await GetVersionsList(); + var aliases = await GetAliasDictionary(); - //There is one version ending in "p1" on BeatMods - var filteredVersionMatch = Regex.Match(version, @"[\d]+.[\d]+.[\d]+(p1)?"); - return filteredVersionMatch.Success ? filteredVersionMatch.Value : version; - } + return versions.Concat(aliases.SelectMany(x => x.Value)).ToList(); } public static string GetOculusDir() diff --git a/ModAssistant/Localisation/cs.xaml b/ModAssistant/Localisation/cs.xaml index 37836a83..ec3de5ba 100644 --- a/ModAssistant/Localisation/cs.xaml +++ b/ModAssistant/Localisation/cs.xaml @@ -43,9 +43,9 @@ nepodporuje nativně mody. To znamená: - Módy - rozbijí každou aktualizaci. To je normální a - ne chyba Beat Games. + Módy se + rozbijí s každou aktualizací. To je normální a + není to chyba Beat Games. Módy @@ -121,7 +121,7 @@ stránku pro příspěvky nebo můj - + Patreon diff --git a/ModAssistant/Localisation/de.xaml b/ModAssistant/Localisation/de.xaml index 96401ac2..5939768d 100644 --- a/ModAssistant/Localisation/de.xaml +++ b/ModAssistant/Localisation/de.xaml @@ -122,7 +122,7 @@ Spendenseite oder mein - + Patreon diff --git a/ModAssistant/Localisation/en.xaml b/ModAssistant/Localisation/en.xaml index c897bed8..cab2d981 100644 --- a/ModAssistant/Localisation/en.xaml +++ b/ModAssistant/Localisation/en.xaml @@ -136,9 +136,9 @@ Do you want to continue? donation page - or my - - Patreon + or the + + BSMG Patreon Special Thanks ♥ diff --git a/ModAssistant/Localisation/es.xaml b/ModAssistant/Localisation/es.xaml index 89fd688b..5f8f124e 100644 --- a/ModAssistant/Localisation/es.xaml +++ b/ModAssistant/Localisation/es.xaml @@ -120,7 +120,7 @@ página de donación o mi - + Patreon diff --git a/ModAssistant/Localisation/fr.xaml b/ModAssistant/Localisation/fr.xaml index 88e30655..c933921e 100644 --- a/ModAssistant/Localisation/fr.xaml +++ b/ModAssistant/Localisation/fr.xaml @@ -127,7 +127,7 @@ page de don ou mon - + Patreon diff --git a/ModAssistant/Localisation/it.xaml b/ModAssistant/Localisation/it.xaml index ff900258..5859f992 100644 --- a/ModAssistant/Localisation/it.xaml +++ b/ModAssistant/Localisation/it.xaml @@ -122,7 +122,7 @@ pagina delle donazioni oppure il mio - + Patreon diff --git a/ModAssistant/Localisation/ja.xaml b/ModAssistant/Localisation/ja.xaml index 5a924982..1c0aec64 100644 --- a/ModAssistant/Localisation/ja.xaml +++ b/ModAssistant/Localisation/ja.xaml @@ -120,7 +120,7 @@ 寄付ページ または私の - + Patreon を訪れてください。 diff --git a/ModAssistant/Localisation/ko.xaml b/ModAssistant/Localisation/ko.xaml index e8905d19..7f5c0854 100644 --- a/ModAssistant/Localisation/ko.xaml +++ b/ModAssistant/Localisation/ko.xaml @@ -121,7 +121,7 @@ donation page or my - + Patreon diff --git a/ModAssistant/Localisation/nb.xaml b/ModAssistant/Localisation/nb.xaml index 3bc6f428..eb4f2a73 100644 --- a/ModAssistant/Localisation/nb.xaml +++ b/ModAssistant/Localisation/nb.xaml @@ -124,7 +124,7 @@ donasjonsside eller min - + Patreon diff --git a/ModAssistant/Localisation/nl.xaml b/ModAssistant/Localisation/nl.xaml index 4845ca1a..f46932c8 100644 --- a/ModAssistant/Localisation/nl.xaml +++ b/ModAssistant/Localisation/nl.xaml @@ -120,7 +120,7 @@ donatie pagina of mijn - + Patreon diff --git a/ModAssistant/Localisation/pl.xaml b/ModAssistant/Localisation/pl.xaml index f7e6adc6..b5b45e9e 100644 --- a/ModAssistant/Localisation/pl.xaml +++ b/ModAssistant/Localisation/pl.xaml @@ -121,7 +121,7 @@ stronę dotacji lub mojego - + Patreon'a diff --git a/ModAssistant/Localisation/pt.xaml b/ModAssistant/Localisation/pt.xaml index 79044131..675dc2db 100644 --- a/ModAssistant/Localisation/pt.xaml +++ b/ModAssistant/Localisation/pt.xaml @@ -121,7 +121,7 @@ página de doação ou meu - + Patreon diff --git a/ModAssistant/Localisation/ru.xaml b/ModAssistant/Localisation/ru.xaml index bb734946..94d00e0a 100644 --- a/ModAssistant/Localisation/ru.xaml +++ b/ModAssistant/Localisation/ru.xaml @@ -122,7 +122,7 @@ страницу для пожертвований или мой - + Patreon diff --git a/ModAssistant/Localisation/sv.xaml b/ModAssistant/Localisation/sv.xaml index 158d5623..544f4367 100644 --- a/ModAssistant/Localisation/sv.xaml +++ b/ModAssistant/Localisation/sv.xaml @@ -122,7 +122,7 @@ donationssida eller min - + Patreon diff --git a/ModAssistant/Localisation/th.xaml b/ModAssistant/Localisation/th.xaml index 5a001a06..9f691703 100644 --- a/ModAssistant/Localisation/th.xaml +++ b/ModAssistant/Localisation/th.xaml @@ -121,7 +121,7 @@ หน้าบริจาคของฉัน หรือ - + หน้า Patreon ของฉัน diff --git a/ModAssistant/Localisation/zh.xaml b/ModAssistant/Localisation/zh.xaml index ad208924..66e0b983 100644 --- a/ModAssistant/Localisation/zh.xaml +++ b/ModAssistant/Localisation/zh.xaml @@ -99,8 +99,6 @@ OneClick源 国际源是BeatMods源站,默认源是BeatSaver/ModelSaber源站,无限额; - 国内源是以上国际源/默认源的国内中转,是由WGzeyu提供的香港服务器,推荐国内用户使用; - 包子源为BeatTop管理,服务器使用美国机房(多节点),同步国际源并添加了部分第三方插件。 光剑中文社区源为社区管理,是默认源的中转,服务器使用美国机房(多节点),无限额。 @@ -155,7 +153,7 @@ OneClick源 捐助页面 或我的 - + Patreon diff --git a/ModAssistant/MainWindow.xaml.cs b/ModAssistant/MainWindow.xaml.cs index 564f0668..7d527f4f 100644 --- a/ModAssistant/MainWindow.xaml.cs +++ b/ModAssistant/MainWindow.xaml.cs @@ -23,8 +23,8 @@ public partial class MainWindow : Window public static string GameVersionDetected; // the real game version detected from the game public static string GameVersionOverride; public TaskCompletionSource VersionLoadStatus = new TaskCompletionSource(); - public static string[] serverList = { "国际源@BeatMods", "国内源@WGzeyu", "包子源@BeatTop" }; - public static string[] assetsServerList = { "默认@default", "国内源@WGzeyu", "光剑中文社区源@BeatSaberChina" }; + public static string[] serverList = { "国际源@BeatMods", "包子源@BeatTop" }; + public static string[] assetsServerList = { "默认@default", "光剑中文社区源@BeatSaberChina" }; public string MainText { @@ -121,16 +121,10 @@ private async void LoadVersionsAsync() try { Utils.Constants.UpdateDownloadNode(); - var resp = await HttpClient.GetAsync(Utils.Constants.BeatModsVersions); - var body = await resp.Content.ReadAsStringAsync(); - List versions = JsonSerializer.Deserialize(body).ToList(); + var versions = await Utils.GetVersionsList(); + var aliases = await Utils.GetAliasDictionary(); - resp = await HttpClient.GetAsync(Utils.Constants.BeatModsAlias); - body = await resp.Content.ReadAsStringAsync(); - Dictionary aliases = JsonSerializer.Deserialize>(body); - - string version = Utils.GetVersion(); - GameVersionDetected = version; + string version = await Utils.GetVersion(); if (!versions.Contains(version) && CheckAliases(versions, aliases, version) == string.Empty) { versions.Insert(0, version); diff --git a/ModAssistant/ModAssistant.csproj b/ModAssistant/ModAssistant.csproj index ceebc761..960f4737 100644 --- a/ModAssistant/ModAssistant.csproj +++ b/ModAssistant/ModAssistant.csproj @@ -118,8 +118,8 @@ True - - ..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll + + ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll True True @@ -178,7 +178,7 @@ True - ..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll + ..\packages\System.Text.RegularExpressions.4.3.1\lib\net463\System.Text.RegularExpressions.dll True True diff --git a/ModAssistant/Pages/About.xaml b/ModAssistant/Pages/About.xaml index 0d0361bc..4fbed1f8 100644 --- a/ModAssistant/Pages/About.xaml +++ b/ModAssistant/Pages/About.xaml @@ -128,8 +128,8 @@ VerticalAlignment="Center" FontSize="20" FontWeight="Bold"> - - lolPants + + Lulu - + #E0E0E0 diff --git a/ModAssistant/Themes/Light.xaml b/ModAssistant/Themes/Light.xaml index e7aed690..ee4bf525 100644 --- a/ModAssistant/Themes/Light.xaml +++ b/ModAssistant/Themes/Light.xaml @@ -1,6 +1,6 @@ - + #101010 diff --git a/ModAssistant/packages.config b/ModAssistant/packages.config index 7588c830..c62036c2 100644 --- a/ModAssistant/packages.config +++ b/ModAssistant/packages.config @@ -23,7 +23,7 @@ - + @@ -44,7 +44,7 @@ - + diff --git a/README.md b/README.md index 45d968bf..2b467920 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Mod Assistant](https://cdn.assistant.moe/images/ModAssistant/Icons/Banner.svg?v=5)](https://github.com/Assistant/ModAssistant/releases/latest) -[![点此下载! Download here!](https://cdn.assistant.moe/images/ModAssistant/Icons/Download.svg)](https://github.com/beatmods-top/ModAssistant/releases/) +[![Mod Assistant](https://github.com/bsmg/ModAssistant/assets/27714637/e4c206b2-a890-4c52-aacf-5c96aebadbc2)](https://github.com/Assistant/ModAssistant/releases/latest) +[![点我下载!Download here!](https://github.com/bsmg/ModAssistant/assets/27714637/aa836eb6-abaf-4d29-8add-eb021fa30bf3)](https://github.com/Assistant/ModAssistant/releases/latest) Mod Assistant 是节奏光剑(Beat Saber)PC版mod安装器。它使用来自[BeatMods](https://beatmods.com/)和[BeatMods.top](https://beatmods.top) (第三方源,镜像BeatMods.com并包含第三方上传插件) @@ -192,50 +192,50 @@ Download the newest installer from the release section and run it. This applicat
Light
-

-

-

-

+

Intro

+

Mods

+

About

+

Options

Dark
-

-

-

-

+

Intro

+

Mods

+

About

+

Options

BSMG
-

-

-

-

+

Intro

+

Mods

+

About

+

Options

Light Pink
-

-

-

-

+

Intro

+

Mods

+

About

+

Options

Your own!
-

-

-

-

+

Intro

+

Mods

+

About

+

Options

@@ -245,7 +245,7 @@ Custom themes are located in a folder called `Themes` in the same folder as `Mod ### Built In These come with the program and you can't change them, however you can overwrite them by creating one of the other two theme types with the same name. -If you have a particularly popular theme, you can submit a [Pull Request](https://github.com/Assistant/ModAssistant/pulls) to add your theme as a built-in theme. +If you have a particularly popular theme, you can submit a [Pull Request](https://github.com/bsmg/ModAssistant/pulls) to add your theme as a built-in theme. ### Packaged `.mat` Files These are pre-packaged theme files. Under the hood they are renamed`.zip` files, and the file structure is the same as that of `Folders` themes. These will be overwritten by `Folders` themes with the same name.