using System; using System.Collections.Generic; using JetBrains.Annotations; using NugetForUnity.PackageSource; using UnityEngine; namespace NugetForUnity.Models { /// /// Represents a package available from NuGet. /// [Serializable] internal sealed class NugetPackageV2 : NugetPackageV2Base { [NotNull] [SerializeField] private NugetPackageSourceV2 packageSourceV2; [CanBeNull] [SerializeField] private List versions; /// /// Initializes a new instance of the class. /// /// The source this package was downloaded with / provided by. public NugetPackageV2([NotNull] NugetPackageSourceV2 packageSourceV2) { this.packageSourceV2 = packageSourceV2; } /// public override INugetPackageSource PackageSource => packageSourceV2; /// public override List Versions { get { if (versions == null) { versions = new List { PackageVersion }; } return versions; } } /// /// Creates a new from the given . /// /// The to use to create the . /// The source this package was downloaded with / provided by. /// The newly created . [NotNull] public static NugetPackageV2 FromNuspec([NotNull] NuspecFile nuspec, [NotNull] NugetPackageSourceV2 packageSource) { var package = new NugetPackageV2(packageSource); FillFromNuspec(nuspec, package); return package; } } }