/// <summary> /// Adds the specified LogItemType to the display. /// </summary> /// <param name="type">LogItemType to add</param> private void AddLogItemType(LogItem.LogItemTypes type) { lstLog.BeginUpdate(); lstLog.ListViewItemSorter = null; foreach (LogItem item in LogItems) { if (item.ItemType == type) { string typeText = Language.GetGenericText(string.Format("LogDisplay.{0}", type), type.ToString()); string valueText = item.Value; string detailsText = item.Details; if (item.ItemType == LogItem.LogItemTypes.Exclusion) { // convert details from format FilterItem~~FilterValue string[] values = Utils.SplitByString(detailsText, "~~"); var filterItem = FilterItem.FromString(values[0]); detailsText = string.Format("{0} -> {1}{2}{3}{4}", Language.GetGenericText(string.Format("Exclusions.{0}", filterItem.FilterType.Category), filterItem.FilterType.Category.ToString()), Language.GetGenericText(string.Format("Exclusions.{0}", filterItem.FilterType.SubCategory), filterItem.FilterType.SubCategory.ToString()), !string.IsNullOrEmpty(filterItem.Value) && filterItem.FilterType.SubCategory != FilterType.SubCategories.Extension ? ", " + values[1] : string.Empty, filterItem.ValueOption != FilterType.ValueOptions.None ? " " + Language.GetGenericText(string.Format("Exclusions.{0}", filterItem.ValueOption), filterItem.ValueOption.ToString()) : string.Empty, !string.IsNullOrEmpty(filterItem.Value) && filterItem.FilterType.SubCategory != FilterType.SubCategories.Extension ? " " + filterItem.Value : string.Empty ); } else if (item.ItemType == LogItem.LogItemTypes.Status) { // Value = Language lookup text (e.g. SearchFinished,SearchCancelled) // Details = 0||1 replacement arguments where 0 is file name or error message, 1 is details string[] values = Utils.SplitByString(detailsText, "||"); valueText = string.Format(Language.GetGenericText(valueText), values); detailsText = string.Empty; if (values.Length > 1) { detailsText = values[1]; } } else if (item.ItemType == LogItem.LogItemTypes.Error) { // Value = Language lookup text (e.g. SearchGenericError, SearchFileError) // Details = 0||1 replacement arguments where 0 = file or empty string, 1 = details (error text) string[] values = Utils.SplitByString(detailsText, "||"); valueText = string.Format(Language.GetGenericText(valueText), values[0]); detailsText = values[1]; } ListViewItem lstItem = new ListViewItem(new string[4] { item.Date.ToShortDateString() + " " + item.Date.ToString("hh:mm:ss.ff tt"), typeText, valueText, detailsText }); lstItem.Tag = item; lstLog.Items.Add(lstItem); } } lstLog.ListViewItemSorter = new LogItemComparer(); lstLog.Sort(); lstLog.EndUpdate(); }