• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SessionEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SessionEventArgs的典型用法代码示例。如果您正苦于以下问题:C# SessionEventArgs类的具体用法?C# SessionEventArgs怎么用?C# SessionEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SessionEventArgs类属于命名空间,在下文中一共展示了SessionEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnRequest

        //Test On Request, intecept requests
        //Read browser URL send back to proxy by the injection script in OnResponse event
        public void OnRequest(object sender, SessionEventArgs e)
        {
            Console.WriteLine(e.ProxySession.Request.Url);

            ////read request headers
            //var requestHeaders = e.ProxySession.Request.RequestHeaders;

            //if ((e.RequestMethod.ToUpper() == "POST" || e.RequestMethod.ToUpper() == "PUT"))
            //{
            //    //Get/Set request body bytes
            //    byte[] bodyBytes = e.GetRequestBody();
            //    e.SetRequestBody(bodyBytes);

            //    //Get/Set request body as string
            //    string bodyString = e.GetRequestBodyAsString();
            //    e.SetRequestBodyString(bodyString);

            //}

            ////To cancel a request with a custom HTML content
            ////Filter URL

            //if (e.ProxySession.Request.RequestUrl.Contains("google.com"))
            //{
            //    e.Ok("<!DOCTYPE html><html><body><h1>Website Blocked</h1><p>Blocked by titanium web proxy.</p></body></html>");
            //}
        }
开发者ID:aprilix,项目名称:Titanium-Web-Proxy,代码行数:29,代码来源:ProxyTestController.cs


