public List<DropStringLists> ReturnDropList(string FileName, bool IsNavi, bool ReturnAll=false) { var items = new List<DropStringLists>(); var pagingList = new List<List<DropStringLists>>(); var bytes = File.ReadAllBytes(FileName); using (var memoryStream = new MemoryStream(bytes)) using (var reader = new BinaryReader(memoryStream)) { while (memoryStream.Position < memoryStream.Length) { var item = new DropStringLists { Date = reader.ReadString(), SeaArea = reader.ReadString(), MapInfo = reader.ReadString(), Boss = reader.ReadString(), EnemyFleet = reader.ReadString(), Rank = reader.ReadString(), Drop = reader.ReadString(), }; //item.SeaArea = KanColleClient.Current.Translations.GetTranslation(item.SeaArea, TranslationType.OperationMaps, true); //item.EnemyFleet = KanColleClient.Current.Translations.GetTranslation(item.EnemyFleet, TranslationType.OperationSortie, true); items.Add(item); } memoryStream.Dispose(); memoryStream.Close(); reader.Dispose(); reader.Close(); } items = DropListFilter(items); if (ReturnAll == true) return items; int Page = 0, i = 0; do { if (i + 20 < items.Count) { pagingList.Add(items.GetRange(i, 20)); Page++; } else pagingList.Add(items.GetRange(i, items.Count - Page * 20)); i = i + 20; } while (i < items.Count); this.DropMaxPage = Page; if (this.DropPages >= DropMaxPage) this.DropPages = this.DropMaxPage; if (IsNavi) return pagingList[this.DropPages]; else { this.DropPages = this.DropMaxPage; return pagingList[this.DropMaxPage]; } }
/// <summary> /// 해당 드랍 데이터가 맵 조건을 만족하고 있는지를 구합니다. /// </summary> public bool DropMapInfoCalc(DropStringLists dropdata) { int dropworld = 0; int dropmap = 0; int dropnode = 0; string[] mapText = dropdata.MapInfo.Split('-'); if (int.TryParse(mapText[0], out dropworld) && int.TryParse(mapText[1], out dropmap) && int.TryParse(mapText[2], out dropnode)) if ((Drop_World == 0 || dropworld == Drop_World) && (Drop_Map == 0 || dropmap == Drop_Map) && (Drop_BossCheck == true || Drop_Nodes.Count == 0 || Drop_Nodes.Any(x => dropnode == x))) return true; return false; }
/// <summary> /// 해당 드랍 데이터가 랭크 조건을 만족하고 있는지를 구합니다. /// </summary> public bool DropRankCalc(DropStringLists dropdata) { if (Drop_RankS && dropdata.Rank == "S") return true; if (Drop_RankA && dropdata.Rank == "A") return true; if (Drop_RankB && dropdata.Rank == "B") return true; if (Drop_RankC && (dropdata.Rank == "C" || dropdata.Rank == "D" || dropdata.Rank == "E")) return true; return false; }
/// <summary> /// 해당 드랍 데이터가 보스 조건을 만족하고 있는지를 구합니다. /// </summary> public bool DropBossCalc(DropStringLists dropdata) { if (Drop_BossCheck == null) return true; if (Drop_BossCheck == true && dropdata.Boss == "O") return true; if (Drop_BossCheck == false && dropdata.Boss == "X") return true; return false; }