Esempio n. 1
0
        async Task DownloadUpdate(VersionCheckCompleteEventArgs a)
        {
            if (Destination.Exists)
            {
                if (Tools.HashEncryption.MD5FileHash(Destination) == a.Hash)
                {
                    _newVersionDownloaded = true;
                    PublishDomainEvent(new NewVersionDownloaded(TryParseVersion(a.Version)));
                    return;
                }
                Tools.FileUtil.Ops.DeleteWithRetry(Destination.ToString());
            }

            var filePath = BasePath + "/";

            if (singleExeMode)
            {
                filePath += SingleExeModeFilenameModifier;
            }

            var nightly =
#if NIGHTLY_RELEASE
                " nightly";
#else
                "";
#endif

            filePath += $"Play withSIX v{a.Version}{nightly} update.exe";

            await TryDownloadUpdate(a, filePath).ConfigureAwait(false);
        }
Esempio n. 2
0
        async Task TryDownloadUpdate(VersionCheckCompleteEventArgs a, string filePath)
        {
            try {
                await
                _downloader.DownloadAsync(Tools.Transfer.JoinUri(CommonUrls.CdnUrl2, filePath), Destination,
                                          Status).ConfigureAwait(false);

                _newVersionDownloaded = true;
                PublishDomainEvent(new NewVersionDownloaded(TryParseVersion(a.Version)));
            } catch (Exception e) {
                Status.UpdateOutput("Error downloading: " + e.Message);
                this.Logger().FormattedWarnException(e);
            } finally {
                IsRunning = false;
            }
        }
Esempio n. 3
0
        async Task VersionCheckerComplete(VersionCheckCompleteEventArgs args)
        {
            if (args.IsNew)
            {
                if (_versionInfoFile.Exists)
                {
                    Tools.FileUtil.Ops.DeleteWithRetry(_versionInfoFile.ToString());
                }

                using (var file = new StreamWriter(_versionInfoFile.ToString()))
                    file.WriteLine(args.Version + ":" + args.ProductCode + ":" + args.Hash);

                PublishDomainEvent(new NewVersionAvailable(TryParseVersion(args.Version)));

                await DownloadUpdate(args).ConfigureAwait(false);
            }
            else
            {
                PublishDomainEvent(new NoNewVersionAvailable(TryParseVersion(args.Version)));
                IsRunning = false;
            }
        }
Esempio n. 4
0
 async Task TryDownloadUpdate(VersionCheckCompleteEventArgs a, string filePath) {
     try {
         await
             _downloader.DownloadAsync(Tools.Transfer.JoinUri(CommonUrls.CdnUrl2, filePath), Destination,
                 Status).ConfigureAwait(false);
         _newVersionDownloaded = true;
         PublishDomainEvent(new NewVersionDownloaded(TryParseVersion(a.Version)));
     } catch (Exception e) {
         Status.UpdateOutput("Error downloading: " + e.Message);
         this.Logger().FormattedWarnException(e);
     } finally {
         IsRunning = false;
     }
 }
Esempio n. 5
0
        async Task DownloadUpdate(VersionCheckCompleteEventArgs a) {
            if (Destination.Exists) {
                if (Tools.HashEncryption.MD5FileHash(Destination) == a.Hash) {
                    _newVersionDownloaded = true;
                    PublishDomainEvent(new NewVersionDownloaded(TryParseVersion(a.Version)));
                    return;
                }
                Tools.FileUtil.Ops.DeleteWithRetry(Destination.ToString());
            }

            var filePath = BasePath + "/";
            if (singleExeMode)
                filePath += SingleExeModeFilenameModifier;

            var nightly =
#if NIGHTLY_RELEASE
                " nightly";
#else
                "";
#endif

            filePath += $"Play withSIX v{a.Version}{nightly} update.exe";

            await TryDownloadUpdate(a, filePath).ConfigureAwait(false);
        }
Esempio n. 6
0
        async Task VersionCheckerComplete(VersionCheckCompleteEventArgs args) {
            if (args.IsNew) {
                if (_versionInfoFile.Exists)
                    Tools.FileUtil.Ops.DeleteWithRetry(_versionInfoFile.ToString());

                using (var file = new StreamWriter(_versionInfoFile.ToString()))
                    file.WriteLine(args.Version + ":" + args.ProductCode + ":" + args.Hash);

                PublishDomainEvent(new NewVersionAvailable(TryParseVersion(args.Version)));

                await DownloadUpdate(args).ConfigureAwait(false);
            } else {
                PublishDomainEvent(new NoNewVersionAvailable(TryParseVersion(args.Version)));
                IsRunning = false;
            }
        }