From 2b7632344ebc48b83d126814e08450361b943862 Mon Sep 17 00:00:00 2001 From: Eicy Date: Wed, 18 Dec 2024 01:43:47 +0800 Subject: [PATCH] =?UTF-8?q?+=E5=8F=91=E4=BF=A1=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eicy --- Login/QrCode.cs | 2 +- Program.cs | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Login/QrCode.cs b/Login/QrCode.cs index 17ba6aa..e1aecb7 100644 --- a/Login/QrCode.cs +++ b/Login/QrCode.cs @@ -4,6 +4,7 @@ using Lagrange.Core; using Lagrange.Core.Common; using Lagrange.Core.Common.Interface; using Lagrange.Core.Common.Interface.Api; +using Lagrange.Core.Event.EventArg; using Shrink.Utility; using Console = System.Console; @@ -19,7 +20,6 @@ public class QrCode { get { - // 双重检查锁定 if (_instance != null) return _instance; lock (Lock) { diff --git a/Program.cs b/Program.cs index 7432cae..2108713 100644 --- a/Program.cs +++ b/Program.cs @@ -1,6 +1,6 @@ -using Grpc.Net.Client; -using Mono.Cecil; -using Mono.Cecil.Cil; +using Debugger; +using Grpc.Core; +using Shrink.API; using Shrink.Command; using Shrink.Login; @@ -16,12 +16,22 @@ public static class Program var newUrl = "自己找"; ModifyAssembly(originalAssemblyPath, tempAssemblyPath, oldUrl, newUrl);*/ + const int port = 50051; + var server = new Server + { + Services = { BotService.BindService(new BotServiceImpl()) }, + Ports = { new ServerPort("localhost", port, ServerCredentials.Insecure) } + }; + + server.Start(); + + Console.WriteLine($"gRPC server listening on port {port}"); + await QrCode.Instance.Login(); await Commands.Instance.Init(); await Commands.Instance.Run(); - - + //await server.ShutdownAsync(); } /*private static void ModifyAssembly(string originalAssemblyPath, string tempAssemblyPath, string oldUrl, string newUrl) { @@ -58,5 +68,4 @@ public static class Program assembly.Write(tempAssemblyPath); Console.WriteLine($"已将修改后的程序集保存在{tempAssemblyPath}"); }*/ - } \ No newline at end of file