public ProtobufReqInspector()
     : base(true)
 {
     if (!ProtobufHelper.LoadDefault())
     {
     }
 }
 protected override void UpdateView(Session oS)
 {
     if (this._headers != null)
     {
         this._encoding = Utilities.getEntityBodyEncoding(_headers, oS.RequestBody);
     }
     else
     {
         _encoding = CONFIG.oHeaderEncoding;
     }
     if (!Utilities.IsNullOrEmpty(oS.RequestBody))
     {
         if (_headers != null)
         {
             string boundary = Utilities.GetCommaTokenValue(_headers["Content-Type"], "boundary");
             if (!string.IsNullOrWhiteSpace(boundary))
             {
                 //var binData = GetRequestData(bodyString, boundary);
                 var binData    = GetBodyData(oS.RequestBody, boundary);
                 var protocData = ProtobufHelper.Decode(oS.oRequest.headers.RequestPath, true, binData);
                 UpdateView(protocData);
             }
         }
     }
 }
 public ProtobufInspector(bool isReq = true)
 {
     _view = new ProtobufView(isReq);
     Views.Add(_view);
     ProtobufHelper.LoadDefault();
     _view.UpdateProtoDirectory(ProtobufHelper.ProtoDirectory);
     _view.UpdateMessageTypes(ProtobufHelper.ProtoTypes);
     _view.ProtoDirectoryChanged += ProtoDirectoryChanged;
     _view.ProtoMapChanged       += ProtoMapChanged;
 }
 private void ProtoDirectoryChanged(object sender, ProtoDirectoryChangeArgs protoDirectoryChangeArgs)
 {
     if (ProtobufHelper.LoadDirectory(protoDirectoryChangeArgs.Directory))
     {
         foreach (var view in Views)
         {
             view.UpdateProtoDirectory(protoDirectoryChangeArgs.Directory);
             view.UpdateMessageTypes(ProtobufHelper.ProtoTypes);
             view.UpdateSelectMsgType();
         }
     }
 }
        private void ProtoMapChanged(object sender, ProtoMapChangeArgs protoMapChangeArgs)
        {
            var findItem =
                ProtobufHelper.ProtoItems.FirstOrDefault(protoItem => protoItem.Value.Contains(protoMapChangeArgs.MessageTyp));

            if (findItem.Value == null)
            {
                return;
            }
            ProtocolItem protocolItem = new ProtocolItem()
            {
                ProtoFile   = findItem.Key,
                MessageType = protoMapChangeArgs.MessageTyp
            };

            ProtobufHelper.UpdateItem(protocolItem, protoMapChangeArgs.URL, protoMapChangeArgs.IsReq);
        }
Exemple #6
0
        public void UpdateSelectMsgType()
        {
            if (_session == null)
            {
                return;
            }
            var item = ProtobufHelper.FindItem(_session.oRequest.headers.RequestPath, _isReqWindow);

            if (item == null)
            {
                return;
            }
            if (cmbMsgType.Items.Contains(item.MessageType))
            {
                cmbMsgType.SelectedItem = item.MessageType;
            }
        }
        protected override void UpdateView(Session oS)
        {
            var msgMap = ProtobufHelper.Decode(Session.oRequest.headers.RequestPath, false, body);

            UpdateView(msgMap);
        }