From 28283d85e8be5387668d8ce9c33d69db12ddd826 Mon Sep 17 00:00:00 2001 From: Akbar Yahya Date: Fri, 9 Dec 2022 23:43:48 +0800 Subject: [PATCH] * Update support 3.3 * Update link github * Update API Download Akebi * Remove command tab (only focused web version) --- Json/Mod/Akebi.cs | 4 +- Main.Designer.cs | 13 ---- Main.cs | 158 +++++++++++++++++++++++++++++++++++++--- README.md | 4 +- Yuuki/API.cs | 8 +- Yuuki/Server.cs | 2 +- YuukiPS Launcher.csproj | 4 +- 7 files changed, 158 insertions(+), 35 deletions(-) diff --git a/Json/Mod/Akebi.cs b/Json/Mod/Akebi.cs index 54599b6..509dfcc 100644 --- a/Json/Mod/Akebi.cs +++ b/Json/Mod/Akebi.cs @@ -9,13 +9,13 @@ namespace YuukiPS_Launcher.Json.Mod public class Cn { public string? url { get; set; } - public string? md6 { get; set; } + public string? md5 { get; set; } } public class Os { public string? url { get; set; } - public string? md6 { get; set; } + public string? md5 { get; set; } } public class Akebi diff --git a/Main.Designer.cs b/Main.Designer.cs index 2f2d55a..73cb742 100644 --- a/Main.Designer.cs +++ b/Main.Designer.cs @@ -81,7 +81,6 @@ private void InitializeComponent() this.label15 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label14 = new System.Windows.Forms.Label(); - this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage(); this.TabConfig = new System.Windows.Forms.TabControl(); this.tabPage5 = new System.Windows.Forms.TabPage(); @@ -225,7 +224,6 @@ private void InitializeComponent() // this.TabMain.Controls.Add(this.tabPage1); this.TabMain.Controls.Add(this.tabPage2); - this.TabMain.Controls.Add(this.tabPage3); this.TabMain.Controls.Add(this.tabPage4); this.TabMain.Controls.Add(this.tabPage8); this.TabMain.Dock = System.Windows.Forms.DockStyle.Top; @@ -645,16 +643,6 @@ private void InitializeComponent() this.label14.TabIndex = 0; this.label14.Text = "Grasscutter Folder:"; // - // tabPage3 - // - this.tabPage3.Location = new System.Drawing.Point(4, 24); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding(3); - this.tabPage3.Size = new System.Drawing.Size(652, 281); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "Command"; - this.tabPage3.UseVisualStyleBackColor = true; - // // tabPage4 // this.tabPage4.Controls.Add(this.TabConfig); @@ -1289,7 +1277,6 @@ private void InitializeComponent() private ColumnHeader ServerList_GetHost; private ColumnHeader ServerList_GetOnline; private ColumnHeader ServerList_GetVersion; - private TabPage tabPage3; private TabPage tabPage4; public ListView ServerList; private Button btReloadServer; diff --git a/Main.cs b/Main.cs index 0047449..46d7b3d 100644 --- a/Main.cs +++ b/Main.cs @@ -308,6 +308,11 @@ public bool CheckVersionGame() md5_ori = get_version.original.md5_check.os.userassembly; } } + else if (get_metode == "RSA") + { + GameMetode = 3; + md5_ori = "No need to check"; + } Get_LA_MD5.Text = "MD5: " + md5_ori; @@ -364,6 +369,7 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1, string MD5_UA_API_Patched; string MD5_Metadata_API_Original; string MD5_Metadata_API_Patched; + string MD5_API_Patched; var DL_Patch = get_version.patched.resources + "Patch/"; var DL_Original = get_version.original.resources; @@ -389,6 +395,8 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1, Original_file_MA = DL_Original + "GenshinImpact_Data/Managed/Metadata/global-metadata.dat"; Original_file_UA = DL_Original + "GenshinImpact_Data/Native/UserAssembly.dll"; + MD5_API_Patched = get_version.patched.md5_vaild.os.ToUpper(); + } else if (use_channel == "CN") { @@ -403,6 +411,8 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1, Original_file_MA = DL_Original + "YuanShen_Data/Managed/Metadata/global-metadata.dat"; Original_file_UA = DL_Original + "YuanShen_Data/Native/UserAssembly.dll"; + + MD5_API_Patched = get_version.patched.md5_vaild.cn.ToUpper(); } else { @@ -411,27 +421,35 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1, // >> Make sure MD5 API is not empty << + // skip check patch + if (metode != 3) + { + if (String.IsNullOrEmpty(MD5_UA_API_Patched)) + { + return "Game version is not supported (3)"; + } + if (String.IsNullOrEmpty(MD5_Metadata_API_Patched)) + { + return "Game version is not supported (1)"; + } + } + if (String.IsNullOrEmpty(MD5_UA_API_Original)) { return "Game version is not supported (4)"; } - if (String.IsNullOrEmpty(MD5_UA_API_Patched)) - { - return "Game version is not supported (3)"; - } if (String.IsNullOrEmpty(MD5_Metadata_API_Original)) { return "Game version is not supported (2)"; } - if (String.IsNullOrEmpty(MD5_Metadata_API_Patched)) - { - return "Game version is not supported (1)"; - } + // >> All << // Check Folder UA var cst_folder_UA = Set_UA_Folder.Text; + var cst_folder_Game = Set_LA_GameFolder.Text; + if (String.IsNullOrEmpty(cst_folder_UA)) { return "No UserAssembly folder found (1)"; @@ -1176,12 +1194,128 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1, */ return "I'm tired Checking Metadata"; + } else if(metode == 3) { + + var fileRSA = cst_folder_Game + "/version.dll"; + var fileRSA_BK = cst_folder_Game + "/version.bk"; + + var fileRSA_Public = cst_folder_Game + "/PublicKey.txt"; + + // TODO: ADD KEY SERVER + File.WriteAllText(fileRSA_Public, "xbbx2m1feHyrQ7jP+8mtDF/pyYLrJWKWAdEv3wZrOtjOZzeLGPzsmkcgncgoRhX4dT+1itSMR9j9m0/OwsH2UoF6U32LxCOQWQD1AMgIZjAkJeJvFTrtn8fMQ1701CkbaLTVIjRMlTw8kNXvNA/A9UatoiDmi4TFG6mrxTKZpIcTInvPEpkK2A7Qsp1E4skFK8jmysy7uRhMaYHtPTsBvxP0zn3lhKB3W+HTqpneewXWHjCDfL7Nbby91jbz5EKPZXWLuhXIvR1Cu4tiruorwXJxmXaP1HQZonytECNU/UOzP6GNLdq0eFDE4b04Wjp396551G99YiFP2nqHVJ5OMQ==AQAB"); + + Console.WriteLine("Find file: "+ fileRSA); + + var dl_rsa = false; + var RSAMD5 = ""; + + if (patchit) + { + if (File.Exists(fileRSA)) + { + // check if source true + RSAMD5 = Tool.CalculateMD5(fileRSA); + if (RSAMD5 == MD5_API_Patched) + { + // if not found backup rsa key, copy dll to bk + if (!File.Exists(fileRSA_BK)) + { + Console.WriteLine("No found backup file rsa key so copy"); + File.Copy(fileRSA, fileRSA_BK, true); + } + + Console.WriteLine("Skip download RSAKEY"); + } + else + { + Console.WriteLine("file not same " + RSAMD5 + " download rsa key " + MD5_API_Patched); + dl_rsa = true; + } + + } + else + { + if (File.Exists(fileRSA_BK)) + { + if (RSAMD5 == MD5_API_Patched) + { + Console.WriteLine("found backup file rsa key so copy"); + try + { + File.Copy(fileRSA_BK, fileRSA, true); + } + catch (Exception ex) { + Console.WriteLine(ex.Message); + return "error1"; + } + } + else + { + Console.WriteLine("key rsa not same so just download it"); + dl_rsa = true; + } + } + else + { + Console.WriteLine("No found file so just download it"); + dl_rsa = true; + } + } + } + else + { + // remove file + try + { + if (File.Exists(fileRSA)) + { + Console.WriteLine("Remove file rsa key"); + File.Delete(fileRSA); + } + } + catch (Exception ex) { + Console.WriteLine(ex.Message); + return "error"; + } + } + + if (dl_rsa) + { + var DL2 = new Download(DL_Patch+ "RSAPatch.dll", fileRSA); + if (DL2.ShowDialog() != DialogResult.OK) + { + return "No Found Patch file...."; + } + else + { + RSAMD5 = Tool.CalculateMD5(fileRSA); + } + } + + Console.WriteLine("RSA MD5: " + RSAMD5); + //return "TODO: "+ DL_Patch; } - else - { + else { return "No other method found"; } + if(metode != 3) + { + var fileRSA = cst_folder_Game + "/version.dll"; + if (File.Exists(fileRSA)) + { + try + { + Console.WriteLine("remove file rsa key (2)"); + File.Delete(fileRSA); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + } + return ""; } @@ -1625,7 +1759,7 @@ private void btStart_Click(object sender, EventArgs e) } else { - Console.WriteLine("No new Akebi found"); + Console.WriteLine("No new Akebi found: "+ cekAkebi); } } @@ -1859,7 +1993,7 @@ private void linkDiscord_LinkClicked(object sender, LinkLabelLinkClickedEventArg private void linkGithub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - Process.Start(new ProcessStartInfo("https://github.com/akbaryahya/YuukiPS-Launcher") { UseShellExecute = true }); + Process.Start(new ProcessStartInfo("https://github.com/YuukiPS/Launcher-PC") { UseShellExecute = true }); } private void linkWeb_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) diff --git a/README.md b/README.md index 30b1934..62c2f51 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## YuukiPS Launcher A simple Launcher that run several anime games. -![GitHub release (latest by date)](https://img.shields.io/github/downloads/akbaryahya/YuukiPS-Launcher/latest/total) ![GitHub all releases](https://img.shields.io/github/downloads/akbaryahya/YuukiPS-Launcher/total) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fakbaryahya%2FYuukiPS-Launcher&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=true)](https://hits.seeyoufarm.com) +![GitHub release (latest by date)](https://img.shields.io/github/downloads/YuukiPS/Launcher-PC/latest/total) ![GitHub all releases](https://img.shields.io/github/downloads/akbaryahya/YuukiPS-Launcher/total) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fakbaryahya%2FYuukiPS-Launcher&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=true)](https://hits.seeyoufarm.com) ### Features @@ -19,7 +19,7 @@ A simple Launcher that run several anime games. ### Installation -For Nightly Releases [Download here](https://github.com/akbaryahya/YuukiPS-Launcher/releases) +For Nightly Releases [Download here](https://github.com/YuukiPS/Launcher-PC/releases) Required * [.NET 6.0 Runtime (Desktop)](https://dotnet.microsoft.com/en-us/download/dotnet/6.0/runtime) diff --git a/Yuuki/API.cs b/Yuuki/API.cs index 704e2f2..2955f08 100644 --- a/Yuuki/API.cs +++ b/Yuuki/API.cs @@ -15,7 +15,9 @@ 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_YuukiPS = "https://api.github.com/repos/YuukiPS/Launcher-PC/"; + public static string API_GITHUB_RSA = "https://api.github.com/repos/34736384/RSAPatch/"; + public static Cient GS_DL(string dl = "os") { var client = new RestClient(API_DL_WB); @@ -236,11 +238,11 @@ public static Patch GetMD5Game(string md5) { if(ch == 2) { - return GetData.package.cn.md6 + "|" + GetData.package.cn.url; + return GetData.package.cn.md5 + "|" + GetData.package.cn.url; } else { - return GetData.package.os.md6 + "|" + GetData.package.os.url; + return GetData.package.os.md5 + "|" + GetData.package.os.url; } } } diff --git a/Yuuki/Server.cs b/Yuuki/Server.cs index e6fc240..88354d5 100644 --- a/Yuuki/Server.cs +++ b/Yuuki/Server.cs @@ -9,7 +9,7 @@ namespace YuukiPS_Launcher.Yuuki { public class Server { - private static string API_GITHUB_DockerGS = "https://api.github.com/repos/akbaryahya/DockerGS/"; + private static string API_GITHUB_DockerGS = "https://api.github.com/repos/YuukiPS/DockerGS/"; private static string API_GITHUB_Grasscutter = "https://api.github.com/repos/Grasscutters/Grasscutter/"; private static string API_DL_Grasscutter_Resources = "https://gitlab.com/yukiz/GrasscutterResources/"; diff --git a/YuukiPS Launcher.csproj b/YuukiPS Launcher.csproj index 1b4b1cd..506bc49 100644 --- a/YuukiPS Launcher.csproj +++ b/YuukiPS Launcher.csproj @@ -12,8 +12,8 @@ Properties\app.manifest - 2022.11.18.0243 - 2022.11.18.0243 + 2022.12.9.1529 + 2022.12.9.1529 true YuukiPS