Ejemplo n.º 1
0
        protected override void AfterSetup()
        {
            base.AfterSetup();

            Cheat.SetServices(Container.GetInstance <ICheatImpl>());
            CalculatedGameSettings.RaiseEvent   = Cheat.PublishEvent;
            CalculatedGameSettings.NotifyEnMass = async(message) => {
                await Cheat.PublishDomainEvent((dynamic)message).ConfigureAwait(false);

                Cheat.PublishEvent(message);
            };

            SetupSettings();
            DomainEvilGlobal.SelectedGame = Container.GetInstance <EvilGlobalSelectedGame>();

            var authProviderStorage = Container.GetInstance <IAuthProviderStorage>();
            var authProvider        = Container.GetInstance <IAuthProvider>();

            PwsUriHandler.GetAuthInfoFromUri = authProvider.GetAuthInfoFromUri;
            PwsUriHandler.SetAuthInfo        = authProviderStorage.SetAuthInfo;

            var gameContext   = Container.GetInstance <IGameContext>();
            var recentGameSet = DomainEvilGlobal.Settings.GameOptions.RecentGameSet;

            DomainEvilGlobal.SelectedGame.ActiveGame = recentGameSet == null
                ? FindFirstInstalledGameOrDefault(gameContext)
                : gameContext.Games.Find(recentGameSet.Id) ??
                                                       FindFirstInstalledGameOrDefault(gameContext);
        }
Ejemplo n.º 2
0
        static async Task CheckForNewVersion()
        {
            var newVersion = await new PlaySquirrel().GetNewVersion().ConfigureAwait(false);

            if (newVersion != null)
            {
                Cheat.PublishDomainEvent(new NewVersionAvailable(newVersion));
            }
        }
Ejemplo n.º 3
0
            async Task UpdateToken(PremiumAccessToken newToken)
            {
                var userInfo      = DomainEvilGlobal.SecretData.UserInfo;
                var existingToken = userInfo.Token;

                // Always process the first time. Then on consequtive, only update on change
                if (_firstCompleted &&
                    (newToken != null && newToken.Equals(existingToken) || (existingToken == null && newToken == null)))
                {
                    return;
                }
                userInfo.Token = newToken;
                await Cheat.PublishDomainEvent(new TokenUpdatedEvent(newToken)).ConfigureAwait(false);
            }
Ejemplo n.º 4
0
        // TODO: Domain events should be raised by the domain, not by the application layer,
        // however it is very difficult in the current setup to detect if modpaths were changed due to a profile change or due to a settings change...
        void HandleNewModPaths(ISupportModding game, ContentPaths newPaths, ContentPaths oldPaths)
        {
            if (!newPaths.IsValid || !oldPaths.IsValid)
            {
                return;
            }

            if (!oldPaths.EqualPath(newPaths))
            {
                if (!oldPaths.EqualRepositoryPath(newPaths))
                {
                    Cheat.PublishDomainEvent(new ModAndSynqPathsChangedEvent(game, oldPaths, newPaths));
                }
                else
                {
                    Cheat.PublishDomainEvent(new ModPathChangedEvent(game, oldPaths, newPaths));
                }
            }
            else if (!oldPaths.EqualRepositoryPath(newPaths))
            {
                Cheat.PublishDomainEvent(new SynqPathChangedEvent(game, oldPaths, newPaths));
            }
        }
Ejemplo n.º 5
0
 async Task SubscribedToCollection(SubscribedToCollection evt)
 {
     await Cheat.PublishDomainEvent(evt).ConfigureAwait(false);
 }
Ejemplo n.º 6
0
        /*
         * async Task CollectionUpdated(CollectionUpdated evt) {
         *  await Cheat.PublishDomainEvent(evt).ConfigureAwait(false);
         * }
         *
         * async Task CollectionVersionAdded(CollectionVersionAdded evt) {
         *  await Cheat.PublishDomainEvent(evt).ConfigureAwait(false);
         * }
         */

        async Task UnsubscribeFromCollection(UnsubscribedFromCollection evt)
        {
            await Cheat.PublishDomainEvent(evt).ConfigureAwait(false);
        }
Ejemplo n.º 7
0
 async Task ApiHashesReceived(ApiHashes obj) => await Cheat.PublishDomainEvent(new ApiHashesEvent(obj)).ConfigureAwait(false);