当前位置: 首页>>代码示例>>C#>>正文


C# Versioning.NuGetVersion类代码示例

本文整理汇总了C#中NuGet.Versioning.NuGetVersion的典型用法代码示例。如果您正苦于以下问题:C# NuGetVersion类的具体用法?C# NuGetVersion怎么用?C# NuGetVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NuGetVersion类属于NuGet.Versioning命名空间,在下文中一共展示了NuGetVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VersionRange

 /// <summary>
 /// Creates a VersionRange with the given min and max.
 /// </summary>
 /// <param name="minVersion">Lower bound of the version range.</param>
 /// <param name="includeMinVersion">True if minVersion satisfies the condition.</param>
 /// <param name="maxVersion">Upper bound of the version range.</param>
 /// <param name="includeMaxVersion">True if maxVersion satisfies the condition.</param>
 /// <param name="includePrerelease">True if prerelease versions should satisfy the condition.</param>
 /// <param name="floatRange">The floating range subset used to find the best version match.</param>
 /// <param name="originalString">The original string being parsed to this object.</param>
 public VersionRange(NuGetVersion minVersion = null, bool includeMinVersion = true, NuGetVersion maxVersion = null,
     bool includeMaxVersion = false, bool? includePrerelease = null, FloatRange floatRange = null, string originalString = null)
     : base(minVersion, includeMinVersion, maxVersion, includeMaxVersion, includePrerelease)
 {
     _floatRange = floatRange;
     _originalString = originalString;
 }
开发者ID:eerhardt,项目名称:NuGet3,代码行数:17,代码来源:VersionRange.cs

示例2: VersionLength

        public void VersionLength(string version)
        {
            // Arrange & Act
            var semVer = new NuGetVersion(version);

           Assert.Equal("2.0.0", semVer.ToNormalizedString());
        }
开发者ID:cinecove,项目名称:NuGet.Versioning,代码行数:7,代码来源:VersionParsingTests.cs

