예제 #1
0
 public WriteContext(
     IApplicationVersion version,
     Container container)
 {
     _container = container;
     _version   = version;
 }
        public UpdaterConfigurationViewModel(IUpdaterSettingsProvider settings,
                                             IApplicationVersion applicationVersion,
                                             IChangelogProvider changelogProvider,
                                             UpdateViewModel updateViewModel)
        {
            this.settings = settings;
            Watch(settings, s => s.Settings, nameof(LastCheckForUpdates));
            Watch(this, t => t.DisableAutoUpdates, nameof(IsModified));
            Watch(this, t => t.EnableSilentUpdates, nameof(IsModified));

            ShowChangelog = new DelegateCommand(changelogProvider.TryShowChangelog, changelogProvider.HasChangelog);
            Save          = new DelegateCommand(() =>
            {
                var sett = settings.Settings;
                sett.DisableAutoUpdates  = DisableAutoUpdates;
                sett.EnableSilentUpdates = EnableSilentUpdates;
                settings.Settings        = sett;
                RaisePropertyChanged(nameof(IsModified));
            });
            EnableSilentUpdates    = settings.Settings.EnableSilentUpdates;
            DisableAutoUpdates     = settings.Settings.DisableAutoUpdates;
            CheckForUpdatesCommand = updateViewModel.CheckForUpdatesCommand;
            CurrentVersion         = applicationVersion.VersionKnown
                ? $"build {applicationVersion.BuildVersion}"
                : "-- not known --";
        }
 public VoltageSummaryRepository(
     IApplicationVersion version,
     ILocalContext context)
 {
     _version = version;
     _context = context;
 }
예제 #4
0
        public AboutViewModel(IApplicationVersion applicationVersion,
                              IDatabaseProvider databaseProvider,
                              IDbcStore dbcStore,
                              IConfigureService settings,
                              ICurrentCoreVersion coreVersion,
                              IRemoteConnectorService remoteConnectorService)
        {
            this.applicationVersion     = applicationVersion;
            this.databaseProvider       = databaseProvider;
            this.dbcStore               = dbcStore;
            this.remoteConnectorService = remoteConnectorService;

            ConfigurationChecks.Add(new ConfigurationCheckup(coreVersion.Current is not UnspecifiedCoreVersion,
                                                             "Core version compatibility mode",
                                                             "WoW Database Editor supports multiple world of warcraft server cores. In order to achieve maximum compatibility, choose version that matches best.\nYou are using: " + coreVersion.Current.FriendlyName + " compatibility mode now."));

            ConfigurationChecks.Add(new ConfigurationCheckup(dbcStore.IsConfigured,
                                                             "DBC settings",
                                                             "DBC is DataBaseClient files provided with WoW client. Those contain a lot of useful stuff for scripting like spells data. For maximum features you have to provide DBC files path. All WoW servers require those files to work so if you have working core, you must have DBC files already."));

            ConfigurationChecks.Add(new ConfigurationCheckup(databaseProvider.IsConnected,
                                                             "Database connection",
                                                             "WoW Database Editor is database editor by design. It stores all data and loads things from wow database. Therefore to activate all features you have to provide wow compatible database connection settings."));

            ConfigurationChecks.Add(new ConfigurationCheckup(remoteConnectorService.IsConnected,
                                                             "Remote SOAP connection",
                                                             "WDE can invoke reload commands for you for faster work. To enable that, you have to enable SOAP connection in your worldserver configuration and provide details in the settings."));

            AllConfigured = ConfigurationChecks.All(s => s.Fulfilled);

            OpenSettingsCommand = new DelegateCommand(settings.ShowSettings);
        }
        /// <summary>
        /// Update ApplicationVersion.
        /// </summary>
        /// <param name="userContext">User context.</param>
        /// <param name="applicationVersion">
        /// Information about the updated applicationVersion.
        /// This object is updated with information
        /// about the updated applicationVersion.
        /// </param>
        public void UpdateApplicationVersion(IUserContext userContext, IApplicationVersion applicationVersion)
        {
            WebApplicationVersion webApplicationVersion;

            CheckTransaction(userContext);
            webApplicationVersion = WebServiceProxy.UserService.UpdateApplicationVersion(GetClientInformation(userContext),
                                                                                         GetApplicationVersion(userContext, applicationVersion));
            UpdateApplicationVersion(userContext, applicationVersion, webApplicationVersion);
        }
