NotSupportedHandler 的摘要说明
Inheritance: Handler
コード例 #1
0
ファイル: UEditorController.cs プロジェクト: Shikyoh/HSWB2B2C
        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())));
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ReflexilWindow() : base()
        {
            InitializeComponent();
            DoubleBuffered = true;

            NotSupportedHandler nsh = new NotSupportedHandler();

            m_handlers.Add(new AssemblyDefinitionHandler());
            m_handlers.Add(new AssemblyNameReferenceHandler());
            m_handlers.Add(new ModuleDefinitionHandler());
            m_handlers.Add(new TypeDefinitionHandler());
            m_handlers.Add(new MethodDefinitionHandler());
            m_handlers.Add(new PropertyDefinitionHandler());
            m_handlers.Add(new FieldDefinitionHandler());
            m_handlers.Add(new EventDefinitionHandler());
            m_handlers.Add(new EmbeddedResourceHandler());
            m_handlers.Add(new LinkedResourceHandler());
            m_handlers.Add(new AssemblyLinkedResourceHandler());
            m_handlers.Add(nsh);

            foreach (IHandler handler in m_handlers)
            {
                (handler as Control).Dock = DockStyle.Fill;
                if (handler != nsh)
                {
                    nsh.LabInfo.Text += " - " + handler.Label + "\n";
                }
            }

#if DEBUG
            PGrid.Visible = true;
#endif
        }
コード例 #3
0
        // 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));
        }
コード例 #4
0
        // 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));
        }
コード例 #5
0
        public ActionResult FileUpload()
        {
            Handler action = null;

            if (Session["UserName"] != null)
            {
                switch (Request["saveto"])
                {
                case "fs":
                    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 "db":
                    action = new FileToDbHandler(this.HttpContext, new UploadConfig()
                    {
                        //AllowExtensions = Config.GetStringList("imageAllowFiles"),
                        PathFormat      = Config.GetString("imagePathFormat"),
                        SizeLimit       = Config.GetInt("imageMaxSize"),
                        UploadFieldName = Config.GetString("imageFieldName")
                    });
                    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"));
            }
        }
コード例 #6
0
ファイル: ReflexilWindow.cs プロジェクト: zarumaru/Reflexil
        public ReflexilWindow(bool useMergedAssemblyModuleHandler = false)
        {
            InitializeComponent();
            DoubleBuffered = true;

            var nsh = new NotSupportedHandler();

            if (useMergedAssemblyModuleHandler)
            {
                _handlers.Add(new MergedAssemblyModuleDefinitionHandler());
            }
            else
            {
                _handlers.Add(new AssemblyDefinitionHandler());
                _handlers.Add(new ModuleDefinitionHandler());
            }

            _handlers.Add(new AssemblyNameReferenceHandler());
            _handlers.Add(new TypeDefinitionHandler());
            _handlers.Add(new MethodDefinitionHandler());
            _handlers.Add(new PropertyDefinitionHandler());
            _handlers.Add(new FieldDefinitionHandler());
            _handlers.Add(new EventDefinitionHandler());
            _handlers.Add(new EmbeddedResourceHandler());
            _handlers.Add(new LinkedResourceHandler());
            _handlers.Add(new AssemblyLinkedResourceHandler());
            _handlers.Add(nsh);

            foreach (var handler in _handlers)
            {
                var control = handler as Control;
                if (control != null)
                {
                    control.Dock = DockStyle.Fill;
                }

                if (handler != nsh)
                {
                    nsh.LabInfo.Text += @" - " + handler.Label + Environment.NewLine;
                }
            }

#if DEBUG
            PGrid.Visible = true;
#endif
        }
コード例 #7
0
        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(""));
        }
コード例 #8
0
        // 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()));
        }
コード例 #9
0
        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();
        }
コード例 #10
0
ファイル: UploadController.cs プロジェクト: zjftuzi/YoShop
        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));
        }
コード例 #11
0
        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());
        }
コード例 #12
0
        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());
        }
コード例 #13
0
        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();
        }
コード例 #14
0
ファイル: UEditorHandler.cs プロジェクト: hbulzy/SYS
 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();
 }
コード例 #15
0
        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();
        }
コード例 #16
0
        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"));
            }
        }
コード例 #17
0
        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();
        }
コード例 #18
0
        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(""));
        }
コード例 #19
0
        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()));
        }
コード例 #20
0
        public async Task Invoke(HttpContext context, IHostingEnvironment env, IOptions <UEditorConfig> uEditorConfig)
        {
            if (context.Request.Path.Value.StartsWith("/ueditor", StringComparison.OrdinalIgnoreCase))
            {
                //RenderMainLogPage(context);
                Handler action = null;
                switch (context.Request.Query["action"])
                {
                case "config":
                    action = new ConfigHandler(env);
                    break;

                case "uploadimage":
                    var config = uEditorConfig.Value;
                    action = new UploadHandler(new UploadConfig()
                    {
                        AllowExtensions = config.imageAllowFiles.ToArray(), // Config.GetStringList("imageAllowFiles"),
                        PathFormat      = config.imagePathFormat,           // Config.GetString("imagePathFormat"),
                        SizeLimit       = config.imageMaxSize,              // Config.GetInt("imageMaxSize"),
                        UploadFieldName = config.imageFieldName             // 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();
                    break;
                }
                await action.ExecuteAsync(context);
            }
            else
            {
                // Call the next delegate/middleware in the pipeline
                await this._next(context);
            }
        }
コード例 #21
0
ファイル: UploadController.cs プロジェクト: zyj0021/QuickWeb
        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));
        }
コード例 #22
0
        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());
        }
コード例 #23
0
        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();
        }
コード例 #24
0
        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();
        }