示例3: Process

        public void Process(IndexReader indexReader,
            string readerName,
            int perSegmentDocumentNumber,
            int perIndexDocumentNumber,
            Document document,
            string id,
            NuGetVersion version)
        {
            // main index docid
            if (id == null || version == null)
            {
                return;
            }

            List<RegistrationEntry> versions;
            if (!_registrations.TryGetValue(id, out versions))
            {
                versions = new List<RegistrationEntry>();
                _registrations.Add(id, versions);
            }

            var entry = new RegistrationEntry(perIndexDocumentNumber, version, GetListed(document));

            versions.Add(entry);
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:25,代码来源:VersionsHandler.cs

示例4: IsInstalled

 public override bool IsInstalled(string packageId, NuGetVersion packageVersion)
 {
     NuGetTraceSources.CoreInteropInstalledPackagesList.Verbose("isinstalled", "IsInstalled? {0} {1}", packageId, packageVersion.ToNormalizedString());
     return _localRepository.Exists(
         packageId,
         new SemanticVersion(packageVersion.Version, packageVersion.Release));
 }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:7,代码来源:CoreInteropInstalledPackagesList.cs

示例5: Process

        public void Process(IndexReader indexReader,
            string readerName,
            int perSegmentDocumentNumber,
            int perIndexDocumentNumber,
            Document document,
            string id,
            NuGetVersion version)
        {
            HashSet<string> registrationOwners;

            if (id != null && _owners.TryGetValue(id, out registrationOwners))
            {
                foreach (string registrationOwner in registrationOwners)
                {
                    _knownOwners.Add(registrationOwner);

                    DynamicDocIdSet ownerDocIdSet;
                    if (_ownerTuples[readerName].TryGetValue(registrationOwner, out ownerDocIdSet))
                    {
                        ownerDocIdSet.DocIds.Add(perSegmentDocumentNumber);
                    }
                    else
                    {
                        ownerDocIdSet = new DynamicDocIdSet();
                        ownerDocIdSet.DocIds.Add(perSegmentDocumentNumber);

                        _ownerTuples[readerName].Add(registrationOwner, ownerDocIdSet);
                    }
                }
            }
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:31,代码来源:OwnersHandler.cs

示例6: TryParse

        /// <summary>
        /// Parses a version string using loose semantic versioning rules that allows 2-4 version components followed
        /// by an optional special version.
        /// </summary>
        public static bool TryParse(string value, out NuGetVersion version)
        {
            version = null;

            if (value != null)
            {
                Version systemVersion = null;

                // trim the value before passing it in since we not strict here
                var sections = ParseSections(value.Trim());

                // null indicates the string did not meet the rules
                if (sections != null
                    && !string.IsNullOrEmpty(sections.Item1))
                {
                    var versionPart = sections.Item1;

                    if (versionPart.IndexOf('.') < 0)
                    {
                        // System.Version requires at least a 2 part version to parse.
                        versionPart += ".0";
                    }

                    if (Version.TryParse(versionPart, out systemVersion))
                    {
                        // labels
                        if (sections.Item2 != null
                            && !sections.Item2.All(s => IsValidPart(s, false)))
                        {
                            return false;
                        }

                        // build metadata
                        if (sections.Item3 != null
                            && !IsValid(sections.Item3, true))
                        {
                            return false;
                        }

                        var ver = NormalizeVersionValue(systemVersion);

                        var originalVersion = value;

                        if (originalVersion.IndexOf(' ') > -1)
                        {
                            originalVersion = value.Replace(" ", "");
                        }

                        version = new NuGetVersion(version: ver,
                            releaseLabels: sections.Item2,
                            metadata: sections.Item3 ?? string.Empty,
                            originalVersion: originalVersion);

                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:eerhardt,项目名称:NuGet3,代码行数:64,代码来源:NuGetVersionFactory.cs

示例7: GetDependencyInfoAsync

        public override Task<FindPackageByIdDependencyInfo> GetDependencyInfoAsync(string id, NuGetVersion version, CancellationToken token)
        {
            var info = GetPackageInfo(id, version);
            FindPackageByIdDependencyInfo dependencyInfo = null;
            if (info != null)
            {
                var nuspecPath = Path.Combine(info.Path, $"{id}.nuspec");
                using (var stream = File.OpenRead(nuspecPath))
                {
                    NuspecReader nuspecReader;
                    try
                    {
                        nuspecReader = new NuspecReader(stream);
                    }
                    catch (XmlException ex)
                    {
                        var message = string.Format(CultureInfo.CurrentCulture, Strings.Protocol_PackageMetadataError, id + "." + version, _source);
                        throw new NuGetProtocolException(message, ex);
                    }
                    catch (PackagingException ex)
                    {
                        var message = string.Format(CultureInfo.CurrentCulture, Strings.Protocol_PackageMetadataError, id + "." + version, _source);
                        throw new NuGetProtocolException(message, ex);
                    }

                    dependencyInfo = GetDependencyInfo(nuspecReader);
                }
            }

            return Task.FromResult(dependencyInfo);
        }
开发者ID:eerhardt,项目名称:NuGet3,代码行数:31,代码来源:LocalV3FindPackageByIdResource.cs

示例8: LocalPackageInfo

 public LocalPackageInfo(string packageId, NuGetVersion version, string path)
 {
     Id = packageId;
     Version = version;
     ExpandedPath = path;
     ManifestPath = Path.Combine(path, string.Format("{0}.nuspec", Id));
     ZipPath = Path.Combine(path, string.Format("{0}.{1}.nupkg", Id, Version));
 }
开发者ID:eerhardt,项目名称:NuGet3,代码行数:8,代码来源:LocalPackageInfo.cs

示例9: CreatePackageIdentity

		static PackageIdentity CreatePackageIdentity (string packageId, string packageVersion)
		{
			NuGetVersion nuGetVersion = null;
			if (packageVersion != null) {
				nuGetVersion = new NuGetVersion (packageVersion);
			}
			return new PackageIdentity (packageId, nuGetVersion);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:8,代码来源:FakeNuGetProjectAction.cs

示例10: GetLockFilePath

 public string GetLockFilePath(string packageId, NuGetVersion version, NuGetFramework framework)
 {
     return Path.Combine(
         GetBaseToolPath(packageId),
         version.ToNormalizedString(),
         framework.GetShortFolderName(),
         "project.lock.json");
 }
开发者ID:krytarowski,项目名称:cli,代码行数:8,代码来源:ToolPathCalculator.cs

示例11: GetUri

        /// <summary>
        /// Constructs the URI of a registration blob with a specific version
        /// </summary>
        public virtual Uri GetUri(string id, NuGetVersion version)
        {
            if (String.IsNullOrEmpty(id) || version == null)
            {
                throw new InvalidOperationException();
            }

            return GetUri(new PackageIdentity(id, version));
        }
开发者ID:michaelstaib,项目名称:NuGet.Protocol,代码行数:12,代码来源:RegistrationResourceV3.cs

示例12: UserAction

 public UserAction(NuGetProjectActionType action, string packageId, NuGetVersion packageVersion)
 {
     Action = action;
     PackageId = packageId;
     if(packageVersion != null)
     {
         PackageIdentity = new PackageIdentity(packageId, packageVersion);
     }
 }
开发者ID:pabomex,项目名称:NuGet.PackageManagement,代码行数:9,代码来源:UserAction.cs

示例13: WriteMinClientVersion

        /// <summary>
        /// Write a minimum client version to packages.config
        /// </summary>
        /// <param name="version">Minumum version of the client required to parse and use this file.</param>
        public void WriteMinClientVersion(NuGetVersion version)
        {
            if (_minClientVersion != null)
            {
                throw new PackagingException(String.Format(CultureInfo.InvariantCulture, "MinClientVersion already exists"));
            }

            _minClientVersion = version;
        }
开发者ID:eerhardt,项目名称:NuGet3,代码行数:13,代码来源:PackagesConfigWriter.cs

示例14: CreatePackageReference

		void CreatePackageReference (
			string packageId = "Id",
			string packageVersion = "1.2.3",
			bool requireReinstallation = false)
		{
			var version = new NuGetVersion (packageVersion);
			var identity = new PackageIdentity (packageId, version);
			packageReference = new PackageReference (identity, null, true, false, requireReinstallation);
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:9,代码来源:PackageReferenceNodeTests.cs

示例15: Clone

 public static PackageReference Clone( this PackageReference source, NuGetVersion version = null )
 {
     return new PackageReference( new PackageIdentity( source.PackageIdentity.Id, version ?? source.PackageIdentity.Version ),
                            source.TargetFramework,
                            source.IsUserInstalled,
                            source.IsDevelopmentDependency,
                            source.RequireReinstallation,
                            source.AllowedVersions );
 }
开发者ID:configit-open-source,项目名称:csmerge,代码行数:9,代码来源:NuGetExtensions.cs


注:本文中的NuGet.Versioning.NuGetVersion类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。