sync code
This commit is contained in:
1 parent
082c25b252
commit
4467c929ce
3 files changed
+53
-9
No files matched your search
@@ -9,4 +9,10 @@
|
|||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -48,4 +48,9 @@ internal class BotExtPipe
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
_pipeServerStream.Close();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+42
-9
@@ -1,28 +1,61 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace BotBridge;
|
namespace BotBridge;
|
||||||
|
|
||||||
|
|
||||||
internal class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
|
[RequiresDynamicCode("Calls Microsoft.Extensions.Logging.LoggerFactory.Create(Action<ILoggingBuilder>)")]
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
BotExtHost botExtHost = new BotExtHost();
|
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)
|
while (true)
|
||||||
{
|
{
|
||||||
BotExtPipe botExtPipe = new BotExtPipe("BotExtPipe");
|
//BotExtPipe botExtPipe = new BotExtPipe("BotExtPipe");
|
||||||
botExtPipe.WaitForConnection();
|
//botExtPipe.WaitForConnection();
|
||||||
|
|
||||||
while (true)
|
//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[] clientData = botExtPipe.ReadData();
|
|
||||||
botExtHost.WriteData(clientData);
|
|
||||||
byte[] serverData = botExtHost.ReadData();
|
byte[] serverData = botExtHost.ReadData();
|
||||||
botExtPipe.WriteData(serverData);
|
logger.LogInformation("Recived from chrom:" + Encoding.UTF8.GetString(serverData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user