/// <summary> /// Unpacks the given <see cref="SerializationSurrogate"/> to the given network stack and returns the resulting surrogate. /// </summary> public static RemoteImageSurrogate UnpackSurrogate(NetStack Stack, SerializationSurrogate Surrogate) { INetworkEndpoint nep = Stack.OpenChannel(Surrogate.Reference); ImageClient imc = new ImageClient(nep); return(Surrogate.GetRemoteSurrogate(imc)); }
public EncryptWrapper(INetworkEndpoint Underlayer, byte[] Key, byte[] IV) { Wrapped = Underlayer; this.IV = IV; this.Key = Key; CryptoGen.Mode = CipherMode.CBC; CryptoGen.Padding = PaddingMode.PKCS7; }
/// <summary> /// Creates a new channel. /// </summary> /// <returns>The new channel's number.</returns> /// <param name="Endpoint">The new channel.</param> public int CreateNewChannel(out INetworkEndpoint Endpoint) { int ChNum; lock (this) ChNum = ChannelCounter++; Endpoint = CreateChannel(ChNum); return(ChNum); }
public ImageClient(INetworkEndpoint Endpoint) { Network = Endpoint; Serializers = new Stack <Ceras.CerasSerializer>(); }
/// <summary>Sends text on a given channel.</summary> string SendReceiveText(INetworkEndpoint Channel, int Reference, string Message) { byte[] Data = System.Text.Encoding.UTF8.GetBytes(Message); Data = Channel.SendReceive(Reference, Data, Data.Length); return(System.Text.Encoding.UTF8.GetString(Data)); }
public FrameEndpoint(INetworkEndpoint network) => this.network = network ?? throw new ArgumentNullException(nameof(network));