Ejemplo n.º 1
0
        public DirectoryModule()
            : base("/dir")
        {
            this.RequiresAuthentication();

            Get["/tree/{path*}"] = x => {
                var            p    = x.path;
                DirectoryModel dirs = new DirectoryModel();
                dirs.parents  = new DirectoryLister("/" + p, false).ParentList.Reverse();
                dirs.children = new DirectoryLister("/" + p, false).FullList;
                return(View["page-dir", dirs]);
            };

            Get["/tttt/{path*}"] = x => {
                var p = x.path;
                HashSet <string> directories = new DirectoryLister("/" + p, false).FullList;
                var i = directories.FirstOrDefault();
                return(Response.AsText(i));
            };

            Get["/directory/tree/{path*}"] = x => {
                var p = x.path;
                HashSet <string> directories = new DirectoryLister("/" + p, true).FullList;
                return(View["page-dir", directories.ToList()]);
            };

            Get["/directory/watch/"] = x => {
                return(View["page-directories-watch"]);
            };
        }