21 lines
539 B
C#
21 lines
539 B
C#
using System.Diagnostics;
|
|
|
|
namespace CommIpc;
|
|
|
|
public static class PipeName
|
|
{
|
|
/// <summary>
|
|
/// Creates a pipe name that is unique per parent process instance and child id.
|
|
/// </summary>
|
|
public static string ForChild(int childId, int? parentPid = null)
|
|
{
|
|
parentPid ??= Environment.ProcessId;
|
|
return $"CommTester_{parentPid}_{childId}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Helpful for logs / debugging.
|
|
/// </summary>
|
|
public static string Describe(string pipeName) => $"\\\\.\\pipe\\{pipeName}";
|
|
}
|