예제 #6
0
        public static string GetUniqueIdentifier(this IApplicationVersion item, IEnumerable <string> versions)
        {
            //First use name if possible
            if (versions != null && versions.Count(x => (x ?? Constants.DefaultVersionName) == (item.Version ?? Constants.DefaultVersionName)) == 1)
            {
                return(item.Version ?? Constants.DefaultVersionName);
            }

            return(item.Id.Replace(":", string.Empty));
        }
예제 #7
0
        public void Init()
        {
            settings        = Substitute.For <IUpdaterSettingsProvider>();
            currentVersion  = Substitute.For <IApplicationVersion>();
            documentManager = Substitute.For <IDocumentManager>();
            fileSystem      = Substitute.For <IFileSystem>();

            fileSystem.Exists("changelog.json").Returns(true);
            fileSystem.ReadAllText("changelog.json").Returns(@"[{""Version"":294,""VersionName"":""Build 0.1.294"",""Date"":""2021-03-13T17:38:00"",""UpdateTitle"":null,""Changes"":[]}]");
        }
 public void Init()
 {
     data               = Substitute.For <IUpdateServerDataProvider>();
     clientFactory      = Substitute.For <IUpdateClientFactory>();
     applicationVersion = Substitute.For <IApplicationVersion>();
     application        = Substitute.For <IApplication>();
     fileSystem         = Substitute.For <IFileSystem>();
     standaloneUpdate   = Substitute.For <IStandaloneUpdater>();
     updateClient       = Substitute.For <IUpdateClient>();
     settings           = Substitute.For <IUpdaterSettingsProvider>();
     platformService    = Substitute.For <IAutoUpdatePlatformService>();
     clientFactory
     .Create(Arg.Any <Uri>(), Arg.Any <string>(), Arg.Any <string?>(), Arg.Any <Platforms>())
     .Returns(updateClient);
 }
예제 #9
0
        public async Task LaunchUpdateAsync(IApplicationVersion version)
        {
            var caption      = _translation.GetFormattedTitle(_applicationNameProvider.ApplicationName);
            var downloadPath = _updateDownloader.GetDownloadPath(version.DownloadUrl);

            // retry until successful
            if (!_updateDownloader.IsDownloaded(downloadPath))
            {
                while (!TryLaunchUpdate(version, caption, downloadPath))
                {
                }
            }

            await AskUserForAppRestartAsync(downloadPath);
        }
예제 #10
0
        public ChangelogProvider(IUpdaterSettingsProvider settings,
                                 IApplicationVersion currentVersion,
                                 IDocumentManager documentManager,
                                 IFileSystem fileSystem)
        {
            this.settings        = settings;
            this.currentVersion  = currentVersion;
            this.documentManager = documentManager;
            this.fileSystem      = fileSystem;

            if (settings.Settings.LastShowedChangelog < currentVersion.BuildVersion)
            {
                TryShowChangelog();
            }
        }
예제 #11
0
        private async Task <IApplicationVersion> LoadOnlineVersionAsyncInternal(bool forceDownload = false, bool onlyCache = false)
        {
            _logger.Debug("Get online Version");

            var url         = _updateInformationProvider.UpdateInfoUrl;
            var sectionName = _updateInformationProvider.SectionName;

            try
            {
                var contents = await RetrieveFileFromCacheOrUrl(url, "update-info.txt", forceDownload);

                using (var stream = CreateStreamFromString(contents))
                {
                    _logger.Debug("Loading update-info.txt");
                    var data       = Data.CreateDataStorage();
                    var iniStorage = new IniStorage("");
                    iniStorage.ReadData(stream, data);

                    var onlineVersion = new System.Version(data.GetValue(sectionName + "\\Version"));
                    var downloadUrl   = data.GetValue(sectionName + "\\DownloadUrl");
                    var fileHash      = data.GetValue(sectionName + "\\FileHash");
                    _logger.Info("Online Version: " + onlineVersion);

                    var versionsInfo       = new List <Release>();
                    var applicationVersion = _versionHelper.ApplicationVersion;

                    if (applicationVersion.CompareTo(onlineVersion) < 0)
                    {
                        var downloadString = await RetrieveFileFromCacheOrUrl(_updateInformationProvider.ChangeLogUrl, "Releases.json", forceDownload);

                        var availableInfos = _changeParser.Parse(downloadString);
                        versionsInfo = availableInfos.FindAll(release => release.Version > applicationVersion);

                        CurrentReleaseVersion = availableInfos.FirstOrDefault(x => x.Version.IsEqualToCurrentVersion(applicationVersion));
                    }

                    _onlineVersion = new ApplicationVersion(onlineVersion, downloadUrl, fileHash, versionsInfo);
                }
            }
            catch (Exception e)
            {
                _logger.Warn(e.Message);

                _onlineVersion = new ApplicationVersion(new System.Version(0, 0, 0), "", "", new List <Release>());
            }

            return(_onlineVersion);
        }
