Browse Source

Revert "Fix #2013: Add option to extract self-contained executables (PublishSingleFile)."

This reverts commit 0d390d604f.
pull/2030/head
Siegfried Pammer 5 years ago
parent
commit
47311949d4
  1. 12
      ILSpy.AddIn/ILSpy.AddIn.csproj
  2. 2
      ILSpy/ILSpy.csproj
  3. 75
      ILSpy/MainWindow.xaml.cs
  4. 15
      ILSpy/Properties/Resources.Designer.cs
  5. 9
      ILSpy/Properties/Resources.resx

12
ILSpy.AddIn/ILSpy.AddIn.csproj

@ -117,14 +117,12 @@
<AdditionalDependencies Include="$(ILSpyBuildPath)Mono.Cecil.Pdb.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)Mono.Cecil.Pdb.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)ILSpy.BamlDecompiler.Plugin.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)ILSpy.BamlDecompiler.Plugin.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Microsoft.DiaSymReader*.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)Microsoft.DiaSymReader*.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)OSVersionHelper.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)OSVersionHelper.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Xceed.Wpf.AvalonDock.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)Xceed.Wpf.AvalonDock.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)DataGridExtensions.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)DataGridExtensions.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Iced.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)Iced.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)ILCompiler.Reflection.ReadyToRun.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)ILCompiler.Reflection.ReadyToRun.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)ILSpy.ReadyToRun.Plugin.dll" /> <AdditionalDependencies Include="$(ILSpyBuildPath)ILSpy.ReadyToRun.Plugin.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Microsoft.NET.HostModel.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Ookii.Dialogs.Wpf.dll" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
ILSpy/ILSpy.csproj

@ -56,8 +56,6 @@
<PackageReference Include="Mono.Cecil" Version="0.10.3" /> <PackageReference Include="Mono.Cecil" Version="0.10.3" />
<PackageReference Include="OSVersionHelper" Version="1.0.11" /> <PackageReference Include="OSVersionHelper" Version="1.0.11" />
<PackageReference Include="DataGridExtensions" Version="2.1.1" /> <PackageReference Include="DataGridExtensions" Version="2.1.1" />
<PackageReference Include="Microsoft.NET.HostModel" Version="3.1.4" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="1.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

75
ILSpy/MainWindow.xaml.cs

