Example #1
0
        public void CaclulateLevel()
        {
            if (string.IsNullOrEmpty(ColorCode))
            {
                return;
            }
            var    colors        = ColorCode.Split(',');
            var    colorsGrouped = colors.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
            var    colorCount    = colors.Distinct().Count();
            double level         = 1;

            foreach (var g in colorsGrouped)
            {
                level = level * Math.Pow(colorCount, g.Value);
            }
            Level = (ulong)(level * colors.Count());
        }