public static ModuleSetting FromJSON(string JSON, string RootPath = null) { var option = new ModuleLoadOption(); var json = JsonDocument.Parse(JSON, new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip, AllowTrailingCommas = true, }); var Controller = json.RootElement.GetProperty("Controller"); var Router = json.RootElement.GetProperty("Router"); var MiddleWare = json.RootElement.GetProperty("MiddleWare"); var load = new ModuleLoad(GetArray(MiddleWare, RootPath), GetArray(Router, RootPath), GetArray(Controller, RootPath)); return(new ModuleSetting(option, load)); }
public ModuleSetting(ModuleLoadOption LoadOption, ModuleLoad Load) { this.LoadOption = LoadOption; this.Load = Load; }