Пример #1
0
            public bool TryParseSupportedVersions(bool logIssues = true)
            {
                if (targetVersion != null && logIssues)
                {
                    Log.Warning("Mod " + name + ": targetVersion field is obsolete, use supportedVersions instead.");
                }
                bool flag = false;

                SupportedVersions = new List <System.Version>();
                if (packageId.ToLower() == ModContentPack.CoreModPackageId)
                {
                    SupportedVersions.Add(VersionControl.CurrentVersion);
                }
                else if (supportedVersions == null)
                {
                    if (logIssues)
                    {
                        Log.Warning("Mod " + name + " is missing supported versions list in About.xml! (example: <supportedVersions><li>1.0</li></supportedVersions>)");
                    }
                    flag = true;
                }
                else if (supportedVersions.Count == 0)
                {
                    if (logIssues)
                    {
                        Log.Error("Mod " + name + ": <supportedVersions> in mod About.xml must specify at least one version.");
                    }
                    flag = true;
                }
                else
                {
                    for (int i = 0; i < supportedVersions.Count; i++)
                    {
                        flag |= !TryParseVersion(supportedVersions[i], logIssues);
                    }
                }
                SupportedVersions = (from v in SupportedVersions
                                     orderby(!VersionControl.IsCompatible(v)) ? 100 : (-100), v.Major descending, v.Minor descending
                                     select v).Distinct().ToList();
                return(!flag);
            }
Пример #2
0
 public static VersionStatus For(ModMetaData mod, List <Version> versions)
 {
     return(For(mod, versions.Any(v => VersionControl.IsCompatible(v)), versions));
 }