Skip to content

Commit

Permalink
sync md5 with server key
Browse files Browse the repository at this point in the history
  • Loading branch information
akbaryahya committed Aug 30, 2022
1 parent 0271ab2 commit 3610435
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 9 deletions.
27 changes: 27 additions & 0 deletions API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,33 @@ public static GS GS_DL(string dl = "os")
return JsonConvert.DeserializeObject<GS>(getme);
}

public static KeyGS? GSKEY()
{
var client = new RestClient(API_DL_WB);
var request = new RestRequest("genshin/key/latest");

var response = client.Execute(request);
//var getme = response.StatusCode == HttpStatusCode.OK ? response.Content : response.StatusCode.ToString();
//return JsonConvert.DeserializeObject<KeyGS>(getme);
if (response.StatusCode == HttpStatusCode.OK)
{
var getme = response.Content;
if (getme != null)
{
var tes = JsonConvert.DeserializeObject<KeyGS>(getme);
if (tes != null)
{
return tes;
}
}
}
else
{
Debug.Print("Error: " + response.StatusCode);
}
return null;
}

public static ServerList ServerList()
{
var client = new RestClient(API_DL_WB);
Expand Down
21 changes: 14 additions & 7 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public partial class Main : Form
Thread thServerList;
List<List> ListServer;

private string TES_API = "https://drive.yuuki.me/api/public/dl/ZOrLF1E5/GenshinImpact/Data/PC/3.0.0/Release/Global/Patch/";
// https://nightly.link/akbaryahya/YuukiPS-Launcher/actions/runs/2947968074/YuukiPS.zip
// https://api.github.com/repos/akbaryahya/YuukiPS-Launcher/actions/artifacts

Expand Down Expand Up @@ -327,8 +326,6 @@ private void btStart_Click(object sender, EventArgs e)
return;
}

GS api;

int set_proxy_port = int.Parse(GetPort.Text);
bool set_server_https = CheckProxyUseHTTPS.Checked;

Expand Down Expand Up @@ -380,21 +377,31 @@ private void btStart_Click(object sender, EventArgs e)
string Metadata_API_Original_MD5;
string Metadata_API_Patches_MD5;

//GS api;
KeyGS last_key_api = API.GSKEY();
if (last_key_api == null)
{
MessageBox.Show("Error Get Key");
return;
}

string TES_API = "https://drive.yuuki.me/api/public/dl/ZOrLF1E5/GenshinImpact/Data/PC/" + last_key_api.Original.MetaData.version + "/Release/Global/Patch/";

if (File.Exists(cn))
{
//api = API.GS_DL("cn");
PathfileGame = cn;
PathMetadata = Path.Combine(Folder_Game_Now, "YuanShen_Data", "Managed", "Metadata");
Metadata_API_Original_MD5 = "BACD1E9DE1888F4896DABA0216C3D829".ToLower();
Metadata_API_Patches_MD5 = "007E1AA68590878BE9B05AC79440E987".ToLower();
Metadata_API_Original_MD5 = last_key_api.Original.MetaData.md5_cn.ToLower();
Metadata_API_Patches_MD5 = last_key_api.Patched.MetaData.md5_cn.ToLower();
}
else if (File.Exists(os))
{
//api = API.GS_DL();
PathfileGame = os;
PathMetadata = Path.Combine(Folder_Game_Now, "GenshinImpact_Data", "Managed", "Metadata");
Metadata_API_Original_MD5 = "809de2b9cd7a0f8cdd8687e3a8291cbb".ToLower();
Metadata_API_Patches_MD5 = "1307D55022167856879B284084F43426".ToLower();
Metadata_API_Original_MD5 = last_key_api.Original.MetaData.md5_os.ToLower();
Metadata_API_Patches_MD5 = last_key_api.Patched.MetaData.md5_os.ToLower();
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions YuukiPS Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

<ApplicationManifest>Properties\app.manifest</ApplicationManifest>

<AssemblyVersion>2022.8.30.0924</AssemblyVersion>
<FileVersion>2022.8.30.0924</FileVersion>
<AssemblyVersion>2022.8.30.2015</AssemblyVersion>
<FileVersion>2022.8.30.2015</FileVersion>

<EnableWindowsTargeting>true</EnableWindowsTargeting>
<AssemblyName>YuukiPS</AssemblyName>
Expand Down
46 changes: 46 additions & 0 deletions json/KeyGS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
namespace YuukiPS_Launcher.json
{
public class MetaData
{
public string key1 { get; set; }
public string key2 { get; set; }
public string version { get; set; }
public string url_os { get; set; }
public string url_cn { get; set; }
public string md5_os { get; set; }
public string md5_cn { get; set; }
public string key2_os { get; set; }
public string key2_cn { get; set; }
public string api_os { get; set; }
public string api_cn { get; set; }
}

public class Original
{
public MetaData MetaData { get; set; }
public UserAssembly UserAssembly { get; set; }
}

public class Patched
{
public MetaData MetaData { get; set; }
public UserAssembly UserAssembly { get; set; }
}

public class KeyGS
{
public Patched Patched { get; set; }
public Original Original { get; set; }
}

public class UserAssembly
{
public string key1 { get; set; }
public string key2 { get; set; }
public string version { get; set; }
public string url_os { get; set; }
public string url_cn { get; set; }
public string md5_os { get; set; }
public string md5_cn { get; set; }
}
}

0 comments on commit 3610435

Please sign in to comment.