/// <summary>
/// Updates the file.
/// </summary>
/// <param name="zipArchive">The zip archive.</param>
/// <param name="zipArchiveEntry">The zip archive entry.</param>
/// <param name="fullName">The full name.</param>
/// <param name="newFilePath">The new file path.</param>
internal void UpdateFile(
ZipArchive zipArchive,
ZipArchiveEntry zipArchiveEntry,
string fullName,
string newFilePath)
{
TraceService.WriteLine("ZipperService::UpdateFile fullName=" + fullName);
FileInfoBase fileInfoBase = this.fileSystem.FileInfo.FromFileName(fullName);
FileInfoBase newFileInfoBase = this.fileSystem.FileInfo.FromFileName(newFilePath);
if (newFileInfoBase.LastWriteTime > fileInfoBase.LastWriteTime)
{
//// delete the current one!
zipArchiveEntry.Delete();
//// and now add the new one!
zipArchive.CreateEntryFromFile(newFilePath, fullName);
TraceService.WriteLine(zipArchiveEntry.Name + " has been replaced");
}
else
{
TraceService.WriteLine(zipArchiveEntry.Name + " has not been replaced");
}
}