public bool StartSync()
 {
     //是否与服务器已经通步过
     if (!ClientConfiguration.HasSync)
     {
         lock (_syncLock)
         {
             if (!ClientConfiguration.HasSync)
             {
                 //心跳检测
                 if (ClientConfiguration.CheckHeartbeat())
                 {
                     //刷新HostToken
                     if (_hostService.RefreshToken())
                     {
                         //同步服务器白名单
                         if (_resourceService.SyncResources())
                         {
                             ClientConfiguration.HasSync = true;
                             return(true);
                         }
                     }
                 }
             }
         }
         return(false);
     }
     return(true);
 }
        public HttpClient GetClient(long?uid = default, long?gid = default)
        {
            if (_hostServer.NeedRefresh())
            {
                _hostServer.RefreshToken();
            }
            var request = _factory.CreateClient(ClientConfiguration.SecretKey);

            request.BaseAddress = ServerAddress;
            request.DefaultRequestHeaders.Add(LyciumConfiguration.SECRET_KEY, ClientConfiguration.SecretKey);
            request.DefaultRequestHeaders.Add(LyciumConfiguration.HOST_TOKEN, ClientConfiguration.HostToken);
            if (uid != null)
            {
                request.DefaultRequestHeaders.Add(LyciumConfiguration.USER_UID, uid.ToString());
            }
            if (gid != null)
            {
                request.DefaultRequestHeaders.Add(LyciumConfiguration.USER_GID, gid.ToString());
            }
            return(request);
        }