Ejemplo n.º 1
0
        internal async Task <PackageVersionInfo> GetPackageVersionInformation()
        {
            string packageVersionString;

            if (!this.PackageVersion.Contains("execute-api")) // check if using AutoUpdate service
            {
                var packageVersionDownloader = UpdateUtility.CreateDownloaderFromUrl(this.PackageVersion, _context);
                packageVersionString = await packageVersionDownloader.ReadFileAsStringAsync(this.PackageVersion);
            }
            else
            {
                var autoUpdateServiceClient = new AutoUpdateServiceClient(this.httpClient);
                var request = new GetVersionRequest
                {
                    AgentId    = Utility.HostName, // use fqdn as unique agent id
                    ProductKey = this.productKey,
                    Ring       = this.ring,
                    Version    = this.GetInstalledVersion().ToString()
                };
                packageVersionString = await autoUpdateServiceClient.GetVersionAsync(this.PackageVersion, request, this.region, this.credential);
            }

            var packageVersion = UpdateUtility.ParsePackageVersion(packageVersionString);

            return(packageVersion);
        }
        /// <summary>
        /// Get the latest version information based on the PackageVersion location.
        /// </summary>
        /// <returns>an instance of <see cref="PackageVersionInfo"/> object.</returns>
        internal async Task <PackageVersionInfo> GetPackageVersionInformation()
        {
            string packageVersionString;

            if (!PackageVersion.Contains("execute-api")) // check if using AutoUpdate service
            {
                var packageVersionDownloader = UpdateUtility.CreateDownloaderFromUrl(PackageVersion, _context);
                packageVersionString = await packageVersionDownloader.ReadFileAsStringAsync(PackageVersion);
            }
            else
            {
                var autoUpdateServiceClient = new AutoUpdateServiceClient(httpClient);
                var request = new GetVersionRequest
                {
                    TenantId       = productKey,
                    AutoUpdateLane = deploymentStage
                };

                packageVersionString = await autoUpdateServiceClient.GetVersionAsync(PackageVersion, request, region, credential);
            }

            var packageVersion = UpdateUtility.ParsePackageVersion(packageVersionString);

            return(packageVersion);
        }
Ejemplo n.º 3
0
        private async Task <PackageVersionInfo> GetPackageVersionInformation()
        {
            var    packageVersionDownloader = UpdateUtility.CreateDownloaderFromUrl(this.PackageVersion, _context);
            string packageVersionString     = await packageVersionDownloader.ReadFileAsStringAsync(this.PackageVersion);

            var packageVersion = UpdateUtility.ParsePackageVersion(packageVersionString);

            return(packageVersion);
        }