Exemplo n.º 1
0
        public static InterruptRequest CreateAndRead(string domain, BinaryReader requestReader)
        {
            InterruptRequest request = new InterruptRequest();

            request.ReadInternal(domain, requestReader);
            return(request);
        }
Exemplo n.º 2
0
        public static BinaryRequest Read(BinaryReader requestReader)
        {
            byte version = BinaryHelper.ReadByte(requestReader);

            if (version != BinaryRequest.Version)
            {
                throw new CorrespondenceException(String.Format("This distributor cannot read version {0} requests.", version));
            }

            string domain = BinaryHelper.ReadString(requestReader);

            byte token = BinaryHelper.ReadByte(requestReader);

            if (token == GetManyRequest.Token)
            {
                return(GetManyRequest.CreateAndRead(domain, requestReader));
            }
            else if (token == PostResponse.Token)
            {
                return(PostRequest.CreateAndRead(domain, requestReader));
            }
            else if (token == WindowsSubscribeRequest.Token)
            {
                return(WindowsSubscribeRequest.CreateAndRead(domain, requestReader));
            }
            else if (token == WindowsUnsubscribeRequest.Token)
            {
                return(WindowsUnsubscribeRequest.CreateAndRead(domain, requestReader));
            }
            else if (token == InterruptRequest.Token)
            {
                return(InterruptRequest.CreateAndRead(domain, requestReader));
            }
            else if (token == NotifyRequest.Token)
            {
                return(NotifyRequest.CreateAndRead(domain, requestReader));
            }
            else
            {
                throw new CorrespondenceException(String.Format("Unknown token {0}.", token));
            }
        }
 public static InterruptRequest CreateAndRead(string domain, BinaryReader requestReader)
 {
     InterruptRequest request = new InterruptRequest();
     request.ReadInternal(domain, requestReader);
     return request;
 }