当前位置: 首页>>代码示例>>C#>>正文


C# IManosContext类代码示例

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


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

示例1: TestSubmitLink

 public void TestSubmitLink(IManosContext ctx, string link)
 {
     var template = new RazorTemplate {
         Model = link
     };
     ctx.Response.End(template.TransformText());
 }
开发者ID:robbytarigan,项目名称:aqrubik,代码行数:7,代码来源:AqrubikWebApp.cs

示例2: SubmitLink

        public void SubmitLink(IManosContext ctx, Shorty app, string link)
        {
            string id = GenerateHash (link, 5);

            Cache [id] = new LinkData (link);
            ctx.Response.Redirect ("/r/" + id + "~");
        }
开发者ID:asbjornu,项目名称:manos,代码行数:7,代码来源:Shorty.cs

示例3: Images

 public void Images(IManosContext ctx, int index)
 {
     var images = new ImageList();
       var image = images[index];
       ctx.Response.End("Image: {0}, size {1} x {2}", image.Name, image.Width,
        image.Height);
 }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:7,代码来源:Routes.cs

示例4: Content

        public void Content(IManosContext ctx)
        {
            string path = ctx.Request.Path;

            // Double check path start with route-prefix
            if (path.StartsWith(route_prefix, StringComparison.InvariantCultureIgnoreCase) && path.IndexOf("..") < 0)
            {
                // Strip off the route prefix and leading slash
                path = path.Substring(route_prefix.Length);
                if (path.StartsWith("/"))
                    path = path.Substring(1);

                // Locate the file
                path = Path.Combine(content_folder, path);

                // Check it exists
                if (File.Exists(path))
                {
                    // Send it
                    ctx.Response.Headers.SetNormalizedHeader("Content-Type", ManosMimeTypes.GetMimeType(path));
                    ctx.Response.SendFile(path);
                    ctx.Response.End();
                    return;
                }
            }

            ctx.Response.StatusCode = 404;
            ctx.Response.End();
        }
开发者ID:toptensoftware,项目名称:manos,代码行数:29,代码来源:StaticContentModule.cs

示例5: HandShake

 public void HandShake(IManosContext ctx)
 {
     var id = GenerateId();
     int heartbeat_timeout = 15;
     int close_timeout = 25;
     string[] supported_transports = new string[] { "websocket" }; //websocket
     ctx.Response.End(id + ":" + heartbeat_timeout.ToString() + ":" + close_timeout.ToString() + ":" + string.Join(",", supported_transports));
 }
开发者ID:kersny,项目名称:manos-socketio,代码行数:8,代码来源:socketio.cs

示例6: SaveSessionState

        public void SaveSessionState(IManosContext ctx, SessionState state)
        {
            if (!state.Modified)
                return;

            // Just store it
            m_ActiveSessions[state.SessionID] = state;
        }
开发者ID:toptensoftware,项目名称:manos,代码行数:8,代码来源:InMemorySessionStateProvider.cs

示例7: Echo

 public void Echo(IManosContext ctx, String value, int id)
 {
     ctx.Response.SetHeader("Content-Type","text/html");
     for(; id > 0; id--)
     {
         ctx.Response.Write(value + "<br/>");
     }
     ctx.Response.End();
 }
开发者ID:atheken,项目名称:pies,代码行数:9,代码来源:pies.cs

示例8: SubmitLink

        public void SubmitLink(IManosContext ctx, Shorty app, string link, bool show_info)
        {
            string id = GenerateHash (link, 5);

            if (show_info)
                ctx.Response.SetCookie ("show_info", "true");

            Cache [id] = new LinkData (link);
            ctx.Response.Redirect ("/r/" + id + "~");
        }
开发者ID:KevinT,项目名称:manos,代码行数:10,代码来源:Shorty.cs

示例9: RenderStache

        public static void RenderStache(this ManosModule mod, IManosContext ctx, string template, object obj)
        {
            var t = new Template ();
            var path = Path.Combine (TEMPLATE_DIR, template);
            using (var r = new StreamReader (path)) {
                  t.Load (r);
              		        }

            t.Render (obj, new StreamWriter (ctx.Response.Stream), locator.GetTemplate);
            ctx.Response.End ();
        }
开发者ID:atsushieno,项目名称:drosh,代码行数:11,代码来源:Manos.Mustache.cs

示例10: OnError

 public void OnError(IManosContext ctx)
 {
     foreach (IManosPipe pipe in AppHost.Pipes) {
         try {
             pipe.OnError (ctx);
         } catch (Exception e) {
             Console.Error.WriteLine ("Exception in {0}::OnError", pipe);
             Console.Error.WriteLine (e);
         }
     }
 }
开发者ID:KevinT,项目名称:manos,代码行数:11,代码来源:ManosApp.cs

示例11: Manual

        public void Manual(IManosContext ctx, string manual)
        {
            string md_page;

            if (!manuals.TryGetValue (manual, out md_page)) {
                ctx.Response.StatusCode = 404;
                return;
            }

            WriteMarkdownDocsPage (ctx.Response, md_page);
        }
开发者ID:davidalpert,项目名称:manos,代码行数:11,代码来源:DocsModule.cs

示例12: Index

 public void Index(IManosContext ctx)
 {
     ctx.Response.WriteLine (@"<html>
                            <head><title>Welcome to Shorty</title></head>
                            <body>
                             <form method='POST' action='submit-link'>
                              <input type='text' name='link' />
                              <input type='submit' />
                             </form>
                            </body>");
 }
开发者ID:asbjornu,项目名称:manos,代码行数:11,代码来源:Shorty.cs

示例13: Index

 public void Index(IManosContext ctx)
 {
     ctx.Response.End(@"<html>
                        <head><title>Welcome to Aqrubik</title></head>
                        <body>
                         <form method='POST' action='TestSubmit'>
                          <input type='text' name='link'>
                          <input type='submit'>
                         </form>
                        </body>
                       </html>");
 }
开发者ID:robbytarigan,项目名称:aqrubik,代码行数:12,代码来源:AqrubikWebApp.cs

示例14: Content

        public void Content(IManosContext ctx)
        {
            var recommender = MyRecommender.Instance.Predictor;
            var ratings = MyRecommender.Instance.Data;

            Log.Info("stats");

            ctx.Response.WriteLine("MyMediaLite recommender: {0}", recommender);
            ctx.Response.WriteLine("Rating statistics: " + ratings.Statistics());

            ctx.Response.End();
        }
开发者ID:zenogantner,项目名称:MyMediaREST,代码行数:12,代码来源:StatisticsModule.cs

示例15: Content

        public static void Content(IManosContext ctx)
        {
            string path = ctx.Request.LocalPath;

            if (path.StartsWith ("/"))
                path = path.Substring (1);

            if (File.Exists (path)) {
                ctx.Response.SendFile (path);
            } else
                ctx.Response.StatusCode = 404;
        }
开发者ID:KevinT,项目名称:manos,代码行数:12,代码来源:StaticContentModule.cs


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