コード例 #1
0
        public static string GetWalletExecuteableFilename()
        {
            var cfg      = Cfg.GetConfig <WalletConfig>();
            var platform = BoxsieUtils.GetPlatform();

            return($"{cfg.InstallerFilename}{(platform == OS.Windows ? ".exe" : "")}");
        }
コード例 #2
0
        private async Task DownloadAsync()
        {
            var platform = BoxsieUtils.GetPlatform();
            var url      = _walletConfig.UserConfig.InstallerUrls[platform];
            var filePath = Path.Combine(_walletInstallerPath, WalletUtils.GetWalletExecuteableFilename());

            using (var client = _httpClientFactory.GetHttpFileDownload())
            {
                await client.DownloadAsync(url, filePath, (x) =>
                {
                    var progressBar = BoxsieUtils.CreateProgressBar(x.Percent, 50);

                    Console.Write(x.Percent < 100
                        ? $"\rDownloading installer.. {progressBar} {Math.Round(x.Percent, 3):N3}% {x.MegabytesPerSecond:N3}Mb/s {x.RemainingTime:hh\\:mm\\:ss} remaining   "
                        : $"\rDownloading installer.. {progressBar} {Math.Round(x.Percent, 3):N3}% {TimeSpan.FromSeconds(x.TotalSeconds):hh\\:mm\\:ss} complete             ");
                });