예제 #1
0
        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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
파일: DiskLibrary.cs 프로젝트: xet7/Musoq
        public void SetAggregateDirectories([InjectGroup] Group group, [InjectSource] DirectoryInfo directory,
                                            string name)
        {
            var list = group.GetOrCreateValue(name, new List <DirectoryInfo>());

            list.Add(directory);
        }
예제 #5
0
        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();
        }
예제 #6
0
        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()));
            });
        }
예제 #7
0
        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());
        }
예제 #8
0
        public void SetAggregateFiles([InjectGroup] Group group, [InjectSource] ExtendedFileInfo file, string name)
        {
            var list = group.GetOrCreateValue(name, new List <ExtendedFileInfo>());

            list.Add(file);
        }
예제 #9
0
        public void SetCount([InjectGroup] Group group, string name, DateTimeOffset?value)
        {
            var values = group.GetOrCreateValue <int>(name);

            group.SetValue(name, values + 1);
        }
예제 #10
0
        public void SetStringAsNumericSum([InjectGroup] Group group, string name, string number)
        {
            var value = group.GetOrCreateValue <decimal>(name);

            group.SetValue(name, value + ToDecimal(number));
        }
예제 #11
0
        private static void AggregateAdd <TType>(Group group, string name, TType value)
        {
            var values = group.GetOrCreateValue(name, new List <TType>());

            values.Add(value);
        }