Browse Source

Fix #3118: Add "Clear assembly list" menu item.

pull/3138/head
Siegfried Pammer 1 year ago
parent
commit
84c5e63370
  1. 11
      ICSharpCode.ILSpyX/AssemblyList.cs
  2. 16
      ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs
  3. 9
      ILSpy/Properties/Resources.Designer.cs
  4. 3
      ILSpy/Properties/Resources.resx

11
ICSharpCode.ILSpyX/AssemblyList.cs

@ -23,7 +23,6 @@ using System.Collections.Immutable; @@ -23,7 +23,6 @@ using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Threading;
@ -395,6 +394,16 @@ namespace ICSharpCode.ILSpyX @@ -395,6 +394,16 @@ namespace ICSharpCode.ILSpyX
}
}
public void Clear()
{
VerifyAccess();
lock (lockObj)
{
dirty = true;
assemblies.Clear();
byFilename.Clear();
}
}
public void Sort(IComparer<LoadedAssembly> comparer)
{
Sort(0, int.MaxValue, comparer);

16
ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs

@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.ILSpy.Properties;
@ -44,4 +42,18 @@ namespace ICSharpCode.ILSpy @@ -44,4 +42,18 @@ namespace ICSharpCode.ILSpy
}
}
}
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.ClearAssemblyList), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)]
class ClearAssemblyList : SimpleCommand
{
public override bool CanExecute(object parameter)
{
return MainWindow.Instance.CurrentAssemblyList?.Count > 0;
}
public override void Execute(object parameter)
{
MainWindow.Instance.CurrentAssemblyList?.Clear();
}
}
}

9
ILSpy/Properties/Resources.Designer.cs generated

@ -495,6 +495,15 @@ namespace ICSharpCode.ILSpy.Properties { @@ -495,6 +495,15 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Clear assembly list.
/// </summary>
public static string ClearAssemblyList {
get {
return ResourceManager.GetString("ClearAssemblyList", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Close.
/// </summary>

3
ILSpy/Properties/Resources.resx

@ -186,6 +186,9 @@ Are you sure you want to continue?</value> @@ -186,6 +186,9 @@ Are you sure you want to continue?</value>
<data name="Checking" xml:space="preserve">
<value>Checking...</value>
</data>
<data name="ClearAssemblyList" xml:space="preserve">
<value>Clear assembly list</value>
</data>
<data name="Close" xml:space="preserve">
<value>Close</value>
</data>

Loading…
Cancel
Save