Пример #1
0
        private async Task <IEnumerable <ILibraryOperationResult> > CheckLibraryForConflictsAsync(ILibraryInstallationState desiredState, CancellationToken cancellationToken)
        {
            var libraries = new List <ILibraryInstallationState>(Libraries);

            libraries.Add(desiredState);

            IEnumerable <ILibraryOperationResult> fileConflicts = await LibrariesValidator.GetLibrariesErrorsAsync(libraries, _dependencies, DefaultDestination, DefaultProvider, cancellationToken).ConfigureAwait(false);

            return(fileConflicts);
        }
Пример #2
0
        /// <summary>
        ///  Deletes all library output files from disk.
        /// </summary>
        /// <remarks>
        /// The host calling this method provides the <paramref name="deleteFileAction"/>
        /// that deletes the files from the project.
        /// </remarks>
        /// <param name="deleteFileAction">>An action to delete the files.</param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <IEnumerable <ILibraryOperationResult> > CleanAsync(Func <IEnumerable <string>, Task <bool> > deleteFileAction, CancellationToken cancellationToken)
        {
            var results = new List <ILibraryOperationResult>();

            IEnumerable <ILibraryOperationResult> validationResults = await LibrariesValidator.GetManifestErrorsAsync(this, _dependencies, cancellationToken).ConfigureAwait(false);

            if (!validationResults.All(r => r.Success))
            {
                return(validationResults);
            }

            foreach (ILibraryInstallationState state in Libraries)
            {
                results.Add(await DeleteLibraryFilesAsync(state, deleteFileAction, cancellationToken).ConfigureAwait(false));
            }

            return(results);
        }
Пример #3
0
        /// <summary>
        /// Restores all libraries in the <see cref="Libraries"/> collection.
        /// </summary>
        /// <param name="cancellationToken">A token that allows for cancellation of the operation.</param>
        public async Task <IEnumerable <ILibraryOperationResult> > RestoreAsync(CancellationToken cancellationToken)
        {
            //TODO: This should have an "undo scope"
            var results = new List <ILibraryOperationResult>();

            IEnumerable <ILibraryOperationResult> validationResults = await LibrariesValidator.GetManifestErrorsAsync(this, _dependencies, cancellationToken).ConfigureAwait(false);

            if (!validationResults.All(r => r.Success))
            {
                return(validationResults);
            }

            foreach (ILibraryInstallationState state in Libraries)
            {
                results.Add(await RestoreLibraryAsync(state, cancellationToken).ConfigureAwait(false));
            }

            return(results);
        }
Пример #4
0
        /// <summary>
        /// Returns a collection of <see cref="ILibraryOperationResult"/> that represents the status for validation of the Manifest and its libraries
        /// </summary>
        /// <param name="cancellationToken">A token that allows for cancellation of the operation.</param>
        public async Task <IEnumerable <ILibraryOperationResult> > GetValidationResultsAsync(CancellationToken cancellationToken)
        {
            IEnumerable <ILibraryOperationResult> validationResults = await LibrariesValidator.GetManifestErrorsAsync(this, _dependencies, cancellationToken).ConfigureAwait(false);

            return(validationResults);
        }