private void Invoked_Delete(RoomInformation.Field item) { if (!CB_RealTimeSet.Checked) { return; } if (CurrentField == item) { CurrentField = null; ReleaseFormInfo(); } TB_Room.Text = infoList.Count.ToString(); if (ListFilter(item)) { return; } for (int i = RoomList.Items.Count - 1; i >= 0; i--) { if (item == RoomList.Items[i] as RoomInformation.Field) { RoomList.Items.RemoveAt(i); RefreshFormInfo(); return; } } }
private void Invoked_Insert(RoomInformation.Field item) { if (!string.IsNullOrWhiteSpace(FilterMapName)) { int length = 5; string first = Path.GetFileNameWithoutExtension(FilterMapName); if (first.Length > 2 && first[first.Length - 2] == '~') { first = first.Substring(0, first.Length - 2); } first = first.Substring(0, first.Length >= length ? length : (length = first.Length)); string second = Path.GetFileNameWithoutExtension(item.mapname); if (second.Length > 2 && second[second.Length - 2] == '~') { second = second.Substring(0, second.Length - 2); } if (second.Length >= length && string.Compare(first, second.Substring(0, length), true) == 0) { StringBuilder Builder = new StringBuilder(); Builder.AppendFormat("[{0}] {1} - {2}" , ConvertAtTimeStamp(item.regdate).ToString("yyyy-MM-dd HH:mm:ss") , item.mapname, item.player0); Builder.AppendLine(); File.AppendAllText("CirnixStartFilter.log", Builder.ToString()); } } if (!CB_RealTimeSet.Checked) { return; } TB_Room.Text = infoList.Count.ToString(); if (ListFilter(item)) { return; } RoomList.Items.Add(item); RefreshFormInfo(); }
private void Invoked_Update(RoomInformation.Field item) { if (!CB_RealTimeSet.Checked) { return; } for (int i = RoomList.Items.Count - 1; i >= 0; i--) { if (item == RoomList.Items[i] as RoomInformation.Field) { if (ListFilter(item)) { RoomList.Items.RemoveAt(i); RefreshFormInfo(); } else { RoomList.Items[i] = item; } return; } } }
private bool ListFilter(RoomInformation.Field item) => (!CB_ShowPrivate.Checked && item.flag == "private") || (!CB_DisplayAll.Checked && item.status != "open") || (!string.IsNullOrEmpty(TB_Search.Text) && IsMapSearch ? item.mapname.ToLower().IndexOf(TB_Search.Text.ToLower()) == -1 : item.gname.ToLower().IndexOf(TB_Search.Text.ToLower()) == -1);