Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ModAssistant/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<!-- Load theme to be modified via the Theme engine. -->
<ResourceDictionary x:Name="LoadedTheme" Source="Themes/Dark.xaml" />

<!-- Load SVG icons, courtesy of lolPants. -->
<!-- Load SVG icons, courtesy of Lulu. -->
<ResourceDictionary x:Name="Icons" Source="Resources/Icons.xaml" />

<!-- Load Styles needed for the Theme engine to work. -->
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Classes/External Interfaces/Playlists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
71 changes: 46 additions & 25 deletions ModAssistant/Classes/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down Expand Up @@ -321,43 +321,64 @@ public static string GetSteamDir()
return null;
}

public static string GetVersion()
public static async Task<string> 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<List<string>> GetVersionsList()
{
var resp = await HttpClient.GetAsync(Constants.BeatModsVersions);
var body = await resp.Content.ReadAsStringAsync();
List<string> versions = JsonSerializer.Deserialize<string[]>(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<Dictionary<string, string[]>> GetAliasDictionary()
{
var resp = await HttpClient.GetAsync(Constants.BeatModsAlias);
var body = await resp.Content.ReadAsStringAsync();
var aliases = JsonSerializer.Deserialize<Dictionary<string, string[]>>(body);

var strlen = reader.ReadInt32();
var strbytes = reader.ReadBytes(strlen);
return aliases;
}

var version = Encoding.UTF8.GetString(strbytes);
public static async Task<List<string>> 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()
Expand Down
8 changes: 4 additions & 4 deletions ModAssistant/Localisation/cs.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
<Bold>nepodporuje</Bold> nativně mody. To znamená:
</Span>
<Span x:Key="Intro:Terms:Term1">
Módy
<Bold>rozbijí</Bold> každou aktualizaci. To je normální a
<Bold>ne</Bold> chyba Beat Games.
Módy se
<Bold>rozbijí</Bold> s každou aktualizací. To je normální a
<Bold>není</Bold> to chyba Beat Games.
</Span>
<Span x:Key="Intro:Terms:Term2">
Módy
Expand Down Expand Up @@ -121,7 +121,7 @@
stránku pro příspěvky
</Hyperlink>
nebo můj
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/de.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
Spendenseite
</Hyperlink>
oder mein
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
6 changes: 3 additions & 3 deletions ModAssistant/Localisation/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ Do you want to continue?</sys:String>
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://bs.assistant.moe/Donate/">
donation page
</Hyperlink>
or my
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
Patreon
or the
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
BSMG Patreon
</Hyperlink>
</Span>
<sys:String x:Key="About:SpecialThanks">Special Thanks ♥</sys:String>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/es.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
página de donación
</Hyperlink>
o mi
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/fr.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
page de don
</Hyperlink>
ou mon
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/it.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
pagina delle donazioni
</Hyperlink>
oppure il mio
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/ja.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
寄付ページ
</Hyperlink>
または私の
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink> を訪れてください。
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/ko.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
donation page
</Hyperlink>
or my
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/nb.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
donasjonsside
</Hyperlink>
eller min
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/nl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
donatie pagina
</Hyperlink>
of mijn
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/pl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
stronę dotacji
</Hyperlink>
lub mojego
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon'a
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/pt.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
página de doação
</Hyperlink>
ou meu
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/ru.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
страницу для пожертвований
</Hyperlink>
или мой
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/sv.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
donationssida
</Hyperlink>
eller min
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Localisation/th.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
หน้าบริจาคของฉัน
</Hyperlink>
หรือ
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
หน้า Patreon ของฉัน
</Hyperlink>
</Span>
Expand Down
4 changes: 1 addition & 3 deletions ModAssistant/Localisation/zh.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ OneClick源</sys:String>
<LineBreak/>
国际源是BeatMods源站,默认源是BeatSaver/ModelSaber源站,无限额;
<LineBreak/>
国内源是以上国际源/默认源的国内中转,是由WGzeyu提供的<Bold>香港服务器</Bold>,推荐国内用户使用;
<LineBreak/>
包子源为BeatTop管理,服务器使用<Bold>美国机房(多节点)</Bold>,同步国际源并添加了部分第三方插件。
<LineBreak/>
光剑中文社区源为社区管理,是默认源的中转,服务器使用<Bold>美国机房(多节点)</Bold>,无限额。
Expand Down Expand Up @@ -155,7 +153,7 @@ OneClick源</sys:String>
捐助页面
</Hyperlink>
或我的
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/AssistantMoe">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/beatsabermods">
Patreon
</Hyperlink>
</Span>
Expand Down
16 changes: 5 additions & 11 deletions ModAssistant/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> VersionLoadStatus = new TaskCompletionSource<bool>();
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
{
Expand Down Expand Up @@ -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<string> versions = JsonSerializer.Deserialize<string[]>(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<string, string[]> aliases = JsonSerializer.Deserialize<Dictionary<string, string[]>>(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);
Expand Down
6 changes: 3 additions & 3 deletions ModAssistant/ModAssistant.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
Expand Down Expand Up @@ -178,7 +178,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll</HintPath>
<HintPath>..\packages\System.Text.RegularExpressions.4.3.1\lib\net463\System.Text.RegularExpressions.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
Expand Down
4 changes: 2 additions & 2 deletions ModAssistant/Pages/About.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@
VerticalAlignment="Center"
FontSize="20"
FontWeight="Bold">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.jackbaron.com/">
lolPants
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://lulu.dev/">
Lulu
</Hyperlink>
</TextBlock>
<TextBlock
Expand Down
2 changes: 2 additions & 0 deletions ModAssistant/Pages/Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ public async Task CheckInstalledMods()
GetBSIPAVersion();
CheckInstallDir("IPA/Pending/Plugins");
CheckInstallDir("IPA/Pending/Libs");
CheckInstallDir("IPA/Pending/Libs/Native");
CheckInstallDir("Plugins");
CheckInstallDir("Libs");
CheckInstallDir("Libs/Native");
}

public async Task GetAllMods()
Expand Down
4 changes: 2 additions & 2 deletions ModAssistant/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.3207.0")]
[assembly: AssemblyFileVersion("1.1.3207.0")]
[assembly: AssemblyVersion("1.1.3400.0")]
[assembly: AssemblyFileVersion("1.1.3400.0")]
2 changes: 1 addition & 1 deletion ModAssistant/Themes/Dark.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<!-- Mod Assistant Dark Theme by Caeden117 and lolPants -->
<!-- Mod Assistant Dark Theme by Caeden117 and Lulu -->

<!-- Standard Styles -->
<Color x:Key="StandardContent">#E0E0E0</Color>
Expand Down
2 changes: 1 addition & 1 deletion ModAssistant/Themes/Light.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<!-- Mod Assistant Light Theme by Caeden117 and lolPants -->
<!-- Mod Assistant Light Theme by Caeden117 and Lulu -->

<!-- Standard Styles -->
<Color x:Key="StandardContent">#101010</Color>
Expand Down
Loading
Loading