public ZipUpdateItem(ZipEntry item, FileSystemInfo targetPath, ZipUpdater owner) { _owner = owner; TargetPath = targetPath ?? throw new ArgumentNullException(nameof(targetPath)); SourceItem = item ?? throw new ArgumentNullException(nameof(item)); ItemSize = FileSize.FromBytes(item.UncompressedSize); ModifiedTime = SourceItem.LastModified; }
public ArchiveItem(IArchiveEntry item, string rootFolder, ZipUpdater source) { Source = source; _sourceItem = item ?? throw new ArgumentNullException(nameof(item)); ItemSize = item.Size; ModifiedTime = _sourceItem.LastModifiedTime ?? _sourceItem.CreatedTime ?? _sourceItem.ArchivedTime ?? _sourceItem.LastAccessedTime ?? DateTime.MinValue; Name = Path.GetFileName(item.Key); IsDirectory = item.IsDirectory; IsFile = !item.IsDirectory; if (rootFolder != null) { _rootFolder = rootFolder; if (!item.Key.StartsWith(_rootFolder)) { throw new IOException($"Remote item full path {_sourceItem.Key} doesn't start with the specified root path {_rootFolder}"); } ClientRelativeFileName = item.Key.Substring(_rootFolder.Length); } }