Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
add branch var for links
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Jan 24, 2024
1 parent 2124aed commit 8b8e8f4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Configuration/OtherConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private static void InitOne<T>(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<T>(str, new JsonSerializerSettings()
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
13 changes: 3 additions & 10 deletions RotationSolver/Helpers/DownloadHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@ namespace RotationSolver.Helpers;
public static class DownloadHelper
{
public static string[] LinkLibraries { get; private set; } = Array.Empty<string>();
public static string[] ContributorsHash { get; private set; } = Array.Empty<string>();
public static string[] UsersHash { get; private set; } = Array.Empty<string>();
public static string[] Supporters { get; private set; } = Array.Empty<string>();
public static IncompatiblePlugin[] IncompatiblePlugins { get; private set; } = Array.Empty<IncompatiblePlugin>();

public static async Task DownloadAsync()
{
LinkLibraries = await DownloadOneAsync<string[]>($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver//main/Resources/downloadList.json") ?? Array.Empty<string>();
IncompatiblePlugins = await DownloadOneAsync<IncompatiblePlugin[]>($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/main/Resources/IncompatiblePlugins.json") ?? Array.Empty<IncompatiblePlugin>();

ContributorsHash = await DownloadOneAsync<string[]>($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver//main/Resources/ContributorsHash.json") ?? Array.Empty<string>();

UsersHash = await DownloadOneAsync<string[]>($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/main/Resources/UsersHash.json") ?? Array.Empty<string>();

Supporters = await DownloadOneAsync<string[]>($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/main/Resources/Supporters.json") ?? Array.Empty<string>();
LinkLibraries = await DownloadOneAsync<string[]>($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver//{Service.BRANCH}/Resources/downloadList.json") ?? Array.Empty<string>();
IncompatiblePlugins = await DownloadOneAsync<IncompatiblePlugin[]>($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/{Service.BRANCH}/Resources/IncompatiblePlugins.json") ?? Array.Empty<IncompatiblePlugin>();
Supporters = await DownloadOneAsync<string[]>($"https://raw.githubusercontent.com/Jaksuhn/RotationSolver/{Service.BRANCH}/Resources/Supporters.json") ?? Array.Empty<string>();
}

private static async Task<T> DownloadOneAsync<T>(string url)
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Localization/LocalizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Strings>(await client.GetStringAsync(url));
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8b8e8f4

Please sign in to comment.