2020-10-21 01:13:40 +02:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
2020-10-25 10:13:14 +01:00
|
|
|
|
using System;
|
2020-10-21 01:13:40 +02:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.IO.Pipes;
|
|
|
|
|
|
|
|
|
|
namespace RatAttack
|
|
|
|
|
{
|
|
|
|
|
class RatAttack_cli
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
2020-12-02 11:18:31 +01:00
|
|
|
|
RatAttack.Ratsignal ratsignal = new RatAttack.Ratsignal(args[0], args.Length > 1 && args[1] == "true");
|
2020-10-21 01:13:40 +02:00
|
|
|
|
|
|
|
|
|
using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "RatAttack", PipeDirection.Out))
|
|
|
|
|
{
|
2020-10-25 10:13:14 +01:00
|
|
|
|
try
|
2020-10-21 01:13:40 +02:00
|
|
|
|
{
|
2020-10-25 10:13:14 +01:00
|
|
|
|
// try connecting for up to 2 minutes; then we’ll assume VoiceAttack just isn’t up and won’t come up
|
|
|
|
|
pipeClient.Connect(120000);
|
|
|
|
|
using (StreamWriter writer = new StreamWriter(pipeClient))
|
|
|
|
|
{
|
|
|
|
|
writer.WriteLine(ratsignal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (TimeoutException)
|
|
|
|
|
{
|
|
|
|
|
Console.Error.WriteLine("Connection to RatAttack pipe has timed out.");
|
2020-10-21 01:13:40 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|