private List <RemodelItemList> MakeUpList(IEnumerable <XElement> remodellist, WeekDayFlag today) { List <RemodelItemList> templist = new List <RemodelItemList>(); foreach (var item in remodellist) { var temp = new RemodelItemList(); temp.Ships = new List <ShipInfo>(); if (WeekDaySetter(Convert.ToInt32(item.Element("AllWeekdays").Value)).HasFlag(today)) { if (item.Element("SlotItemName") != null) { temp.ItemName = KanColleClient.Current.Translations.GetTranslation(item.Element("SlotItemName").Value, TranslationType.Equipment); foreach (var slotitem in KanColleClient.Current.Master.SlotItems) { if (slotitem.Value.Name == temp.ItemName) { temp.IconType = slotitem.Value.IconType; } } } int shipCount = 1; bool Checker = true; try { List <ShipInfo> ShipList = new List <ShipInfo>(); while (Checker) { string shipname = "ShipName" + shipCount.ToString(); string weekdays = "WeekDays" + shipCount.ToString(); string upgrade = "Upgrade" + shipCount.ToString(); ShipInfo ship = new ShipInfo(); if (item.Element(shipname) != null) { ship.ShipName = KanColleClient.Current.Translations.GetTranslation(item.Element(shipname).Value, TranslationType.Ships); ship.Weekday = WeekDaySetter(Convert.ToInt32(item.Element(weekdays).Value)); } if (item.Element(upgrade) != null) { ship.Upgrade = KanColleClient.Current.Translations.GetTranslation(item.Element(upgrade).Value, TranslationType.Equipment); foreach (var slotitem in KanColleClient.Current.Master.SlotItems) { if (slotitem.Value.Name == ship.Upgrade) { ship.UpgradeIconType = slotitem.Value.IconType; } } } shipCount++; if (ship.ShipName == null && ship.Upgrade != null) { ship.Weekday |= WeekDayFlag.NotNeedShip; } if (ship != null) { if (ship.Weekday.HasFlag(today) || ship.Weekday.HasFlag(WeekDayFlag.NotNeedShip)) { ShipList.Add(ship); } if (ship.ShipName == null && ship.Upgrade == null && ship.UpgradeIconType == null && ship.Weekday.HasFlag(WeekDayFlag.None)) { Checker = false; } } else { Checker = false; } } if (ShipList != null) { foreach (var shipinfo in ShipList) { temp.Ships.Add(shipinfo); } } } catch (Exception ex) { Debug.WriteLine(ex); } if (item.Element("AllWeekdays") != null) { temp.TotalWeekday = WeekDaySetter(Convert.ToInt32(item.Element("AllWeekdays").Value)); } if (item.Element("ToolTip") != null) { temp.ToolTipString = item.Element("ToolTip").Value; } else { temp.ToolTipString = "특이사항 없음"; } StringBuilder equipCombine = new StringBuilder(); if (item.Element("StartEquip") != null) { equipCombine.Append(item.Element("StartEquip").Value); } if (item.Element("MidEquip") != null) { equipCombine.Append("/"); equipCombine.Append(item.Element("MidEquip").Value); } if (item.Element("LastEquip") != null) { equipCombine.Append("/"); equipCombine.Append(item.Element("LastEquip").Value); } if (equipCombine != null) { temp.UseEquip = equipCombine.ToString(); } if (temp.TotalWeekday.HasFlag(today)) { templist.Add(temp); if (temp.Ships != null) { foreach (var context in temp.Ships) { if (context.Upgrade != null) { tempimp.Add(temp); break; } } } if (temp.UseEquip != null) { tempUse.Add(temp); } } } } return(templist); }
private List<ShipInfo> MakeShipList(XElement Context, bool IsImprovementList = false) { List<ShipInfo> ShipList = new List<ShipInfo>(); bool Checker = true; int ShipCount = 1; while (Checker) { //이름작성 string ShipElement = "ShipName"; var temp = ShipElement + ShipCount.ToString(); ShipInfo Ship = new ShipInfo(); Ship.IsSameUpgradeExist = false; if (Context.Element(temp) != null) { Ship.ShipName = Context.Element(temp).Value; Ship.ShipName = KanColleClient.Current.Translations.GetTranslation(Ship.ShipName, TranslationType.Ships, false); } else Ship.ShipName = string.Empty; //업그레이드 부분 ShipElement = "Upgrade"; temp = ShipElement + ShipCount.ToString(); if (Context.Element(temp) != null) { Ship.Upgrade = Context.Element(temp).Value; Ship.Upgrade = KanColleClient.Current.Translations.GetTranslation(Ship.Upgrade, TranslationType.Equipment, false); //슬롯 아이템 Master목록에서 해당되는 아이콘을 찾아 삽입 foreach (var slotitem in KanColleClient.Current.Master.SlotItems) { if (slotitem.Value.Name == Ship.Upgrade) Ship.UpgradeIconType = slotitem.Value.IconType; } } else { Ship.Upgrade = null; Ship.UpgradeIconType = null; } ShipElement = "WeekDays"; temp = ShipElement + ShipCount.ToString(); if (Context.Element(temp) != null) { int weekday = Convert.ToInt32(Context.Element(temp).Value); Ship.Weekday = WeekDaySetter(weekday); } else Ship.Weekday = WeekDayFlag.None; if (Ship.Weekday == WeekDayFlag.None && Ship.Upgrade == null && Ship.ShipName == string.Empty) { Checker = false; } else { if (Ship.ShipName != string.Empty) { if (Ship.Weekday.HasFlag(today)) { if (IsImprovementList) { if (Ship.Upgrade != null) { ShipList.Add(Ship); ShipCount++; } else ShipCount++; } else { ShipList.Add(Ship); ShipCount++; } } else { ShipCount++; } } else { if (IsImprovementList) { if (Ship.Upgrade != null) { Ship.ShipName = "없음"; ShipList.Add(Ship); ShipCount++; } else ShipCount++; } else ShipCount++; } } }//while구문 종료 return ShipList; }
private List<ShipInfo> TrimShipList(List<ShipInfo> ShipList) { for (int i = 0; i < ShipList.Count; i++) { for (int j = i + 1; j < ShipList.Count; j++) { if (ShipList[i].Upgrade == ShipList[j].Upgrade) { ShipList[i].IsSameUpgradeExist = true; ShipList[j].IsSameUpgradeExist = true; } } } var RemoveSameShip = ShipList.Where(x => !x.IsSameUpgradeExist).ToList(); var SameShipList = ShipList.Where(x => x.IsSameUpgradeExist).ToList(); if (SameShipList.Count > 1) { ShipInfo mergedShip = new ShipInfo(); string MergedName = SameShipList[0].ShipName; for (int i = 1; i < SameShipList.Count; i++) { MergedName = MergedName + ", " + SameShipList[i].ShipName; } mergedShip = SameShipList[0]; mergedShip.ShipName = MergedName; RemoveSameShip.Add(mergedShip); } return RemoveSameShip; }
private List <ShipInfo> MakeShipList(XElement Context, bool IsImprovementList = false) { List <ShipInfo> ShipList = new List <ShipInfo>(); bool Checker = true; int ShipCount = 1; while (Checker) { //이름작성 string ShipElement = "ShipName"; var temp = ShipElement + ShipCount.ToString(); ShipInfo Ship = new ShipInfo(); Ship.IsSameUpgradeExist = false; if (Context.Element(temp) != null) { Ship.ShipName = Context.Element(temp).Value; Ship.ShipName = KanColleClient.Current.Translations.GetTranslation(Ship.ShipName, TranslationType.Ships, false); } else { Ship.ShipName = string.Empty; } //업그레이드 부분 ShipElement = "Upgrade"; temp = ShipElement + ShipCount.ToString(); if (Context.Element(temp) != null) { Ship.Upgrade = Context.Element(temp).Value; Ship.Upgrade = KanColleClient.Current.Translations.GetTranslation(Ship.Upgrade, TranslationType.Equipment, false); //슬롯 아이템 Master목록에서 해당되는 아이콘을 찾아 삽입 foreach (var slotitem in KanColleClient.Current.Master.SlotItems) { if (slotitem.Value.Name == Ship.Upgrade) { Ship.UpgradeIconType = slotitem.Value.IconType; } } } else { Ship.Upgrade = null; Ship.UpgradeIconType = null; } ShipElement = "WeekDays"; temp = ShipElement + ShipCount.ToString(); if (Context.Element(temp) != null) { int weekday = Convert.ToInt32(Context.Element(temp).Value); Ship.Weekday = WeekDaySetter(weekday); } else { Ship.Weekday = WeekDayFlag.None; } if (Ship.Weekday == WeekDayFlag.None && Ship.Upgrade == null && Ship.ShipName == string.Empty) { Checker = false; } else { if (Ship.ShipName != string.Empty) { if (Ship.Weekday.HasFlag(today)) { if (IsImprovementList) { if (Ship.Upgrade != null) { ShipList.Add(Ship); ShipCount++; } else { ShipCount++; } } else { ShipList.Add(Ship); ShipCount++; } } else { ShipCount++; } } else { if (IsImprovementList) { if (Ship.Upgrade != null) { Ship.ShipName = "없음"; ShipList.Add(Ship); ShipCount++; } else { ShipCount++; } } else { ShipCount++; } } } } //while구문 종료 return(ShipList); }