Esempio n. 1
0
        /// <summary>
        /// Exports the asynchronous.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="modCollection">The mod collection.</param>
        /// <param name="exportOrderOnly">if set to <c>true</c> [export order only].</param>
        /// <param name="exportMods">if set to <c>true</c> [export mods].</param>
        /// <returns>Task&lt;System.Boolean&gt;.</returns>
        public virtual Task <bool> ExportAsync(string file, IModCollection modCollection, bool exportOrderOnly = false, bool exportMods = false)
        {
            var game = GameService.GetSelected();

            if (game == null || modCollection == null)
            {
                return(Task.FromResult(false));
            }
            var collection = Mapper.Map <IModCollection>(modCollection);

            if (string.IsNullOrWhiteSpace(collection.MergedFolderName) && exportMods)
            {
                collection.MergedFolderName = collection.Name.GenerateValidFileName();
            }
            var path       = GetPatchModDirectory(game, modCollection);
            var parameters = new ModCollectionExporterParams()
            {
                File               = file,
                Mod                = collection,
                ModDirectory       = path,
                ExportModOrderOnly = exportOrderOnly
            };

            if (exportMods)
            {
                parameters.ExportMods = GetCollectionMods(collectionName: modCollection.Name);
            }
            return(modCollectionExporter.ExportAsync(parameters));
        }
Esempio n. 2
0
        /// <summary>
        /// Exports the asynchronous.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="modCollection">The mod collection.</param>
        /// <param name="exportOrderOnly">if set to <c>true</c> [export order only].</param>
        /// <returns>Task&lt;System.Boolean&gt;.</returns>
        public virtual Task <bool> ExportAsync(string file, IModCollection modCollection, bool exportOrderOnly = false)
        {
            var game = GameService.GetSelected();

            if (game == null || modCollection == null)
            {
                return(Task.FromResult(false));
            }
            var path = GetModDirectory(game, modCollection);

            return(modCollectionExporter.ExportAsync(new ModCollectionExporterParams()
            {
                File = file,
                Mod = modCollection,
                ModDirectory = path,
                ExportModOrderOnly = exportOrderOnly
            }));
        }