static ZipEntry GetZipEntry(PackageContent contentFile) { if (contentFile.RelativePath == ".") return new ZipEntry(Path.GetFileName(contentFile.FileName)); var target = contentFile.RelativePath; if (target.Last() != '/') target += '/'; var fileEntry = new ZipEntry(Path.Combine(target, contentFile.FileName)); if (contentFile.Size != null) fileEntry.Size = contentFile.Size.Value; return fileEntry; }
static ZipEntry GetZipEntry(PackageContent contentFile) { var target = string.IsNullOrEmpty(contentFile.RelativePath) ? "." : contentFile.RelativePath; if (target == ".") { return(new ZipEntry(Path.GetFileName(contentFile.FileName))); } if (target.Last() != '/') { target += '/'; } var fileEntry = new ZipEntry(Path.Combine(target, contentFile.FileName)); if (contentFile.Size != null) { fileEntry.Size = contentFile.Size.Value; } return(fileEntry); }