Exemplo n.º 1
0
        public static string GetWalletExecuteableFilename()
        {
            var cfg      = Cfg.GetConfig <WalletConfig>();
            var platform = BoxsieUtils.GetPlatform();

            return($"{cfg.InstallerFilename}{(platform == OS.Windows ? ".exe" : "")}");
        }
Exemplo n.º 2
0
        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             ");
                });
Exemplo n.º 3
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             ");
                });
Exemplo n.º 4
0
 public EncryptedJsonStore(string key, JsonSerializerSettings settings = null)
 {
     _key      = key;
     _settings = settings ?? BoxsieUtils.GetDefaultSerialiserSettings();
 }
Exemplo n.º 5
0
        public override async Task <string> ReadAsync(string filePath)
        {
            var encryptedText = await base.ReadAsync(filePath);

            return(await BoxsieUtils.DecryptTextAsync(encryptedText, _key));
        }
Exemplo n.º 6
0
        public override async Task WriteAsync(string filePath, string content)
        {
            var encryptedText = await BoxsieUtils.EncryptTextAsync(content, _key);

            await base.WriteAsync(filePath, encryptedText);
        }
Exemplo n.º 7
0
 public JsonStore(JsonSerializerSettings settings = null)
 {
     _settings = settings ?? BoxsieUtils.GetDefaultSerialiserSettings();
 }
Exemplo n.º 8
0
 private static string GetDefaultUserDataPath()
 {
     return(BoxsieUtils.GetDefaultUserDataPath(Cfg.GetConfig <GeneralConfig>().AppName));
 }