コード例 #1
0
ファイル: SetWrapCommand.cs プロジェクト: seantfox/openwrap
 PackageDependency UpdatedDependency(PackageDependency dependency)
 {
     var builder = new PackageDependencyBuilder(dependency);
     if (_content.HasValue)
     {
         builder = builder.Content(_content.Value);
     }
     if (_anchored.HasValue)
     {
         builder = builder.Anchored(_anchored.Value);
     }
     if (SomeVersionInputGiven)
     {
         builder = builder.SetVersionVertices(Enumerable.Empty<VersionVertex>());
     }
     if (AnyVersion)
     {
         builder = builder.VersionVertex(new AnyVersionVertex());
     }
     if (Version != null)
     {
         builder = builder.VersionVertex(new ExactVersionVertex(Version.ToVersion()));
     }
     if (MinVersion != null)
     {
         builder = builder.VersionVertex(new GreaterThenOrEqualVersionVertex(MinVersion.ToVersion()));
     }
     if (MaxVersion != null)
     {
         builder = builder.VersionVertex(new LessThanVersionVertex(MaxVersion.ToVersion()));
     }
     return builder;
 }
コード例 #2
0
ファイル: NuGetConverter.cs プロジェクト: seantfox/openwrap
        static PackageDependency CreateDependency(XmlNode xmlNode)
        {
            var dep = new PackageDependencyBuilder((xmlNode.Attributes["id"] ?? xmlNode.Attributes["id", NuSpecSchema]).Value);

            var version = xmlNode.Attributes["version"] ?? xmlNode.Attributes["version", NuSpecSchema];
            var minversion = xmlNode.Attributes["minversion"] ?? xmlNode.Attributes["minversion", NuSpecSchema];
            var maxversion = xmlNode.Attributes["maxversion"] ?? xmlNode.Attributes["maxversion", NuSpecSchema];
            if (version != null)
                dep.VersionVertex(new ExactVersionVertex(version.Value.ToVersion()));
            if (minversion != null)
                dep.VersionVertex(new GreaterThenOrEqualVersionVertex(minversion.Value.ToVersion()));
            if (maxversion != null)
                dep.VersionVertex(new LessThanVersionVertex(maxversion.Value.ToVersion()));
            return dep;
        }