Ejemplo n.º 1
0
        private static bool ShouldInclude(
            string fullName,
            string hashFileName)
        {
            // Not all the files from a zip file are needed
            // So, files such as '.rels' and '[Content_Types].xml' are not extracted
            var fileName = Path.GetFileName(fullName);

            if (fileName != null)
            {
                if (fileName == ".rels")
                {
                    return(false);
                }
                if (fileName == "[Content_Types].xml")
                {
                    return(false);
                }
            }

            var extension = Path.GetExtension(fullName);

            if (extension == ".psmdcp")
            {
                return(false);
            }

            if (string.Equals(fullName, hashFileName, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            // Skip nupkgs and nuspec files found in the root, the valid ones are already extracted
            if (PackageHelper.IsRoot(fullName) &&
                (PackageHelper.IsNuspec(fullName) ||
                 fullName.EndsWith(PackagingCoreConstants.NupkgExtension, StringComparison.OrdinalIgnoreCase)))
            {
                return(false);
            }

            return(true);
        }