Beispiel #1
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);
        }
Beispiel #2
0
        private void ParseXML(string xml)
        {
            Action a = () =>
            {
                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);
                    //Debug.WriteLine(xml);

                    if (doc.SelectSingleNode("//type").InnerText.ToString() == "request")
                    {
                        if (!xml.Contains("<host></host>"))
                        {
                            WebRequestViewModel webRequest = new WebRequestViewModel(doc, Web.Requests.Source.Count);
                            Web.Requests.Source.Add(webRequest);
                        }
                    }
                    else if (doc.SelectSingleNode("//type").InnerText.ToString() == "fileaccess")
                    {
                        FileViewModel fileView = new FileViewModel(doc, FileSystem.Files.Source.Count);
                        FileSystem.Files.Source.Add(fileView);
                    }
                    else if (doc.SelectSingleNode("//type").InnerText.ToString() == "sqlite")
                    {
                        TransactionViewModel transaction = new TransactionViewModel(doc, Database.Transactions.Source.Count);
                        Database.Transactions.Source.Add(transaction);
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Error: " + ex.Message);
                    //MessageBox.Show("Error: " + ex.Message);
                }
            };

            a.BeginInvoke(DispatcherHelper.UIDispatcher);
        }