/// <summary> /// 用 ESI 获取的蓝图数据更新数据库中的一般属性 /// </summary> /// <param name="esiBluePrint">ESI数据</param> private void _updateGeneralPropertyFromESIData(OwnedBluePrints esiBluePrint) { Owner = esiBluePrint.Owner; CharacterOwned = esiBluePrint.CharacterOwned; LocationID = esiBluePrint.LocationID; LocationFlag = esiBluePrint.LocationFlag; }
/// <summary> /// 用ESI数据更新蓝图的全部属性(ItemID,BluePrintID除外) /// </summary> /// <param name="esiBluePrint"></param> private void _updateAllPropertyFromESIData(OwnedBluePrints esiBluePrint) { // 更新基本属性 //BluePrintID = esiBluePrint.BluePrintID; TimeEfficiency = esiBluePrint.TimeEfficiency; MaterialEfficiency = esiBluePrint.MaterialEfficiency; Quantity = esiBluePrint.Quantity; Runs = esiBluePrint.Runs; // 更新一般属性 _updateGeneralPropertyFromESIData(esiBluePrint); }
/// <summary> /// 获取角色和军团(若有权限)拥有的蓝图列表 /// 蓝图不单独更新, 所有角色批量更新, 防止有蓝图给予等现象 /// </summary> /// <returns></returns> public List <OwnedBluePrints> GetBluePrints() { DateTime updateTime = DateTime.Now; // 通过ESI获取角色拥有的蓝图列表 List <ESIBluePrint> lstBluePrint = ESI.GetBluePrints(CharacterID, GetAccessToken()); // 若获取失败, 则返回空值 if (lstBluePrint == null) { return(null); } List <OwnedBluePrints> lstOwnedBluePrints = new List <OwnedBluePrints>(); OwnedBluePrints ownedBluePrints; // 将ESI获得的数据转换为Linq对象 foreach (var bp in lstBluePrint) { ownedBluePrints = new OwnedBluePrints() { ItemID = bp.ItemID, BluePrintID = bp.TypeID, Owner = CharacterID, CharacterOwned = true, LocationID = bp.LocationID, LocationFlag = bp.LocationFlag, Quantity = bp.Quantity, TimeEfficiency = bp.TimeEfficiency, MaterialEfficiency = bp.MaterialEfficiency, Runs = bp.Runs, UpdateTime = updateTime }; lstOwnedBluePrints.Add(ownedBluePrints); } // 如果角色有军团权限, 则获取军团拥有的蓝图 if (Corporation) { lstBluePrint = ESI.GetBluePrints(CharacterID, GetAccessToken(), true); foreach (var bp in lstBluePrint) { ownedBluePrints = new OwnedBluePrints() { ItemID = bp.ItemID, BluePrintID = bp.TypeID, Owner = CharacterID, CharacterOwned = false, LocationID = bp.LocationID, LocationFlag = bp.LocationFlag, Quantity = bp.Quantity, TimeEfficiency = bp.TimeEfficiency, MaterialEfficiency = bp.MaterialEfficiency, Runs = bp.Runs, UpdateTime = updateTime }; lstOwnedBluePrints.Add(ownedBluePrints); } } return(lstOwnedBluePrints); }