예제 #12
0
        public OnlineVersionHelper(UpdateInformationProvider updateInformationProvider, ITempFolderProvider tempFolderProvider, IVersionHelper versionHelper, IUpdateChangeParser changeParser, IFileCacheFactory fileCacheFactory, IDownloader downloader, ICurrentSettings <ApplicationSettings> applicationSettingsProvider)
        {
            _updateInformationProvider = updateInformationProvider;
            _tempFolderProvider        = tempFolderProvider;
            _versionHelper             = versionHelper;
            _changeParser                = changeParser;
            _fileCacheFactory            = fileCacheFactory;
            _downloader                  = downloader;
            _applicationSettingsProvider = applicationSettingsProvider;

            if (_applicationSettingsProvider != null)
            {
                _fileCache = GetFileCache();
                _applicationSettingsProvider.SettingsChanged += ApplicationSettingsProviderOnSettingsChanged;
            }
            _onlineVersion = new ApplicationVersion(new System.Version(0, 0, 0, 0), "", "", new List <Release>());
        }
 /// <summary>
 /// Update applicationVersion object.
 /// </summary>
 /// <param name="userContext">User context.</param>
 /// <param name="applicationVersion">ApplicationVersion.</param>
 /// <param name="webApplicationVersion">Web application version.</param>
 private void UpdateApplicationVersion(IUserContext userContext,
                                       IApplicationVersion applicationVersion,
                                       WebApplicationVersion webApplicationVersion)
 {
     applicationVersion.ApplicationId = webApplicationVersion.ApplicationId;
     applicationVersion.UpdateInformation.CreatedBy   = webApplicationVersion.CreatedBy;
     applicationVersion.UpdateInformation.CreatedDate = webApplicationVersion.CreatedDate;
     applicationVersion.DataContext   = GetDataContext(userContext);
     applicationVersion.Description   = webApplicationVersion.Description;
     applicationVersion.Id            = webApplicationVersion.Id;
     applicationVersion.IsRecommended = webApplicationVersion.IsRecommended;
     applicationVersion.IsValid       = webApplicationVersion.IsValid;
     applicationVersion.UpdateInformation.ModifiedBy   = webApplicationVersion.ModifiedBy;
     applicationVersion.UpdateInformation.ModifiedDate = webApplicationVersion.ModifiedDate;
     applicationVersion.ValidFromDate = webApplicationVersion.ValidFromDate;
     applicationVersion.ValidToDate   = webApplicationVersion.ValidToDate;
     applicationVersion.Version       = webApplicationVersion.Version;
 }
 public UpdateService(IUpdateServerDataProvider data,
                      IUpdateClientFactory clientFactory,
                      IApplicationVersion applicationVersion,
                      IApplication application,
                      IFileSystem fileSystem,
                      IStandaloneUpdater standaloneUpdater,
                      IUpdaterSettingsProvider settings,
                      IAutoUpdatePlatformService platformService)
 {
     this.data               = data;
     this.clientFactory      = clientFactory;
     this.applicationVersion = applicationVersion;
     this.application        = application;
     this.fileSystem         = fileSystem;
     this.standaloneUpdater  = standaloneUpdater;
     this.settings           = settings;
     this.platformService    = platformService;
     standaloneUpdater.RenameIfNeeded();
 }
