protected bool Equals(NuspecDependency other) { var versionsMatch = false; if (VersionSpec == null && other.VersionSpec == null) { versionsMatch = true; } else if (VersionSpec != null && other.VersionSpec != null) { versionsMatch = VersionSpec.ToString().Equals(other.VersionSpec.ToString()); } return string.Equals(Name, other.Name) && versionsMatch; }
public void AddDependency(NuspecDependency dependency) { var dependencies = _document.XPathSelectElement("//nuspec:dependencies", _xmlNamespaceManager); foreach (XElement dependencyElement in dependencies.Nodes()) { if (dependencyElement.Attribute("id").Value == dependency.Name) { dependencyElement.SetAttributeValue("version", dependency.VersionSpec.ToString()); return; } } var element = new XElement(_xmlns + "dependency"); element.SetAttributeValue("id", dependency.Name); if (dependency.VersionSpec != null) { element.SetAttributeValue("version", dependency.VersionSpec.ToString()); } dependencies.Add(element); }