From dcbcdd17fa04b68862854024b4656a2b1e61da3b Mon Sep 17 00:00:00 2001 From: milimoe Date: Thu, 16 Jan 2025 20:22:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=A4=9A=E5=AE=A2=E6=88=B7=E7=AB=AF=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E6=A8=A1=E7=BB=84=E6=97=B6=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E4=BA=A7=E7=94=9F=E7=9A=84=E7=BA=BF=E7=A8=8B=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Main.cs | 4 ++++ Library/Tests/CheckDLL.cs | 26 ++++++++++++++++---------- Library/Tests/WebSocketTest.cs | 6 ++++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Library/Main.cs b/Library/Main.cs index d9efe41..0f6b26f 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -4,6 +4,10 @@ using Oshima.FunGame.WebAPI.Controllers; using Oshima.FunGame.OshimaModules; using Oshima.FunGame.OshimaServers.Service; +_ = new Milimoe.FunGame.Testing.Tests.CheckDLL(); + +Console.WriteLine(); + _ = new Milimoe.FunGame.Testing.Tests.WebSocketTest(); CharacterModule cm = new(); diff --git a/Library/Tests/CheckDLL.cs b/Library/Tests/CheckDLL.cs index 94cf406..c0b8fbb 100644 --- a/Library/Tests/CheckDLL.cs +++ b/Library/Tests/CheckDLL.cs @@ -16,11 +16,11 @@ namespace Milimoe.FunGame.Testing.Tests Console.WriteLine(plugin + " is loaded."); } - Dictionary plugindllsha512 = []; + Dictionary plugindllsha256 = []; foreach (string pfp in PluginLoader.PluginFilePaths.Keys) { - string text = Encryption.FileSha512(PluginLoader.PluginFilePaths[pfp]); - plugindllsha512.Add(pfp, text); + string text = Encryption.FileSha256(PluginLoader.PluginFilePaths[pfp]); + plugindllsha256.Add(pfp, text); Console.WriteLine(pfp + $" is {text}."); } @@ -45,20 +45,26 @@ namespace Milimoe.FunGame.Testing.Tests } } - Dictionary moduledllsha512 = []; + Dictionary moduledllsha256 = []; foreach (string mfp in GameModuleLoader.ModuleFilePaths.Keys) { - string text = Encryption.FileSha512(GameModuleLoader.ModuleFilePaths[mfp]); - moduledllsha512.Add(mfp, text); + string text = Encryption.FileSha256(GameModuleLoader.ModuleFilePaths[mfp]); + moduledllsha256.Add(mfp, text); Console.WriteLine(mfp + $" is {text}."); } - foreach (string moduledll in moduledllsha512.Keys) + GameModuleLoader serverModels = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Server, []); + + foreach (string moduledll in serverModels.ModuleServers.Keys) { - string server = moduledllsha512[moduledll]; - if (plugindllsha512.TryGetValue(moduledll, out string? client) && client != "" && server == client) + if (!serverModels.ModuleServers[moduledll].IsAnonymous) { - Console.WriteLine(moduledll + $" is checked pass."); + string server = Encryption.FileSha256(GameModuleLoader.ModuleFilePaths[moduledll]); + string client = moduledllsha256[moduledll]; + if (server == client) + { + Console.WriteLine(moduledll + $" is checked pass."); + } } } } diff --git a/Library/Tests/WebSocketTest.cs b/Library/Tests/WebSocketTest.cs index 93a64b5..75147c6 100644 --- a/Library/Tests/WebSocketTest.cs +++ b/Library/Tests/WebSocketTest.cs @@ -66,6 +66,12 @@ namespace Milimoe.FunGame.Testing.Tests data.Add("sc", 1); await HTTPClient.Send(SocketMessageType.AnonymousGameServer, OshimaGameModuleConstant.Anonymous, data); } + if (str == "sclist") + { + Dictionary data = []; + data.Add("command", "sclist"); + await HTTPClient.Send(SocketMessageType.AnonymousGameServer, OshimaGameModuleConstant.Anonymous, data); + } if (str == "wsclose") { await HTTPClient.Send(SocketMessageType.EndGame);