public static bool GetPrinterSplits(ITournPlayerArray playerList, PrinterSplitList splits) { playerList.SortByLastname(); int val1 = 0; foreach (int key in splits.Keys) { splits[key].Counts = 0; val1 = Math.Max(val1, key); } foreach (ITournPlayer player in (IEnumerable <ITournPlayer>)playerList) { string str = ""; if (player.LastName.Length > 0) { str = player.LastName[0].ToString(); } foreach (int key in splits.Keys) { bool flag1 = key <= 1 || str.CompareTo(splits[key].FirstChar) >= 0; bool flag2 = key == val1 || str.CompareTo(splits[key].LastChar) <= 0; if (flag1 && flag2) { ++splits[key].Counts; break; } } } return(true); }
private void PrepSplits() { if (this.Splits == null) { this.Splits = new PrinterSplitList(); } if (this.Splits.Count != 0) { return; } for (int index = 0; index < 12; ++index) { this.Splits.Add(index, new PrinterSplits(index, this.cheats.Substring(0, 1), this.cheats.Substring(this.cheats.Length - 1, 1))); } }