Exemple #1
0
 public PublishCollectionCommandHandler(IContentManager contentList, IConnectApiHandler api,
                                        IUserSettingsStorage storage)
 {
     _contentList = contentList;
     _api         = api;
     _storage     = storage;
 }
Exemple #2
0
 protected CollectionSynchronizationBase(IConnectApiHandler api, IGameContext context,
                                         IContentManager contentList)
 {
     _api         = api;
     _context     = context;
     _contentList = contentList;
 }
Exemple #3
0
 public CollectionNotificationHandler(IConnectApiHandler api, IGameContext context,
                                      IContentManager contentList) : base(api, context, contentList)
 {
     _api         = api;
     _context     = context;
     _contentList = contentList;
 }
 public UnsubscribeFromCollectionCommandHandler(IContentManager contentList, IConnectApiHandler api,
                                                UserSettings settings, IUserSettingsStorage storage)
 {
     _contentList = contentList;
     _api         = api;
     _storage     = storage;
 }
Exemple #5
0
        public ContactList(IEventAggregator ea,
                           IConnectApiHandler handler, IMediator mediator)
        {
            _eventBus   = ea;
            _mediator   = mediator;
            _apiHandler = handler;
            _apiHandler.MessageBus.Listen <ConnectionStateChanged>().Subscribe(Handle);

            LoginState = string.IsNullOrWhiteSpace(DomainEvilGlobal.SecretData.UserInfo.AccessToken)
                ? LoginState.LoggedOut
                : LoginState.LoggedIn;

            this.WhenAnyValue(x => x.LoginState)
            .Skip(1)
            .Subscribe(HandleNewLogginState);

            // TODO: Not good

            /*
             * _apiHandler.MessageBus.Listen<ConnectionStateChanged>()
             *  .Subscribe(x => {
             *      if (LoginState == LoginState.LoggedIn)
             *          ConnectedState = x.IsConnected ? ConnectedState.Connected : ConnectedState.Connecting;
             *  });
             */
        }
        public async Task Publish(IConnectApiHandler api, IContentManager modList,
                                  CollectionScope scope   = CollectionScope.Unlisted,
                                  Guid?forkedCollectionId = null)
        {
            if (string.IsNullOrWhiteSpace(Name))
            {
                throw new CollectionNameMissingException();
            }
            //if (scope != CollectionScope.Private && string.IsNullOrWhiteSpace(Description))
            // throw new CollectionDescriptionMissingException();
            if (!Items.Any())
            {
                throw new CollectionEmptyException();
            }

            var version = defaultVersion;
            List <CollectionVersionDependencyModel> dependencies;

            lock (Items)
                dependencies = GetMods()
                               .Select(Convert)
                               .ToList();

            var hasCustomRepo = HasCustomRepo();

            if (hasCustomRepo)
            {
                UpdateRepositoriesFromCustomRepo();
            }

            var servers = GetServersForPublishing();

            var publishInfo =
                await api.PublishCollection(new CreateCollectionModel {
                GameId             = GameId,
                Name               = Name,
                Scope              = scope,
                ForkedCollectionId = forkedCollectionId,
                InitialVersion     = new CreateCollectionVersionModel {
                    Description  = Description,
                    Version      = version,
                    Dependencies = dependencies,
                    Repositories = Repositories.ToList(),
                    Servers      = servers
                }
            }).ConfigureAwait(false);

            if (hasCustomRepo)
            {
                CleanupRepo();
            }

            UpdatePublishInfo(scope, version, publishInfo);
            HandleModsetMods(modList);
            if (hasCustomRepo)
            {
                await UploadImageIfAvailable(api).ConfigureAwait(false);
            }
        }
Exemple #7
0
 public MediatorApiContextDecorator(IMediator mediator, IConnectApiHandler scopeFactory) : base(mediator)
 {
     if (scopeFactory == null)
     {
         throw new ArgumentNullException(nameof(scopeFactory));
     }
     _scopeFactory = scopeFactory;
 }
        public async Task ChangeScope(IConnectApiHandler api, CollectionScope desiredScope)
        {
            await api.ChangeCollectionScope(PublishedId.Value, desiredScope).ConfigureAwait(false);

            PublishingScope = desiredScope;
            if (desiredScope == CollectionScope.Private)
            {
                Subscribers = null;
            }
        }
        public async Task DeleteOnline(IConnectApiHandler api, IContentManager modList)
        {
            await api.DeleteCollection(PublishedId.Value).ConfigureAwait(false);

            _publishedAccountId = null;
            PublishedVersion    = null;
            Version             = null;
            _publishingScope    = null;
            PublishedId         = null;
            HandleModsetMods(modList);
        }
