Exemple #1
0
        private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
        {
            HttpWebRequest webRequest = (HttpWebRequest)asynchronousResult.AsyncState;
            // End the stream request operation
            System.IO.Stream postStream = webRequest.EndGetRequestStream(asynchronousResult);

            PCOSMsgRegister pcosmsgRegister = new PCOSMsgRegister(this.RegistrationID, this.PEMPublicKey);
            //PCOSMsgRegister pcosmsgRegister = new PCOSMsgRegister(this.RegistrationID, this.DERPublicKey);

            // Add the post data to the web request
            postStream.Write(pcosmsgRegister.Bytes, 0, pcosmsgRegister.Bytes.Length);
            postStream.Close();

            // Start the web request
            webRequest.BeginGetResponse(new AsyncCallback(GetResponseCallback), webRequest);
        }
        public static PCOSMsgRegister Parse(ArraySegment<byte> raw)
        {
            PCOSMsgRegister reg = new PCOSMsgRegister();

            reg.ParseHeader(raw);
            reg.ParseMessageBlock(raw);

            if (reg.MessageBlocks.Count > 0)
            {
            }

            return reg;
        }