예제 #15
0
        private void AddApplicationVersion(IApplicationVersion applicationVersion)
        {
            var application = _repository.GetApplication(applicationVersion.ApplicationId);

            _repository.AddApplicationVersion(applicationVersion);

            if (application.KeepLatestVersions == null)
            {
                return;
            }

            var versions          = GetApplicationVersions(application.Id).OrderBy(x => x.Version);
            var versionsToArchive = versions.Take(versions.Count() - application.KeepLatestVersions.Value);

            foreach (var version in versionsToArchive)
            {
                _repository.ArchiveApplicationVersion(version.Id);
            }
        }
 public BatteryInverterTemperatureSummaryRepoStore(
     ILogger logger,
     IMediator mediator,
     IAppCache cache,
     IRepoConfig config,
     IApplicationVersion versionConfig,
     IInverterTemperatureSummaryDocumentReadRepository readRepo,
     IBatteryInverterTemperatureSummaryRepository writeRepo)
 {
     _persistFunctions = new PersistToRepositoryFunctions <InverterTemperatureSummary, BatteryInverterTemperatureSummaryReadModel>(
         readRepo,
         writeRepo,
         versionConfig,
         logger,
         config,
         cache,
         "persistBatteryInverterTemperatureSummaryList",
         mediator,
         GetKeyExtensions.GetKey,
         GetKeyExtensions.GetKeyVersion2);
 }
예제 #17
0
 public EnergySummaryRepoStore(
     ILogger logger,
     IMediator mediator,
     IAppCache cache,
     IRepoConfig config,
     IApplicationVersion versionConfig,
     IEnergySummaryDocumentReadRepository energySummaryReadRepository,
     IEnergySummaryRepository energySummaryRepository)
 {
     _persistFunctions = new PersistToRepositoryFunctions <EnergySummary, EnergySummaryReadModel>(
         energySummaryReadRepository,
         energySummaryRepository,
         versionConfig,
         logger,
         config,
         cache,
         "persistEnergySummaryList",
         mediator,
         GetKeyExtensions.GetKey,
         GetKeyExtensions.GetKeyVersion2);
 }
        /// <summary>
        /// Get WebApplicationVersion from ApplicationVersion.
        /// </summary>
        /// <param name="userContext">User context.</param>
        /// <param name="applicationVersion">ApplicationVersion.</param>
        /// <returns>WebApplicationVersion.</returns>
        public WebApplicationVersion GetApplicationVersion(IUserContext userContext,
                                                           IApplicationVersion applicationVersion)
        {
            WebApplicationVersion webApplicationVersion;

            webApplicationVersion = new WebApplicationVersion();

            webApplicationVersion.ApplicationId = applicationVersion.ApplicationId;
            webApplicationVersion.CreatedBy     = applicationVersion.UpdateInformation.CreatedBy;
            webApplicationVersion.CreatedDate   = applicationVersion.UpdateInformation.CreatedDate;
            webApplicationVersion.Description   = applicationVersion.Description;
            webApplicationVersion.Id            = applicationVersion.Id;
            webApplicationVersion.IsRecommended = applicationVersion.IsRecommended;
            webApplicationVersion.IsValid       = applicationVersion.IsValid;
            webApplicationVersion.ModifiedBy    = applicationVersion.UpdateInformation.ModifiedBy;
            webApplicationVersion.ModifiedDate  = applicationVersion.UpdateInformation.ModifiedDate;
            webApplicationVersion.ValidFromDate = applicationVersion.ValidFromDate;
            webApplicationVersion.ValidToDate   = applicationVersion.ValidToDate;
            webApplicationVersion.Version       = applicationVersion.Version;

            return(webApplicationVersion);
        }
예제 #19
0
        public void StartDownload(IApplicationVersion version)
        {
            if (isDownloading)
            {
                return;
            }

            _httpClient = new HttpClient();

            Task.Run(() =>
            {
                isDownloading = true;
                DownloadSpeed = new DownloadSpeed();

                OnProgressChanged  += DownloadSpeed.DownloadProgressChanged;
                OnDownloadFinished += DownloadSpeed.webClient_DownloadFileCompleted;

                var downloadFileWithRange = DownloadFileWithRange(version);
                OnDownloadFinished?.Invoke(this, new UpdateProgressChangedEventArgs(downloadFileWithRange, 0, 0, 0));
                isDownloading = false;
            });
        }