Exemple #10
0
        public HomeView(BrowserInterop browserInterop, ILoginHandler loginHandler, IConnectApiHandler connMan)
        {
            InitializeComponent();
            _loginHandler = loginHandler;

            WebControl.LifeSpanHandler = new LifeSpanHandler();

            WebControl.RegisterJsObject("six_client", new Handler(browserInterop, connMan, HandleLogin));

            this.WhenActivated(d => {
                d(this.WhenAnyValue(x => x.ViewModel).BindTo(this, v => v.DataContext));
                d(this.WhenAnyValue(x => x.ViewModel)
                  .Skip(1)
                  .Subscribe(vm => {
                    d(WebControl.WhenAnyValue(x => x.IsLoading).Subscribe(x => {
                        ViewModel.ProgressState.Active = x;
                        ViewModel.CanGoBack            = WebControl.CanGoBack;
                        ViewModel.CanGoForward         = WebControl.CanGoForward;
                    }));
                    d(vm.Navigate.Subscribe(x => {
                        switch (x)
                        {
                        case HomeViewModel.NavigateMode.GoBack: {
                            WebControl.BackCommand.Execute(null);
                            break;
                        }

                        case HomeViewModel.NavigateMode.Abort: {
                            WebControl.Stop();
                            break;
                        }

                        case HomeViewModel.NavigateMode.GoForward: {
                            WebControl.ForwardCommand.Execute(null);
                            break;
                        }

                        case HomeViewModel.NavigateMode.Reload: {
                            WebControl.Reload(false);
                            break;
                        }
                        }
                    }));
                }));

                d(this.WhenAnyValue(v => v.WebControl.IsLoading)
                  .Skip(1)
                  .Subscribe(x => ViewModel.IsNavigating = x));
            });

            CommandBindings.Add(new CommandBinding(BrowserView.CopyToClipboard, OnCopyToClipboard, CanCopyToClipboard));
            CommandBindings.Add(new CommandBinding(BrowserView.OpenInSystemBrowser, OnOpenInSystemBrowser,
                                                   CanOpenInSystemBrowser));
        }
        public async Task PublishNewVersion(IConnectApiHandler api)
        {
            if (PublishedId == null)
            {
                throw new Exception("Not a published collection");
            }
            if (string.IsNullOrWhiteSpace(Name))
            {
                throw new CollectionNameMissingException();
            }
            //if (scope != CollectionScope.Private && string.IsNullOrWhiteSpace(Description))
            // throw new CollectionDescriptionMissingException();
            if (!Items.Any())
            {
                throw new CollectionEmptyException();
            }

            await api.ChangeCollectionName(PublishedId.Value, Name).ConfigureAwait(false);

            var version = PublishedVersion.AutoIncrement();

            var hasCustomRepo = HasCustomRepo();

            if (hasCustomRepo)
            {
                UpdateRepositoriesFromCustomRepo();
            }

            var servers = GetServersForPublishing();

            await api.PublishNewCollectionVersion(new AddCollectionVersionModel {
                Description  = Description,
                CollectionId = PublishedId.Value,
                Version      = version,
                Dependencies = Items.OfType <ToggleableModProxy>()
                               .Select(Convert)
                               .ToList(),
                Repositories = Repositories.ToList(),
                Servers      = servers
            }).ConfigureAwait(false);

            if (hasCustomRepo)
            {
                CleanupRepo();
            }

            UpdatePublishInfo(version);

            if (hasCustomRepo)
            {
                await UploadImageIfAvailable(api).ConfigureAwait(false);
            }
        }
 public Task Unsubscribe(IConnectApiHandler api) => api.UnsubscribeCollection(CollectionID);
Exemple #13
0
 public Handler(BrowserInterop interop, IConnectApiHandler connMan, Action <AccessInfo> handleLogin)
 {
     _interop     = interop;
     _connMan     = connMan;
     _handleLogin = handleLogin;
 }
Exemple #14
0
 public FetchCollectionQueryHandler(IConnectApiHandler api, IGameContext context,
                                    IContentManager contentList)
     : base(api, context, contentList)
 {
 }
Exemple #15
0
 public CollectionSynchronizer(IConnectApiHandler api, IGameContext context,
                               IContentManager contentList) : base(api, context, contentList)
 {
     _contentList = contentList;
 }
 public async Task UploadAvatar(IAbsoluteFilePath filePath, IConnectApiHandler api)
 {
     ImageLarge =
         Image  =
             "http:" + await api.UploadCollectionAvatar(filePath, PublishedId.Value).ConfigureAwait(false);
 }
 public async Task GenerateNewAvatar(IConnectApiHandler api)
 {
     ImageLarge =
         Image  = "http:" + await api.GenerateNewCollectionImage(PublishedId.Value).ConfigureAwait(false);
 }
 public UploadNewCollectionImageCommandHandler(IConnectApiHandler api, IContentManager contentList)
 {
     _api         = api;
     _contentList = contentList;
 }
 public Task Unsubscribe(IConnectApiHandler api) {
     return api.UnsubscribeCollection(CollectionID);
 }
Exemple #20
0
 public ShowCollectionVisibilityQueryHandler(IContentManager contentList, IConnectApiHandler apiHandler)
 {
     _contentList = contentList;
     _apiHandler  = apiHandler;
 }