コード例 #1
0
 public PublishCollectionCommand(Guid id, CollectionScope scope = CollectionScope.Unlisted,
                                 Guid?forkedCollectionId        = null)
 {
     Id    = id;
     Scope = scope;
     ForkedCollectionId = forkedCollectionId;
 }
コード例 #2
0
 void UpdatePublishInfo(CollectionScope scope, Version version, CollectionPublishInfo publishInfo)
 {
     PublishedId         = publishInfo.Id;
     _publishedAccountId = publishInfo.AccountId;
     PublishingScope     = scope;
     UpdatePublishInfo(version);
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        public async Task ChangeScope(IConnectApiHandler api, CollectionScope desiredScope)
        {
            await api.ChangeCollectionScope(PublishedId.Value, desiredScope).ConfigureAwait(false);

            PublishingScope = desiredScope;
            if (desiredScope == CollectionScope.Private)
            {
                Subscribers = null;
            }
        }
コード例 #5
0
        public async Task<bool> Publish(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) {
            if (!await DealWithCustomRepo(collection.Model))
                return false;

            return
                await
                    WrapAsync(collection,
                        () =>
                            _mediator.RequestAsyncWrapped(new PublishCollectionCommand(collection.Model.Id, scope,
                                collection.Model.ForkedCollectionId)))
                        .ConfigureAwait(false);
        }
コード例 #6
0
        protected sealed override IEnumerator ProcessPayload(VisualPayload payload)
        {
            var window = GetWindowVisualizer(payload);

            var disasmsEntries = new List <DisasmEntryDescriptor>();

            foreach (var entry in CollectionScope.GetEntries(payload.Data))
            {
                var index      = InstructionIndex.GetValue(entry);
                var disasmText = DisasmText.GetValue(entry);

                disasmsEntries.Add(new DisasmEntryDescriptor(index, disasmText));
            }

            window.DisasmEntries = disasmsEntries;

            yield return(null);
        }
コード例 #7
0
        protected sealed override IEnumerator ProcessPayload(VisualPayload payload)
        {
            var window = GetWindowVisualizer(payload);

            var commsEntries = new List <CommsEntryDescriptor>();

            foreach (var entry in CollectionScope.GetEntries(payload.Data))
            {
                var index             = InstructionIndexField.GetValue(entry);
                var message           = MessageField.GetValue(entry);
                var isFromRequestSide = IsFromRequestSideField.GetValue(entry);
                var color             = ColorField.GetValue(entry);

                commsEntries.Add(new CommsEntryDescriptor(index, message, isFromRequestSide, color));
            }

            window.CommsEntries = commsEntries;

            yield return(null);
        }
コード例 #8
0
 public Task<bool> ChangeScope(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) {
     return WrapAsync(collection,
         () => _mediator.RequestAsyncWrapped(new ChangeCollectionScopeCommand(collection.Model.Id, scope)));
 }
コード例 #9
0
 public async Task ChangeCollectionScope(Guid collectionId, CollectionScope scope)
 {
     ConfirmConnected();
     await _connectionManager.CollectionsHub.ChangeScope(collectionId, scope).ConfigureAwait(false);
 }
コード例 #10
0
        public async Task <bool> Publish(CustomCollectionLibraryItemViewModel collection, CollectionScope scope)
        {
            if (!await DealWithCustomRepo(collection.Model))
            {
                return(false);
            }

            return
                (await
                 WrapAsync(collection,
                           () =>
                           _mediator.RequestAsyncWrapped(new PublishCollectionCommand(collection.Model.Id, scope,
                                                                                      collection.Model.ForkedCollectionId)))
                 .ConfigureAwait(false));
        }
コード例 #11
0
 public Task <bool> ChangeScope(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) => WrapAsync(collection,
                                                                                                                     () => _mediator.RequestAsyncWrapped(new ChangeCollectionScopeCommand(collection.Model.Id, scope)));
コード例 #12
0
 Task ChangeState(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) => _uploadCollection.ChangeScope(collection, scope);
コード例 #13
0
 public ChangeCollectionScopeCommand(Guid id, CollectionScope scope)
 {
     Id    = id;
     Scope = scope;
 }