public static void SetValue(ref uint rawValue, bool?value, PermissionBits bit) { if (value.HasValue) { if (value == true) { SetBit(ref rawValue, bit); } else { UnsetBit(ref rawValue, bit); } } }
public static PermValue GetValue(uint allow, uint deny, PermissionBits bit) { if (allow.HasBit((byte)bit)) { return(PermValue.Allow); } else if (deny.HasBit((byte)bit)) { return(PermValue.Deny); } else { return(PermValue.Inherit); } }
public static void SetValue(ref uint allow, ref uint deny, PermValue?value, PermissionBits bit) { if (value.HasValue) { switch (value) { case PermValue.Allow: SetBit(ref allow, bit); UnsetBit(ref deny, bit); break; case PermValue.Deny: UnsetBit(ref allow, bit); SetBit(ref deny, bit); break; default: UnsetBit(ref allow, bit); UnsetBit(ref deny, bit); break; } } }
private static void UnsetBit(ref uint value, PermissionBits bit) => value &= ~(1U << (int)bit);
private static void SetBit(ref uint value, PermissionBits bit) => value |= 1U << (int)bit;
public static void SetValue(ref uint allow, ref uint deny, PermValue? value, PermissionBits bit) { if (value.HasValue) { switch (value) { case PermValue.Allow: SetBit(ref allow, bit); UnsetBit(ref deny, bit); break; case PermValue.Deny: UnsetBit(ref allow, bit); SetBit(ref deny, bit); break; default: UnsetBit(ref allow, bit); UnsetBit(ref deny, bit); break; } } }
public static void SetValue(ref uint rawValue, bool? value, PermissionBits bit) { if (value.HasValue) { if (value == true) SetBit(ref rawValue, bit); else UnsetBit(ref rawValue, bit); } }
public static bool GetValue(uint value, PermissionBits bit) => value.HasBit((byte)bit);
public static PermValue GetValue(uint allow, uint deny, PermissionBits bit) { if (allow.HasBit((byte)bit)) return PermValue.Allow; else if (deny.HasBit((byte)bit)) return PermValue.Deny; else return PermValue.Inherit; }