public ContentResult Handle() { IUEditorHandle configHandler = null; string item = base.Request["action"]; string str = item; if (item != null) { if (str == "config") { configHandler = new ConfigHandler(); return(base.Content(JsonConvert.SerializeObject(configHandler.Process()))); } else { if (str != "uploadimage") { configHandler = new NotSupportedHandler(); return(base.Content(JsonConvert.SerializeObject(configHandler.Process()))); } UploadConfig uploadConfig = new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }; configHandler = new UploadHandle(uploadConfig); return(base.Content(JsonConvert.SerializeObject(configHandler.Process()))); } } configHandler = new NotSupportedHandler(); return(base.Content(JsonConvert.SerializeObject(configHandler.Process()))); }
// GET: UEditor public ContentResult Handle() { UploadConfig config = null; IUEditorHandle handle = null; string action = Request.Query["action"].ToString(); switch (action) { case "config": handle = new ConfigHandler(); break; case "uploadimage": config = new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }; handle = new UploadHandle(config); break; default: handle = new NotSupportedHandler(); break; } var result = handle.Process(); var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(result); return(Content(jsonString)); }
// GET: UEditor public ContentResult Handle(string action) { UploadConfig config = null; IUEditorHandle handle = null; action = Request["action"]; switch (action) { case "config": handle = new ConfigHandler(); break; case "uploadimage": config = new UploadConfig() { AllowExtensions = Config.GetStringList("imageAllowFiles"), PathFormat = Config.GetString("imagePathFormat"), SizeLimit = Config.GetInt("imageMaxSize"), UploadFieldName = Config.GetString("imageFieldName") }; handle = new UploadHandle(config); break; case "uploadtemplateimage": var controllerName = Request["areaName"].ToString(); var shopId = "0"; if (controllerName.ToLower().Equals("selleradmin")) { ManagerInfo sellerManager = null; //long userId = UserCookieEncryptHelper.Decrypt(WebHelper.GetCookie(CookieKeysCollection.SELLER_MANAGER), "SellerAdmin"); string _tmpstr = Request["ShopId"]; //if (userId != 0) //{ // sellerManager = ServiceHelper.Create<IManagerService>().GetSellerManager(userId); //} shopId = (string.IsNullOrWhiteSpace(_tmpstr) ? "NonShopID" : _tmpstr); } config = new UploadConfig() { AllowExtensions = Config.GetStringList("templateimageAllowFiles"), PathFormat = Config.GetString("templateimagePathFormat").Replace("{ShopID}", shopId), SizeLimit = Config.GetInt("templateimageMaxSize"), UploadFieldName = Config.GetString("templateimageFieldName"), ShopId = long.Parse(shopId) }; handle = new UploadHandle(config); break; default: handle = new NotSupportedHandler(); break; } var result = handle.Process(); var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(result); return(Content(jsonString)); }
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 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 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 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())); }
// 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 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 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 ProcessRequest(HttpContext context) { IUser user = UserContext.CurrentUser; if (user == null) { context.Response.Redirect(SiteUrls.Instance().Login()); } 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 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 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 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(); }