示例#1
0
        private static string GetColor(string role)
        {
            if (role == null)
            {
                return(Color.Gray.ToHtml());
            }

            if (RoleColors.TryGetValue(role, out Color color))
            {
                return(color.ToHtml());
            }

            return(ColorExtensions.ToHtmlColor(StringHashEncoder.GetHashCode32(role)));
        }
示例#2
0
 public override int GetHashCode()
 {
     return(id == null?
            base.GetHashCode() :
                StringHashEncoder.GetHashCode32(GetType().FullName) ^ id.Value.GetHashCode());
 }