public static WindowsUnsubscribeRequest CreateAndRead(string domain, BinaryReader requestReader) { WindowsUnsubscribeRequest request = new WindowsUnsubscribeRequest(); request.ReadInternal(domain, requestReader); return(request); }
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)); } }