Example #1
0
        private static FileManagerResource Discover(string path, string module)
        {
            var resource = FileManagerResource.Get(path, "*.xml");

            resource = FileManagerResource.NormalizePath(path, resource);
            return(Normalize(resource, module));
        }
Example #2
0
        private static FileManagerResource Normalize(FileManagerResource resource, string module)
        {
            resource.Text = resource.Text.Replace(".xml", "").ToTitleCaseSentence();
            resource.Icon = resource.IsDirectory ? "folder open outline green icon" : "file code outline green icon";
            resource.Path = resource.IsDirectory ? "" : $"/dashboard/reports/view/Areas/{module}/Reports/{resource.Path}";

            foreach (var item in resource.Children)
            {
                Normalize(item, module);
            }

            return(resource);
        }
        public ActionResult GetResources()
        {
            string path = $"~/Tenants/{this.Tenant}/";

            path = HostingEnvironment.MapPath(path);

            if (path == null || !Directory.Exists(path))
            {
                return(this.Failed("Path not found", HttpStatusCode.NotFound));
            }

            var resource = FileManagerResource.Get(path);

            resource = FileManagerResource.NormalizePath(path, resource);

            string json = JsonConvert.SerializeObject(resource, Formatting.None,
                                                      new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            });

            return(this.Content(json, "application/json"));
        }