public static T GetNewProtocol <T>(this CastClient client, params object[] args) where T : Protocol { var protocol = (T)Activator.CreateInstance(typeof(T), args); protocol.SubscribeToClient(client); return(protocol); }
public virtual void SubscribeToClient(CastClient client) { if (client == null) { throw new ArgumentNullException("client"); } if (this.IsDisposed) { throw new ObjectDisposedException(this.GetType().Name); } if (client.IsDisposed) { throw new ObjectDisposedException(client.GetType().Name); } if (this.SubscribedClient != null) { this.RemoveClientSubscription(); } this.SubscribedClient = client; }
public override void SubscribeToClient(CastClient client) { base.SubscribeToClient(client); this.SubscribedClient.MessageReceived += this.OnMessageReceivedHandler; }