/// <summary> /// Merges the contents of another directory with another. /// </summary> /// <param name="to">Destination directory.</param> /// <param name="from">Directory to merge data from.</param> public static void MergeWith(this IArchiveDirectory to, IArchiveDirectory from) { foreach (var item in from) { if (item is IArchiveDirectory dir) { var selfDir = to.GetDirectory(item.BuildPath(from.Parent)); if (selfDir == null) { to.Add(item, true); continue; } selfDir.MergeWith(dir); } else { to.Add(item, true); } } }