コード例 #1
0
        public override ExitCode Execute()
        {
            bool removed = false;

            foreach (var digest in AdditionalArgs.Select(x => new ManifestDigest(x)))
            {
                removed |= ImplementationStore.Remove(digest, Handler);
            }
            return(removed ? ExitCode.OK : ExitCode.NoChanges);
        }
コード例 #2
0
    private void CleanImplementations(IEnumerable <ImplementationSelection> implementations)
    {
        var digestsToKeep   = implementations.Select(x => x.ManifestDigest);
        var digestsToRemove = ImplementationStore.ListAll().Except(digestsToKeep, ManifestDigestPartialEqualityComparer.Instance);

        Handler.RunTask(ForEachTask.Create(
                            name: Resources.RemovingOutdated,
                            target: digestsToRemove.ToList(),
                            work: digest => ImplementationStore.Remove(digest, Handler)));
    }
コード例 #3
0
 public override ExitCode Execute()
 {
     foreach (var digest in AdditionalArgs.Select(x => new ManifestDigest(x)))
     {
         if (!ImplementationStore.Remove(digest, Handler))
         {
             throw new ImplementationNotFoundException(digest);
         }
     }
     return(ExitCode.OK);
 }
コード例 #4
0
 /// <summary>
 /// Deletes this implementation from the <see cref="IImplementationStore"/> it is located in.
 /// </summary>
 /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about IO tasks.</param>
 /// <exception cref="KeyNotFoundException">No matching implementation could be found in the <see cref="IImplementationStore"/>.</exception>
 /// <exception cref="IOException">The implementation could not be deleted.</exception>
 /// <exception cref="UnauthorizedAccessException">Write access to the store is not permitted.</exception>
 public override void Delete(ITaskHandler handler)
 {
     try
     {
         ImplementationStore.Remove(_digest, handler);
     }
     #region Error handling
     catch (ImplementationNotFoundException ex)
     {
         throw new KeyNotFoundException(ex.Message, ex);
     }
     #endregion
 }
コード例 #5
0
 /// <summary>
 /// Deletes this implementation from the <see cref="IImplementationStore"/> it is located in.
 /// </summary>
 /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about IO tasks.</param>
 /// <exception cref="KeyNotFoundException">No matching implementation could be found in the <see cref="IImplementationStore"/>.</exception>
 /// <exception cref="IOException">The implementation could not be deleted.</exception>
 /// <exception cref="UnauthorizedAccessException">Write access to the store is not permitted.</exception>
 public override void Delete(ITaskHandler handler)
 {
     try
     {
         handler.RunTask(new SimpleTask(
                             string.Format(Resources.DeletingImplementation, _digest),
                             () => ImplementationStore.Remove(_digest, handler)));
     }
     #region Error handling
     catch (ImplementationNotFoundException ex)
     {
         throw new KeyNotFoundException(ex.Message, ex);
     }
     #endregion
 }
コード例 #6
0
    private void CleanImplementations(IEnumerable <ImplementationSelection> implementations)
    {
        var digestsToKeep   = implementations.Select(x => x.ManifestDigest);
        var digestsToRemove = ImplementationStore.ListAll().Except(digestsToKeep, ManifestDigestPartialEqualityComparer.Instance);

        Handler.RunTask(ForEachTask.Create(
                            name: Resources.RemovingOutdated,
                            target: digestsToRemove.ToList(),
                            work: digest =>
        {
            try
            {
                ImplementationStore.Remove(digest, Handler);
            }
            catch (NotAdminException ex) when(ZeroInstallInstance.IsLibraryMode)
            {
                Log.Info($"Unable to remove {digest}", ex);
            }
        }
                            ));
    }
コード例 #7
0
        private void Clean(IEnumerable <ManifestDigest> digestsToKeep)
        {
            var toDelete = ImplementationStore.ListAll().Except(digestsToKeep, ManifestDigestPartialEqualityComparer.Instance).ToList();

            Handler.RunTask(ForEachTask.Create(Resources.RemovingOutdated, toDelete, x => ImplementationStore.Remove(x, Handler)));
        }