public void Install_CLI_Wallet()
        {
            try
            {
                Github goshimmer = new Github("https://api.github.com/repos/iotaledger/goshimmer/releases");
                GithubObjects.Releases.Assets app = goshimmer.GetReleasebyAssetName("cli-wallet.*_Windows").assets.Where(x => Regex.Match(x.name, "cli-wallet.*_Windows").Success).ToList()[0];
                string download_url = app.browser_download_url;

                UpdateProgressBar.Visibility = Visibility.Visible;

                using (WebClient wc = new WebClient())
                {
                    wc.DownloadProgressChanged += DownloadProgressChanged;
                    wc.DownloadFileCompleted   += (sender, args) =>
                    {
                        using (ZipFile zipFile = ZipFile.Read(app.name))
                        {
                            foreach (ZipEntry zipEntry in zipFile)
                            {
                                zipEntry.Extract(@".\", ExtractExistingFileAction.OverwriteSilently);
                            }
                        }
                        File.Delete(app.name);
                        UpdateProgressBar.Visibility = Visibility.Collapsed;
                        UpdateProgressBar.Value      = 0;
                        CloseSplashView(0);
                    };
                    wc.DownloadFileAsync(
                        new Uri(download_url),
                        app.name
                        );
                }
            }
            catch (Exception exc)
            {
                Log.Write(exc.Message, LogLevel.EXCEPTION);
            }
        }
Exemplo n.º 2
0
        public static void Update()
        {
            try
            {
                GithubObjects.Releases.Assets app = electricShimmer.GetReleasebyVersion().assets.Where(x => x.name.Contains(".exe")).ToList()[0];
                string download_url = app.browser_download_url;

                Directory.CreateDirectory("temp");

                using (WebClient wc = new WebClient())
                {
                    wc.DownloadProgressChanged += ((MainWindow)App.Current.MainWindow).DownloadProgressChanged;
                    wc.DownloadFileCompleted   += ((MainWindow)App.Current.MainWindow).DownloadFinished;
                    wc.DownloadFileAsync(
                        new Uri(download_url),
                        @"temp\" + app.name
                        );
                }
            }
            catch (Exception exc)
            {
                Log.Write(exc.Message, LogLevel.EXCEPTION);
            }
        }