當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。