private static bool LoadDaiBiShiYong(out List <BoCaiConfigMgr.DaiBiShiYongData> _DaiBiShiYongCfgList) { _DaiBiShiYongCfgList = new List <BoCaiConfigMgr.DaiBiShiYongData>(); try { XElement xml = CheckHelper.LoadXml(Global.GameResPath("Config/DaiBiShiYong.xml"), true); if (null == xml) { LogManager.WriteLog(LogTypes.Fatal, string.Format("读取 {0} null == xml", "Config/DaiBiShiYong.xml"), null, true); return(false); } IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { if (null != xmlItem) { BoCaiConfigMgr.DaiBiShiYongData myData = new BoCaiConfigMgr.DaiBiShiYongData(); myData.ID = (int)Global.GetSafeAttributeLong(xmlItem, "ID"); myData.IsOpen = ((int)Global.GetSafeAttributeLong(xmlItem, "DaiBiKaiGuan") > 0); myData.XiTongMingCheng = Global.GetSafeAttributeStr(xmlItem, "XiTongMingCheng").Trim(); myData.ZhongWenMingCheng = Global.GetSafeAttributeStr(xmlItem, "ZhongWenMingCheng"); _DaiBiShiYongCfgList.Add(myData); } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/DuiHuanShangCheng.xml", ex.Message), null, true); return(false); } return(true); }
public static bool CanReplaceMoney(DaiBiSySType type) { try { BoCaiConfigMgr.DaiBiShiYongData cfg = BoCaiConfigMgr.DaiBiShiYongCfgList.Find((BoCaiConfigMgr.DaiBiShiYongData x) => x.XiTongMingCheng.Equals(type.ToString())); if (null != cfg) { return(cfg.IsOpen); } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true); } return(false); }