Ejemplo n.º 1
0
        protected void Update(AllFiles allFiles, string realPathDir)
        {
            string readDir = Path.Combine(Directory.GetCurrentDirectory(), realPathDir);
            string realPath = null;

            this.Contents.Clear();

            foreach (string file in Directory.GetFiles(readDir))
            {
                realPath = Path.Combine(realPathDir, Path.GetFileName(file));
                if (!allFiles.Any(f =>
                    Path.Equals(f.RealPath, realPath)))
                    this.Add(new OtherFile()
                    {
                        Name = Path.GetFileName(file),
                        RealPath = realPath,
                    });
            }
            foreach (string dir in Directory.GetDirectories(readDir))
            {
                realPath = Path.Combine(realPathDir, Path.GetFileName(dir));
                OtherFilesFolder child = new OtherFilesFolder()
                {
                    Name = Path.GetFileName(dir),
                    RealPath = realPath,
                };
                child.Update(allFiles,  Path.Combine(realPathDir, child.Name));
                this.Add(child);
            }
        }