public static int InstalledModsListHash(bool activeOnly) { int num = 17; int num2 = 0; foreach (ModMetaData item in ModsConfig.ActiveModsInLoadOrder) { if (!activeOnly || ModsConfig.IsActive(item.PackageId)) { num = num * 31 + item.GetHashCode(); num = num * 31 + num2 * 2654241; num2++; } } return(num); }
public override bool TryResolve(FailMode failReportMode) { bool flag = false; for (int i = 0; i < defNames.Count; i++) { bool flag2 = mayRequireMods != null && i < mayRequireMods.Count && !mayRequireMods[i].NullOrEmpty() && !ModsConfig.IsActive(mayRequireMods[i]); T val = TryResolveDef <T>(defNames[i], (!flag2) ? failReportMode : FailMode.Silent, debugWanterInfo); if (val != null) { ((List <T>)wanter).Add(val); defNames.RemoveAt(i); if (mayRequireMods != null && i < mayRequireMods.Count) { mayRequireMods.RemoveAt(i); } i--; } else { flag = true; } } return(!flag); }
private static List <T> ListFromXml <T>(XmlNode listRootNode) { List <T> list = new List <T>(); try { bool flag = typeof(Def).IsAssignableFrom(typeof(T)); foreach (XmlNode childNode in listRootNode.ChildNodes) { if (!ValidateListNode(childNode, listRootNode, typeof(T))) { continue; } XmlAttribute xmlAttribute = childNode.Attributes["MayRequire"]; if (flag) { DirectXmlCrossRefLoader.RegisterListWantsCrossRef(list, childNode.InnerText, listRootNode.Name, xmlAttribute?.Value); continue; } try { if (xmlAttribute == null || xmlAttribute.Value.NullOrEmpty() || ModsConfig.IsActive(xmlAttribute.Value)) { list.Add(ObjectFromXml <T>(childNode, doPostLoad: true)); } } catch (Exception ex) { Log.Error(string.Concat("Exception loading list element from XML: ", ex, "\nXML:\n", listRootNode.OuterXml)); } } return(list); } catch (Exception ex2) { Log.Error(string.Concat("Exception loading list from XML: ", ex2, "\nXML:\n", listRootNode.OuterXml)); return(list); } }