Пример #1
0
        internal static bool IsPackageFile(System.IO.Packaging.PackagePart part)
        {
            string path = UriUtility.GetPath(part.Uri);

            // We exclude any opc files and the manifest file (.nuspec)
            return(!ExcludePaths.Any(p => path.StartsWith(p, StringComparison.OrdinalIgnoreCase)) &&
                   !PackageHelper.IsManifest(path));
        }
Пример #2
0
        internal static bool IsPackageFile(ZipArchiveEntry part)
        {
            string path = part.FullName;

            // We exclude any opc files and the manifest file (.nuspec)
            return(!ExcludePaths.Any(p => path.StartsWith(p, StringComparison.OrdinalIgnoreCase)) &&
                   !PackageHelper.IsManifest(path) &&
                   !path.StartsWith("[Content_Types]", StringComparison.OrdinalIgnoreCase));
        }
Пример #3
0
        internal static bool IsPackageFile(Uri uri)
        {
            string path      = UriUtility.GetPath(uri);
            string directory = Path.GetDirectoryName(path);

            // We exclude any opc files and the manifest file (.nuspec)
            return(!ExcludePaths.Any(p => directory.StartsWith(p, StringComparison.OrdinalIgnoreCase)) &&
                   !PackageHelper.IsManifest(path));
        }
Пример #4
0
 private static void CreatePart(Package package, string path, Stream sourceStream)
 {
     if (!PackageHelper.IsManifest(path))
     {
         Uri partUri = UriUtility.CreatePartUri(path);
         using (Stream stream = package.CreatePart(partUri, "application/octet", CompressionOption.Maximum).GetStream())
         {
             sourceStream.CopyTo(stream);
         }
     }
 }
Пример #5
0
        private static void CreatePart(ZipArchive package, string path, Stream sourceStream)
        {
            if (PackageHelper.IsManifest(path))
            {
                return;
            }

            var entry = package.CreateEntry(path.Replace('\\', '/'), CompressionLevel.Optimal);

            using (var stream = entry.Open())
            {
                sourceStream.CopyTo(stream);
            }
        }
Пример #6
0
        private static void CreatePart(ZipArchive package, string path, Stream sourceStream)
        {
            if (PackageHelper.IsManifest(path))
            {
                return;
            }

            var entry = package.CreateEntry(PathUtility.GetPathWithForwardSlashes(path), CompressionLevel.Optimal);

            using (var stream = entry.Open())
            {
                sourceStream.CopyTo(stream);
            }
        }
Пример #7
0
        private static void CreatePart(System.IO.Packaging.Package package, string path, Stream sourceStream)
        {
            if (PackageHelper.IsManifest(path))
            {
                return;
            }

            Uri uri = UriUtility.CreatePartUri(path);

            // Create the part
            var packagePart = package.CreatePart(uri, DefaultContentType, System.IO.Packaging.CompressionOption.Maximum);

            using (Stream stream = packagePart.GetStream())
            {
                sourceStream.CopyTo(stream);
            }
        }
Пример #8
0
        internal static bool IsPackageFile(PackagePart part)
        {
            string path      = UriUtility.GetPath(part.Uri);
            string directory = Path.GetDirectoryName(path);

            return(!Enumerable.Any <string>(ExcludePaths, p => directory.StartsWith(p, StringComparison.OrdinalIgnoreCase)) && !PackageHelper.IsManifest(path));
        }
 private IEnumerable <string> GetPackageFilePaths()
 {
     return(from p in _repositoryFileSystem.GetFiles(_packageName, "*.*", recursive: true)
            where !PackageHelper.IsManifest(p) && !PackageHelper.IsPackageFile(p)
            select p);
 }