/// <summary> /// import as an asynchronous operation. /// </summary> /// <param name="file">The file.</param> /// <returns>Task<IModCollection>.</returns> public async Task <IModCollection> ImportAsync(string file) { var game = GameService.GetSelected(); if (game == null) { return(null); } var instance = await GetImportedCollectionDetailsAsync(file); if (instance != null) { var path = GetPatchModDirectory(game, instance); var exportPath = GetPatchModDirectory(game, !string.IsNullOrWhiteSpace(instance.MergedFolderName) ? instance.MergedFolderName : instance.Name); if (await modCollectionExporter.ImportModDirectoryAsync(new ModCollectionExporterParams() { File = file, ModDirectory = path, Mod = instance, ExportModDirectory = exportPath })) { return(instance); } } return(null); }
/// <summary> /// import as an asynchronous operation. /// </summary> /// <param name="file">The file.</param> /// <returns>Task<IModCollection>.</returns> public async Task <IModCollection> ImportAsync(string file) { var game = GameService.GetSelected(); if (game == null) { return(null); } var instance = await GetImportedCollectionDetailsAsync(file); if (instance != null) { var path = GetModDirectory(game, instance); if (await modCollectionExporter.ImportModDirectoryAsync(new ModCollectionExporterParams() { File = file, ModDirectory = path, Mod = instance })) { return(instance); } } return(null); }
/// <summary> /// import as an asynchronous operation. /// </summary> /// <param name="file">The file.</param> /// <returns>Task<IModCollection>.</returns> public async Task <IModCollection> ImportAsync(string file) { var game = GameService.GetSelected(); if (game == null) { return(null); } var instance = await GetImportedCollectionDetailsAsync(file); if (instance != null) { // Incase selected game != imported collection game if (!game.Type.Equals(instance.Game)) { game = GameService.Get().FirstOrDefault(p => p.Type.Equals(instance.Game)); } var path = GetPatchModDirectory(game, instance); var exportPath = GetPatchModDirectory(game, !string.IsNullOrWhiteSpace(instance.MergedFolderName) ? instance.MergedFolderName : instance.Name); var result = await modCollectionExporter.ImportModDirectoryAsync(new ModCollectionExporterParams() { File = file, ModDirectory = path, Mod = instance, ExportModDirectory = exportPath }); if (result) { return(instance); } } return(null); }