本文整理汇总了C#中IVersionSpec类的典型用法代码示例。如果您正苦于以下问题:C# IVersionSpec类的具体用法?C# IVersionSpec怎么用?C# IVersionSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVersionSpec类属于命名空间,在下文中一共展示了IVersionSpec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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());
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例6: PackageDependency
public PackageDependency(string id, IVersionSpec versionSpec)
{
if (String.IsNullOrEmpty(id)) {
throw new ArgumentNullException("id");
}
Id = id;
VersionSpec = versionSpec;
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
}
}
}
}
}
示例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);
}
示例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));
}
示例13: NuspecDependency
public NuspecDependency(string name, IVersionSpec spec)
{
Name = name;
VersionSpec = spec;
}
示例14: UpdatePackageReference
public void UpdatePackageReference (string packageId, IVersionSpec versionSpec, bool updateDependencies, bool allowPrereleaseVersions)
{
throw new NotImplementedException ();
}
示例15: AddConstraint
public void AddConstraint(string packageId, IVersionSpec versionSpec)
{
_constraints[packageId] = versionSpec;
}