mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-15 10:58:13 +08:00
2.8
This commit is contained in:
@@ -18,15 +18,14 @@ public static class Export {
|
||||
[4] 表格文件
|
||||
输入一个数字(0-4): ".Split("\n").Select(s => s.Trim()).JoinToString("\n") + " ");
|
||||
if (!int.TryParse(Console.ReadLine(), out var num)) num = 0;
|
||||
Action<AchievementAllDataNotify> act = num switch {
|
||||
((Action<AchievementAllDataNotify>) (num switch {
|
||||
1 => ToSnapGenshin,
|
||||
2 => ToPaimon,
|
||||
3 => ToSeelie,
|
||||
4 => ToCSV,
|
||||
7 => ToRawJson,
|
||||
_ => ToCocogoat
|
||||
};
|
||||
act(data);
|
||||
})).Invoke(data);
|
||||
}
|
||||
|
||||
private static void ToCocogoat(AchievementAllDataNotify data) {
|
||||
|
||||
@@ -28,7 +28,7 @@ public static class Logger {
|
||||
|
||||
private static void Log(string msg, Level level) {
|
||||
if (level >= GlobalVars.LogLevel) {
|
||||
Console.WriteLine($"{DateTime.Now:MM/dd HH:mm:ss} {level.ToString().ToUpper().PadLeft(5)} : {msg}");
|
||||
Console.WriteLine(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// <auto-generated>
|
||||
// <auto-generated>
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: AchievementAllDataNotify.proto
|
||||
// </auto-generated>
|
||||
@@ -23,11 +23,11 @@ public static partial class AchievementAllDataNotifyReflection {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"Ch5BY2hpZXZlbWVudEFsbERhdGFOb3RpZnkucHJvdG8iowIKGEFjaGlldmVt",
|
||||
"ZW50QWxsRGF0YU5vdGlmeRIzCgRsaXN0GAUgAygLMiUuQWNoaWV2ZW1lbnRB",
|
||||
"ZW50QWxsRGF0YU5vdGlmeRIzCgRsaXN0GAQgAygLMiUuQWNoaWV2ZW1lbnRB",
|
||||
"bGxEYXRhTm90aWZ5LkFjaGlldmVtZW50GtEBCgtBY2hpZXZlbWVudBIKCgJp",
|
||||
"ZBgPIAEoDRI8CgZzdGF0dXMYDSABKA4yLC5BY2hpZXZlbWVudEFsbERhdGFO",
|
||||
"b3RpZnkuQWNoaWV2ZW1lbnQuU3RhdHVzEg8KB2N1cnJlbnQYCyABKA0SDQoF",
|
||||
"dG90YWwYBiABKA0SEQoJdGltZXN0YW1wGAwgASgNIkUKBlN0YXR1cxILCgdJ",
|
||||
"ZBgOIAEoDRI8CgZzdGF0dXMYDSABKA4yLC5BY2hpZXZlbWVudEFsbERhdGFO",
|
||||
"b3RpZnkuQWNoaWV2ZW1lbnQuU3RhdHVzEg8KB2N1cnJlbnQYDCABKA0SDQoF",
|
||||
"dG90YWwYCCABKA0SEQoJdGltZXN0YW1wGAsgASgNIkUKBlN0YXR1cxILCgdJ",
|
||||
"TlZBTElEEAASDgoKVU5GSU5JU0hFRBABEgwKCEZJTklTSEVEEAISEAoMUkVX",
|
||||
"QVJEX1RBS0VOEANiBnByb3RvMw=="));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
@@ -85,9 +85,9 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "list" field.</summary>
|
||||
public const int ListFieldNumber = 5;
|
||||
public const int ListFieldNumber = 4;
|
||||
private static readonly pb::FieldCodec<global::AchievementAllDataNotify.Types.Achievement> _repeated_list_codec
|
||||
= pb::FieldCodec.ForMessage(42, global::AchievementAllDataNotify.Types.Achievement.Parser);
|
||||
= pb::FieldCodec.ForMessage(34, global::AchievementAllDataNotify.Types.Achievement.Parser);
|
||||
private readonly pbc::RepeatedField<global::AchievementAllDataNotify.Types.Achievement> list_ = new pbc::RepeatedField<global::AchievementAllDataNotify.Types.Achievement>();
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
@@ -188,7 +188,7 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||
break;
|
||||
case 42: {
|
||||
case 34: {
|
||||
list_.AddEntriesFrom(input, _repeated_list_codec);
|
||||
break;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
|
||||
break;
|
||||
case 42: {
|
||||
case 34: {
|
||||
list_.AddEntriesFrom(ref input, _repeated_list_codec);
|
||||
break;
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "id" field.</summary>
|
||||
public const int IdFieldNumber = 15;
|
||||
public const int IdFieldNumber = 14;
|
||||
private uint id_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
@@ -294,7 +294,7 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "current" field.</summary>
|
||||
public const int CurrentFieldNumber = 11;
|
||||
public const int CurrentFieldNumber = 12;
|
||||
private uint current_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
@@ -306,7 +306,7 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "total" field.</summary>
|
||||
public const int TotalFieldNumber = 6;
|
||||
public const int TotalFieldNumber = 8;
|
||||
private uint total_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
@@ -318,7 +318,7 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "timestamp" field.</summary>
|
||||
public const int TimestampFieldNumber = 12;
|
||||
public const int TimestampFieldNumber = 11;
|
||||
private uint timestamp_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
@@ -380,23 +380,23 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
output.WriteRawMessage(this);
|
||||
#else
|
||||
if (Total != 0) {
|
||||
output.WriteRawTag(48);
|
||||
output.WriteRawTag(64);
|
||||
output.WriteUInt32(Total);
|
||||
}
|
||||
if (Current != 0) {
|
||||
output.WriteRawTag(88);
|
||||
output.WriteUInt32(Current);
|
||||
}
|
||||
if (Timestamp != 0) {
|
||||
output.WriteRawTag(96);
|
||||
output.WriteRawTag(88);
|
||||
output.WriteUInt32(Timestamp);
|
||||
}
|
||||
if (Current != 0) {
|
||||
output.WriteRawTag(96);
|
||||
output.WriteUInt32(Current);
|
||||
}
|
||||
if (Status != global::AchievementAllDataNotify.Types.Achievement.Types.Status.Invalid) {
|
||||
output.WriteRawTag(104);
|
||||
output.WriteEnum((int) Status);
|
||||
}
|
||||
if (Id != 0) {
|
||||
output.WriteRawTag(120);
|
||||
output.WriteRawTag(112);
|
||||
output.WriteUInt32(Id);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
@@ -410,23 +410,23 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
|
||||
if (Total != 0) {
|
||||
output.WriteRawTag(48);
|
||||
output.WriteRawTag(64);
|
||||
output.WriteUInt32(Total);
|
||||
}
|
||||
if (Current != 0) {
|
||||
output.WriteRawTag(88);
|
||||
output.WriteUInt32(Current);
|
||||
}
|
||||
if (Timestamp != 0) {
|
||||
output.WriteRawTag(96);
|
||||
output.WriteRawTag(88);
|
||||
output.WriteUInt32(Timestamp);
|
||||
}
|
||||
if (Current != 0) {
|
||||
output.WriteRawTag(96);
|
||||
output.WriteUInt32(Current);
|
||||
}
|
||||
if (Status != global::AchievementAllDataNotify.Types.Achievement.Types.Status.Invalid) {
|
||||
output.WriteRawTag(104);
|
||||
output.WriteEnum((int) Status);
|
||||
}
|
||||
if (Id != 0) {
|
||||
output.WriteRawTag(120);
|
||||
output.WriteRawTag(112);
|
||||
output.WriteUInt32(Id);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
@@ -496,23 +496,23 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||
break;
|
||||
case 48: {
|
||||
case 64: {
|
||||
Total = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 88: {
|
||||
Current = input.ReadUInt32();
|
||||
Timestamp = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 96: {
|
||||
Timestamp = input.ReadUInt32();
|
||||
Current = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 104: {
|
||||
Status = (global::AchievementAllDataNotify.Types.Achievement.Types.Status) input.ReadEnum();
|
||||
break;
|
||||
}
|
||||
case 120: {
|
||||
case 112: {
|
||||
Id = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
@@ -531,23 +531,23 @@ public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementA
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
|
||||
break;
|
||||
case 48: {
|
||||
case 64: {
|
||||
Total = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 88: {
|
||||
Current = input.ReadUInt32();
|
||||
Timestamp = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 96: {
|
||||
Timestamp = input.ReadUInt32();
|
||||
Current = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
case 104: {
|
||||
Status = (global::AchievementAllDataNotify.Types.Achievement.Types.Status) input.ReadEnum();
|
||||
break;
|
||||
}
|
||||
case 120: {
|
||||
case 112: {
|
||||
Id = input.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
|
||||
11
src/Utils.cs
11
src/Utils.cs
@@ -101,7 +101,7 @@ public static class Utils {
|
||||
public static void LoadConfig() {
|
||||
var conf = JsonNode.Parse(File.ReadAllText(GlobalVars.ConfigFileName))!;
|
||||
var path = conf["location"];
|
||||
if (path == null || CheckGamePathValid(path.GetValue<string>())) {
|
||||
if (path == null || !CheckGamePathValid(path.GetValue<string>())) {
|
||||
GlobalVars.GamePath = SelectGameExecutable();
|
||||
conf["location"] = GlobalVars.GamePath;
|
||||
File.WriteAllText(GlobalVars.ConfigFileName, conf.ToJsonString());
|
||||
@@ -130,7 +130,7 @@ public static class Utils {
|
||||
}
|
||||
}
|
||||
if (info.EnableLibDownload) {
|
||||
File.WriteAllBytes("YaeLib.dll", GetBucketFileAsByteArray("schicksal/lib.dll"));
|
||||
File.WriteAllBytes(GlobalVars.LibName, GetBucketFileAsByteArray("schicksal/lib.dll"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,10 +239,12 @@ public static class Utils {
|
||||
|
||||
// ReSharper disable once UnusedMethodReturnValue.Global
|
||||
public static Thread StartAndWaitResult(string exePath, Func<string, bool> onReceive) {
|
||||
const string lib = "C:/ProgramData/yae.dll";
|
||||
File.Copy(Path.GetFullPath(GlobalVars.LibName), lib, true);
|
||||
if (!Injector.CreateProcess(exePath, out var hProcess, out var hThread, out var pid)) {
|
||||
Environment.Exit(new Win32Exception().PrintMsgAndReturnErrCode("ICreateProcess fail"));
|
||||
}
|
||||
if (Injector.LoadLibraryAndInject(hProcess, Path.GetFullPath(GlobalVars.LibName)) != 0) {
|
||||
if (Injector.LoadLibraryAndInject(hProcess, lib) != 0) {
|
||||
if (!Native.TerminateProcess(hProcess, 0)) {
|
||||
Environment.Exit(new Win32Exception().PrintMsgAndReturnErrCode("TerminateProcess fail"));
|
||||
}
|
||||
@@ -257,6 +259,9 @@ public static class Utils {
|
||||
Environment.Exit(114514);
|
||||
}
|
||||
};
|
||||
AppDomain.CurrentDomain.ProcessExit += (_, _) => {
|
||||
File.Delete(lib);
|
||||
};
|
||||
if (Native.ResumeThread(hThread) == 0xFFFFFFFF) {
|
||||
var e = new Win32Exception();
|
||||
if (!Native.TerminateProcess(hProcess, 0)) {
|
||||
|
||||
Reference in New Issue
Block a user