From 0959d5287d3d2209e12ad49ce2b46694584cd97c Mon Sep 17 00:00:00 2001 From: Akbar Yahya <11765082+akbaryahya@users.noreply.github.com> Date: Thu, 29 Sep 2022 06:57:22 +0800 Subject: [PATCH] Support latest release Akebi again. --- Download.cs | 8 ++++---- Main.cs | 2 +- Yuuki/API.cs | 34 +++++++++++++++++++++++----------- YuukiPS Launcher.csproj | 4 ++-- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Download.cs b/Download.cs index 0c94a84..2c842ca 100644 --- a/Download.cs +++ b/Download.cs @@ -6,11 +6,11 @@ namespace YuukiPS_Launcher { public partial class Download : Form { - private string set_download; - private string set_folder; + private string set_download = ""; + private string set_folder = ""; private DownloadService dl; - public Download(string url_download, string folder_download) + public Download(string url_download = "", string folder_download = "") { set_download = url_download; set_folder = folder_download; @@ -114,7 +114,7 @@ private void Dl_DownloadProgressChanged(object? sender, DownloadProgressChangedE private void Dl_DownloadStarted(object? sender, DownloadStartedEventArgs e) { - Console.WriteLine("Start Download: " + e.FileName); + Console.WriteLine("Start Download: " + set_download); } private void btCancel_Click(object sender, EventArgs e) diff --git a/Main.cs b/Main.cs index 60f590b..c875afe 100644 --- a/Main.cs +++ b/Main.cs @@ -1193,7 +1193,7 @@ private void btStart_Click(object sender, EventArgs e) var Update_AkebiGC = false; - var cekAkebi = API.GetAkebi(GameChannel); + var cekAkebi = API.GetAkebi(GameChannel, VersionGame); if (string.IsNullOrEmpty(cekAkebi)) { MessageBox.Show("Can't check latest Akebi"); diff --git a/Yuuki/API.cs b/Yuuki/API.cs index ae7dadd..67cecba 100644 --- a/Yuuki/API.cs +++ b/Yuuki/API.cs @@ -12,7 +12,7 @@ public class API public static string API_DL_OW = "https://drive.yuuki.me/"; public static string API_DL_WB = "https://ps.yuuki.me/api/"; public static string API_GITHUB_YuukiPS = "https://api.github.com/repos/akbaryahya/YuukiPS-Launcher/"; - public static string API_GITHUB_Akebi = "https://api.github.com/repos/Akebi-Group/Akebi-GC/"; + public static string API_GITHUB_Akebi = "https://api.github.com/repos/Taiga74164/Akebi-GC/"; public static GS GS_DL(string dl = "os") { @@ -180,34 +180,46 @@ public static GS GS_DL(string dl = "os") return null; } - public static string? GetAkebi(int ch = 1) + public static string? GetAkebi(int ch = 1, string ver_set = "3.1") { var client = new RestClient(API_GITHUB_Akebi); - var request = new RestRequest("actions/artifacts"); + var request = new RestRequest("releases"); var response = client.Execute(request); - var whos = "master"; + var whos = "global"; if (ch == 2) { - whos = "chinese"; + whos = "china"; } + ver_set = ver_set.Replace(".0", ""); + if (response.StatusCode == HttpStatusCode.OK) { if (response.Content != null) { try { - var tes = JsonConvert.DeserializeObject(response.Content); - if (tes != null) + var GetData = JsonConvert.DeserializeObject>(response.Content); + if (GetData != null) { - foreach (var file in tes.artifacts) + // Get List Releases + foreach (var GetVersion in GetData) { - if (file.workflow_run != null) + if (GetVersion.name.Contains(ver_set)) { - if (file.workflow_run.head_branch == whos) + var version = GetVersion.tag_name + "_" + whos + "_" + ver_set; + var aseet = GetVersion.assets; + if (aseet != null) { - return file.workflow_run.head_sha + "|https://nightly.link/Akebi-Group/Akebi-GC/actions/runs/" + file.workflow_run.id + "/" + file.name + ".zip"; + // Get List Asset + foreach (var file in aseet) + { + if (file.name.Contains(whos)) + { + return version + "|" + file.browser_download_url; + } + } } } } diff --git a/YuukiPS Launcher.csproj b/YuukiPS Launcher.csproj index c2d0b44..39dc22f 100644 --- a/YuukiPS Launcher.csproj +++ b/YuukiPS Launcher.csproj @@ -12,8 +12,8 @@ Properties\app.manifest - 2022.9.27.0535 - 2022.9.27.0535 + 2022.9.28.2255 + 2022.9.28.2255 true YuukiPS