public static string GetWalletExecuteableFilename() { var cfg = Cfg.GetConfig <WalletConfig>(); var platform = BoxsieUtils.GetPlatform(); return($"{cfg.InstallerFilename}{(platform == OS.Windows ? ".exe" : "")}"); }
private async Task DownloadAsync() { using (var client = _httpClientFactory.GetHttpFileDownload()) { await client.DownloadAsync(_walletConfig.UserConfig.BootstrapUrl, _bootstrapFilePath, (x) => { var progressBar = BoxsieUtils.CreateProgressBar(x.Percent, 50); Console.Write(x.Percent < 100 ? $"\rDownloading bootstrap.. {progressBar} {Math.Round(x.Percent, 3):N3}% {x.MegabytesPerSecond:N3}Mb/s {x.RemainingTime:hh\\:mm\\:ss} remaining " : $"\rDownloading bootstrap.. {progressBar} {Math.Round(x.Percent, 3):N3}% {TimeSpan.FromSeconds(x.TotalSeconds):hh\\:mm\\:ss} complete "); });
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 "); });
public EncryptedJsonStore(string key, JsonSerializerSettings settings = null) { _key = key; _settings = settings ?? BoxsieUtils.GetDefaultSerialiserSettings(); }
public override async Task <string> ReadAsync(string filePath) { var encryptedText = await base.ReadAsync(filePath); return(await BoxsieUtils.DecryptTextAsync(encryptedText, _key)); }
public override async Task WriteAsync(string filePath, string content) { var encryptedText = await BoxsieUtils.EncryptTextAsync(content, _key); await base.WriteAsync(filePath, encryptedText); }
public JsonStore(JsonSerializerSettings settings = null) { _settings = settings ?? BoxsieUtils.GetDefaultSerialiserSettings(); }
private static string GetDefaultUserDataPath() { return(BoxsieUtils.GetDefaultUserDataPath(Cfg.GetConfig <GeneralConfig>().AppName)); }