public ActionResult FileUploader() { HttpContext context = System.Web.HttpContext.Current; Handler action = new NotSupportedHandler(context); switch (Request["action"])//管理员用 { case "config": action = new ConfigHandler(context); break; case "uploadimage": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = UeditorConfig.GetStringList("imageAllowFiles"), PathFormat = UeditorConfig.GetString("imagePathFormat"), SizeLimit = UeditorConfig.GetInt("imageMaxSize"), UploadFieldName = UeditorConfig.GetString("imageFieldName") }); break; case "uploadscrawl": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = new[] { ".png" }, PathFormat = UeditorConfig.GetString("scrawlPathFormat"), SizeLimit = UeditorConfig.GetInt("scrawlMaxSize"), UploadFieldName = UeditorConfig.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "catchimage": action = new CrawlerHandler(context); break; case "uploadvideo": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = UeditorConfig.GetStringList("videoAllowFiles"), PathFormat = UeditorConfig.GetString("videoPathFormat"), SizeLimit = UeditorConfig.GetInt("videoMaxSize"), UploadFieldName = UeditorConfig.GetString("videoFieldName") }); break; case "uploadfile": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = UeditorConfig.GetStringList("fileAllowFiles"), PathFormat = UeditorConfig.GetString("filePathFormat"), SizeLimit = UeditorConfig.GetInt("fileMaxSize"), UploadFieldName = UeditorConfig.GetString("fileFieldName") }); break; case "listimage": action = new ListFileManager(context, UeditorConfig.GetString("imageManagerListPath"), UeditorConfig.GetStringList("imageManagerAllowFiles")); break; case "listfile": action = new ListFileManager(context, UeditorConfig.GetString("fileManagerListPath"), UeditorConfig.GetStringList("fileManagerAllowFiles")); break; } #region 用户通用方法 //switch (Request["action"])//通用 //{ // case "config": // action = new ConfigHandler(context); // break; // case "uploadimage": // action = new UploadHandler(context, new UploadConfig() // { // AllowExtensions = UeditorConfig.GetStringList("imageAllowFiles"), // PathFormat = UeditorConfig.GetString("imagePathFormat"), // SizeLimit = UeditorConfig.GetInt("imageMaxSize"), // UploadFieldName = UeditorConfig.GetString("imageFieldName") // }); // break; // case "uploadscrawl": // action = new UploadHandler(context, new UploadConfig() // { // AllowExtensions = new[] { ".png" }, // PathFormat = UeditorConfig.GetString("scrawlPathFormat"), // SizeLimit = UeditorConfig.GetInt("scrawlMaxSize"), // UploadFieldName = UeditorConfig.GetString("scrawlFieldName"), // Base64 = true, // Base64Filename = "scrawl.png" // }); // break; // case "catchimage": // action = new CrawlerHandler(context); // break; //} #endregion #region 管理员权限使用方法 //UserInfoOutputDto user = HttpContext.Session.GetByRedis<UserInfoOutputDto>(SessionKey.UserInfo) ?? new UserInfoOutputDto(); //if (user.IsAdmin) //{ // switch (Request["action"])//管理员用 // { // case "uploadvideo": // action = new UploadHandler(context, new UploadConfig() // { // AllowExtensions = UeditorConfig.GetStringList("videoAllowFiles"), // PathFormat = UeditorConfig.GetString("videoPathFormat"), // SizeLimit = UeditorConfig.GetInt("videoMaxSize"), // UploadFieldName = UeditorConfig.GetString("videoFieldName") // }); // break; // case "uploadfile": // action = new UploadHandler(context, new UploadConfig() // { // AllowExtensions = UeditorConfig.GetStringList("fileAllowFiles"), // PathFormat = UeditorConfig.GetString("filePathFormat"), // SizeLimit = UeditorConfig.GetInt("fileMaxSize"), // UploadFieldName = UeditorConfig.GetString("fileFieldName") // }); // break; // case "listimage": // action = new ListFileManager(context, UeditorConfig.GetString("imageManagerListPath"), UeditorConfig.GetStringList("imageManagerAllowFiles")); // break; // case "listfile": // action = new ListFileManager(context, UeditorConfig.GetString("fileManagerListPath"), UeditorConfig.GetStringList("fileManagerAllowFiles")); // break; // } //} #endregion string result = action.Process(); return(Content(result, ContentType.Json, Encoding.UTF8)); }
public void Main(int publishmentSystemId) { var queryString = HttpContext.Current.Request.QueryString; Handler action; switch (queryString["action"]) { case "config": action = new ConfigHandler(HttpContext.Current); break; case "uploadimage": action = new UploadHandler(HttpContext.Current, new UploadConfig { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }, publishmentSystemId, EUploadType.Image); break; case "uploadscrawl": action = new UploadHandler(HttpContext.Current, new UploadConfig { AllowExtensions = new[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }, publishmentSystemId, EUploadType.Image); break; case "uploadvideo": action = new UploadHandler(HttpContext.Current, new UploadConfig { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }, publishmentSystemId, EUploadType.Video); break; case "uploadfile": action = new UploadHandler(HttpContext.Current, new UploadConfig { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }, publishmentSystemId, EUploadType.File); break; case "listimage": action = new ListFileManager(HttpContext.Current, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles"), publishmentSystemId, EUploadType.Image); break; case "listfile": action = new ListFileManager(HttpContext.Current, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles"), publishmentSystemId, EUploadType.File); break; case "catchimage": action = new CrawlerHandler(HttpContext.Current, publishmentSystemId); break; default: action = new NotSupportedHandler(HttpContext.Current); break; } action.Process(); }
public void ProcessRequest(HttpContext context) { Handler action = null; switch (context.Request["action"]) { case "config": action = new ConfigHandler(context); break; case "uploadimage": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }); break; case "uploadscrawl": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "uploadvideo": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }); break; case "uploadfile": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }); break; case "listimage": action = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles")); break; case "listfile": action = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles")); break; case "catchimage": action = new CrawlerHandler(context); break; default: action = new NotSupportedHandler(context); break; } action.Process(); }
public ActionResult EditorFile() { Handler action = null; //string orgCode = this.GetRelationCode(); if (Session["UserName"] != null) { switch (Request["action"]) { case "config": action = new ConfigHandler(this.HttpContext); break; case "uploadimage": action = new UploadHandler(this.HttpContext, new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }); break; case "uploadscrawl": action = new UploadHandler(this.HttpContext, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "uploadvideo": action = new UploadHandler(this.HttpContext, new UploadConfig() { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }); break; case "uploadfile": action = new UploadHandler(this.HttpContext, new UploadConfig() { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }); break; case "listimage": { //action = new ListFileManager(this.HttpContext, !string.IsNullOrEmpty(orgCode) // ? Config.GetString("imageManagerListPath").Replace("{orgcode}", orgCode) // : Config.GetString("imageManagerListPath").Replace("{orgcode}", orgCode), // Config.GetStringList("imageManagerAllowFiles")); } break; case "listfile": //action = new ListFileManager(this.HttpContext, !string.IsNullOrEmpty(orgCode) // ? Config.GetString("imageManagerListPath").Replace("{orgcode}", orgCode) // : Config.GetString("imageManagerListPath").Replace("{orgcode}", orgCode), // Config.GetStringList("fileManagerAllowFiles")); break; case "catchimage": action = new CrawlerHandler(this.HttpContext); break; default: action = new NotSupportedHandler(this.HttpContext); break; } } else { action = new NeedLoginedHandler(this.HttpContext); } var result = action.Process(); var jsonpCallBack = Request["callback"]; if (string.IsNullOrWhiteSpace(jsonpCallBack)) { return(Content(result, "text/plain")); } else { return(Content(result, "application/javascript")); } }
public async Task StartApp() { //Custom code // await CrawlerCore.DemoCrawl(); await CrawlerHandler.DemoSimpleCrawler(); }
// GET: /Ueditors/ public ActionResult ueditorupload() { Handler action = null; switch (this.HttpContext.Request["action"]) { case "config": action = new ConfigHandler(this.HttpContext); break; case "uploadimage": action = new UploadHandler(this.HttpContext, new UploadConfig() { AllowExtensions = bitcms.Ueditor.Config.GetStringList("imageAllowFiles"), UploadFieldName = bitcms.Ueditor.Config.GetString("imageFieldName"), Folder = "image" }); break; case "uploadscrawl": action = new UploadHandler(this.HttpContext, new UploadConfig() { AllowExtensions = new string[] { ".png" }, UploadFieldName = bitcms.Ueditor.Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png", Folder = "scrawl" }); break; case "uploadvideo": action = new UploadHandler(this.HttpContext, new UploadConfig() { AllowExtensions = bitcms.Ueditor.Config.GetStringList("videoAllowFiles"), UploadFieldName = bitcms.Ueditor.Config.GetString("videoFieldName"), Folder = "video" }); break; case "uploadfile": action = new UploadHandler(this.HttpContext, new UploadConfig() { AllowExtensions = bitcms.Ueditor.Config.GetStringList("fileAllowFiles"), UploadFieldName = bitcms.Ueditor.Config.GetString("fileFieldName"), Folder = "file" }); break; case "listimage": action = new ListFileManager(this.HttpContext, bitcms.Ueditor.Config.GetString("imageManagerListPath"), bitcms.Ueditor.Config.GetStringList("imageManagerAllowFiles")); break; case "listfile": action = new ListFileManager(this.HttpContext, bitcms.Ueditor.Config.GetString("fileManagerListPath"), bitcms.Ueditor.Config.GetStringList("fileManagerAllowFiles")); break; case "catchimage": action = new CrawlerHandler(this.HttpContext); break; default: action = new NotSupportedHandler(this.HttpContext); break; } return(Content(action.Process())); }
public ContentResult EditorHelp() { Handler handler = null; HttpContext context = System.Web.HttpContext.Current; string actionName = Request.QueryString["action"]; switch (actionName) { case "config": handler = new ConfigHandler(context); break; case "uploadimage": handler = new UploadHandler(context, new UploadConfig() { ActionName = actionName, AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }); break; case "buiuploadimage": handler = new UploadHandler(context, new UploadConfig() { ActionName = actionName, AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = "Filedata" }); break; case "uploadscrawl": handler = new UploadHandler(context, new UploadConfig() { ActionName = actionName, AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "uploadvideo": handler = new UploadHandler(context, new UploadConfig() { ActionName = actionName, AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }); break; case "uploadfile": handler = new UploadHandler(context, new UploadConfig() { ActionName = actionName, AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }); break; case "listimage": handler = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles")); break; case "listfile": handler = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles")); break; case "catchimage": handler = new CrawlerHandler(context); break; default: handler = new NotSupportedHandler(context); break; } handler.Process(); return(Content("")); }
public ActionResult Index() { var context = System.Web.HttpContext.Current; Handler action; switch (context.Request["action"]) { case "config": action = new ConfigHandler(context); break; case "uploadimage": action = new UploadHandler(context, new UploadConfig { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }, _uploadFolder); break; case "uploadscrawl": action = new UploadHandler(context, new UploadConfig { AllowExtensions = new[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }, _uploadFolder); break; case "uploadvideo": action = new UploadHandler(context, new UploadConfig { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }, _uploadFolder); break; case "uploadfile": action = new UploadHandler(context, new UploadConfig { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }, _uploadFolder); break; case "listimage": action = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles"), _uploadFolder); break; case "listfile": action = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles"), _uploadFolder); break; case "catchimage": action = new CrawlerHandler(context, _uploadFolder); break; default: action = new NotSupportedHandler(context); break; } action.Process(); return(Content("")); }
public JsonResult UeTest() { HttpContext context = HttpContext; //var ss = HttpContext.Request.Form; Handler action = null; //action.serverPath = serverPath; switch (GetKeyValue("action")) { case "config": action = new ConfigHandler(context) { serverPath = serverPath }; break; case "uploadimage": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }) { serverPath = serverPath }; break; case "uploadscrawl": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png", }) { serverPath = serverPath }; break; case "uploadvideo": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName"), }) { serverPath = serverPath }; break; case "uploadfile": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }) { serverPath = serverPath }; break; case "listimage": action = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles")) { serverPath = serverPath }; break; case "listfile": action = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles")) { serverPath = serverPath }; break; case "catchimage": action = new CrawlerHandler(context) { serverPath = serverPath }; break; default: action = new NotSupportedHandler(context) { serverPath = serverPath }; break; } return(Json(action.Process())); }
public ActionResult FileUpload() { Handler Action = null; var context = ControllerContext.HttpContext; string action = context.Request["action"].ToString(); switch (action) { case "config": Action = new ConfigHandler(context); break; case "uploadimage": Action = new UploadHandler(context, AttachmentType.Image, new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }); break; case "uploadscrawl": Action = new UploadHandler(context, AttachmentType.Scrawl, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "uploadvideo": Action = new UploadHandler(context, AttachmentType.Media, new UploadConfig() { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }); break; case "uploadfile": Action = new UploadHandler(context, AttachmentType.File, new UploadConfig() { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }); break; case "listimage": Action = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles")); break; case "listfile": Action = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles")); break; case "catchimage": Action = new CrawlerHandler(context); break; default: Action = new NotSupportedHandler(context); break; } return(Action.Process()); }
public ActionResult UeditorFileUploader() { //UserInfoOutputDto user = HttpContext.Session.GetByRedis<UserInfoOutputDto>(SessionKey.UserInfo) ?? new UserInfoOutputDto(); bool IsAdmin = false; Handler action = new NotSupportedHandler(HttpContext); switch (Request.Query["action"])//通用 { case "config": action = new ConfigHandler(HttpContext); break; case "uploadimage": action = new UploadHandler(HttpContext, new UploadConfig() { AllowExtensions = UeditorConfig.GetStringList("imageAllowFiles"), PathFormat = UeditorConfig.GetString("imagePathFormat"), SizeLimit = UeditorConfig.GetInt("imageMaxSize"), UploadFieldName = UeditorConfig.GetString("imageFieldName") }); break; case "uploadscrawl": action = new UploadHandler(HttpContext, new UploadConfig() { AllowExtensions = new[] { ".png" }, PathFormat = UeditorConfig.GetString("scrawlPathFormat"), SizeLimit = UeditorConfig.GetInt("scrawlMaxSize"), UploadFieldName = UeditorConfig.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "catchimage": action = new CrawlerHandler(HttpContext); break; } if (IsAdmin) { switch (Request.Query["action"])//管理员用 { //case "uploadvideo": // action = new UploadHandler(context, new UploadConfig() // { // AllowExtensions = UeditorConfig.GetStringList("videoAllowFiles"), // PathFormat = UeditorConfig.GetString("videoPathFormat"), // SizeLimit = UeditorConfig.GetInt("videoMaxSize"), // UploadFieldName = UeditorConfig.GetString("videoFieldName") // }); // break; case "uploadfile": action = new UploadHandler(HttpContext, new UploadConfig() { AllowExtensions = UeditorConfig.GetStringList("fileAllowFiles"), PathFormat = UeditorConfig.GetString("filePathFormat"), SizeLimit = UeditorConfig.GetInt("fileMaxSize"), UploadFieldName = UeditorConfig.GetString("fileFieldName") }); break; //case "listimage": // action = new ListFileManager(context, UeditorConfig.GetString("imageManagerListPath"), UeditorConfig.GetStringList("imageManagerAllowFiles")); // break; //case "listfile": // action = new ListFileManager(context, UeditorConfig.GetString("fileManagerListPath"), UeditorConfig.GetStringList("fileManagerAllowFiles")); // break; } } string result = action.Process(); return(Content(result, ContentType.Json)); }
public object Handler(string action) { string type = Request.Query["action"]; IHandler handler = null; switch (type) { case "config": handler = new ConfigHandler(_editorSettings); break; case "uploadimage": handler = new UploadHandler(new UploadConfig() { AllowExtensions = _editorSettings.Value.imageAllowFiles, PathFormat = _editorSettings.Value.imagePathFormat, SizeLimit = _editorSettings.Value.imageMaxSize, UploadFieldName = _editorSettings.Value.imageFieldName }); break; //case "uploadscrawl": // handler = new UploadHandler(new UploadConfig() // { // AllowExtensions = new string[] { ".png" }, // PathFormat = ConfigHandler.GetString("scrawlPathFormat"), // SizeLimit = ConfigHandler.GetInt("scrawlMaxSize"), // UploadFieldName = ConfigHandler.GetString("scrawlFieldName"), // Base64 = true, // Base64Filename = "scrawl.png" // }); // break; //case "uploadvideo": // handler = new UploadHandler(new UploadConfig() // { // AllowExtensions = ConfigHandler.GetStringList("videoAllowFiles"), // PathFormat = ConfigHandler.GetString("videoPathFormat"), // SizeLimit = ConfigHandler.GetInt("videoMaxSize"), // UploadFieldName = ConfigHandler.GetString("videoFieldName") // }); // break; //case "uploadfile": // handler = new UploadHandler(new UploadConfig() // { // AllowExtensions = ConfigHandler.GetStringList("fileAllowFiles"), // PathFormat = ConfigHandler.GetString("filePathFormat"), // SizeLimit = ConfigHandler.GetInt("fileMaxSize"), // UploadFieldName = ConfigHandler.GetString("fileFieldName") // }); // break; //case "listimage": // handler = new ListFileHandler(ConfigHandler.GetStringList("imageManagerAllowFiles")); // break; //case "listfile": // handler = new ListFileHandler(ConfigHandler.GetStringList("fileManagerAllowFiles")); // break; case "catchimage": handler = new CrawlerHandler(); break; default: handler = new NotSupportedHandler(); break; } return(handler.Process()); }
public void ProcessRequest(HttpContext context) { if (context.Request.Headers["Access-Control-Request-Method"] != null) { context.Response.Headers.Add("Access-Control-Allow-Credentials", "true"); context.Response.Headers.Add("Access-Control-Allow-Headers", "x_requested_with"); context.Response.Headers.Add("Access-Control-Allow-Methods", context.Request.Headers["Access-Control-Request-Method"]); context.Response.Headers.Add("Access-Control-Allow-Origin", context.Request.Headers["Origin"]); context.Response.End(); return; } Handler action = null; switch (context.Request["action"]) { case "config": action = new ConfigHandler(context); break; case "uploadimage": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }); break; case "uploadscrawl": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "uploadvideo": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }); break; case "uploadfile": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }); break; case "listimage": action = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles")); break; case "listfile": action = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles")); break; case "catchimage": action = new CrawlerHandler(context); break; default: action = new NotSupportedHandler(context); break; } action.Process(); }
public void Index() { string action = Request.Params["action"]; Handler hand = null; var context = HttpContext; switch (action) { case "config": hand = new ConfigHandler(context); break; case "uploadimage": hand = new UploadHandler(context, new UploadConfig() { AllowExtensions = EditorConfig.GetStringList("imageAllowFiles"), PathFormat = EditorConfig.GetString("imagePathFormat"), SizeLimit = EditorConfig.GetInt("imageMaxSize"), UploadFieldName = EditorConfig.GetString("imageFieldName") }); break; case "uploadscrawl": hand = new UploadHandler(context, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = EditorConfig.GetString("scrawlPathFormat"), SizeLimit = EditorConfig.GetInt("scrawlMaxSize"), UploadFieldName = EditorConfig.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "uploadvideo": hand = new UploadHandler(context, new UploadConfig() { AllowExtensions = EditorConfig.GetStringList("videoAllowFiles"), PathFormat = EditorConfig.GetString("videoPathFormat"), SizeLimit = EditorConfig.GetInt("videoMaxSize"), UploadFieldName = EditorConfig.GetString("videoFieldName") }); break; case "uploadfile": hand = new UploadHandler(context, new UploadConfig() { AllowExtensions = EditorConfig.GetStringList("fileAllowFiles"), PathFormat = EditorConfig.GetString("filePathFormat"), SizeLimit = EditorConfig.GetInt("fileMaxSize"), UploadFieldName = EditorConfig.GetString("fileFieldName") }); break; case "listimage": hand = new ListFileManager(context, EditorConfig.GetString("imageManagerListPath"), EditorConfig.GetStringList("imageManagerAllowFiles")); break; case "listfile": hand = new ListFileManager(context, EditorConfig.GetString("fileManagerListPath"), EditorConfig.GetStringList("fileManagerAllowFiles")); break; case "catchimage": hand = new CrawlerHandler(context); break; default: hand = new NotSupportedHandler(context); break; } hand.Process(); }
public string ProcessRequest([FromServices] IWebHostEnvironment environment) { var context = HttpContext; Handler action = null; var x = AppContext.BaseDirectory; switch (Request.Query["action"].Count != 0 ? Request.Query["action"].ToString() : "") { case "config": action = new ConfigHandler(context); break; case "uploadimage": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }); break; case "uploadscrawl": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "uploadvideo": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }); break; case "uploadfile": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }); break; case "listimage": action = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles")); break; case "listfile": action = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles")); break; case "catchimage": ///暂时没有发现什么用 action = new CrawlerHandler(context); break; default: action = new NotSupportedHandler(context); break; } return(action.Process()); }
public void ProcessRequest(HttpContext context) { Handler action = null; switch (context.Request["action"]) { case "config": action = new ConfigHandler(context); break; case "uploadimage": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName"), ImageServicePath = Config.GetString("imageServicePath") }); break; case "uploadscrawl": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); break; case "uploadvideo": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }); break; case "uploadfile": action = new UploadHandler(context, new UploadConfig() { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }); break; case "listimage": action = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles")); break; case "listfile": action = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles")); break; case "catchimage": action = new CrawlerHandler(context, Config.GetString("imageServicePath")); break; default: action = new NotSupportedHandler(context); break; } action.Response.AddHeader("Access-Control-Allow-Origin", "*"); action.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"); action.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type"); action.Process(); }
public void ProcessRequest(System.Web.HttpContext context) { string key; Handler handler; switch (key = context.Request["action"]) { case "config": handler = new ConfigHandler(context); goto IL_291; case "uploadimage": handler = new UploadHandler(context, new UploadConfig { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }); goto IL_291; case "uploadscrawl": handler = new UploadHandler(context, new UploadConfig { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString("scrawlPathFormat"), SizeLimit = Config.GetInt("scrawlMaxSize"), UploadFieldName = Config.GetString("scrawlFieldName"), Base64 = true, Base64Filename = "scrawl.png" }); goto IL_291; case "uploadvideo": handler = new UploadHandler(context, new UploadConfig { AllowExtensions = Config.GetStringList("videoAllowFiles"), PathFormat = Config.GetString("videoPathFormat"), SizeLimit = Config.GetInt("videoMaxSize"), UploadFieldName = Config.GetString("videoFieldName") }); goto IL_291; case "uploadfile": handler = new UploadHandler(context, new UploadConfig { AllowExtensions = Config.GetStringList("fileAllowFiles"), PathFormat = Config.GetString("filePathFormat"), SizeLimit = Config.GetInt("fileMaxSize"), UploadFieldName = Config.GetString("fileFieldName") }); goto IL_291; case "listimage": handler = new ListFileManager(context, Config.GetString("imageManagerListPath"), Config.GetStringList("imageManagerAllowFiles")); goto IL_291; case "listfile": handler = new ListFileManager(context, Config.GetString("fileManagerListPath"), Config.GetStringList("fileManagerAllowFiles")); goto IL_291; case "catchimage": handler = new CrawlerHandler(context); goto IL_291; } handler = new NotSupportedHandler(context); IL_291: handler.Process(); }