示例#1
0
        private void CopyChangedFiles(string path, Snapshot compareTo, Snapshot added, Snapshot deleted)
        {
            foreach (var file in Directory.GetFiles(path))
            {
                string absolute = Path.Combine(path, file);
                string relative = Utils.UriRelativePath(absolute, Source);
                if (!compareTo.FileExists(relative))
                {
                    added.AddFile(relative);
                    FileSystemAPI.CopyFile(absolute, FileSystemAPI.CombinePath(Target, FileSystemAPI.ConvertSeparators(relative)));
                }
            }

            foreach (var dir in Directory.GetDirectories(path))
            {
                string absolute = Path.Combine(path, dir);
                string relative = Utils.UriRelativePath(absolute, Source);
                if (relative == ConfigDirectory)
                {
                    continue;
                }
                if (!compareTo.DirExist(relative))
                {
                    added.AddDirectory(relative);
                    FileSystemAPI.CreateDirectory(FileSystemAPI.CombinePath(Target, FileSystemAPI.ConvertSeparators(relative)));
                }
                CopyChangedFiles(absolute, compareTo, added, deleted);
            }
        }