private static bool ZTryAsLiteral(IList <byte> pBytes, bool pSecret, bool pEncoded, out cLiteralCommandPart rResult) { if (pBytes == null) { rResult = null; return(false); } foreach (byte lByte in pBytes) { if (lByte == cASCII.NUL) { rResult = null; return(false); } } rResult = new cLiteralCommandPart(pBytes, false, pSecret, pEncoded); return(true); }
public static bool TryAsASCIILiteral(string pString, bool pSecret, out cLiteralCommandPart rResult) { if (pString == null) { rResult = null; return(false); } var lBytes = new cByteList(pString.Length); foreach (char lChar in pString) { if (lChar == cChar.NUL || lChar > cChar.DEL) { rResult = null; return(false); } lBytes.Add((byte)lChar); } rResult = new cLiteralCommandPart(lBytes, false, pSecret); return(true); }