Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
 }