private static void CacheAllModInfoAsync() { var mymod = ModHelpersMod.Instance; var modInfoArgs = new ModInfoListPromiseArguments(); GetModInfo.RetrieveAllModInfoAsync((modInfo, found) => { modInfoArgs.ModInfo = modInfo; modInfoArgs.Found = found; Promises.TriggerValidatedPromise(GetModInfo.ModInfoListPromiseValidator, GetModInfo.PromiseValidatorKey, modInfoArgs); }); Promises.AddValidatedPromise <ModInfoListPromiseArguments>(GetModInfo.ModInfoListPromiseValidator, (modInfoArgs2) => { if (modInfoArgs2.Found) { GetModInfo.RetrieveBadModsAsync((badMods, found) => { if (found) { GetModInfo.RegisterBadMods(modInfoArgs2, badMods); } Promises.TriggerValidatedPromise(GetModInfo.BadModsListPromiseValidator, GetModInfo.PromiseValidatorKey, modInfoArgs2); }); } return(true); }); }
private static void RegisterBadMods(ModInfoListPromiseArguments modInfoArgs, IDictionary <string, int> badMods) { foreach (var kv in modInfoArgs.ModInfo) { string modName = kv.Key; BasicModInfoEntry modInfo = kv.Value; modInfo.IsBadMod = badMods.ContainsKey(modName); } }