Skip to content

Commit

Permalink
now supports 3.2,4.0.1,4.6,4.7 by using simple copy method instead of…
Browse files Browse the repository at this point in the history
… complicated thing and some functions are temporarily removed.
  • Loading branch information
Yuuki committed Jun 29, 2024
1 parent aa5b5b0 commit b6cdf0c
Show file tree
Hide file tree
Showing 14 changed files with 327 additions and 1,703 deletions.
6 changes: 6 additions & 0 deletions Download.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Downloader;
using System.ComponentModel;
using YuukiPS_Launcher.Utils;
using YuukiPS_Launcher.Yuuki;

namespace YuukiPS_Launcher
Expand Down Expand Up @@ -32,6 +33,11 @@ private void btDownload_Click(object sender, EventArgs e)
return;
}

if (File.Exists(set_folder))
{
Logger.Info("Download", $"File old found {set_folder} remove for redownload?");
File.Delete(set_folder);
}

btDownload.Enabled = false;

Expand Down
25 changes: 25 additions & 0 deletions Game/Genshin/ServerRegionID.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using static YuukiPS_Launcher.Game.Genshin.Settings;

public class ServerRegionIDConverter : StringEnumConverter
{
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.String)
{
string enumText = reader.Value.ToString();

Check warning on line 12 in Game/Genshin/ServerRegionID.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 12 in Game/Genshin/ServerRegionID.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.
foreach (ServerRegionID enumValue in Enum.GetValues(typeof(ServerRegionID)))
{
if (enumValue.ToString().Equals(enumText, StringComparison.OrdinalIgnoreCase))
{
return enumValue;
}
}
// Handle unknown value here
return ServerRegionID.os_usa; // Default value
}
return base.ReadJson(reader, objectType, existingValue, serializer);
}
}
8 changes: 2 additions & 6 deletions Game/Genshin/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@ public enum ServerRegionID
os_usa = 0,
os_euro = 1,
os_asia = 2,
os_cht = 3,
// YuukiPS
sg1 = 4,
eu1 = 5,
// make the warn thing to shut the hell up
dev_docker = 6
os_cht = 3
}

public class GeneralDataProp
Expand All @@ -124,6 +119,7 @@ public class GeneralDataProp
public string userLocalDataVersionId { get; set; } = "0.0.1";
public int deviceLanguageType { get; set; } = 1;
public int deviceVoiceLanguageType { get; set; } = 2;
[JsonConverter(typeof(ServerRegionIDConverter))]
public ServerRegionID? selectedServerName { get; set; }
public int localLevelIndex { get; set; } = 0;
public string deviceID { get; set; } = "";
Expand Down
48 changes: 9 additions & 39 deletions Json/GameClient/Patch.cs
Original file line number Diff line number Diff line change
@@ -1,57 +1,27 @@
namespace YuukiPS_Launcher.Json.GameClient
{
public class Cn
{
public string userassembly { get; set; }
public string metadata { get; set; }
}

public class KeyFind
{
public string cn { get; set; }
public string os { get; set; }
}

public class Md5Check
{
public Os os { get; set; }
public Cn cn { get; set; }
}

public class Md5Vaild
{
public string os { get; set; }
public string cn { get; set; }
}

public class Original
{
public string resources { get; set; }
public KeyFind key_find { get; set; }
public Md5Check md5_check { get; set; }
}

public class Os
{
public string userassembly { get; set; }
public string metadata { get; set; }
public string file { get; set; }
public string location { get; set; }
public string md5 { get; set; }
}

public class Patched
{
public string metode { get; set; }
public string resources { get; set; }
public string key_patch { get; set; }
public Md5Vaild md5_vaild { get; set; }
public string file { get; set; }
public string location { get; set; }
public string md5 { get; set; }
}

public class Patch
{
public string version { get; set; } = "0.0.0";
public string channel { get; set; } = "Global";
public string release { get; set; } = "Official";
public string method { get; set; } = "copy"; // rare use
public string nosupport { get; set; } = "";
public Patched? patched { get; set; }
public Original? original { get; set; }
public List<Patched> patched { get; set; }
public List<Original> original { get; set; }
}
}
46 changes: 0 additions & 46 deletions Json/KeyGS.cs

This file was deleted.

17 changes: 0 additions & 17 deletions Json/ServerList.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Json/VersionGenshin.cs

This file was deleted.

25 changes: 0 additions & 25 deletions Json/VersionServer.cs

This file was deleted.

Loading

0 comments on commit b6cdf0c

Please sign in to comment.