Exemplo n.º 1
0
        public void SetPermission(Permissions permission, bool hasPermission)
        {
            if (permission == Permissions.None)
            {
                return;
            }
            byte byteIndex = (byte)((int)permission / 8);
            byte bitIndex  = (byte)((int)permission % 8);
            byte mask      = (byte)Bit.LeftShift(1, bitIndex);

            if (hasPermission)
            {
                RawPermissionField[byteIndex] = Bit.SetBit(mask, RawPermissionField[byteIndex]);
            }
            else
            {
                RawPermissionField[byteIndex] = Bit.ClearBit(mask, RawPermissionField[byteIndex]);
            }
        }