/// <inheritdoc/>
 public override bool Equals(object obj)
 {
     if (!(obj is EndpointRegistration registration))
     {
         return(false);
     }
     if (!base.Equals(registration))
     {
         return(false);
     }
     if (DiscovererId != registration.DiscovererId)
     {
         return(false);
     }
     if (SupervisorId != registration.SupervisorId)
     {
         return(false);
     }
     if (ApplicationId != registration.ApplicationId)
     {
         return(false);
     }
     if (EndpointUrlLC != registration.EndpointUrlLC)
     {
         return(false);
     }
     if (SupervisorId != registration.SupervisorId)
     {
         return(false);
     }
     if (SecurityLevel != registration.SecurityLevel)
     {
         return(false);
     }
     if (SecurityPolicy != registration.SecurityPolicy)
     {
         return(false);
     }
     if (SecurityMode != registration.SecurityMode)
     {
         return(false);
     }
     if (Thumbprint != registration.Thumbprint)
     {
         return(false);
     }
     if (!AuthenticationMethods.DecodeAsList().SetEqualsSafe(
             AuthenticationMethods.DecodeAsList(), VariantValue.DeepEquals))
     {
         return(false);
     }
     return(true);
 }
Пример #2
0
        /// <inheritdoc/>
        public override bool Equals(object obj)
        {
            var registration = obj as EndpointRegistration;

            return(base.Equals(registration) &&
                   DiscovererId == registration.DiscovererId &&
                   SupervisorId == registration.SupervisorId &&
                   ApplicationId == registration.ApplicationId &&
                   EndpointUrlLC == registration.EndpointUrlLC &&
                   SupervisorId == registration.SupervisorId &&
                   SecurityLevel == registration.SecurityLevel &&
                   SecurityPolicy == registration.SecurityPolicy &&
                   SecurityMode == registration.SecurityMode &&
                   AuthenticationMethods.DecodeAsList().SetEqualsSafe(
                       AuthenticationMethods.DecodeAsList(), JToken.DeepEquals));
        }
Пример #3
0
        /// <inheritdoc/>
        public override bool Equals(object obj)
        {
            var registration = obj as EndpointRegistration;

            return(base.Equals(registration) &&
                   (Activated ?? false) == (registration.Activated ?? false) &&
                   EndpointUrlLC == registration.EndpointUrlLC &&
                   SupervisorId == registration.SupervisorId &&
                   JToken.DeepEquals(Credential, registration.Credential) &&
                   State == registration.State &&
                   CredentialType == registration.CredentialType &&
                   SecurityLevel == registration.SecurityLevel &&
                   SecurityPolicy == registration.SecurityPolicy &&
                   SecurityMode == registration.SecurityMode &&
                   AuthenticationMethods.DecodeAsList().SetEqualsSafe(
                       AuthenticationMethods.DecodeAsList(), JToken.DeepEquals));
        }
 /// <summary>
 /// Convert to service model
 /// </summary>
 /// <returns></returns>
 public EndpointInfoModel ToServiceModel()
 {
     return(new EndpointInfoModel {
         ApplicationId = ApplicationId,
         Registration = new EndpointRegistrationModel {
             Id = DeviceId,
             SiteId = string.IsNullOrEmpty(SiteId) ?
                      null : SiteId,
             SupervisorId = string.IsNullOrEmpty(SupervisorId) ?
                            null : SupervisorId,
             Certificate = Certificate.DecodeAsByteArray(),
             AuthenticationMethods = AuthenticationMethods?.DecodeAsList(j =>
                                                                         j.ToObject <AuthenticationMethodModel>()),
             SecurityLevel = SecurityLevel,
             EndpointUrl = string.IsNullOrEmpty(EndpointRegistrationUrl) ?
                           (string.IsNullOrEmpty(EndpointUrl) ?
                            EndpointUrlLC : EndpointUrl) : EndpointRegistrationUrl,
             Endpoint = new EndpointModel {
                 Url = string.IsNullOrEmpty(EndpointUrl) ?
                       EndpointUrlLC : EndpointUrl,
                 AlternativeUrls = AlternativeUrls?.DecodeAsList().ToHashSetSafe(),
                 User = CredentialType == null ? null :
                        new CredentialModel {
                     Value = Credential,
                     Type = CredentialType == Models.CredentialType.None ?
                            null : CredentialType
                 },
                 SecurityMode = SecurityMode == Models.SecurityMode.Best ?
                                null : SecurityMode,
                 SecurityPolicy = string.IsNullOrEmpty(SecurityPolicy) ?
                                  null : SecurityPolicy,
                 ClientCertificate = ClientCertificate.DecodeAsByteArray(),
                 ServerThumbprint = ServerThumbprint.DecodeAsByteArray()
             }
         },
         ActivationState = ActivationState,
         NotSeenSince = NotSeenSince,
         EndpointState = ActivationState == EndpointActivationState.ActivatedAndConnected ?
                         State : (EndpointConnectivityState?)null,
         OutOfSync = Connected && !_isInSync ? true : (bool?)null
     });
 }