Initial commit
This commit is contained in:
20
CommIpc/PipeName.cs
Normal file
20
CommIpc/PipeName.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
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}";
|
||||
}
|
||||
Reference in New Issue
Block a user