public void SetSum([InjectGroup] Group group, string name, long?number) { if (!number.HasValue) { group.GetOrCreateValue <long>(name); return; } var value = group.GetOrCreateValue <long>(name); group.SetValue(name, value + number); }
public void SetMin([InjectGroup] Group group, string name, decimal?value) { if (!value.HasValue) { group.GetOrCreateValue <decimal>(name); return; } var storedValue = group.GetOrCreateValue <decimal>(name); if (storedValue > value) { group.SetValue(name, value); } }
public void SetSumOutcome([InjectGroup] Group group, string name, decimal?number) { if (!number.HasValue) { group.GetOrCreateValue <decimal>(name); return; } var value = group.GetOrCreateValue <decimal>(name); if (number < 0) { group.SetValue(name, value + number); } }
public void SetAggregateDirectories([InjectGroup] Group group, [InjectSource] DirectoryInfo directory, string name) { var list = group.GetOrCreateValue(name, new List <DirectoryInfo>()); list.Add(directory); }
public void SetDominant([InjectGroup] Group group, string name, decimal?value) { if (!value.HasValue) { group.GetOrCreateValue <decimal>(name); return; } var dict = group.GetOrCreateValue(name, new SortedDictionary <decimal, Occurence>()); if (!dict.TryGetValue(value.Value, out var occur)) { occur = new Occurence(); dict.Add(value.Value, occur); } occur.Increment(); }
private static void AggregateAdd <TType>(Group group, string name, TType value) { var list = group.GetOrCreateValue(name, new List <string>()); list.Add(value.ToString()); group.GetOrCreateValueWithConverter <List <string>, string>(name, new List <string>(), (lst) => { var rawList = (List <string>)lst; return(list.Count == 0 ? string.Empty : list.Aggregate((a, b) => a.ToString() + b.ToString())); }); }
public string AggregateValue([InjectGroup] Group group, string name) { var list = group.GetOrCreateValue <List <string> >(name); var builder = new StringBuilder(); for (int i = 0, j = list.Count - 1; i < j; i++) { builder.Append(list[i]); builder.Append(','); } builder.Append(list[list.Count - 1]); return(builder.ToString()); }
public void SetAggregateFiles([InjectGroup] Group group, [InjectSource] ExtendedFileInfo file, string name) { var list = group.GetOrCreateValue(name, new List <ExtendedFileInfo>()); list.Add(file); }
public void SetCount([InjectGroup] Group group, string name, DateTimeOffset?value) { var values = group.GetOrCreateValue <int>(name); group.SetValue(name, values + 1); }
public void SetStringAsNumericSum([InjectGroup] Group group, string name, string number) { var value = group.GetOrCreateValue <decimal>(name); group.SetValue(name, value + ToDecimal(number)); }
private static void AggregateAdd <TType>(Group group, string name, TType value) { var values = group.GetOrCreateValue(name, new List <TType>()); values.Add(value); }