chore: Introduce Qodana static analysis configuration and apply minor code formatting and C# 12 collection expressions.
This commit is contained in:
@@ -11,19 +11,19 @@ public static class ToggleCommand
|
||||
public static async Task ExecuteAsync(bool pipeToStdout, bool copyToClipboard, bool verbose)
|
||||
{
|
||||
Logger.Verbose = verbose;
|
||||
|
||||
|
||||
var socketPath = DaemonService.GetSocketPath();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
|
||||
var endPoint = new UnixDomainSocketEndPoint(socketPath);
|
||||
await socket.ConnectAsync(endPoint);
|
||||
|
||||
|
||||
// Send TOGGLE (cmd == 4), pipeToStdout, copyToClipboard
|
||||
var msg = new byte[] { 4, (byte)(pipeToStdout ? 1 : 0), (byte)(copyToClipboard ? 1 : 0) };
|
||||
await socket.SendAsync(msg, SocketFlags.None);
|
||||
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Console.WriteLine("Sent TOGGLE command to daemon.");
|
||||
@@ -36,7 +36,7 @@ public static class ToggleCommand
|
||||
{
|
||||
int received = await socket.ReceiveAsync(responseBuffer, SocketFlags.None);
|
||||
if (received == 0) break; // socket closed by daemon
|
||||
|
||||
|
||||
if (pipeToStdout)
|
||||
{
|
||||
var text = System.Text.Encoding.UTF8.GetString(responseBuffer, 0, received);
|
||||
|
||||
Reference in New Issue
Block a user