public async Task List(HttpProcessor arg) { if (arg.Request.Query.ContainsKey("dir")) { var dir = arg.Request.Query["dir"]; if (!string.IsNullOrWhiteSpace(dir)) { if (!dir.EndsWith("\\")) { dir += "\\"; } var dirInfos = Directory.GetFiles(dir).Select(x => { var attr = new System.IO.DirectoryInfo(x); return new StorageItemInfo(attr); }).ToList(); await arg.WriteJson(dirInfos); return; } } await arg.WriteFail(HttpStatusCode.BadRequest); }
public override async Task HandlePOSTRequest(HttpProcessor p) { Console.WriteLine("{0} {1}", p.Request.Method, p.Request.URL); var action = RouteHelper.ResolvePost(p.Request.URL); if (action == null) { await p.WriteFail(HttpStatusCode.NotFound); return; } await action.Invoke(p); }