示例#1
0
        /// <summary>
        /// checks th level of an case type. "add" -> 0, "add customer" -> 1 etc.
        /// </summary>
        /// <param name="flag">The case type to check against</param>
        /// <returns>The specific level</returns>
        internal static uint LevelOf(this CaseTypeFlags flag)
        {
            uint       number = (uint)flag;
            const uint GROUP  = 0x1_0000;

            for (uint i = 0; ; i++)
            {
                if (Math.Floor(number / Math.Pow(GROUP, i + 1)) > 0)
                {
                    continue;
                }
                return(i);
            }
        }
示例#2
0
 /// <summary>
 /// The upper command type of a command. "add customer" -> "add" etc.
 /// </summary>
 /// <param name="flag">The command type to check against.</param>
 /// <returns>The base command type</returns>
 internal static CaseTypeFlags BaseTypeOf(this CaseTypeFlags flag) => (CaseTypeFlags)((uint)flag % (uint)Math.Pow(0x1_0000, flag.LevelOf()));