• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IVersionSpec类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Latest

        public static IPackage Latest(this IEnumerable<IPackage> values, IVersionSpec spec)
        {
            var candidates = values.ToArray();
            var candidate = candidates.FirstOrDefault(x => x.IsAbsoluteLatestVersion)
                            ?? candidates.FirstOrDefault(x => x.IsLatestVersion);

            if (candidate == null)
            {
                // If both absolute and latest are false, then we order in descending order (by version) and take the top
                var ordered = candidates
                    .OrderByDescending(x => x.Version)
                    .ToArray();

                if (spec == null)
                {
                    candidate = ordered.FirstOrDefault();
                }
                else
                {
                    Func<IPackage, bool> predicate;
                    if (spec.IsMaxInclusive)
                    {
                        predicate = x => x.Version <= spec.MaxVersion;
                    }
                    else
                    {
                        predicate = x => x.Version < spec.MaxVersion;
                    }

                    candidate = ordered.FirstOrDefault(predicate);
                }
            }

            return candidate;
        }
开发者ID:modulexcite,项目名称:ripple,代码行数:35,代码来源:PackageFiltering.cs


示例2: DependencyInfo

        public DependencyInfo(FullPackageName fullName, IVersionSpec versionSpec)
        {
            FullName = fullName;

            // Default to the simple version (which means min-version)
            VersionSpec = versionSpec ?? VersionUtility.ParseVersionSpec(FullName.Version.ToString());
        }
开发者ID:larsw,项目名称:nuget,代码行数:7,代码来源:Program.cs


示例3: Matches

        public static bool Matches(IVersionSpec versionSpec, SemanticVersion version)
        {
            if (versionSpec == null)
                return true; // I CAN'T DEAL WITH THIS

            bool minVersion;
            if (versionSpec.MinVersion == null) {
                minVersion = true; // no preconditon? LET'S DO IT
            } else if (versionSpec.IsMinInclusive) {
                minVersion = version >= versionSpec.MinVersion;
            } else {
                minVersion = version > versionSpec.MinVersion;
            }

            bool maxVersion;
            if (versionSpec.MaxVersion == null) {
                maxVersion = true; // no preconditon? LET'S DO IT
            } else if (versionSpec.IsMaxInclusive) {
                maxVersion = version <= versionSpec.MaxVersion;
            } else {
                maxVersion = version < versionSpec.MaxVersion;
            }

            return maxVersion && minVersion;
        }
开发者ID:christianrondeau,项目名称:Squirrel.Windows.Next,代码行数:25,代码来源:ReleasePackage.cs


示例4: GetPackage

        public void GetPackage(string packageId, IVersionSpec version)
        {
            /*
            if (repositoryRemote == null)
            {
                //var repositoryRemote = PackageRepositoryFactory.Default.CreateRepository("https://nuget.org/api/v2");
                repositoryRemote = PackageRepositoryFactory.Default.CreateRepository(@"C:\Dev\Tools\NuGetFeed");
            }
            if (repositoryLocal == null)
            {
                repositoryLocal = GetLocalRepository();
            }
            */
            var packageInfo = FindPackage(packageId, version, false, false);

            if (packageInfo == null)
                throw new NotImplementedException();

            var localRepository = _repositories[0];
            if (localRepository != packageInfo.Item1)
            {
                localRepository.AddPackage(packageInfo.Item2);
            }

            foreach (var deps in packageInfo.Item2.DependencySets)
            {
                foreach (var dep in deps.Dependencies)
                {
                    GetPackage(dep.Id, dep.VersionSpec);
                }
            }
        }
开发者ID:CloudMorph,项目名称:cloudmorph-fabric,代码行数:32,代码来源:LibraryService.cs


示例5: PackageDependency

 public PackageDependency(string id, IVersionSpec versionSpec)
 {
     if (String.IsNullOrEmpty(id)) {
         throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "id");
     }
     Id = id;
     VersionSpec = versionSpec;
 }
开发者ID:larsw,项目名称:nuget,代码行数:8,代码来源:PackageDependency.cs


示例6: PackageDependency

 public PackageDependency(string id, IVersionSpec versionSpec)
 {
     if (String.IsNullOrEmpty(id)) {
         throw new ArgumentNullException("id");
     }
     Id = id;
     VersionSpec = versionSpec;
 }
开发者ID:jacksonh,项目名称:nuget,代码行数:8,代码来源:PackageDependency.cs


示例7: SafeToVerRange

 internal static VersionRange SafeToVerRange(IVersionSpec spec)
 {
     if(spec == null) {
         return null;
     }
     return new VersionRange(
         SafeToNuGetVer(spec.MinVersion),
         spec.IsMinInclusive,
         SafeToNuGetVer(spec.MaxVersion),
         spec.IsMaxInclusive);
 }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:11,代码来源:CoreConverters.cs


示例8: Dependency

        public Dependency(string name, IVersionSpec versionSpec)
            : this(name)
        {
            if (versionSpec.MinVersion != null && versionSpec.MaxVersion != null &&
                versionSpec.MinVersion == versionSpec.MaxVersion)
            {
                Mode = UpdateMode.Fixed;
                Version = versionSpec.MinVersion.Version.ToString();
            }
            else
            {
                Mode = UpdateMode.Float;
            }

            _versionSpec = versionSpec;
        }
