/// <summary> /// Loads a <see cref="Repository"/> from a repository element. /// </summary> /// <param name="value"> /// The element from which to load the <see cref="Repository"/>. /// </param> /// <param name="baseUri"> /// The base <see cref="Uri"/> which is used to resolve relative package URLs. /// </param> /// <returns> /// A new <see cref="Repository"/> object. /// </returns> public static Repository FromXElement(XElement value, Uri baseUri) { if (value == null) { throw new ArgumentNullException(nameof(value)); } if ((value.Name.Namespace != Repository.RepositoryNamespace && value.Name.LocalName != "sdk-repository") && (value.Name.Namespace != Repository.AddonNamespace && value.Name.LocalName != "sdk-addon")) { throw new ArgumentOutOfRangeException(nameof(value)); } var repository = new Repository() { Namespace = value.Name.Namespace }; repository.LoadComponents(value, repository.BuildTools, repository.Namespace + "build-tool", baseUri); repository.LoadComponents(value, repository.PlatformTools, repository.Namespace + "platform-tool", baseUri); repository.LoadExtras(value, repository.Extras, repository.Namespace, baseUri); return repository; }
/// <summary> /// Merges another repository with this repository. /// </summary> /// <param name="other"> /// The repository to merge into this repository. /// </param> public void Merge(Repository other) { this.BuildTools.AddRange(other.BuildTools); this.Extras.AddRange(other.Extras); this.PlatformTools.AddRange(other.PlatformTools); }