protected string RightsToAccess (PipeAccessRights rights)
{
string access = null;
if ((rights & PipeAccessRights.ReadData) != 0) {
if ((rights & PipeAccessRights.WriteData) != 0)
access = "r+";
else
access = "r";
}
else if ((rights & PipeAccessRights.WriteData) != 0)
access = "w";
else
throw new InvalidOperationException ("The pipe must be opened to either read or write");
return access;
}