void IEntityClone <IDeviceConfiguration> .CloneFrom(IDeviceConfiguration deviceConf)
        {
            if (string.IsNullOrEmpty(deviceToken))
            {
                deviceToken = deviceConf.DeviceToken;
                if (deviceConf.DeviceKey != null)
                {
                    privateKey = deviceConf.DeviceKey.Base64UrlEncode();
                }
            }

            if (deviceConf.ServerInfo == null)
            {
                return;
            }

            var existing = new HashSet <string>();

            existing.UnionWith(ServerInfo.List.Select(x => x.Id));
            foreach (var si in deviceConf.ServerInfo.List)
            {
                existing.Remove(si.Id);
                ServerInfo.Put(si);
            }
            foreach (var id in existing)
            {
                ServerInfo.Delete(id);
            }
        }
Exemplo n.º 2
0
 private void SetConfigurationValid(int keyId)
 {
     if (keyId != ServerKeyId)
     {
         ServerKeyId = keyId;
         if (_storage != null)
         {
             var sc            = _storage.Get(Server);
             var configuration = sc != null ? new ServerConfiguration(sc) : new ServerConfiguration(Server);
             configuration.ServerKeyId = ServerKeyId;
             _storage.Put(configuration);
         }
     }
 }