예제 #1
0
 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;
 }
예제 #2
0
        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);
        }