Ejemplo n.º 1
0
        private void UpdateOtherFiles(OtherFilesFolder folder, AllFiles allFiles, string savePathDir)
        {
            string pathOffset = Path.GetDirectoryName(SavePath);
            string realPath = null;

            foreach (string file in Directory.GetFiles(savePathDir))
            {
                realPath = file.Substring(pathOffset.Length + (pathOffset.EndsWith("\\")? 0 : 1));
                if (!allFiles.Any(f =>
                    Path.Equals(f.RealPath, realPath)))
                    folder.Add(new OtherFile()
                    {
                        Name = Path.GetFileName(file),
                        RealPath = realPath
                    });
            }
            foreach (string dir in Directory.GetDirectories(savePathDir))
            {
                OtherFilesFolder child = new OtherFilesFolder()
                {
                    Name = Path.GetFileName(dir),
                };
                UpdateOtherFiles(child, allFiles, dir+"\\");
                folder.Add(child);
            }
        }