private IPreparedUpdate PrepareUpdate(AppUpdater updater, IExtendedFileSystem fileSystem, IPackage package)
{
if (package == null)
throw new ArgumentNullException("package");
if (package.Version < updater.CurrentVersion)
throw new BackwardUpdateException(updater.CurrentVersion, package.Version);
var prepDirectory = Path.Combine(fileSystem.AppDirectory, ".updates", package.Version.ToString());
var preparedFiles = new List<string>();
foreach (var packageFile in package.GetFiles("tools"))
{
var targetPath = Path.Combine(prepDirectory, Get(packageFile.Path, relativeTo: "app"));
fileSystem.AddFile(targetPath, packageFile.GetStream());
preparedFiles.Add(targetPath);
}
return new PreparedUpdate(package.Version, preparedFiles);
}