Esempio 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));
        }
Esempio 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));
        }
Esempio 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));
        }
Esempio 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);
         }
     }
 }
Esempio 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);
            }
        }
Esempio 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);
            }
        }
Esempio 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);
            }
        }
Esempio 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);
 }