/// <summary> /// Adds all descendant files of a Directory to a changelog /// </summary> private static void AggregateAdd(ChangelogBuilder changelog, string prefix, VersionData update) { foreach (var child in update.Children) { string fpath = PrefixFilename(prefix, child.Filename); changelog.Add(fpath, child.Hash); if (child.Filetype == FileType.Directory) { var subchangelog = BuildChangelog(child, null, fpath); changelog.Aggregate(subchangelog); } } }
/// <summary> /// Finds objects that exist in one collection but not the other /// </summary> private static void FindAddRemoveds(ChangelogBuilder changelog, string prefix, VDKeyedCollection byName, VDKeyedCollection otherByName) { foreach (var pair in byName) { string fpath = PrefixFilename(prefix, pair.Filename); changelog.Remove(fpath); if (pair.Filetype == FileType.Directory) { var subchangelog = BuildChangelog(pair, null, fpath); changelog.Aggregate(subchangelog); } } foreach (var pair in otherByName) { string fpath = PrefixFilename(prefix, pair.Filename); changelog.Add(fpath, pair.Hash); if (pair.Filetype == FileType.Directory) { var subchangelog = BuildChangelog(null, pair, fpath); changelog.Aggregate(subchangelog); } } }