public static byte[] SessionCreate( SessionStyle sessionStyle, string id, string destinationPrivateKey = null, string i2CpOptions = null ) { if(id == null) throw new ArgumentNullException("id"); if(id.Contains(' ')) throw new ArgumentOutOfRangeException("id"); string sessionTypeString = sessionStyle == SessionStyle.Stream ? "STREAM" : sessionStyle == SessionStyle.Datagram ? "DATAGRAM" : "RAW"; destinationPrivateKey = destinationPrivateKey ?? "TRANSIENT"; string i2cpOptionsParam = i2CpOptions == null ? string.Empty : (" " + i2CpOptions); return Encoding.ASCII.GetBytes(string.Format( "SESSION CREATE" + " STYLE={0}" + " ID={1}" + " DESTINATION={2}" + "{3}" + " \n", sessionTypeString, id, destinationPrivateKey, i2cpOptionsParam )); }
public static byte[] SessionCreate( SessionStyle sessionStyle, string id, string destinationPrivateKey = null, string i2CpOptions = null ) { if (id == null) { throw new ArgumentNullException("id"); } if (id.Contains(' ')) { throw new ArgumentOutOfRangeException("id"); } string sessionTypeString = sessionStyle == SessionStyle.Stream ? "STREAM" : sessionStyle == SessionStyle.Datagram ? "DATAGRAM" : "RAW"; destinationPrivateKey = destinationPrivateKey ?? "TRANSIENT"; string i2cpOptionsParam = i2CpOptions == null ? string.Empty : (" " + i2CpOptions); return(Encoding.ASCII.GetBytes(string.Format( "SESSION CREATE" + " STYLE={0}" + " ID={1}" + " DESTINATION={2}" + "{3}" + " \n", sessionTypeString, id, destinationPrivateKey, i2cpOptionsParam ))); }