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