Skip to content

Commit

Permalink
dirty pipe hack
Browse files Browse the repository at this point in the history
  • Loading branch information
pifopi committed Nov 16, 2023
1 parent 9863365 commit 048d60e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions RaidCrawler.WinForms/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using SysBot.Base;
using System.Data;
using System.Diagnostics;
using System.IO.Pipes;
using System.Text;
using System.Text.Json;
using static RaidCrawler.Core.Structures.Offsets;

Expand Down Expand Up @@ -63,6 +65,8 @@ public partial class MainWindow : Form
private bool StopAdvances =>
!Config.EnableFilters || RaidFilters.Count == 0 || RaidFilters.All(x => !x.Enabled);

Thread backgroundThread;

public MainWindow()
{
string build = string.Empty;
Expand Down Expand Up @@ -133,6 +137,25 @@ public MainWindow()
USB_Port_TB.Visible = false;
USB_Port_label.Visible = false;
}

backgroundThread = new Thread(async () =>
{
NamedPipeServerStream serverStream = new NamedPipeServerStream("TestPipe", PipeDirection.InOut);
await serverStream.WaitForConnectionAsync();
while (true)
{
byte[] buffer = new byte[100];
int bytesRead = await serverStream.ReadAsync(buffer, 0, buffer.Length);
string receivedMessage = Encoding.UTF8.GetString(buffer, 0, bytesRead);
Console.WriteLine($"Server: Received message from client: {receivedMessage}");
string responseMessage = $"Thanks for your message: {receivedMessage}";
byte[] responseBuffer = Encoding.UTF8.GetBytes(responseMessage);
await serverStream.WriteAsync(responseBuffer, 0, responseBuffer.Length);
}
});
backgroundThread.Start();
}

private void UpdateStatus(string status)
Expand Down

0 comments on commit 048d60e

Please sign in to comment.