示例#1
0
        private async Task <EndpointManifest> GetManifestFromService()
        {
            var commonFile = await this.FileHandler.ReadCommonCongetherFile();

            var appFile = await this.FileHandler.ReadAppCongetherFile();

            EndpointManifest manifest = null;

            _latestEndpointRequest = DateTime.Now;
            try
            {
                manifest = await this._client.ApiByVersionEndpointByEndpointManifestGetAsync(_endpoint, null, await GetEndpointInfo());
            }catch (Exception ex)
            {
                manifest = null;
            }

            return(manifest);
        }
示例#2
0
        /// <summary>
        /// Returns
        /// </summary>
        /// <returns></returns>
        internal async Task <EndpointManifest> GetManifest()
        {
            EndpointManifest manifest = null;

            if (RequiresManifestFromService)
            {
                manifest = await GetManifestFromService();

                if (manifest != null)
                {
                    await this.FileHandler.SetCachedEndpointManifest(manifest);

                    _latestCachedManifest = manifest;

                    if (manifest.Endpoint.DeviceId != null && manifest.Endpoint.DeviceId != this._commonCongetherFile.InstanceId)
                    {
                        this._commonCongetherFile.InstanceId = manifest.Endpoint.DeviceId;
                        this.FileHandler.SetCommonCongetherFile(this._commonCongetherFile);
                    }
                    if (manifest.Endpoint.InstallationId != null && manifest.Endpoint.InstallationId != this._appCongetherFile.InstanceId)
                    {
                        this._appCongetherFile.InstanceId = manifest.Endpoint.InstallationId;
                        this.FileHandler.SetAppCongetherFile(this._appCongetherFile);
                    }
                }
            }
            if (manifest == null && _latestCachedManifest == null)
            {
                manifest = await this.FileHandler.GetCachedEndpointManifest();

                _latestCachedManifest = manifest;
            }
            if (manifest == null && _latestCachedManifest != null)
            {
                manifest = _latestCachedManifest;
            }

            return(manifest);
        }
示例#3
0
        internal async Task SetCachedEndpointManifest(EndpointManifest manifest)
        {
            var filePath = Path.Combine(CongetherAppDir.FullName, ".manifest");

            WriteToFile(manifest, filePath);
        }