@ -35,7 +35,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Threading; using System.Windows.Threading;
using ICSharpCode.Decompiler; using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Documentation; using ICSharpCode.Decompiler.Documentation;
using ICSharpCode.Decompiler.Metadata; using ICSharpCode.Decompiler.Metadata;
@ -47,13 +46,7 @@ using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpy.TreeNodes; using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpy.ViewModels; using ICSharpCode.ILSpy.ViewModels;
using ICSharpCode.TreeView; using ICSharpCode.TreeView;
using Microsoft.NET.HostModel.AppHost;
using Microsoft.NET.HostModel.Bundle;
using Microsoft.Win32; using Microsoft.Win32;
using Ookii.Dialogs.Wpf;
using OSVersionHelper; using OSVersionHelper;
using Xceed.Wpf.AvalonDock.Layout.Serialization; using Xceed.Wpf.AvalonDock.Layout.Serialization;
@ -1012,55 +1005,15 @@ namespace ICSharpCode.ILSpy
} }
break; break;
default: default:
if (IsAppBundle(file, out var headerOffset)) { var asm = assemblyList.OpenAssembly(file);
if (MessageBox.Show(this, Properties.Resources.OpenSelfContainedExecutableMessage, "ILSpy", MessageBoxButton.YesNo) == MessageBoxResult.No) if (asm != null) {
break; if (loadedAssemblies != null)
var dialog = new VistaFolderBrowserDialog(); loadedAssemblies.Add(asm);
if (dialog.ShowDialog() != true) else {
break; var node = assemblyListTreeNode.FindAssemblyNode(asm);
DockWorkspace.Instance.RunWithCancellation(ct => Task<AvalonEditTextOutput>.Factory.StartNew(() => { if (node != null && focusNode) {
var output = new AvalonEditTextOutput { Title = "Extracting " + file }; AssemblyTreeView.SelectedItems.Add(node);
Stopwatch w = Stopwatch.StartNew(); lastNode = node;
output.WriteLine($"Extracting {file} to {dialog.SelectedPath}...");
var extractor = new Extractor(file, dialog.SelectedPath);
extractor.ExtractFiles();
output.WriteLine($"Done in {w.Elapsed}.");
return output;
}, ct)).Then(output => {
DockWorkspace.Instance.ShowText(output);
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = ".NET assemblies|*.dll;*.exe;*.winmd";
dlg.Multiselect = true;
dlg.InitialDirectory = dialog.SelectedPath;
if (dlg.ShowDialog() == true) {
foreach (var item in dlg.FileNames) {
var asm = assemblyList.OpenAssembly(item);
if (asm != null) {
if (loadedAssemblies != null)
loadedAssemblies.Add(asm);
else {
var node = assemblyListTreeNode.FindAssemblyNode(asm);
if (node != null && focusNode) {
AssemblyTreeView.SelectedItems.Add(node);
lastNode = node;
}
}
}
}
}
}).HandleExceptions();
} else {
var asm = assemblyList.OpenAssembly(file);
if (asm != null) {
if (loadedAssemblies != null)
loadedAssemblies.Add(asm);
else {
var node = assemblyListTreeNode.FindAssemblyNode(asm);
if (node != null && focusNode) {
AssemblyTreeView.SelectedItems.Add(node);
lastNode = node;
}
} }
} }
} }
@ -1070,16 +1023,6 @@ namespace ICSharpCode.ILSpy
if (lastNode != null && focusNode) if (lastNode != null && focusNode)
AssemblyTreeView.FocusNode(lastNode); AssemblyTreeView.FocusNode(lastNode);
} }
bool IsAppBundle(string filename, out long bundleHeaderOffset)
{
try {
return HostWriter.IsBundle(filename, out bundleHeaderOffset);
} catch (Exception) {
bundleHeaderOffset = -1;
return false;
}
}
} }
void RefreshCommandExecuted(object sender, ExecutedRoutedEventArgs e) void RefreshCommandExecuted(object sender, ExecutedRoutedEventArgs e)

15
ILSpy/Properties/Resources.Designer.cs generated

@ -1614,21 +1614,6 @@ namespace ICSharpCode.ILSpy.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to You are trying to open a single-file executable (app bundle). In order to work with this type of program, ILSpy will
///
///(i) show you a dialog to select a folder to extract the bundle to
///(ii) extract the assemblies (might take a few seconds)
///(iii) show you a dialog to select one or more of those extracted assemblies to decompile
///
///Do you want to proceed?.
/// </summary>
public static string OpenSelfContainedExecutableMessage {
get {
return ResourceManager.GetString("OpenSelfContainedExecutableMessage", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Options. /// Looks up a localized string similar to Options.
/// </summary> /// </summary>

9
ILSpy/Properties/Resources.resx

@ -867,15 +867,6 @@ Do you want to continue?</value>
<data name="CultureLabel" xml:space="preserve"> <data name="CultureLabel" xml:space="preserve">
<value>Culture</value> <value>Culture</value>
</data> </data>
<data name="OpenSelfContainedExecutableMessage" xml:space="preserve">
<value>You are trying to open a single-file executable (app bundle). In order to work with this type of program, ILSpy will
(i) show you a dialog to select a folder to extract the bundle to
(ii) extract the assemblies (might take a few seconds)
(iii) show you a dialog to select one or more of those extracted assemblies to decompile
Do you want to proceed?</value>
</data>
<data name="NewTab" xml:space="preserve"> <data name="NewTab" xml:space="preserve">
<value>New Tab</value> <value>New Tab</value>
</data> </data>

Loading…
Cancel
Save