protected override void OnValidate(bool allowLocalMockPns) { Uri uri; if (base.Properties == null || string.IsNullOrEmpty(base.Properties["ClientId"]) && string.IsNullOrEmpty(base.Properties["ClientSecret"])) { throw new InvalidDataContractException(SRClient.RequiredPropertiesNotSpecified("ClientId, ClientSecret")); } if (string.IsNullOrEmpty(base.Properties["ClientId"])) { throw new InvalidDataContractException(SRClient.RequiredPropertyNotSpecified("ClientId")); } if (string.IsNullOrEmpty(base.Properties["ClientSecret"])) { throw new InvalidDataContractException(SRClient.RequiredPropertyNotSpecified("ClientSecret")); } if (base.Properties.Count > 2) { int count = base.Properties.Count; Dictionary <!0, !1> .KeyCollection keys = base.Properties.Keys; string[] strArrays = new string[] { "ClientId", "ClientSecret", "SendUrlTemplate", "AuthTokenUrl" }; if (count > keys.Intersect <string>(strArrays).Count <string>()) { throw new InvalidDataContractException(SRClient.OnlyNPropertiesRequired(2, "ClientId, ClientSecret")); } } if (!Uri.TryCreate(this.AuthTokenUrl, UriKind.Absolute, out uri) || !string.Equals(this.AuthTokenUrl, "https://api.amazon.com/auth/O2/token", StringComparison.OrdinalIgnoreCase) && !string.Equals(this.AuthTokenUrl, "http://pushtestservice.cloudapp.net/adm/token", StringComparison.OrdinalIgnoreCase) && !string.Equals(this.AuthTokenUrl, "http://pushtestservice2.cloudapp.net/adm/token", StringComparison.OrdinalIgnoreCase) && !string.Equals(this.AuthTokenUrl, "http://pushperfnotificationserver.cloudapp.net/adm/token", StringComparison.OrdinalIgnoreCase) && !string.Equals(this.AuthTokenUrl, "http://pushstressnotificationserver.cloudapp.net/adm/token", StringComparison.OrdinalIgnoreCase) && !string.Equals(this.AuthTokenUrl, "http://pushnotificationserver.cloudapp.net/adm/token", StringComparison.OrdinalIgnoreCase) && (!allowLocalMockPns || !string.Equals(this.AuthTokenUrl, "http://localhost:8450/adm/token", StringComparison.OrdinalIgnoreCase))) { throw new InvalidDataContractException(SRClient.InvalidAdmAuthTokenUrl); } try { if (!string.IsNullOrWhiteSpace(this.SendUrlTemplate)) { CultureInfo invariantCulture = CultureInfo.InvariantCulture; string sendUrlTemplate = this.SendUrlTemplate; object[] objArray = new object[] { "AdmRegistrationId" }; if (Uri.TryCreate(string.Format(invariantCulture, sendUrlTemplate, objArray), UriKind.Absolute, out uri) && (string.Equals(this.SendUrlTemplate, "https://api.amazon.com/messaging/registrations/{0}/messages", StringComparison.OrdinalIgnoreCase) || string.Equals(this.SendUrlTemplate, "http://pushtestservice.cloudapp.net/adm/send/{0}/messages", StringComparison.OrdinalIgnoreCase) || string.Equals(this.SendUrlTemplate, "http://pushtestservice2.cloudapp.net/adm/send/{0}/messages", StringComparison.OrdinalIgnoreCase) || string.Equals(this.SendUrlTemplate, "http://pushperfnotificationserver.cloudapp.net/adm/send/{0}/messages", StringComparison.OrdinalIgnoreCase) || string.Equals(this.SendUrlTemplate, "http://pushstressnotificationserver.cloudapp.net/adm/send/{0}/messages", StringComparison.OrdinalIgnoreCase) || string.Equals(this.SendUrlTemplate, "http://pushnotificationserver.cloudapp.net/adm/send/{0}/messages", StringComparison.OrdinalIgnoreCase) || allowLocalMockPns && string.Equals(this.SendUrlTemplate, "http://localhost:8450/adm/send/{0}/messages", StringComparison.OrdinalIgnoreCase))) { return; } } throw new InvalidDataContractException(SRClient.InvalidAdmSendUrlTemplate); } catch (FormatException formatException) { throw new InvalidDataContractException(SRClient.InvalidAdmSendUrlTemplate); } }