Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 public override void SubscribeToClient(CastClient client)
 {
     base.SubscribeToClient(client);
     this.SubscribedClient.MessageReceived += this.OnMessageReceivedHandler;
 }