From 8b8e8f474ea753c2036bcb05e3d27b74a6187c7b Mon Sep 17 00:00:00 2001 From: Jackson <9527380+Jaksuhn@users.noreply.github.com> Date: Wed, 24 Jan 2024 19:03:33 +0000 Subject: [PATCH] add branch var for links --- .../Configuration/OtherConfiguration.cs | 2 +- RotationSolver.Basic/Service.cs | 2 +- RotationSolver/Helpers/DownloadHelper.cs | 13 +++---------- RotationSolver/Localization/LocalizationManager.cs | 2 +- RotationSolver/UI/RotationConfigWindow.cs | 2 +- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/RotationSolver.Basic/Configuration/OtherConfiguration.cs b/RotationSolver.Basic/Configuration/OtherConfiguration.cs index dac050568..1405c6306 100644 --- a/RotationSolver.Basic/Configuration/OtherConfiguration.cs +++ b/RotationSolver.Basic/Configuration/OtherConfiguration.cs @@ -238,7 +238,7 @@ private static void InitOne(ref T value, string name, bool download = true) try { using var client = new HttpClient(); - var str = client.GetStringAsync($"https://raw.githubusercontent.com/{Service.USERNAME}/{Service.REPO}/main/Resources/{name}.json").Result; + var str = client.GetStringAsync($"https://raw.githubusercontent.com/{Service.USERNAME}/{Service.REPO}/{Service.BRANCH}/Resources/{name}.json").Result; File.WriteAllText(path, str); value = JsonConvert.DeserializeObject(str, new JsonSerializerSettings() diff --git a/RotationSolver.Basic/Service.cs b/RotationSolver.Basic/Service.cs index 212477a66..93ddef163 100644 --- a/RotationSolver.Basic/Service.cs +++ b/RotationSolver.Basic/Service.cs @@ -9,7 +9,7 @@ namespace RotationSolver.Basic; internal class Service : IDisposable { - public const string COMMAND = "/rotation", USERNAME = "Jaksuhn", REPO = "RotationSolver"; + public const string COMMAND = "/rotation", USERNAME = "Jaksuhn", REPO = "RotationSolver", BRANCH = "testing"; // From https://GitHub.com/PunishXIV/Orbwalker/blame/master/Orbwalker/Memory.cs#L85-L87 [Signature("F3 0F 10 05 ?? ?? ?? ?? 0F 2E C6 0F 8A", ScanType = ScanType.StaticAddress, Fallibility = Fallibility.Infallible)] diff --git a/RotationSolver/Helpers/DownloadHelper.cs b/RotationSolver/Helpers/DownloadHelper.cs index ac3e81403..36b3cd509 100644 --- a/RotationSolver/Helpers/DownloadHelper.cs +++ b/RotationSolver/Helpers/DownloadHelper.cs @@ -6,21 +6,14 @@ namespace RotationSolver.Helpers; public static class DownloadHelper { public static string[] LinkLibraries { get; private set; } = Array.Empty(); - public static string[] ContributorsHash { get; private set; } = Array.Empty(); - public static string[] UsersHash { get; private set; } = Array.Empty(); public static string[] Supporters { get; private set; } = Array.Empty(); public static IncompatiblePlugin[] IncompatiblePlugins { get; private set; } = Array.Empty(); public static async Task DownloadAsync() { - LinkLibraries = await DownloadOneAsync($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver//main/Resources/downloadList.json") ?? Array.Empty(); - IncompatiblePlugins = await DownloadOneAsync($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/main/Resources/IncompatiblePlugins.json") ?? Array.Empty(); - - ContributorsHash = await DownloadOneAsync($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver//main/Resources/ContributorsHash.json") ?? Array.Empty(); - - UsersHash = await DownloadOneAsync($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/main/Resources/UsersHash.json") ?? Array.Empty(); - - Supporters = await DownloadOneAsync($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/main/Resources/Supporters.json") ?? Array.Empty(); + LinkLibraries = await DownloadOneAsync($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver//{Service.BRANCH}/Resources/downloadList.json") ?? Array.Empty(); + IncompatiblePlugins = await DownloadOneAsync($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/{Service.BRANCH}/Resources/IncompatiblePlugins.json") ?? Array.Empty(); + Supporters = await DownloadOneAsync($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/{Service.BRANCH}/Resources/Supporters.json") ?? Array.Empty(); } private static async Task DownloadOneAsync(string url) diff --git a/RotationSolver/Localization/LocalizationManager.cs b/RotationSolver/Localization/LocalizationManager.cs index f4db3b7fc..e6c4115fa 100644 --- a/RotationSolver/Localization/LocalizationManager.cs +++ b/RotationSolver/Localization/LocalizationManager.cs @@ -26,7 +26,7 @@ private async void SetLanguage(string lang) { try { - var url = $"https://raw.githubusercontent.com/{Service.USERNAME}/{Service.REPO}/main/RotationSolver/Localization/{lang}.json"; + var url = $"https://raw.githubusercontent.com/{Service.USERNAME}/{Service.REPO}/{Service.BRANCH}/RotationSolver/Localization/{lang}.json"; using var client = new HttpClient(); RightLang = _translations[lang] = JsonConvert.DeserializeObject(await client.GetStringAsync(url)); } diff --git a/RotationSolver/UI/RotationConfigWindow.cs b/RotationSolver/UI/RotationConfigWindow.cs index 38293e58d..aa5806ccd 100644 --- a/RotationSolver/UI/RotationConfigWindow.cs +++ b/RotationSolver/UI/RotationConfigWindow.cs @@ -296,7 +296,7 @@ private static bool GetLocalImage(string name, out IDalamudTextureWrap texture) { if (!File.Exists(file)) { - var url = $"https://raw.githubusercontent.com/{Service.USERNAME}/{Service.REPO}/main/Images/{name}.png"; + var url = $"https://raw.githubusercontent.com/{Service.USERNAME}/{Service.REPO}/{Service.BRANCH}/Images/{name}.png"; using var client = new HttpClient(); var stream = await client.GetStreamAsync(url);