Exemple #1
0
        public JsonResult GetFile(string path)
        {
            FileSystemFrame.FillInFileSystemFrame(path);

            var temp = FileSystemFrame.Files.Select(x => new { file = x.Name });


            return(Json(temp, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public JsonResult GetFolder(string path)
        {
            FileSystemFrame.FillInFileSystemFrame(path);

            var temp = FileSystemFrame.Directories.Select(x => new { folder = x.Name, path = x.FullName });


            return(Json(temp, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public JsonResult GetDirectory(string path)
        {
            //var z = path;
            //var xxxx = FileSystemProvider.GetDirectories("C:/");

            FileSystemFrame.FillInFileSystemFrame(path);
            var temp = new {
                Files   = FileSystemFrame.Files.Select(x => x.Name),
                Folders = FileSystemFrame.Directories.Select(x => x.Name)
            };

            return(Json(temp, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public JsonResult Index2()
        {
            ViewBag.Drives = FileSystemFrame.Drives.Select(x => x.Name).ToList();
            FileSystemFrame.FillInFileSystemFrame("c:/Home");
            RepresentingClass r = new RepresentingClass()
            {
                Drives  = FileSystemFrame.Drives.Select(x => x.Name),
                Files   = FileSystemFrame.Files.Select(x => x.Name),
                Folders = FileSystemFrame.Directories.Select(x => x.Name)
            };

            return(Json(r, JsonRequestBehavior.AllowGet));
            //return View();
        }
Exemple #5
0
        public void FillInFileSystemFrame_RightParams_FillInFileSystemFrameProperly()
        {
            var path = Path.GetFullPath("c:/Home");

            fileSystemFrame.FillInFileSystemFrame(path);
            var fsExpected = new FileSystemFrame(new FileSystemProvider());

            fsExpected.Directories = new DirectoryInfo(path).GetDirectories();
            fsExpected.Files       = new DirectoryInfo(path).GetFiles();

            var xx = fsExpected.Directories.Select(x => x.Name).ToArray()[1];
            var yx = fileSystemFrame.Directories.Select(x => x.Name).ToArray()[1];

            Assert.AreEqual(fsExpected.Directories.Select(x => x.Name).ToArray()[1], fileSystemFrame.Directories.Select(x => x.Name).ToArray()[1]);
            Assert.AreEqual(fsExpected.Files.Select(x => x.Name).ToArray()[1], fileSystemFrame.Files.Select(x => x.Name).ToArray()[1]);
            Assert.AreEqual(fsExpected.Drives.Select(x => x.Name).ToArray()[0], fileSystemFrame.Drives.Select(x => x.Name).ToArray()[0]);
        }
Exemple #6
0
 public void Init()
 {
     fileSystemFrame = new FileSystemFrame(new FileSystemProvider());
 }