本文整理汇总了C#中IManosContext类的典型用法代码示例。如果您正苦于以下问题:C# IManosContext类的具体用法?C# IManosContext怎么用?C# IManosContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IManosContext类属于命名空间,在下文中一共展示了IManosContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: GetItemData
public void GetItemData(IManosContext ctx)
{
var ratings = MyRecommender.Instance.Data;
var user_mapping = MyRecommender.Instance.UserMapping;
var item_mapping = MyRecommender.Instance.ItemMapping;
int item_id = ctx.GetItemID("items");
if (item_id < 0 || item_id > ratings.MaxItemID)
{
ctx.Response.StatusCode = 404; // TODO maybe different error
ctx.Response.End();
return;
}
var match = new Regex(@"items/\d+/(\w+)").Match(ctx.Request.Path);
string command = match.Success ? match.Groups[1].Value : string.Empty;
switch(command)
{
case "statistics":
ctx.Response.WriteLine("iid={0} num_ratings={1}", item_mapping.ToOriginalID(item_id), ratings.ByItem[item_id].Count);
break;
case "events":
var users_string = ctx.Request.QueryData.GetString("users");
if (users_string == null)
{
foreach (int index in ratings.ByItem[item_id])
ctx.Response.WriteLine("eid={0} uid={1} value={2}", index, user_mapping.ToOriginalID(ratings.Users[index]), ratings[index]);
}
else
{
var requested_users = new HashSet<int>(from u in users_string.Split(',') select user_mapping.ToInternalID(int.Parse(u)));
foreach (int index in ratings.ByItem[item_id])
{
int user_id = ratings.Users[index];
if (requested_users.Contains(user_id))
ctx.Response.WriteLine("eid={0} uid={1} value={2}", index, user_mapping.ToOriginalID(user_id), ratings[index]);
}
}
break;
case "events/ratings":
goto case "events";
case "":
ctx.Response.WriteLine("no item metadata available"); // TODO
break;
default:
ctx.Response.StatusCode = 404; // TODO maybe different error
break;
}
ctx.Response.End();
}
开发者ID:zenogantner,项目名称:MyMediaREST,代码行数:53,代码来源:ItemDataModule.cs
示例17: InvokeMvcController
public void InvokeMvcController(IManosContext ctx)
{
if (useThreadPool)
{
// Invoke the action on the thread pool
System.Threading.ThreadPool.QueueUserWorkItem(o=>InvokeControllerInternal((IManosContext)ctx), ctx);
}
else
{
// Invoke the controller on the event loop thread
InvokeControllerInternal(ctx);
}
}
开发者ID:toptensoftware,项目名称:manos,代码行数:13,代码来源:ActionHandler.cs
示例18: TryConvertType
public static bool TryConvertType(IManosContext ctx, Type type, string str_value, out object data)
{
try {
data = Convert.ChangeType (str_value, type);
} catch (Exception e) {
Console.Error.WriteLine ("Error while converting '{0}' to '{1}'.", str_value, type);
data = null;
return false;
}
return true;
}
开发者ID:emiaj,项目名称:manos,代码行数:13,代码来源:ParameterizedActionTarget.cs
示例19: 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' /><br />
<input type='checkbox' name='show_info' /> Show me the info page, instead of redirecting.<br />
<input type='submit' />
</form>
</body>
</html>");
}
开发者ID:jcbozonier,项目名称:manos,代码行数:13,代码来源:Shorty.cs
示例20: ReverseString
public void ReverseString(IManosContext ctx, string the_string)
{
// This is intentionally awful, as its trying to test the stream
// Write it normally, then try to overwrite it with the new value
ctx.Response.Write (the_string);
ctx.Response.Stream.Position = 0;
byte [] data = Encoding.Default.GetBytes (the_string);
for (int i = data.Length; i >= 0; --i) {
ctx.Response.Stream.Write (data, i, 1);
}
}
开发者ID:silk,项目名称:manos,代码行数:14,代码来源:StreamTestsModule.cs
注:本文中的IManosContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论