示例#1
0
        public int PackageVersionAsNumber()
        {
            Version version = VersionParser.ParseVersion(PackageVersion);
            int     result  = version.Major * 1000000;

            if (version.Minor != null)
            {
                result += ((int)version.Minor) * 1000;
            }
            if (version.Patch != null)
            {
                result += (int)version.Patch;
            }
            return(result);
        }
示例#2
0
        public override PackageRepo[] Filter(PackageRepo[] candidates)
        {
            var result = new List <PackageRepo>();

            var grouped = candidates.GroupBy(pr => new {
                pr.Package.PackageName,
                pr.Package.PackageVersion
            });

            foreach (var group in grouped)
            {
                var closestMatch = group.OrderByDescending(i => VersionParser.ParseVersion(i.Package.UnityVersion, false)).First();
                result.Add(closestMatch);
            }

            return(result.ToArray());
        }
        public override PackageRepo[] Filter(PackageRepo[] candidates)
        {
            var result = new List <PackageRepo>();

            foreach (PackageRepo item in candidates)
            {
                // if lack of UnityVersion - continue gracefully but notify
                if (item.Package.UnityVersion == null)
                {
                    Debug.LogWarning("Package " + item.Package.ToString() + " doesn't have minimal UnityVersion specified!");
                    result.Add(item);
                    continue;
                }

                Version packageUnityRequirement = VersionParser.ParseVersion(item.Package.UnityVersion, false);

                if (unityVersion >= packageUnityRequirement)
                {
                    result.Add(item);
                }
            }

            return(result.ToArray());
        }
 public OnlyMatchingUnityVersionStrategy(string unityVersion)
 {
     this.unityVersion = VersionParser.ParseVersion(unityVersion, false);
 }
示例#5
0
 public FindBestPackageForUnityVersion(string unityVersion)
 {
     this.unityVersion = VersionParser.ParseVersion(unityVersion, false);
 }