private void AddEntropyResultItems(EntropyLogic pEntropyLogic, MatchCollection pMatchCollection, EntropyResult pEntropyResult) { foreach (Match m in pMatchCollection) { string value = m.Value; if (pEntropyLogic.Trim != string.Empty) { value = value.Trim(); } if (pEntropyLogic.NoEmpty && value == string.Empty) { continue; } EntropyItem it = pEntropyResult.ItemList.Find(x => x.Value == value); if (it == null) { pEntropyResult.ItemList.Add(new EntropyItem() { Value = value, Count = 1 }); } else { it.Count++; } pEntropyResult.SignCount++; } }
private void AddEntropyResults(ThreadParams pThreadParams, EntropyLogic pEntropyLogic, MatchCollection pMatchCollection) { EntropyResult er2 = pThreadParams.FindEntropyResult(pEntropyLogic.Name); if (er2 == null) { er2 = new EntropyResult() { Logic = pEntropyLogic }; pThreadParams.AddEntropyResult(er2); } AddEntropyResultItems(pEntropyLogic, pMatchCollection, er2); }
private MatchCollection FindSigns(EntropyLogic pEntropyLogic, string pText) { string tmp = pText; MatchCollection mc = null; foreach (RegEx re in pEntropyLogic.RegexList) { if (re.ToLower) { tmp = tmp.ToLower(); } RegexOptions ro = re.RegexOptions == string.Empty ? RegexOptions.None : (RegexOptions)Enum.Parse(typeof(RegexOptions), re.RegexOptions); if (re.Replace != string.Empty) { tmp = Regex.Replace(tmp, re.Pattern, re.Replace, ro); } else { mc = Regex.Matches(tmp, re.Pattern, ro); } } return(mc); }