internal static void ValidateRegistration(RegistrationDescription registration)
        {
            string str;
            WindowsTemplateRegistrationDescription windowsTemplateRegistrationDescription = registration as WindowsTemplateRegistrationDescription;

            if (windowsTemplateRegistrationDescription == null)
            {
                MpnsTemplateRegistrationDescription mpnsTemplateRegistrationDescription = registration as MpnsTemplateRegistrationDescription;
                if (mpnsTemplateRegistrationDescription != null)
                {
                    mpnsTemplateRegistrationDescription.SetMpnsType();
                }
            }
            else
            {
                windowsTemplateRegistrationDescription.SetWnsType();
            }
            RegistrationDescription registrationDescription = registration;

            if (registration.Tags == null || registration.Tags.Count == 0)
            {
                str = null;
            }
            else
            {
                str = string.Join(",", registration.Tags);
            }
            registrationDescription.TagsString = str;
            registration.Validate(true, ApiVersion.Four, true);
        }
Exemple #2
0
        internal static string ComputeChannelHash(string pnsHandle)
        {
            ASCIIEncoding aSCIIEncoding             = new ASCIIEncoding();
            SHA1          sHA1CryptoServiceProvider = new SHA1CryptoServiceProvider();

            return(RegistrationDescription.GenerateUrlSafeBase64(sHA1CryptoServiceProvider.ComputeHash(aSCIIEncoding.GetBytes(pnsHandle))));
        }
Exemple #3
0
 public RegistrationDescription(RegistrationDescription registration)
 {
     this.NotificationHubPath = registration.NotificationHubPath;
     this.RegistrationId      = registration.RegistrationId;
     this.Tags = registration.Tags;
     this.ETag = registration.ETag;
 }
 public Task DeleteRegistrationAsync(RegistrationDescription registration)
 {
     if (registration == null)
     {
         throw new ArgumentNullException("registration");
     }
     return(this.DeleteRegistrationAsync(registration.RegistrationId, registration.ETag));
 }
 internal void DeleteRegistration(RegistrationDescription registration)
 {
     if (registration == null)
     {
         throw new ArgumentNullException("registration");
     }
     this.DeleteRegistration(registration.RegistrationId, registration.ETag);
 }
Exemple #6
0
 internal string GetChannelHash()
 {
     if (string.IsNullOrEmpty(this.channelHash))
     {
         this.channelHash = RegistrationDescription.ComputeChannelHash(this.GetPnsHandle());
     }
     return(this.channelHash);
 }