开发者ID:kjnilsson,项目名称:ripple,代码行数:16,代码来源:Dependency.cs


示例9: AzureVersionSpec

        public AzureVersionSpec(IVersionSpec version)
        {

            this.IsMaxInclusive = version.IsMaxInclusive;
            this.IsMinInclusive = version.IsMinInclusive;

            if (version.MaxVersion != null)
            {
                this.MaxVersionSpecial = version.MaxVersion.SpecialVersion;
                this.MaxVersionVersion = version.MaxVersion.Version.ToString();
            }

            if (version.MinVersion != null)
            {
                this.MinVersionSpecial = version.MinVersion.SpecialVersion;
                this.MinVersionVersion = version.MinVersion.Version.ToString();
            }
        }
开发者ID:rjygraham,项目名称:Nuget.Server.AzureStorage,代码行数:18,代码来源:AzureVersionSpec.cs


示例10: EnumPackageRequests

        /// <summary>
        /// Enumerates the required package requests.
        /// </summary>
        /// <param name="packageId">
        /// The package id.
        /// </param>
        /// <param name="version">
        /// The version.
        /// </param>
        /// <returns>
        /// An enumeration of package requests.
        /// </returns>
        public IEnumerable<SolutionPackageRequest> EnumPackageRequests(string packageId, IVersionSpec version)
        {
            if (packageId.EndsWith(Constants.SolutionPackagePostFix, StringComparison.CurrentCultureIgnoreCase))
            {
                var packageRequest = SolutionPackageRequestFactory.CreatePackageRequest(packageId, version);
                if (packageRequest != null)
                {
                    yield return packageRequest;

                    foreach (var dependencySet in packageRequest.Package.DependencySets)
                    {
                        foreach (var dependency in dependencySet.Dependencies)
                        {
                            foreach (var request in this.EnumPackageRequests(dependency.Id, dependency.VersionSpec))
                            {
                                yield return request;
                            }
                        }
                    }
                }
            }
        }
开发者ID:alexfdezsauco,项目名称:PackageManager.SharePoint,代码行数:34,代码来源:SolutionPackageRequestService.cs


示例11: findPackageFromName

        IPackage findPackageFromName(string id, IVersionSpec versionSpec, string packagesRootDir = null, IQueryable<IPackage> machineCache = null)
        {
            machineCache = machineCache ?? Enumerable.Empty<IPackage>().AsQueryable();

            if (packagesRootDir != null && localPackageCache == null) {
                localPackageCache = Utility.GetAllFilePathsRecursively(packagesRootDir)
                    .Where(PackageHelper.IsPackageFile)
                    .Select(x => new ZipPackage(x))
                    .ToArray();
            }

            return findPackageFromNameInList(id, versionSpec, localPackageCache ?? Enumerable.Empty<IPackage>()) ??
                findPackageFromNameInList(id, versionSpec, machineCache);
        }
开发者ID:KyleGobel,项目名称:Shimmer,代码行数:14,代码来源:ReleasePackage.cs


示例12: findPackageFromNameInList

 static IPackage findPackageFromNameInList(string id, IVersionSpec versionSpec, IEnumerable<IPackage> packageList)
 {
     return packageList.Where(x => x.Id == id).ToArray()
         .FirstOrDefault(x => VersionComparer.Matches(versionSpec, x.Version));
 }
开发者ID:KyleGobel,项目名称:Shimmer,代码行数:5,代码来源:ReleasePackage.cs


示例13: NuspecDependency

 public NuspecDependency(string name, IVersionSpec spec)
 {
     Name = name;
     VersionSpec = spec;
 }
开发者ID:4lexm,项目名称:ripple,代码行数:5,代码来源:NuspecDependency.cs


示例14: UpdatePackageReference

		public void UpdatePackageReference (string packageId, IVersionSpec versionSpec, bool updateDependencies, bool allowPrereleaseVersions)
		{
			throw new NotImplementedException ();
		}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:4,代码来源:FakeProjectManager.cs


示例15: AddConstraint

 public void AddConstraint(string packageId, IVersionSpec versionSpec)
 {
     _constraints[packageId] = versionSpec;
 }
开发者ID:Newtopian,项目名称:nuget,代码行数:4,代码来源:DefaultConstraintProvider.cs


