diff --git a/Application/OasisBot/OasisBot.csproj b/Application/OasisBot/OasisBot.csproj
index 7ffd4512..2e329f71 100644
--- a/Application/OasisBot/OasisBot.csproj
+++ b/Application/OasisBot/OasisBot.csproj
@@ -46,4 +46,21 @@
+
+
+ ..\..\Build\Data\navigation_linkage.json.gz
+ ..\..\Build\Data\navigation_linkage.json
+
+
+
+
diff --git a/Botbases/RSBot.Training/Bot/NavigationManager.cs b/Botbases/RSBot.Training/Bot/NavigationManager.cs
index bf6e4739..ba5ac777 100644
--- a/Botbases/RSBot.Training/Bot/NavigationManager.cs
+++ b/Botbases/RSBot.Training/Bot/NavigationManager.cs
@@ -14,7 +14,7 @@ namespace RSBot.Training.Bot;
internal static class NavigationManager
{
private const string LinkageUrl =
- "https://raw.githubusercontent.com/Silkroad-Developer-Community/Silkroad-NavLink/main/navigation_linkage.json";
+ "https://github.com/Silkroad-Developer-Community/Silkroad-NavLink/releases/latest/download/navigation_linkage.json.gz";
private static readonly string LinkagePath = Path.Combine(Kernel.BasePath, "Data", "navigation_linkage.json");
private static readonly object _linkageLock = new();
private static NavigationLinkage _linkage;
@@ -44,7 +44,7 @@ public static bool LoadLinkageData()
{
if (!File.Exists(LinkagePath))
{
- Log.Warn($"Navigation linkage file not found at {LinkagePath}");
+ Log.Warn($"navigation linkage file not found at {LinkagePath}");
return false;
}
@@ -117,7 +117,16 @@ public static async Task FetchRemoteLinkageData()
{
Log.Notify("Fetching navigation linkage data from GitHub...");
using var client = new HttpClient();
- var json = await client.GetStringAsync(LinkageUrl);
+ using var response = await client.GetAsync(LinkageUrl);
+ response.EnsureSuccessStatusCode();
+
+ using var responseStream = await response.Content.ReadAsStreamAsync();
+ using var decompressedStream = new System.IO.Compression.GZipStream(
+ responseStream,
+ System.IO.Compression.CompressionMode.Decompress
+ );
+ using var reader = new StreamReader(decompressedStream);
+ var json = await reader.ReadToEndAsync();
if (string.IsNullOrWhiteSpace(json))
{
diff --git a/scripts/build.ps1 b/scripts/build.ps1
index c5d3dcac..637fdc7f 100644
--- a/scripts/build.ps1
+++ b/scripts/build.ps1
@@ -37,28 +37,6 @@ if ($Clean) {
}
if ($buildExitCode -eq 0) {
- # TODO: move linkage logic to msbuild for vs devs
- Write-Output "Fetching navigation linkage data..."
- $linkageUrl = "https://raw.githubusercontent.com/Silkroad-Developer-Community/Silkroad-NavLink/main/navigation_linkage.json"
- $linkagePath = ".\Build\Data\navigation_linkage.json"
- if (-not (Test-Path ".\Build\Data")) {
- New-Item -ItemType Directory ".\Build\Data" -Force | Out-Null
- }
- $linkageTempPath = "$linkagePath.tmp"
- try {
- Invoke-WebRequest -Uri $linkageUrl -OutFile $linkageTempPath -UseBasicParsing -ErrorAction Stop
- $jsonContent = Get-Content -Path $linkageTempPath -Raw
- $null = $jsonContent | ConvertFrom-Json -ErrorAction Stop
- Move-Item -Path $linkageTempPath -Destination $linkagePath -Force
- Write-Output "Successfully updated navigation linkage data."
- }
- catch {
- Write-Warning "Failed to update navigation linkage data: $($_.Exception.Message). Keeping existing file if it exists."
- if (Test-Path $linkageTempPath) {
- Remove-Item $linkageTempPath -Force
- }
- }
-
if (!$DoNotStart) {
Write-Output "Starting OasisBot..."
& ".\Build\OasisBot.exe"