protected static bool LoadSocialData(BooterHelper.DocumentBootFile socialData) { if (!socialData.IsValid) { BooterLogger.AddError(socialData + ": Unknown SocialData File"); return(false); } XmlElementLookup lookup = new XmlElementLookup(socialData.Document); List <XmlElement> actions = lookup["Action"]; if ((actions == null) || (actions.Count == 0)) { BooterLogger.AddError(socialData + ": No Action"); return(false); } bool isEp5Installed = GameUtils.IsInstalled(ProductVersion.EP5); foreach (XmlElement element in actions) { XmlElementLookup table = new XmlElementLookup(element); CommodityTypes types; ParserFunctions.TryParseEnum <CommodityTypes>(element.GetAttribute("com"), out types, CommodityTypes.Undefined); ProductVersion version; ParserFunctions.TryParseEnum <ProductVersion>(element.GetAttribute("ver"), out version, ProductVersion.BaseGame); ActionData data = new ActionData(element.GetAttribute("key"), types, version, table, isEp5Installed); List <XmlElement> list = table["LHS"]; if (list.Count > 0x0) { SocialRuleLHS.sDictionary.Remove(data.Key); foreach (XmlElement element3 in list) { SocialRuleLHS lhs = new SocialRuleLHS(data.Key, data.IntendedCommodityString, element3); lhs.ProceduralPrecondition = FindMethod(element3.GetAttribute("ProcTest")); } SocialRuleLHS.Get(data.Key).Sort(new Comparison <SocialRuleLHS>(SocialRuleLHS.SortSocialRules)); } ActionData.Add(data); BooterLogger.AddTrace(" " + data.Key + " Added"); } return(true); }
public static void LoadSocialData(string spreadsheet) { XmlDocument root = Simulator.LoadXML(spreadsheet); bool isEp5Installed = GameUtils.IsInstalled(ProductVersion.EP5); if (spreadsheet != null) { XmlElementLookup lookup = new XmlElementLookup(root); List <XmlElement> list = lookup["Action"]; foreach (XmlElement element in list) { CommodityTypes types; XmlElementLookup table = new XmlElementLookup(element); ParserFunctions.TryParseEnum <CommodityTypes>(element.GetAttribute("com"), out types, CommodityTypes.Undefined); ActionData data = new ActionData(element.GetAttribute("key"), types, ProductVersion.BaseGame, table, isEp5Installed); ActionData.Add(data); } } }
protected static bool LoadSocialData(BooterHelper.DocumentBootFile socialData) { if (!socialData.IsValid) { BooterLogger.AddError(socialData + ": Unknown SocialData File"); return false; } XmlElementLookup lookup = new XmlElementLookup(socialData.Document); List<XmlElement> actions = lookup["Action"]; if ((actions == null) || (actions.Count == 0)) { BooterLogger.AddError(socialData + ": No Action"); return false; } bool isEp5Installed = GameUtils.IsInstalled(ProductVersion.EP5); foreach (XmlElement element in actions) { XmlElementLookup table = new XmlElementLookup(element); CommodityTypes types; ParserFunctions.TryParseEnum<CommodityTypes>(element.GetAttribute("com"), out types, CommodityTypes.Undefined); ProductVersion version; ParserFunctions.TryParseEnum<ProductVersion>(element.GetAttribute("ver"), out version, ProductVersion.BaseGame); ActionData data = new ActionData(element.GetAttribute("key"), types, version, table, isEp5Installed); List<XmlElement> list = table["LHS"]; if (list.Count > 0x0) { SocialRuleLHS.sDictionary.Remove(data.Key); foreach (XmlElement element3 in list) { SocialRuleLHS lhs = new SocialRuleLHS(data.Key, data.IntendedCommodityString, element3); lhs.ProceduralPrecondition = FindMethod(element3.GetAttribute("ProcTest")); } SocialRuleLHS.Get(data.Key).Sort(new Comparison<SocialRuleLHS>(SocialRuleLHS.SortSocialRules)); } ActionData.Add(data); BooterLogger.AddTrace(" " + data.Key + " Added"); } return true; }