Пример #1
0
 void chromeListener_ChromeEvent(ChromeNetworkEvent message)
 {
     if (ChromeEvent != null)
     {
         ChromeEvent(message);
     }
 }
Пример #2
0
        void adb_ChromeEvent(ChromeNetworkEvent message)
        {
            // parse the chrome event
            Action a = () =>
            {
                string scheme = message.parameters.request.uri.Scheme;
                try
                {
                    if (scheme == "file")
                    {
                        FileViewModel fileRequest = new FileViewModel(message, FileSystem.Files.Source.Count);
                        FileSystem.Files.Source.Add(fileRequest);
                    }
                    else if (scheme == "http" || scheme == "https")
                    {
                        WebRequestViewModel webRequest = new WebRequestViewModel(message, Web.Requests.Source.Count);
                        Web.Requests.Source.Add(webRequest);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error-" + ex.Message);
                }
            };

            a.BeginInvoke(DispatcherHelper.UIDispatcher);
        }
Пример #3
0
 void webSocket_MessageReceived(object sender, WebSocket4Net.MessageReceivedEventArgs e)
 {
     if (ChromeEvent != null)
     {
         ChromeNetworkEvent networkEvent = JsonConvert.DeserializeObject <ChromeNetworkEvent>(e.Message);
         if (networkEvent.method == "Network.requestWillBeSent")
         {
             ChromeEvent(networkEvent);
         }
     }
 }
Пример #4
0
 public FileViewModel(ChromeNetworkEvent networkEvent, int eventId)
 {
     try
     {
         _Path  = networkEvent.parameters.request.uri.AbsolutePath;
         _Mode  = "write";
         _Event = eventId;
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Cannot parse File Access: " + ex.Message);
     }
 }
Пример #5
0
 public WebRequestViewModel(ChromeNetworkEvent networkEvent, int eventId)
 {
     try
     {
         _Host        = String.Format("{0}://{1}", networkEvent.parameters.request.uri.Scheme, networkEvent.parameters.request.uri.Host);
         _Headers     = networkEvent.parameters.request.HeaderString;
         _URL         = networkEvent.parameters.request.url;
         _RequestLine = String.Format("{0} {1} HTTP/1.1", networkEvent.parameters.request.method, networkEvent.parameters.request.uri.PathAndQuery);
         _PostData    = networkEvent.parameters.request.postData;
         _Event       = eventId;
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Cannot parse request: " + ex.Message);
     }
 }