61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
using System.Text;
|
|
using Microsoft.Extensions.Logging;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
namespace BotBridge;
|
|
|
|
|
|
internal class Program
|
|
{
|
|
[RequiresDynamicCode("Calls Microsoft.Extensions.Logging.LoggerFactory.Create(Action<ILoggingBuilder>)")]
|
|
static void Main(string[] args)
|
|
{
|
|
BotExtHost botExtHost = new BotExtHost();
|
|
|
|
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
|
{
|
|
builder.AddSimpleConsole(options =>
|
|
{
|
|
options.IncludeScopes = true;
|
|
options.SingleLine = true;
|
|
options.TimestampFormat = "HH:mm:ss ";
|
|
}
|
|
);
|
|
}
|
|
|
|
);
|
|
|
|
ILogger<Program> logger = loggerFactory.CreateLogger<Program>();
|
|
using (logger.BeginScope("[scope is enabled]"))
|
|
{
|
|
while (true)
|
|
{
|
|
//BotExtPipe botExtPipe = new BotExtPipe("BotExtPipe");
|
|
//botExtPipe.WaitForConnection();
|
|
|
|
//byte[] clientData = botExtPipe.ReadData();
|
|
//logger.LogInformation("Recived: " + Encoding.UTF8.GetString(clientData));
|
|
//botExtPipe.WriteData(Encoding.UTF8.GetBytes("Hello from BotExtHost"));
|
|
//logger.LogInformation("Send: Hello from BotExtHost");
|
|
//botExtPipe.Close();
|
|
|
|
//while (true)
|
|
//{
|
|
|
|
// byte[] clientData = botExtPipe.ReadData();
|
|
// //Console.WriteLine(Encoding.UTF8.GetString(clientData));
|
|
// botExtPipe.Close();
|
|
// //botExtHost.WriteData(clientData);
|
|
// //byte[] serverData = botExtHost.ReadData();
|
|
// //botExtPipe.WriteData(serverData);
|
|
|
|
//}
|
|
|
|
byte[] serverData = botExtHost.ReadData();
|
|
logger.LogInformation("Recived from chrom:" + Encoding.UTF8.GetString(serverData));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
} |