public ActionNotifierDecorator(IMediator decorated, IDbContextLocator locator, IGameSwitcher gameSwitcher,
                                INetworkContentSyncer networkSyncer) : base(decorated)
 {
     _locator       = locator;
     _gameSwitcher  = gameSwitcher;
     _networkSyncer = networkSyncer;
 }
Пример #2
0
 public SetupGameStuff(IDbContextLocator locator, IDbContextFactory factory,
     INetworkContentSyncer networkContentSyncer, /* ICacheManager cacheMan, */
     IGameLocker gameLocker, IStateHandler stateHandler, IAssemblyService ass) {
     _locator = locator;
     _factory = factory;
     _networkContentSyncer = networkContentSyncer;
     //_cacheMan = cacheMan;
     _gameLocker = gameLocker;
     _stateHandler = stateHandler;
     _timer = new TimerWithElapsedCancellationAsync(TimeSpan.FromMinutes(30), onElapsedNonBool: OnElapsed);
     _gameFactory = new GameFactory(ass);
 }
Пример #3
0
 public SetupGameStuff(IDbContextLocator locator, IDbContextFactory factory,
                       INetworkContentSyncer networkContentSyncer, /* ICacheManager cacheMan, */
                       IGameLocker gameLocker, IStateHandler stateHandler, IAssemblyService ass)
 {
     _locator = locator;
     _factory = factory;
     _networkContentSyncer = networkContentSyncer;
     //_cacheMan = cacheMan;
     _gameLocker   = gameLocker;
     _stateHandler = stateHandler;
     _timer        = new TimerWithElapsedCancellationAsync(TimeSpan.FromMinutes(30), onElapsedNonBool: OnElapsed);
     _gameFactory  = new GameFactory(ass);
 }
Пример #4
0
        public static async Task DealWithCollections(Game game, IEnumerable <ContentGuidSpec> contents,
                                                     INetworkContentSyncer networkContentSyncer)
        {
            var ids = contents.Select(x => x.Id).ToArray();
            var existingCollections = game.SubscribedCollections.Where(x => ids.Contains(x.Id)).ToList();
            var newCollectionIds    =
                ids.Except(existingCollections.Select(x => x.Id)).ToList();

            await
            networkContentSyncer.SyncCollections(existingCollections).ConfigureAwait(false);

            if (newCollectionIds.Any())
            {
                var newCollections =
                    await networkContentSyncer.GetCollections(game.Id, newCollectionIds).ConfigureAwait(false);

                game.Contents.AddRange(newCollections);
            }
        }
Пример #5
0
 public SyncCollectionsHandler(IDbContextLocator dbContextLocator, INetworkContentSyncer contentSyncer)
     : base(dbContextLocator)
 {
     _contentSyncer = contentSyncer;
 }
Пример #6
0
 public Task Synchronize(Game game, INetworkContentSyncer syncer)
 => SyncCollectionsHandler.DealWithCollections(game, new[] { Content }, syncer);
Пример #7
0
 public CollectionSyncer(ICollectionInfoFetcher collectionInfoFetcher, INetworkContentSyncer syncer, IW6Api api)
 {
     _collectionInfoFetcher = collectionInfoFetcher;
     _syncer = syncer;
     _api    = api;
 }
Пример #8
0
 public SetupGameStuff(IDbContextLocator gameContextFactory, INetworkContentSyncer networkContentSyncer) {
     _gameContextFactory = gameContextFactory;
     _networkContentSyncer = networkContentSyncer;
 }