Ejemplo n.º 1
0
        ////////////////

        public static bool IsLoadedModProperlyPresented(string modName)
        {
            Mod mod = ModLoader.GetMod(modName);

            if (mod == null)
            {
                LogHelpers.Alert("Invalid mod " + modName);
                return(false);
            }

            IDictionary <string, Services.Tml.BuildPropertiesEditor> modInfos = ModListHelpers.GetLoadedModNamesWithBuildProps();

            if (!modInfos.ContainsKey(modName))
            {
                LogHelpers.Alert("Missing mod " + modName);
                return(false);
            }

            var modInfo = new BasicModInfoEntry(mod.DisplayName,
                                                modInfos[modName].Author.Split(',').SafeSelect(a => a.Trim()),
                                                mod.Version, modInfos[modName].Description, modInfos[modName].Homepage
                                                );

            return(ModIdentityHelpers.IsProperlyPresented(modInfo));
        }
Ejemplo n.º 2
0
        ////////////////

        public static string FormatBadDependencyModList(Mod mod)
        {
            IDictionary <Mod, Version> badDepMods = ModIdentityHelpers.FindDependencyModMajorVersionMismatches(mod);

            if (badDepMods.Count != 0)
            {
                IEnumerable <string> badDepModsList = badDepMods.SafeSelect(
                    kv => kv.Key.DisplayName + " (needs " + kv.Value.ToString() + ", is " + kv.Key.Version.ToString() + ")"
                    );
                return(mod.DisplayName + " (" + mod.Name + ") is out of date with its dependency mod(s): " + string.Join(", \n", badDepModsList));
            }
            return(null);
        }
Ejemplo n.º 3
0
        public static void IsListModProperlyPresented(string modName, Action <bool> callback)
        {
            Promises.AddValidatedPromise <ModInfoListPromiseArguments>(GetModInfo.ModInfoListPromiseValidator, (args) => {
                if (args.Found && args.ModInfo.ContainsKey(modName))
                {
                    BasicModInfoEntry modInfo = args.ModInfo[modName];

                    bool isProper = ModIdentityHelpers.IsProperlyPresented(modInfo);

                    callback(isProper);
                }
                else
                {
                    if (ModHelpersMod.Instance.Config.DebugModeNetInfo)
                    {
                        LogHelpers.Log("Error retrieving mod data for '" + modName + "'");                           //+ "': " + reason );
                    }
                }
                return(false);
            });
        }