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); }
public byte[] Encode() { if (string.IsNullOrEmpty(ProtoFile) || string.IsNullOrEmpty(MessageType)) { return(ProtobufBytes); } // try to encode using these things... return(ProtoBufUtil.EncodeWithProto(Data, MessageType, ProtoFile)); }
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); }
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 } }