コード例 #1
0
        private void bnDecodeAs_Click(object sender, EventArgs e)
        {
            this.MessageType = (string)cbType.SelectedItem;
            this.ProtoFile   = txtProtoFile.Text;

            this.Data = ProtoBufUtil.DecodeWithProto(this.ProtobufBytes, this.MessageType, this.ProtoFile);
        }
コード例 #2
0
        public byte[] Encode()
        {
            if (string.IsNullOrEmpty(ProtoFile) || string.IsNullOrEmpty(MessageType))
            {
                return(ProtobufBytes);
            }

            // try to encode using these things...

            return(ProtoBufUtil.EncodeWithProto(Data, MessageType, ProtoFile));
        }
コード例 #3
0
        void bnDecodeAs_Click(object sender, EventArgs e)
        {
            MessageType = (string)cbType.SelectedItem;
            ProtoFile   = txtProtoFile.Text;

            if (!string.IsNullOrWhiteSpace(ProtoFile) &&
                !string.IsNullOrWhiteSpace(MessageType))
            {
                Data = ProtoBufUtil.DecodeWithProto(ProtobufBytes, MessageType, ProtoFile);
            }

            ProtoMiddlerState.Serialize(this);
        }
コード例 #4
0
        public override void AssignSession(Session oSession)
        {
            byte[] protobufBytes = null;

            if (oSession.oRequest["Content-Type"].ToLower().Contains("protobuf"))
            {
                protobufBytes = oSession.requestBodyBytes;

                _entityBody              = protobufBytes;
                _myControl.Data          = ProtoBufUtil.DecodeRaw(protobufBytes);
                _myControl.ProtobufBytes = protobufBytes;
            }
            else
            {
                _myControl.Data = "NA";  // oSession.requestBodyBytes
            }
        }