Пример #1
0
        static PackageContent ConvertSpecification(ZipFile file, ZipEntry entry)
        {
            var inputStream = file.GetInputStream(entry);

            var nuspec = new XmlDocument();

            nuspec.Load(inputStream);

            PackageDescriptor descriptor = NuSpecConverter.ConvertSpecificationToDescriptor(nuspec);
            var memoryStream             = new MemoryStream();

            new PackageDescriptorReaderWriter().Write(descriptor, memoryStream);
            memoryStream.Position = 0;

            return(new PackageContent
            {
                FileName = Path.GetFileNameWithoutExtension(entry.Name) + ".wrapdesc",
                RelativePath = ".",
                Size = memoryStream.Length,
                Stream = () =>
                {
                    memoryStream.Position = 0;
                    return memoryStream;
                }
            });
        }
Пример #2
0
        IEnumerable <VersionVertex> CreateVersionVertices()
        {
            if (Version != null)
            {
                foreach (var vertice in NuSpecConverter.ConvertNuGetVersionRange(Version).DefaultIfEmpty(new AnyVersionVertex()))
                {
                    yield return(vertice);
                }
                yield break;
            }
            Version version = null;

            if (!string.IsNullOrEmpty(ExactVersion) && (version = ExactVersion.ToVersion()) != null)
            {
                yield return(new EqualVersionVertex(version));
            }
            if (!string.IsNullOrEmpty(MinVersion) && (version = MinVersion.ToVersion()) != null)
            {
                yield return(new GreaterThanOrEqualVersionVertex(version));
            }
            if (!string.IsNullOrEmpty(MaxVersion) && (version = MaxVersion.ToVersion()) != null)
            {
                yield return(new LessThanVersionVertex(version));
            }
        }