/// <summary> /// Creates an instance of an ExclusionItem object from a string. /// </summary> /// <param name="value">string to convert to object</param> /// <returns>ExclusionItem object</returns> public static ExclusionItem FromString(string value) { var item = new ExclusionItem(); string[] values = value.Split(DELIMETER); item.Type = (ExclusionTypes)Enum.Parse(typeof(ExclusionTypes), values[0]); item.Value = values[1]; item.Option = (OptionsTypes)Enum.Parse(typeof(OptionsTypes), values[2]); item.IgnoreCase = Convert.ToBoolean(values[3]); if (values.Length > 4) { item.Enabled = Convert.ToBoolean(values[4]); } return(item); }
/// <summary> /// Converts the given string to a list of ExclusionItems. /// </summary> /// <param name="value">string to convert</param> /// <returns>List of ExclusionItems</returns> public static List <ExclusionItem> ConvertStringToExclusions(string value) { var list = new List <ExclusionItem>(); if (!string.IsNullOrEmpty(value)) { var values = value.Split(LIST_DELIMETER); foreach (string val in values) { var item = ExclusionItem.FromString(val); list.Add(item); } } return(list); }