コード例 #1
0
        private static async Task <XElement> GetXmlAsync(
            InternalZipFileInfo packageFileInfo,
            IMSBuildProjectSystem projectSystem,
            CancellationToken cancellationToken)
        {
            string content;

            using (var packageStream = File.OpenRead(packageFileInfo.ZipArchivePath))
            {
                var zipArchive             = new ZipArchive(packageStream);
                var zipArchivePackageEntry = PathUtility.GetEntry(zipArchive, packageFileInfo.ZipArchiveEntryFullName);

                if (zipArchivePackageEntry == null)
                {
                    throw new ArgumentException("internalZipFileInfo");
                }

                content = await Preprocessor.ProcessAsync(
                    () => Task.FromResult(zipArchivePackageEntry.Open()),
                    projectSystem,
                    cancellationToken);
            }

            return(XElement.Parse(content, LoadOptions.PreserveWhitespace));
        }
コード例 #2
0
        private static XElement GetXml(InternalZipFileInfo packageFileInfo, IMSBuildNuGetProjectSystem msBuildNuGetProjectSystem)
        {
            string content;
            using (var packageStream = File.OpenRead(packageFileInfo.ZipArchivePath))
            {
                var zipArchive = new ZipArchive(packageStream);
                var zipArchivePackageEntry = zipArchive.GetEntry(packageFileInfo.ZipArchiveEntryFullName);
                if(zipArchivePackageEntry == null)
                {
                    throw new ArgumentException("internalZipFileInfo");
                }

                content = Preprocessor.Process(zipArchivePackageEntry, msBuildNuGetProjectSystem);
            }
            return XElement.Parse(content, LoadOptions.PreserveWhitespace);
        }
コード例 #3
0
        private static XElement GetXml(InternalZipFileInfo packageFileInfo, IMSBuildNuGetProjectSystem msBuildNuGetProjectSystem)
        {
            string content;

            using (var packageStream = File.OpenRead(packageFileInfo.ZipArchivePath))
            {
                var zipArchive             = new ZipArchive(packageStream);
                var zipArchivePackageEntry = PathUtility.GetEntry(zipArchive, packageFileInfo.ZipArchiveEntryFullName);
                if (zipArchivePackageEntry == null)
                {
                    throw new ArgumentException("internalZipFileInfo");
                }

                content = Preprocessor.Process(zipArchivePackageEntry.Open, msBuildNuGetProjectSystem);
            }
            return(XElement.Parse(content, LoadOptions.PreserveWhitespace));
        }