+发信代码

Signed-off-by: Eicy <im@crash.work>
This commit is contained in:
2024-12-18 01:43:47 +08:00
parent 1051517140
commit 2b7632344e
2 changed files with 16 additions and 7 deletions

View File

@@ -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)
{

View File

@@ -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}");
}*/
}