예제 #20
0
        public async Task StartDownloadAsync(IApplicationVersion version)
        {
            if (_downloadTask == null)
            {
                _cancellationSource = _cancellationSourceFactory.CreateSource();
                _downloadTask       = Task.Run(() =>
                {
                    _httpClient = new HttpClient();

                    DownloadSpeed = new DownloadSpeed();

                    OnProgressChanged  += DownloadSpeed.DownloadProgressChanged;
                    OnDownloadFinished += DownloadSpeed.webClient_DownloadFileCompleted;

                    var downloadFileWithRange = DownloadFileWithRange(version);
                    OnDownloadFinished?.Invoke(this, new UpdateProgressChangedEventArgs(downloadFileWithRange, 0, 0, 0));
                    _downloadTask = null;
                }, _cancellationSource.Token);
            }

            await _downloadTask;
        }
예제 #21
0
 public PersistToRepositoryFunctions(
     IDocumentReadRepository <TReadModel> documentReadRepository,
     ISummaryRepository <TPersistedType> documentWriteRepository,
     IApplicationVersion versionConfig,
     ILogger logger,
     IRepoConfig repoConfig,
     IAppCache cache,
     string cacheCollectionKey,
     IMediator mediator,
     Func <TPersistedType, string> getKey,
     Func <TPersistedType, string> getKey2)
 {
     _documentReadRepository  = documentReadRepository;
     _documentWriteRepository = documentWriteRepository;
     _getKey             = getKey;
     _getKey2            = getKey2;
     _versionConfig      = versionConfig;
     _logger             = logger;
     _repoConfig         = repoConfig;
     _cache              = cache;
     _cacheCollectionKey = cacheCollectionKey;
     _mediator           = mediator;
 }
예제 #22
0
        private bool TryLaunchUpdate(IApplicationVersion version, string caption, string filePath)
        {
            try
            {
                var interaction = new UpdateDownloadInteraction(async() => await _updateDownloader.StartDownloadAsync(version));
                _interactionInvoker.Invoke(interaction);

                if (interaction.Success)
                {
                    // Hash test
                    if (!_hashUtil.VerifyFileMd5(filePath, version.FileHash))
                    {
                        //Hash does not fit should we retry download
                        var message = _translation.DownloadHashErrorMessage;
                        var res     = ShowMessage(message, caption, MessageOptions.YesNo, MessageIcon.Warning);

                        if (res == MessageResponse.Yes) // Yes please retry download: Download was not successful
                        {
                            return(false);
                        }
                    }
                }
            }
            catch (Exception)
            {
                var message = _translation.DownloadErrorMessage;
                var res     = ShowMessage(message, caption, MessageOptions.YesNo, MessageIcon.PDFCreator);

                if (res == MessageResponse.Yes)
                {
                    Process.Start(version.DownloadUrl);
                }
            }

            return(true); // Download was successful
        }
예제 #23
0
 public void UpdateApplicationVersion(IApplicationVersion applicationVersion)
 {
     throw new NotImplementedException();
 }
예제 #24
0
 public HttpClientFactory(IApplicationVersion applicationVersion, IEnumerable <IUserAgentPart> parts)
 {
     this.applicationVersion = applicationVersion;
     this.parts = parts;
 }
 public Task LaunchUpdate(IApplicationVersion version)
 {
     return(Task.FromResult((object)null));
 }
 public UpdateClientFactory(IApplicationVersion applicationVersion)
 {
     this.applicationVersion = applicationVersion;
 }
예제 #27
0
        public static ApplicationVersionPersist ToPersist(this IApplicationVersion item)
        {
            var response = Mapper.Map <IApplicationVersion, ApplicationVersionPersist>(item);

            return(response);
        }
예제 #28
0
 public void AddApplicationVersion(IApplicationVersion applicationVersion)
 {
     Database.GetCollection("ApplicationVersion").Insert(applicationVersion.ToPersist());
 }
예제 #29
0
        private static Guid GetInitiativeId(IInitiative[] initiatives, IApplicationVersion x)
        {
            var initiative = initiatives.SingleOrDefault(xx => xx.ApplicationGroups.SelectMany(y => y.Applications).Any(z => z.Id == x.ApplicationId));

            return(initiative != null ? initiative.Id : Guid.Empty);
        }
예제 #30
0
 public Task LaunchUpdateAsync(IApplicationVersion version)
 {
     _webLinkLauncher.Launch(Urls.PDFCreatorDownloadUrl);
     return(Task.FromResult((object)null));
 }