Skip to content

Commit

Permalink
Update:
Browse files Browse the repository at this point in the history
* If md5 doesn't match api version, just re-download it
* Add name server id (YuukiPS)
  • Loading branch information
akbaryahya committed Oct 5, 2022
1 parent 38f9593 commit 074aecc
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 18 deletions.
5 changes: 3 additions & 2 deletions Game/Genshin/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ public enum ServerRegionID
os_euro = 1,
os_asia = 2,
os_cht = 3,
// BETA?
sg1 = 4
// YuukiPS
sg1 = 4,
eu1 = 5
}

public class GeneralDataProp
Expand Down
62 changes: 48 additions & 14 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,23 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1,
else if (MD5_UA_API_Patched != MD5_UA_LOC_Currently)
{
// Jika User pilih patch (MD5_UA_API_Patched doesn't match MD5_UA_LOC_Currently)
var download_patch = false;
if (!File.Exists(PathfileUA_Patched))
{
// If you don't have PathfileUA_Patched, download it
download_patch = true;
}
else
{
// If UA_API_Patches_MD5 (patch file from api) matches UA_LOC_Patched_MD5 (current patch file)
if (MD5_UA_API_Patched != MD5_UA_LOC_Patched)
{
download_patch = true;
}
}

// If you don't have PathfileUA_Patched, download it
if (download_patch)
{
var DL2 = new Download(DL_Patch + "UserAssembly-patched.dll", PathfileUA_Patched);
if (DL2.ShowDialog() != DialogResult.OK)
{
Expand All @@ -470,8 +484,11 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1,
}
}

// If UA_API_Patches_MD5 (patch file from api) matches UA_LOC_Patched_MD5 (current patch file)
if (MD5_UA_API_Patched == MD5_UA_LOC_Patched)
if (MD5_UA_API_Patched != MD5_UA_LOC_Patched)
{
return "(UA) Failed because file doesn't match from md5 api";
}
else
{
// Patch to PathfileUA_Now
try
Expand All @@ -480,16 +497,14 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1,
MD5_UA_LOC_Currently = Tool.CalculateMD5(PathfileUA_Currently);

Console.WriteLine("Patch done...");
download_patch = false;
}
catch (Exception x)
{
return "Failed Patch: " + x.ToString();
}
}
else
{
return "Failed because file doesn't match from md5 api";
}

}
else
{
Expand Down Expand Up @@ -723,8 +738,26 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1,
}
else if (MD5_Metadata_API_Patched != MD5_Metadata_LOC_Currently)
{
// Jika User pilih patch (MD5_Metadata_API_Patched doesn't match MD5_Metadata_LOC_Currently)
// Jika md5 patch tidak cocok dengan metadata sekarang

var download_patch = false;

// jIka file tidak ada
if (!File.Exists(PathfileMetadata_Patched))
{
download_patch = true;
}
else
{
// If Metadata_API_Patches_MD5 (patch file from api) matches Metadata_LOC_Patched_MD5 (current patch file)
if (MD5_Metadata_API_Patched != MD5_Metadata_LOC_Patched)
{
download_patch = true;
}
}

// re-download
if (download_patch)
{
// If you don't have PathfileMetadata_Patched, download it
var DL2 = new Download(DL_Patch + "global-metadata-patched.dat", PathfileMetadata_Patched);
Expand All @@ -739,8 +772,11 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1,
}
}

// If Metadata_API_Patches_MD5 (patch file from api) matches Metadata_LOC_Patched_MD5 (current patch file)
if (MD5_Metadata_API_Patched == MD5_Metadata_LOC_Patched)
if (MD5_Metadata_API_Patched != MD5_Metadata_LOC_Patched)
{
return "(MA) Failed because file doesn't match from md5 api";
}
else
{
// Patch to PathfileMetadata_Now
try
Expand All @@ -749,16 +785,14 @@ public string PatchGame(bool patchit = true, bool online = true, int metode = 1,
MD5_Metadata_LOC_Currently = Tool.CalculateMD5(PathfileMetadata_Currently);

Console.WriteLine("Patch done...");
download_patch = false;
}
catch (Exception x)
{
return "Failed Patch: " + x.ToString();
}
}
else
{
return "Failed because file doesn't match from md5 api";
}

}
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.10.5.0815</AssemblyVersion>
<FileVersion>2022.10.5.0815</FileVersion>
<AssemblyVersion>2022.10.5.1732</AssemblyVersion>
<FileVersion>2022.10.5.1732</FileVersion>

<EnableWindowsTargeting>true</EnableWindowsTargeting>
<AssemblyName>YuukiPS</AssemblyName>
Expand Down

0 comments on commit 074aecc

Please sign in to comment.