示例16: TryParseVersionSpec

        /// <summary>
        /// Copyright 2010 Outercurve Foundation 
        /// Licensed under the Apache License, Version 2.0 (the "License"); 
        /// you may not use this file except in compliance with the License. 
        /// You may obtain a copy of the License at 
        ///  http://www.apache.org/licenses/LICENSE-2.0 
        /// Unless required by applicable law or agreed to in writing, software 
        /// distributed under the License is distributed on an "AS IS" BASIS, 
        /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
        /// See the License for the specific language governing permissions and 
        /// limitations under the License.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static bool TryParseVersionSpec(string value, out IVersionSpec result)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var versionSpec = new VersionSpec();
            value = value.Trim();

            // First, try to parse it as a plain version string
            Version version;
            if (Version.TryParse(value, out version))
            {
                // A plain version is treated as an inclusive minimum range
                result = new VersionSpec
                {
                    MinVersion = version,
                    IsMinInclusive = true
                };

                return true;
            }

            // It's not a plain version, so it must be using the bracket arithmetic range syntax

            result = null;

            // Fail early if the string is too short to be valid
            if (value.Length < 3)
            {
                return false;
            }

            // The first character must be [ ot (
            switch (value.First())
            {
                case '[':
                    versionSpec.IsMinInclusive = true;
                    break;
                case '(':
                    versionSpec.IsMinInclusive = false;
                    break;
                default:
                    return false;
            }

            // The last character must be ] ot )
            switch (value.Last())
            {
                case ']':
                    versionSpec.IsMaxInclusive = true;
                    break;
                case ')':
                    versionSpec.IsMaxInclusive = false;
                    break;
                default:
                    return false;
            }

            // Get rid of the two brackets
            value = value.Substring(1, value.Length - 2);

            // Split by comma, and make sure we don't get more than two pieces
            string[] parts = value.Split(',');
            if (parts.Length > 2)
            {
                return false;
            }

            // If there is only one piece, we use it for both min and max
            string minVersionString = parts[0];
            string maxVersionString = (parts.Length == 2) ? parts[1] : parts[0];

            // Only parse the min version if it's non-empty
            if (!String.IsNullOrWhiteSpace(minVersionString))
            {
                if (!Version.TryParse(minVersionString, out version))
                {
                    return false;
                }
                versionSpec.MinVersion = version;
            }

            // Same deal for max
//.........这里部分代码省略.........
开发者ID:mausch,项目名称:RefactorToMonadicCSharp,代码行数:101,代码来源:Imperative.cs


示例17: StripPatchLevel

    private static IVersionSpec StripPatchLevel(IVersionSpec dependencyVersionSpec)
    {
      // Given a curatedFeedVersion of 8.0, make [8.0.1] work. Semver says the patch
      // level should be backwards compatible, so this should be safe
      var spec = new VersionSpec
      {
        IsMinInclusive = true,
        MinVersion =
          new SemanticVersion(dependencyVersionSpec.MinVersion.Version.Major,
            dependencyVersionSpec.MinVersion.Version.Minor, 0, 0),
        IsMaxInclusive = dependencyVersionSpec.IsMaxInclusive,
        MaxVersion = dependencyVersionSpec.MaxVersion
      };

      return spec;
    }
开发者ID:JetBrains,项目名称:ReSharperGallery,代码行数:16,代码来源:RequiredDependencyPackageCurator.cs


示例18: findPackageFromNameInList

        IPackage findPackageFromNameInList(string id, IVersionSpec versionSpec, IQueryable<IPackage> packageList)
        {
            // Apply a VersionSpec to a specific Version (this code is nicked
            // from NuGet)
            return packageList.Where(x => x.Id == id).ToArray().FirstOrDefault(x => {
                if (((versionSpec != null) && (versionSpec.MinVersion != null)) && (versionSpec.MaxVersion != null)) {
                    if ((!versionSpec.IsMaxInclusive || !versionSpec.IsMinInclusive) && (versionSpec.MaxVersion == versionSpec.MinVersion)) {
                        return false;
                    }

                    if (versionSpec.MaxVersion < versionSpec.MinVersion) {
                        return false;
                    }
                }

                return true;
            });
        }
开发者ID:iamnilay3,项目名称:Shimmer,代码行数:18,代码来源:ReleasePackage.cs


示例19: UpdatePackage

 public void UpdatePackage(string packageId, IVersionSpec versionSpec, bool updateDependencies, bool allowPrereleaseVersions)
 {
     UpdatePackage(packageId, () => SourceRepository.FindPackage(packageId, versionSpec, allowPrereleaseVersions, allowUnlisted: false),
         updateDependencies, allowPrereleaseVersions);
 }
开发者ID:monoman,项目名称:NugetCracker,代码行数:5,代码来源:PackageManager.cs


示例20: AddCacheEntryByConstraint

        /// <summary>
        /// Adds a package that has been resolved as the latest within a constraint.  Saves doing the math and resolution again.
        /// </summary>
        /// <param name="package"></param>
        /// <param name="constraint"></param>
        /// <returns></returns>
        public bool AddCacheEntryByConstraint(IPackage package, IVersionSpec constraint)
        {
            if (!_latestPackageConstraintCache.ContainsKey(package.Id))
                _latestPackageConstraintCache.Add(package.Id, new Dictionary<IVersionSpec, IPackage>());

            if (!_latestPackageConstraintCache[package.Id].ContainsKey(constraint))
            {
                _latestPackageConstraintCache[package.Id].Add(constraint, package);
                return true;
            }
            return false;

        }
开发者ID:modulexcite,项目名称:NuGet.Extensions,代码行数:19,代码来源:MemoryBasedPackageCache.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVertex类代码示例发布时间:2022-05-24
下一篇:
C# IVersion类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap