public async Task Update(long nodeid) { var dom = await CustomCrawlerDynamics.ss.SendAsync(new GetDocumentCommand()); var nn = await CustomCrawlerDynamics.ss.SendAsync(new PushNodesByBackendIdsToFrontendCommand { BackendNodeIds = new long[] { nodeid } }); var mm = await CustomCrawlerDynamics.ss.SendAsync(new GetNodeStackTracesCommand { NodeId = nn.Result.NodeIds[0] }); var stack = mm.Result.Creation; if (stack != null) { var depth = 0; var paragraph = new Paragraph(); while (stack != null) { if (!string.IsNullOrEmpty(stack.Description)) { paragraph.Inlines.Add("Description: " + stack.Description + "\r\n"); } if (depth < 5) { var frames = stack.CallFrames.ToList().Where(frame => !CustomCrawlerDynamics.ignore_js(frame.Url)).ToList(); var picks = new List <(CallFrame, int, int, int)> [frames.Count];
public CustomCrawlerDynamicsHover(CustomCrawlerDynamics parent) { InitializeComponent(); this.parent = parent; Loaded += CustomCrawlerDynamicsHover_Loaded; Closed += CustomCrawlerDynamicsHover_Closed; }
public CustomCrawlerDynamicsRequest(IChromeSession env, CustomCrawlerDynamics parent) { InitializeComponent(); this.parent = parent; RequestList.DataContext = new CustomCrawlerDynamicsRequestDataGridViewModel(); RequestList.Sorting += new DataGridSortingEventHandler(new DataGridSorter <CustomCrawlerDynamicsRequestDataGridItemViewModel>(RequestList).SortHandler); env.Subscribe <RequestWillBeSentEvent>(x => { Task.Run(() => parent.add_request_info(x)); Application.Current.Dispatcher.BeginInvoke(new Action( delegate { (RequestList.DataContext as CustomCrawlerDynamicsRequestDataGridViewModel).Items.Add(new CustomCrawlerDynamicsRequestDataGridItemViewModel { Id = (++index_count).ToString(), Type = "Request", Url = x.Request.Url, ContentType = x.Type.ToString(), Request = x }); })); }); env.Subscribe <ResponseReceivedEvent>(x => { Task.Run(() => parent.add_response_info(x)); Application.Current.Dispatcher.BeginInvoke(new Action( delegate { (RequestList.DataContext as CustomCrawlerDynamicsRequestDataGridViewModel).Items.Add(new CustomCrawlerDynamicsRequestDataGridItemViewModel { Id = (++index_count).ToString(), Type = "Response", Url = x.Response.Url, ContentType = x.Type.ToString(), Response = x }); })); }); env.Subscribe <DocumentUpdatedEvent>(x => { Application.Current.Dispatcher.BeginInvoke(new Action( delegate { (RequestList.DataContext as CustomCrawlerDynamicsRequestDataGridViewModel).Items.Add(new CustomCrawlerDynamicsRequestDataGridItemViewModel { Id = (++index_count).ToString(), Type = "DocumentUpdated", }); })); }); env.Subscribe <ChildNodeInsertedEvent>(x => { Application.Current.Dispatcher.BeginInvoke(new Action( delegate { (RequestList.DataContext as CustomCrawlerDynamicsRequestDataGridViewModel).Items.Add(new CustomCrawlerDynamicsRequestDataGridItemViewModel { Id = (++index_count).ToString(), Type = "ChildNodeInserted", Url = $"{x.Node.NodeName}" }); })); }); env.Subscribe <ScriptParsedEvent>(async x => { _ = Task.Run(() => parent.add_script_info(x)); if (x.Url == "") { var pos = ""; if (x.StackTrace != null) { pos = $"{x.StackTrace.CallFrames[0].Url}:<{x.StackTrace.CallFrames[0].FunctionName}>:{x.StackTrace.CallFrames[0].LineNumber + 1}:{x.StackTrace.CallFrames[0].ColumnNumber + 1}"; // Cannot get the script code later. var src_snippet = await CustomCrawlerDynamics.ss.SendAsync(new GetScriptSourceCommand { ScriptId = x.ScriptId }); var src_code = ""; if (src_snippet.Result != null) { src_code = $"/* this code is generated from {pos} */\r\n"; src_code += src_snippet.Result.ScriptSource; } await Application.Current.Dispatcher.BeginInvoke(new Action( delegate { (RequestList.DataContext as CustomCrawlerDynamicsRequestDataGridViewModel).Items.Add(new CustomCrawlerDynamicsRequestDataGridItemViewModel { Id = (++index_count).ToString(), Type = "AnonymouseParsed", Url = pos, AnonymouseCode = src_code, AnonymouseSource = x.StackTrace.CallFrames[0] }); })); } } }); //Closed += (s, e) => //{ // env.Dispose(); //}; }