protected void OnCompleted(ProxyEventArgs args) { if (m_Completed != null) { m_Completed(this, args); } }
private void ProxyEvents_onCompleted(ProxyEventArgs evt) { var response = evt.ProxyParams.Contents["response"] as Response; if (response == null) { return; } // we need content-encoding (in case server refuses to serve it in plain text) // content-length: final size of content sent to user may change via plugins, so it makes no sense to send old content-length var forwardHeaders = new List <string> { "content-type", "zzzcontent-length", "accept-ranges", "content-range", "content-disposition", "location", "set-cookie" }; NameValueCollection col = new NameValueCollection(); foreach (string responseHeader in response.Headers) { col.Add(responseHeader.ToLowerInvariant(), response.Headers[responseHeader]); } foreach (string forwardHeader in response.Headers) { if (forwardHeaders.IndexOf(forwardHeader) == -1) { col.Remove(forwardHeader); } } response.Headers = col; response.Headers.Set("cache-control", "no-cache, no-store, must-revalidate"); response.Headers.Set("pragma", "no-cache"); response.Headers.Set("expires", "0"); }
private void GetConceptByCodeSystemCodeCompleted(object sender, ProxyEventArgs e) { if (e.Exception == null) { var results = e.LoadResult <TerminologyConcept> (); if (results != null) { SearchResults = results; } else { _userDialogService .ShowDialog( "Unable to find a concept with a matching Code System Code", "No results found", UserDialogServiceOptions.Ok); } } else { _userDialogService.ShowDialog( "An error occurred when retrieving the Terminology Concept. Error: " + e.Exception.Message, "An error has occurred", UserDialogServiceOptions.Ok); } }
private void GetConceptByCodeSystemCodeCompleted(object sender, ProxyEventArgs e) { if (e.Exception == null) { var result = e.LoadResult <TerminologyConcept> (); if (result != null) { ChangeSearchState( SearchState.AdvancedSearchFoundState, new PagedCollectionView(MapTerminolgyConceptsToSearchResult(new List <TerminologyConcept> { result })), 1, 100, 1); } else { ChangeSearchState(SearchState.AdvancedSearchNotFoundState, null); } } else { _userDialogService.ShowDialog(e.Exception.Message, "Search Failed", UserDialogServiceOptions.Ok); } }
private void ProxyEvents_onCompleted(ProxyEventArgs evt) { var response = evt.ProxyParams.Contents["response"] as Response; var contentType = response.Headers.Get("content-type"); if (_doNotTouch.Any(v => v.Equals(contentType))) { return; } var str = response.Content; const string iframePattern = @"<iframe[^>]*>[^<]*<\\/iframe>"; str = Regex.Replace(str, iframePattern, "", RegexOptions.IgnoreCase | RegexOptions.Multiline); str = ProxifyHead(str); str = ProxifyCss(str); const string htmlAttrPattern = @"(?:src|href)\s*=\s*(["" |\'])(.*?)\1"; str = Regex.Replace(str, htmlAttrPattern, CallBackHtmlAttr, RegexOptions.IgnoreCase | RegexOptions.Multiline); const string formAction = @"<form[^>]*action=([""\'])(.*?)\1[^>]*>"; str = Regex.Replace(str, formAction, CallBackFormAction, RegexOptions.IgnoreCase); response.Content = str; }
// Token: 0x0600091C RID: 2332 RVA: 0x000070E9 File Offset: 0x000052E9 protected void OnCompleted(ProxyEventArgs args) { if (this.m_Completed == null) { return; } this.m_Completed(this, args); }
private void ProxyErrorOccured(object sender, ProxyEventArgs args) { this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { this.MessageLabel.Text = "Proxy Error (" + args.StatusCode + ") occured:" + args.Message; this.P2PEditor.GuiLogMessage(this.MessageLabel.Text.ToString(), NotificationLevel.Error); this.MessageLabel.Visibility = Visibility.Visible; }, null); }
private void OnBeforeExecute(ProxyEventArgs proxyEventArgs) { if (BeforeExecute != null) { if (_filter(proxyEventArgs)) { BeforeExecute(this, proxyEventArgs); } } }
private void OnAfterExecute(ProxyEventArgs methodInfo) { if (AfterExecute != null) { if (_filter(methodInfo)) { AfterExecute(this, methodInfo); } } }
private void OnErrorExecuting(ProxyEventArgs methodInfo) { if (ErrorExecuting != null) { if (_filter(methodInfo)) { ErrorExecuting(this, methodInfo); } } }
private void ProxyEvents_onCompleted(ProxyEventArgs evt) { var response = evt.ProxyParams.Contents["response"] as Response; var contentType = Helper.CleanContentType(response.Headers.Get("content-type") ?? ""); var contentLen = response.Headers.Get("content-length"); var cLen = 0; int.TryParse(contentLen, out cLen); evt.Handled = !string.IsNullOrWhiteSpace(contentType) && (Array.IndexOf(_outputBufferTypes, contentType) == -1 || cLen > MaxContentLen); }
private void ProxyEvent(object sender, ProxyEventArgs e) { foreach (User user in e.GetList()) { users.Add(user); UserEnter?.Invoke(this, new ChatEventArgs { User = user }); } }
private static void ProxyEvent(object sender, ProxyEventArgs e) { foreach (User user in e.GetList()) { if (user.Name != User.AutoExporterServiceName) { users.Add(user); UserEnter?.Invoke(null, new ChatEventArgs(user)); } } }
/* * public void treeWindow_AfterSelect(object sender, TreeViewEventArgs e) * { * var targetObject = this.treeWindow.SelectedNode.Tag; * * if (targetObject is Process) * { * var process = (Process)targetObject; * tsHookProcess.Enabled = true; * tsButtonStartStop.Enabled = false; * this.ModulesList.clear().add_Nodes(process.Modules.toList<ProcessModule>().Select((m)=>m.ModuleName)); * } * if (targetObject is ControlProxy) * { * tsButtonStartStop.Enabled = false; * tsButtonStartStop.Enabled = true; * } * * * this.propertyGrid.SelectedObject = targetObject; * * this.toolStripStatusLabel1.Text = treeWindow.SelectedNode.Text; * * StopLogging(); * //this.eventGrid.Rows.Clear(); * StartLogging(); * }*/ /// <summary> /// This is called when the selected ControlProxy raises an event /// </summary> public void ProxyEventFired(object sender, ProxyEventArgs args) { try { eventGrid.FirstDisplayedScrollingRowIndex = this.eventGrid.Rows.Add(new object[] { args.eventDescriptor.Name, args.eventArgs.ToString() }); } catch (Exception ex) { ex.log(); } }
private void ProxyEventsOnBeforeRequest(ProxyEventArgs evt) { var request = evt.ProxyParams.Contents["request"] as Request; if (request == null) { return; } request.Headers.Remove("connection"); request.Headers.Set("accept-encoding", "identity"); // // tell target website that we only accept plain text without any transformations request.Headers.Remove("referer"); // mask proxy referer }
void Proxy_Completed(object sender, ProxyEventArgs e) { Proxy.Completed -= new EventHandler <ProxyEventArgs>(Proxy_Completed); if (e.Connected) { ProcessConnect(e.Socket, null, null); return; } OnError(new Exception("proxy error", e.Exception)); m_InConnecting = false; }
private void ProxyEvents_onBeforeRequest(ProxyEventArgs evt) { var request = evt.ProxyParams.Contents["request"] as Request; if (string.IsNullOrEmpty(request.Post["convertGET"])) { return; } request.Post.Remove("convertGET"); foreach (string o in request.Post) { request.Get.Set(o, request.Post[o]); } request.Post.Clear(); request.Method = HttpMethod.Get; }
private void GetVocabularyListCompleted(object sender, ProxyEventArgs e) { if (e.Exception == null) { var list = e.LoadResult <ObservableCollection <TerminologyVocabulary> > (); var snomed = list.Where(n => n.BusinessCode == "SNOMED").FirstOrDefault(); Namespaces = list; SelectedNamespace = snomed; } else { _userDialogService .ShowDialog(e.Exception.Message, "Could not retrieve the Vocabulary List", UserDialogServiceOptions.Ok); } }
void Proxy_Completed(object sender, ProxyEventArgs e) { Proxy.Completed -= Proxy_Completed; if (e.Connected) { SocketAsyncEventArgs se = null; if (e.TargetHostName != null) { se = new SocketAsyncEventArgs(); se.RemoteEndPoint = new DnsEndPoint(e.TargetHostName, 0); } ProcessConnect(e.Socket, null, se, null); return; } OnError(new Exception("proxy error", e.Exception)); m_InConnecting = false; }
public void TestMatchSecondTime() { var server = CreateSimplyRespond(Encoding.ASCII.GetBytes("OK")); var proxyServer = CreateSimplyRespond(Encoding.ASCII.GetBytes("OK")); ManualResetEvent wait = new ManualResetEvent(false); var proxy = new HttpConnectProxy(proxyServer.LocalEndPoint); ProxyEventArgs eventArgs = null; proxy.Completed += (a, e) => { eventArgs = e; wait.Set(); }; proxy.Connect(server.LocalEndPoint); Assert.True(wait.WaitOne(5000)); Assert.Null(eventArgs.Exception); Assert.True(eventArgs.Connected); }
private void HandleProxy(ProxyEventArgs args) { if (!Deployment.Current.Dispatcher.CheckAccess()) { Deployment.Current.Dispatcher.BeginInvoke(() => HandleProxy(args)); return; } HidePogressIndicator(); if (args.Code == HttpStatusCode.OK) { PushDataToModel(args.Response); } else if (args.Code == HttpStatusCode.Unused) { MessageBox.Show(Resource.message_Exception, Resource.hint, MessageBoxButton.OK); } else { MessageBox.Show(Resource.message_WebExeption, Resource.hint, MessageBoxButton.OK); } }
private void FindConceptsWithNameMatchingCompleted(object sender, ProxyEventArgs e) { if (e.Exception == null) { var result = e.LoadResult <ObservableCollection <TerminologyConcept> > (); if (result != null) { if (result.Count > 0) { ChangeSearchState( SearchState.QuickSearchFoundState, new PagedCollectionView(MapTerminolgyConceptsToSearchResult(result)), 1, 100, result.Count); } else { ChangeSearchState( SearchState.QuickSearchNotFoundState, new PagedCollectionView(MapTerminolgyConceptsToSearchResult(result)), 1, 100, result.Count); } } else { ChangeSearchState(SearchState.QuickSearchNotFoundState, null); } } else { _userDialogService.ShowDialog(e.Exception.Message, "Search Failed", UserDialogServiceOptions.Ok); } }
private void GetVocabularyListCompleted(object sender, ProxyEventArgs e) { if (e.Exception == null) { var results = e.LoadResult <ObservableCollection <TerminologyVocabulary> > (); if (results != null) { _namspace = results.FirstOrDefault(tv => tv.BusinessCode == _namespaceToUse); if (_namspace == null) { throw new Exception("Dts Vocabulary not found."); } (ManualSearchCommand as DelegateCommand).RaiseCanExecuteChanged(); } } else { _userDialogService.ShowDialog( "An error occurred when retrieving the Terminology Vocabularies. Error: " + e.Exception.Message, "An error has occurred", UserDialogServiceOptions.Ok); } }
private void Proxy_Completed(object sender, ProxyEventArgs e) { string str; this.Proxy.Completed -= new EventHandler <ProxyEventArgs>(this.Proxy_Completed); this.ProxyConnected = e.Connected; string targetHostName = e.TargetHostName; Exception exception = e.Exception; if (exception != null) { str = exception.ToString(); } else { str = null; } Debug.WriteLine(string.Concat("Proxy_Completed ", targetHostName, " ", str)); if (e.Connected) { this.Socket = e.Socket; } this.WaitRes.Set(); }
// called when the user logs in void Lobby_ProxyEvent(object sender, ProxyEventArgs e) { // when this method gets called, it's usually not by the UI thread. // this codeblock ensures the correct thread is used if (!this.Dispatcher.CheckAccess()) { this.Dispatcher.BeginInvoke( DispatcherPriority.Normal, new ProxySingletonProxyEventDelegate(Lobby_ProxyEvent), sender, new object[] { e }); return; } }
private void GetVocabularyListCompleted( object sender, ProxyEventArgs e ) { if ( e.Exception == null ) { var list = e.LoadResult<ObservableCollection<TerminologyVocabulary>> (); var snomed = list.Where ( n => n.BusinessCode == "SNOMED" ).FirstOrDefault (); Namespaces = list; SelectedNamespace = snomed; } else { _userDialogService .ShowDialog ( e.Exception.Message, "Could not retrieve the Vocabulary List", UserDialogServiceOptions.Ok ); } }
private void FindConceptsWithNameMatchingCompleted( object sender, ProxyEventArgs e ) { SearchResults = e.LoadResult<ObservableCollection<TerminologyConcept>> (); }
private void GetVocabularyListCompleted( object sender, ProxyEventArgs e ) { if ( e.Exception == null ) { var results = e.LoadResult<ObservableCollection<TerminologyVocabulary>> (); if ( results != null ) { _namspace = results.FirstOrDefault ( tv => tv.BusinessCode == _namespaceToUse ); if ( _namspace == null ) { throw new Exception ( "Dts Vocabulary not found." ); } ( ManualSearchCommand as DelegateCommand ).RaiseCanExecuteChanged (); } } else { _userDialogService.ShowDialog ( "An error occurred when retrieving the Terminology Vocabularies. Error: " + e.Exception.Message, "An error has occurred", UserDialogServiceOptions.Ok ); } }
/// <summary> /// This is called when the selected ControlProxy raises an event /// </summary> private void ProxyEventFired(object sender, ProxyEventArgs args) { eventGrid.FirstDisplayedScrollingRowIndex = this.eventGrid.Rows.Add(new object[] { args.eventDescriptor.Name, args.eventArgs.ToString() }); }
/* public void treeWindow_AfterSelect(object sender, TreeViewEventArgs e) { var targetObject = this.treeWindow.SelectedNode.Tag; if (targetObject is Process) { var process = (Process)targetObject; tsHookProcess.Enabled = true; tsButtonStartStop.Enabled = false; this.ModulesList.clear().add_Nodes(process.Modules.toList<ProcessModule>().Select((m)=>m.ModuleName)); } if (targetObject is ControlProxy) { tsButtonStartStop.Enabled = false; tsButtonStartStop.Enabled = true; } this.propertyGrid.SelectedObject = targetObject; this.toolStripStatusLabel1.Text = treeWindow.SelectedNode.Text; StopLogging(); //this.eventGrid.Rows.Clear(); StartLogging(); }*/ /// <summary> /// This is called when the selected ControlProxy raises an event /// </summary> public void ProxyEventFired(object sender, ProxyEventArgs args) { try { eventGrid.FirstDisplayedScrollingRowIndex = this.eventGrid.Rows.Add(new object[] { args.eventDescriptor.Name, args.eventArgs.ToString() }); } catch (Exception ex) { ex.log(); } }
private void FindConceptsWithNameMatchingCompleted( object sender, ProxyEventArgs e ) { if ( e.Exception == null ) { var result = e.LoadResult<ObservableCollection<TerminologyConcept>> (); if ( result != null ) { if ( result.Count > 0 ) { ChangeSearchState ( SearchState.QuickSearchFoundState, new PagedCollectionView ( MapTerminolgyConceptsToSearchResult ( result ) ), 1, 100, result.Count ); } else { ChangeSearchState ( SearchState.QuickSearchNotFoundState, new PagedCollectionView ( MapTerminolgyConceptsToSearchResult ( result ) ), 1, 100, result.Count ); } } else { ChangeSearchState ( SearchState.QuickSearchNotFoundState, null ); } } else { _userDialogService.ShowDialog ( e.Exception.Message, "Search Failed", UserDialogServiceOptions.Ok ); } }
private void GetConceptByCodeSystemCodeCompleted( object sender, ProxyEventArgs e ) { if ( e.Exception == null ) { var result = e.LoadResult<TerminologyConcept> (); if ( result != null ) { ChangeSearchState ( SearchState.AdvancedSearchFoundState, new PagedCollectionView ( MapTerminolgyConceptsToSearchResult ( new List<TerminologyConcept> { result } ) ), 1, 100, 1 ); } else { ChangeSearchState ( SearchState.AdvancedSearchNotFoundState, null ); } } else { _userDialogService.ShowDialog ( e.Exception.Message, "Search Failed", UserDialogServiceOptions.Ok ); } }
private void FindConceptsWithNameMatchingCompleted(object sender, ProxyEventArgs e) { SearchResults = e.LoadResult <ObservableCollection <TerminologyConcept> > (); }
private void ProxyErrorOccured(object sender, ProxyEventArgs args) { LogMessage(String.Format(Properties.Resources.Proxy_Error_occured_, args.StatusCode, args.Message), true); }
void ProxySingleton_ProxyEvent(object sender, ProxyEventArgs e) { throw new Exception("The method or operation is not implemented."); }
/// <summary> /// This is called when the selected ControlProxy raises an event /// </summary> private void ProxyEventFired(object sender, ProxyEventArgs args) { eventGrid.FirstDisplayedScrollingRowIndex = this.eventGrid.Rows.Add(new object[] { args.eventDescriptor.Name, args.eventArgs.ToString() }); }
void Instance_ProxyEvent(object sender, ProxyEventArgs e) { if (e.lobby != null) { OnLobbyJoined(e.lobby); } else { lblCreateAccount.Content = "Login failed"; } }