예제 #1
0
        public int GetHashCode(IJsonOrganizationPreferences obj)
        {
            if (obj == null)
            {
                return(0);
            }

            unchecked
            {
                var hashCode = obj.PermissionLevel.GetHashCode();
                hashCode = (hashCode * 397) ^ GetCollectionHashCode(obj.OrgInviteRestrict);
                hashCode = (hashCode * 397) ^ obj.ExternalMembersDisabled.GetHashCode();
                hashCode = (hashCode * 397) ^ (obj.AssociatedDomain?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ (obj.BoardVisibilityRestrict?.GetHashCode() ?? 0);
                return(hashCode);
            }
        }
예제 #2
0
        public bool Equals(IJsonOrganizationPreferences x, IJsonOrganizationPreferences y)
        {
            if (x == null && y != null)
            {
                return(false);
            }
            if (x != null && y == null)
            {
                return(false);
            }
            if (x == null)
            {
                return(true);
            }

            return(x.PermissionLevel == y.PermissionLevel &&
                   (x.OrgInviteRestrict?.SequenceEqual(y.OrgInviteRestrict) ?? true) &&
                   x.ExternalMembersDisabled == y.ExternalMembersDisabled &&
                   x.AssociatedDomain == y.AssociatedDomain &&
                   x.BoardVisibilityRestrict == y.BoardVisibilityRestrict);
        }
예제 #3
0
        public void FromJson(JsonValue json, JsonSerializer serializer)
        {
            switch (json.Type)
            {
            case JsonValueType.Object:
                var obj = json.Object;
                Id              = obj.TryGetString("id");
                Name            = obj.TryGetString("name");
                DisplayName     = obj.TryGetString("displayName");
                Desc            = obj.TryGetString("desc");
                Url             = obj.TryGetString("url");
                Website         = obj.TryGetString("website");
                LogoHash        = obj.TryGetString("logoHash");
                PowerUps        = obj.Deserialize <List <int> >(serializer, "powerUps");
                PaidAccount     = obj.TryGetBoolean("paid_account");
                PremiumFeatures = obj.Deserialize <List <string> >(serializer, "premiumFeatures");
                Prefs           = obj.Deserialize <IJsonOrganizationPreferences>(serializer, "prefs");
                break;

            case JsonValueType.String:
                Id = json.String;
                break;
            }
        }