public virtual ManifestModuleInfo LoadFromExternalManifest(ExternalModuleManifest manifest, ExternalModuleManifestVersion version) { if (manifest == null) { throw new ArgumentNullException(nameof(manifest)); } ModuleName = manifest.Id; if (version.Dependencies != null) { foreach (var dependency in version.Dependencies) { DependsOn.Add(dependency.Id); } } Id = manifest.Id; Version = version.SemanticVersion; VersionTag = version.VersionTag; PlatformVersion = version.PlatformSemanticVersion; ReleaseNotes = version.ReleaseNotes; Ref = version.PackageUrl; if (version.Dependencies != null) { Dependencies.AddRange(version.Dependencies.Select(x => new ModuleIdentity(x.Id, SemanticVersion.Parse(x.Version)))); } if (version.Incompatibilities != null) { Incompatibilities.AddRange(version.Incompatibilities.Select(x => new ModuleIdentity(x.Id, SemanticVersion.Parse(x.Version)))); } Title = manifest.Title; Description = manifest.Description; Authors = manifest.Authors; Owners = manifest.Owners; LicenseUrl = manifest.LicenseUrl; ProjectUrl = manifest.ProjectUrl; IconUrl = manifest.IconUrl; RequireLicenseAcceptance = manifest.RequireLicenseAcceptance; Copyright = manifest.Copyright; Tags = manifest.Tags; Identity = new ModuleIdentity(Id, Version); if (manifest.Groups != null) { Groups.AddRange(manifest.Groups); } return(this); }
public static ExternalModuleManifest FromManifest(ModuleManifest manifest) { var result = new ExternalModuleManifest { Title = manifest.Title, Description = manifest.Description, Authors = manifest.Authors, Copyright = manifest.Copyright, Groups = manifest.Groups, IconUrl = manifest.IconUrl, Id = manifest.Id, LicenseUrl = manifest.LicenseUrl, Owners = manifest.Owners, ProjectUrl = manifest.ProjectUrl, RequireLicenseAcceptance = manifest.RequireLicenseAcceptance, Tags = manifest.Tags }; result.Versions.Add(ExternalModuleManifestVersion.FromManifest(manifest)); return(result); }