示例2: session_PlayTokenLost

 void session_PlayTokenLost(ISession sender, SessionEventArgs e)
 {
     this.ParentForm.BeginInvoke(new MethodInvoker(delegate()
         {
             CF_displayMessage("Play token lost! What do we do???" + Environment.NewLine + e.Status.ToString() + Environment.NewLine + e.Message);
         }));
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:7,代码来源:Spotify.Session.cs


示例3: session_MessageToUser

 void session_MessageToUser(ISession sender, SessionEventArgs e)
 {
     this.ParentForm.BeginInvoke(new MethodInvoker(delegate()
         {
             CF_displayMessage(e.Message);
         }));
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:7,代码来源:Spotify.Session.cs


示例4: session_Exception

 void session_Exception(ISession sender, SessionEventArgs e)
 {
     this.ParentForm.BeginInvoke(new MethodInvoker(delegate()
         {
             WriteError(e.Message);
             CF_displayMessage(e.Status.ToString() + Environment.NewLine + e.Message);
         }));
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:8,代码来源:Spotify.Session.cs


示例5: Session

        public void Session()
        {
            Mocks mocks = new Mocks();

            SessionEventArgs s = new SessionEventArgs(mocks.Session.Object);

            Assert.Equal(s.Session, mocks.Session.Object);
        }
开发者ID:rnwood,项目名称:smtp4dev,代码行数:8,代码来源:SessionEventArgsTests.cs


示例6: OnConnectionError

 private void OnConnectionError(object sender, SessionEventArgs e)
 {
     if (e.Status != Error.OK)
     {
         _logger.Log("Connection error " + e.Message + "[" + e.Status + "]", Category.Exception, Priority.High);
     }
     else
     {
         _logger.Log("Connected", Category.Info, Priority.Low);
     }
 }
开发者ID:krikelin,项目名称:torshify-client,代码行数:11,代码来源:SpotifyLogging.cs


示例7: session_LoginComplete

 void session_LoginComplete(ISession sender, SessionEventArgs e)
 {
     this.ParentForm.BeginInvoke(new MethodInvoker(() =>
         {
             if (e.Status != sp_error.OK)
             {
                 CF_displayMessage("Login Failed: " + e.Status + Environment.NewLine + e.Message);
             }
             else
             {
                 OnLoginComplete();
             }
         }));
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:14,代码来源:Spotify.Session.cs


示例8: OnResponse

        //Test script injection
        //Insert script to read the Browser URL and send it back to proxy
        public void OnResponse(object sender, SessionEventArgs e)
        {
            ////read response headers
               // var responseHeaders = e.ProxySession.Response.ResponseHeaders;

            //if (!e.ProxySession.Request.Hostname.Equals("medeczane.sgk.gov.tr")) return;
            //if (e.RequestMethod == "GET" || e.RequestMethod == "POST")
            //{
            //    if (e.ProxySession.Response.ResponseStatusCode == "200")
            //    {
            //        if (e.ProxySession.Response.ContentType.Trim().ToLower().Contains("text/html"))
            //        {
            //            string body = e.GetResponseBodyAsString();
            //        }
            //    }
            //}
        }
开发者ID:aprilix,项目名称:Titanium-Web-Proxy,代码行数:19,代码来源:ProxyTestController.cs


示例9: Dispose

        private static void Dispose(TcpClient client, Stream clientStream, CustomBinaryReader clientStreamReader, StreamWriter clientStreamWriter, SessionEventArgs args)
        {
            if (args != null)
                args.Dispose();

            if (clientStreamReader != null)
                clientStreamReader.Dispose();

            if (clientStreamWriter != null)
                clientStreamWriter.Dispose();

            if (clientStream != null)
                clientStream.Dispose();

            if (client != null)
                client.Close();
        }
开发者ID:amitla,项目名称:Titanium,代码行数:17,代码来源:ResponseHandler.cs


示例10: OnSessionStopPlayback

 private void OnSessionStopPlayback(object sender, SessionEventArgs e)
 {
     _logger.Log("Session - Stop playback recevied", Category.Info, Priority.Low);
 }
开发者ID:krikelin,项目名称:torshify-client,代码行数:4,代码来源:PlayerController.cs


示例11: session_ConnectionError

 void session_ConnectionError(ISession sender, SessionEventArgs e)
 {
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:3,代码来源:Spotify.Session.cs


示例12: OnSessionEndOfTrack

 private void OnSessionEndOfTrack(object sender, SessionEventArgs e)
 {
     if (Playlist.CanGoNext)
     {
         Playlist.Next();
     }
 }
开发者ID:krikelin,项目名称:torshify-client,代码行数:7,代码来源:PlayerController.cs


示例13: OnSessionPlayerTokenLost

        private void OnSessionPlayerTokenLost(object sender, SessionEventArgs e)
        {
            Pause();

            _eventAggregator
                .GetEvent<NotificationEvent>()
                .Publish(new NotificationMessage("torshify has been paused because your account is used somewhere else"));
        }
开发者ID:krikelin,项目名称:torshify-client,代码行数:8,代码来源:PlayerController.cs


示例14: sessionClosed

 public virtual void sessionClosed(SessionEventArgs e)
 {
 }
开发者ID:BDizzle,项目名称:BeepForNet,代码行数:3,代码来源:SessionAdapter.cs


示例15: UserLoggedOut

 private void UserLoggedOut(object sender, SessionEventArgs e)
 {
     ConsoleEx.WriteLine("Logged out..", ConsoleColor.Yellow);
 }
开发者ID:kms,项目名称:torshify,代码行数:4,代码来源:Program.cs


示例16: OnStopped

 protected void OnStopped(SessionEventArgs e)
 {
     if (Stopped == null)
     {
         return;
     }
     Stopped(this, e);
 }
开发者ID:katasource,项目名称:shironet,代码行数:8,代码来源:AbstractSessionManager.cs


示例17: session_LogoutComplete

 void session_LogoutComplete(ISession sender, SessionEventArgs e)
 {
     loginComplete = false;
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:4,代码来源:Spotify.Session.cs


示例18: HandleHttpSessionResponse

        //Called asynchronously when a request was successfully and we received the response
        private static void HandleHttpSessionResponse(SessionEventArgs args)
        {
            args.ProxySession.ReceiveResponse();

            try
            {

                args.ProxySession.Response.ResponseHeaders = ReadResponseHeaders(args.ProxySession);
                args.ProxySession.Response.ResponseStream = args.ProxySession.ProxyClient.ServerStreamReader.BaseStream;


                if (BeforeResponse != null)
                {
                    args.ProxySession.Response.Encoding = args.ProxySession.GetResponseEncoding();
                    BeforeResponse(null, args);
                }

                args.ProxySession.Response.ResponseLocked = true;

                if (args.ProxySession.Response.ResponseBodyRead)
                {
                    var isChunked = args.ProxySession.Response.IsChunked;
                    var contentEncoding = args.ProxySession.Response.ContentEncoding;

                    if(contentEncoding!=null)
                    switch (contentEncoding)
                    {
                        case "gzip":
                            args.ProxySession.Response.ResponseBody = CompressionHelper.CompressGzip(args.ProxySession.Response.ResponseBody);
                            break;
                        case "deflate":
                            args.ProxySession.Response.ResponseBody = CompressionHelper.CompressDeflate(args.ProxySession.Response.ResponseBody);
                            break;
                        case "zlib":
                            args.ProxySession.Response.ResponseBody = CompressionHelper.CompressZlib(args.ProxySession.Response.ResponseBody);
                            break;
                    }

                    WriteResponseStatus(args.ProxySession.Response.HttpVersion, args.ProxySession.Response.ResponseStatusCode,
                        args.ProxySession.Response.ResponseStatusDescription, args.Client.ClientStreamWriter);
                    WriteResponseHeaders(args.Client.ClientStreamWriter, args.ProxySession.Response.ResponseHeaders, args.ProxySession.Response.ResponseBody.Length,
                        isChunked);
                    WriteResponseBody(args.Client.ClientStream, args.ProxySession.Response.ResponseBody, isChunked);
                }
                else
                {
                    WriteResponseStatus(args.ProxySession.Response.HttpVersion, args.ProxySession.Response.ResponseStatusCode,
                         args.ProxySession.Response.ResponseStatusDescription, args.Client.ClientStreamWriter);
                    WriteResponseHeaders(args.Client.ClientStreamWriter, args.ProxySession.Response.ResponseHeaders);

                    if (args.ProxySession.Response.IsChunked || args.ProxySession.Response.ContentLength > 0)
                        WriteResponseBody(args.ProxySession.ProxyClient.ServerStreamReader, args.Client.ClientStream, args.ProxySession.Response.IsChunked, args.ProxySession.Response.ContentLength);
                }

                args.Client.ClientStream.Flush();

            }
            catch
            {
                Dispose(args.Client.TcpClient, args.Client.ClientStream, args.Client.ClientStreamReader, args.Client.ClientStreamWriter, args);
            }
            finally
            {
                args.Dispose();
            }
        }
开发者ID:davidchiew,项目名称:Titanium-Web-Proxy,代码行数:67,代码来源:ResponseHandler.cs


示例19: session_StreamingError

 void session_StreamingError(ISession sender, SessionEventArgs e)
 {
     this.ParentForm.BeginInvoke(new MethodInvoker(delegate()
         {
             WriteError(e.Message);
             CF_displayMessage("Streaming Error:" + Environment.NewLine + e.Message);
         }));
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:8,代码来源:Spotify.Player.cs


示例20: OnExpired

 protected void OnExpired(SessionEventArgs e)
 {
     if (Expired == null)
     {
         return;
     }
     Expired(this, e);
 }
开发者ID:katasource,项目名称:shironet,代码行数:8,代码来源:AbstractSessionManager.cs



注:本文中的SessionEventArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SessionFactory类代码示例发布时间:2022-05-24
下一篇:
C# SessionData类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap