Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move classes to separate files & organize command functionality under…

… one folder.
  • Loading branch information...
commit 7ddf11ef7505323c5cddbe2785a15d88fcb6587d 1 parent 83b565a
@EdHarvey EdHarvey authored
View
178 ILSpy/Commands.cs
@@ -1,178 +0,0 @@
-// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this
-// software and associated documentation files (the "Software"), to deal in the Software
-// without restriction, including without limitation the rights to use, copy, modify, merge,
-// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
-// to whom the Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all copies or
-// substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
-// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-
-using System;
-using System.ComponentModel.Composition;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows.Input;
-using ICSharpCode.ILSpy.TextView;
-using ICSharpCode.ILSpy.TreeNodes;
-
-namespace ICSharpCode.ILSpy
-{
- [ExportMainMenuCommand(Menu = "_File", Header = "E_xit", MenuOrder = 99999, MenuCategory = "Exit")]
- sealed class ExitCommand : SimpleCommand
- {
- public override void Execute(object parameter)
- {
- MainWindow.Instance.Close();
- }
- }
-
- [ExportToolbarCommand(ToolTip = "Back", ToolbarIcon = "Images/Back.png", ToolbarCategory = "Navigation", ToolbarOrder = 0)]
- sealed class BrowseBackCommand : CommandWrapper {
- public BrowseBackCommand() : base(NavigationCommands.BrowseBack) {}
- }
-
- [ExportToolbarCommand(ToolTip = "Forward", ToolbarIcon = "Images/Forward.png", ToolbarCategory = "Navigation", ToolbarOrder = 1)]
- sealed class BrowseForwardCommand : CommandWrapper {
- public BrowseForwardCommand() : base(NavigationCommands.BrowseForward) {}
- }
-
- [ExportToolbarCommand(ToolTip = "Open", ToolbarIcon = "Images/Open.png", ToolbarCategory = "Open", ToolbarOrder = 0)]
- [ExportMainMenuCommand(Menu = "_File", MenuIcon = "Images/Open.png", MenuCategory = "Open", MenuOrder = 0)]
- sealed class OpenCommand : CommandWrapper {
- public OpenCommand() : base(ApplicationCommands.Open) {}
- }
-
- [ExportMainMenuCommand(Menu = "_File", Header = "Open from _GAC", MenuCategory = "Open", MenuOrder = 1)]
- sealed class OpenFromGacCommand : SimpleCommand
- {
- public override void Execute(object parameter)
- {
- OpenFromGacDialog dlg = new OpenFromGacDialog();
- dlg.Owner = MainWindow.Instance;
- if (dlg.ShowDialog() == true) {
- MainWindow.Instance.OpenFiles(dlg.SelectedFileNames);
- }
- }
- }
-
- [ExportToolbarCommand(ToolTip = "Reload all assemblies", ToolbarIcon = "Images/Refresh.png", ToolbarCategory = "Open", ToolbarOrder = 2)]
- [ExportMainMenuCommand(Menu = "_File", Header = "Reload", MenuIcon = "Images/Refresh.png", MenuCategory = "Open", MenuOrder = 2)]
- sealed class RefreshCommand : CommandWrapper {
- public RefreshCommand() : base(NavigationCommands.Refresh) {}
- }
-
- [ExportMainMenuCommand(Menu = "_File", Header = "_Save Code...", MenuIcon = "Images/SaveFile.png", MenuCategory = "Save", MenuOrder = 0)]
- sealed class SaveCommand : CommandWrapper
- {
- public SaveCommand() : base(ApplicationCommands.Save) {}
- }
-
- #if DEBUG
- [ExportMainMenuCommand(Menu = "_File", Header = "DEBUG -- Decompile All", MenuCategory = "Open", MenuOrder = 2.5)]
- sealed class DecompileAllCommand : SimpleCommand
- {
- public override bool CanExecute(object parameter)
- {
- return System.IO.Directory.Exists("c:\\temp\\decompiled");
- }
-
- public override void Execute(object parameter)
- {
- MainWindow.Instance.TextView.RunWithCancellation(
- ct => Task<AvalonEditTextOutput>.Factory.StartNew(
- () => {
- AvalonEditTextOutput output = new AvalonEditTextOutput();
- Parallel.ForEach(
- MainWindow.Instance.CurrentAssemblyList.GetAssemblies(),
- new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount, CancellationToken = ct },
- delegate (LoadedAssembly asm) {
- if (!asm.HasLoadError) {
- Stopwatch w = Stopwatch.StartNew();
- Exception exception = null;
- using (var writer = new System.IO.StreamWriter("c:\\temp\\decompiled\\" + asm.ShortName + ".cs")) {
- try {
- new CSharpLanguage().DecompileAssembly(
- asm, new Decompiler.PlainTextOutput(writer),
- new DecompilationOptions { FullDecompilation = true, CancellationToken = ct });
- } catch (Exception ex) {
- writer.WriteLine(ex.ToString());
- exception = ex;
- }
- }
- lock (output) {
- output.Write(asm.ShortName + " - " + w.Elapsed);
- if (exception != null) {
- output.Write(" - ");
- output.Write(exception.GetType().Name);
- }
- output.WriteLine();
- }
- }
- });
- return output;
- }
- ),
- task => MainWindow.Instance.TextView.ShowText(task.Result));
- }
- }
- #endif
-
- class CommandWrapper : ICommand
- {
- ICommand wrappedCommand;
-
- public CommandWrapper(ICommand wrappedCommand)
- {
- this.wrappedCommand = wrappedCommand;
- }
-
- public static ICommand Unwrap(ICommand command)
- {
- CommandWrapper w = command as CommandWrapper;
- if (w != null)
- return w.wrappedCommand;
- else
- return command;
- }
-
- public event EventHandler CanExecuteChanged {
- add { wrappedCommand.CanExecuteChanged += value; }
- remove { wrappedCommand.CanExecuteChanged -= value; }
- }
-
- public void Execute(object parameter)
- {
- wrappedCommand.Execute(parameter);
- }
-
- public bool CanExecute(object parameter)
- {
- return wrappedCommand.CanExecute(parameter);
- }
- }
-
- public abstract class SimpleCommand : ICommand
- {
- public event EventHandler CanExecuteChanged {
- add { CommandManager.RequerySuggested += value; }
- remove { CommandManager.RequerySuggested -= value; }
- }
-
- public abstract void Execute(object parameter);
-
- public virtual bool CanExecute(object parameter)
- {
- return true;
- }
- }
-}
View
32 ILSpy/Commands/BrowseBackCommand.cs
@@ -0,0 +1,32 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Windows.Input;
+
+namespace ICSharpCode.ILSpy
+{
+ [ExportToolbarCommand(ToolTip = "Back", ToolbarIcon = "Images/Back.png", ToolbarCategory = "Navigation", ToolbarOrder = 0)]
+ sealed class BrowseBackCommand : CommandWrapper
+ {
+ public BrowseBackCommand()
+ : base(NavigationCommands.BrowseBack)
+ {
+ }
+ }
+}
View
32 ILSpy/Commands/BrowseForwardCommand.cs
@@ -0,0 +1,32 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Windows.Input;
+
+namespace ICSharpCode.ILSpy
+{
+ [ExportToolbarCommand(ToolTip = "Forward", ToolbarIcon = "Images/Forward.png", ToolbarCategory = "Navigation", ToolbarOrder = 1)]
+ sealed class BrowseForwardCommand : CommandWrapper
+ {
+ public BrowseForwardCommand()
+ : base(NavigationCommands.BrowseForward)
+ {
+ }
+ }
+}
View
58 ILSpy/Commands/CommandWrapper.cs
@@ -0,0 +1,58 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Windows.Input;
+
+namespace ICSharpCode.ILSpy
+{
+ class CommandWrapper : ICommand
+ {
+ private ICommand wrappedCommand;
+
+ public CommandWrapper(ICommand wrappedCommand)
+ {
+ this.wrappedCommand = wrappedCommand;
+ }
+
+ public static ICommand Unwrap(ICommand command)
+ {
+ CommandWrapper w = command as CommandWrapper;
+ if (w != null)
+ return w.wrappedCommand;
+ else
+ return command;
+ }
+
+ public event EventHandler CanExecuteChanged
+ {
+ add { wrappedCommand.CanExecuteChanged += value; }
+ remove { wrappedCommand.CanExecuteChanged -= value; }
+ }
+
+ public void Execute(object parameter)
+ {
+ wrappedCommand.Execute(parameter);
+ }
+
+ public bool CanExecute(object parameter)
+ {
+ return wrappedCommand.CanExecute(parameter);
+ }
+ }
+}
View
69 ILSpy/Commands/DecompileAllCommand.cs
@@ -0,0 +1,69 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+#if DEBUG
+
+using System;
+using System.Diagnostics;
+using System.Threading.Tasks;
+using ICSharpCode.ILSpy.TextView;
+
+namespace ICSharpCode.ILSpy
+{
+ [ExportMainMenuCommand(Menu = "_File", Header = "DEBUG -- Decompile All", MenuCategory = "Open", MenuOrder = 2.5)]
+ sealed class DecompileAllCommand : SimpleCommand
+ {
+ public override bool CanExecute(object parameter)
+ {
+ return System.IO.Directory.Exists("c:\\temp\\decompiled");
+ }
+
+ public override void Execute(object parameter)
+ {
+ MainWindow.Instance.TextView.RunWithCancellation(ct => Task<AvalonEditTextOutput>.Factory.StartNew(() => {
+ AvalonEditTextOutput output = new AvalonEditTextOutput();
+ Parallel.ForEach(MainWindow.Instance.CurrentAssemblyList.GetAssemblies(), new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount, CancellationToken = ct }, delegate(LoadedAssembly asm) {
+ if (!asm.HasLoadError) {
+ Stopwatch w = Stopwatch.StartNew();
+ Exception exception = null;
+ using (var writer = new System.IO.StreamWriter("c:\\temp\\decompiled\\" + asm.ShortName + ".cs")) {
+ try {
+ new CSharpLanguage().DecompileAssembly(asm, new Decompiler.PlainTextOutput(writer), new DecompilationOptions { FullDecompilation = true, CancellationToken = ct });
+ }
+ catch (Exception ex) {
+ writer.WriteLine(ex.ToString());
+ exception = ex;
+ }
+ }
+ lock (output) {
+ output.Write(asm.ShortName + " - " + w.Elapsed);
+ if (exception != null) {
+ output.Write(" - ");
+ output.Write(exception.GetType().Name);
+ }
+ output.WriteLine();
+ }
+ }
+ });
+ return output;
+ }), task => MainWindow.Instance.TextView.ShowText(task.Result));
+ }
+ }
+}
+
+#endif
View
31 ILSpy/Commands/ExitCommand.cs
@@ -0,0 +1,31 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace ICSharpCode.ILSpy
+{
+ [ExportMainMenuCommand(Menu = "_File", Header = "E_xit", MenuOrder = 99999, MenuCategory = "Exit")]
+ sealed class ExitCommand : SimpleCommand
+ {
+ public override void Execute(object parameter)
+ {
+ MainWindow.Instance.Close();
+ }
+ }
+}
View
0  ILSpy/ExportCommandAttribute.cs → ILSpy/Commands/ExportCommandAttribute.cs
File renamed without changes
View
33 ILSpy/Commands/OpenCommand.cs
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Windows.Input;
+
+namespace ICSharpCode.ILSpy
+{
+ [ExportToolbarCommand(ToolTip = "Open", ToolbarIcon = "Images/Open.png", ToolbarCategory = "Open", ToolbarOrder = 0)]
+ [ExportMainMenuCommand(Menu = "_File", MenuIcon = "Images/Open.png", MenuCategory = "Open", MenuOrder = 0)]
+ sealed class OpenCommand : CommandWrapper
+ {
+ public OpenCommand()
+ : base(ApplicationCommands.Open)
+ {
+ }
+ }
+}
View
34 ILSpy/Commands/OpenFromGacCommand.cs
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+
+namespace ICSharpCode.ILSpy
+{
+ [ExportMainMenuCommand(Menu = "_File", Header = "Open from _GAC", MenuCategory = "Open", MenuOrder = 1)]
+ sealed class OpenFromGacCommand : SimpleCommand
+ {
+ public override void Execute(object parameter)
+ {
+ OpenFromGacDialog dlg = new OpenFromGacDialog();
+ dlg.Owner = MainWindow.Instance;
+ if (dlg.ShowDialog() == true)
+ MainWindow.Instance.OpenFiles(dlg.SelectedFileNames);
+ }
+ }
+}
View
33 ILSpy/Commands/RefreshCommand.cs
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Windows.Input;
+
+namespace ICSharpCode.ILSpy
+{
+ [ExportToolbarCommand(ToolTip = "Reload all assemblies", ToolbarIcon = "Images/Refresh.png", ToolbarCategory = "Open", ToolbarOrder = 2)]
+ [ExportMainMenuCommand(Menu = "_File", Header = "Reload", MenuIcon = "Images/Refresh.png", MenuCategory = "Open", MenuOrder = 2)]
+ sealed class RefreshCommand : CommandWrapper
+ {
+ public RefreshCommand()
+ : base(NavigationCommands.Refresh)
+ {
+ }
+ }
+}
View
32 ILSpy/Commands/SaveCommand.cs
@@ -0,0 +1,32 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Windows.Input;
+
+namespace ICSharpCode.ILSpy
+{
+ [ExportMainMenuCommand(Menu = "_File", Header = "_Save Code...", MenuIcon = "Images/SaveFile.png", MenuCategory = "Save", MenuOrder = 0)]
+ sealed class SaveCommand : CommandWrapper
+ {
+ public SaveCommand()
+ : base(ApplicationCommands.Save)
+ {
+ }
+ }
+}
View
39 ILSpy/Commands/SimpleCommand.cs
@@ -0,0 +1,39 @@
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Windows.Input;
+
+namespace ICSharpCode.ILSpy
+{
+ public abstract class SimpleCommand : ICommand
+ {
+ public event EventHandler CanExecuteChanged
+ {
+ add { CommandManager.RequerySuggested += value; }
+ remove { CommandManager.RequerySuggested -= value; }
+ }
+
+ public abstract void Execute(object parameter);
+
+ public virtual bool CanExecute(object parameter)
+ {
+ return true;
+ }
+ }
+}
View
14 ILSpy/ILSpy.csproj
@@ -93,16 +93,20 @@
</Compile>
<Compile Include="AssemblyList.cs" />
<Compile Include="AssemblyListManager.cs" />
+ <Compile Include="Commands\BrowseBackCommand.cs" />
+ <Compile Include="Commands\BrowseForwardCommand.cs" />
<Compile Include="CommandLineArguments.cs" />
- <Compile Include="Commands.cs" />
+ <Compile Include="Commands\ExitCommand.cs" />
+ <Compile Include="Commands\CommandWrapper.cs" />
<Compile Include="ConnectMethodDecompiler.cs" />
<Compile Include="Controls\DockedPane.cs" />
+ <Compile Include="Commands\DecompileAllCommand.cs" />
<Compile Include="DecompilerSettingsPanel.xaml.cs">
<DependentUpon>DecompilerSettingsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="DisplaySettings.cs" />
- <Compile Include="ExportCommandAttribute.cs" />
+ <Compile Include="Commands\ExportCommandAttribute.cs" />
<Compile Include="Controls\SearchBox.cs" />
<Compile Include="Controls\SortableGridViewColumn.cs" />
<Compile Include="CSharpLanguage.cs" />
@@ -126,6 +130,8 @@
<Compile Include="NativeMethods.cs" />
<Compile Include="NavigationHistory.cs" />
<Compile Include="NavigationState.cs" />
+ <Compile Include="Commands\OpenCommand.cs" />
+ <Compile Include="Commands\OpenFromGacCommand.cs" />
<Compile Include="OpenFromGacDialog.xaml.cs">
<DependentUpon>OpenFromGacDialog.xaml</DependentUpon>
<SubType>Code</SubType>
@@ -135,6 +141,8 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Commands\RefreshCommand.cs" />
+ <Compile Include="Commands\SaveCommand.cs" />
<Compile Include="SearchPane.cs">
<SubType>Code</SubType>
</Compile>
@@ -142,6 +150,7 @@
<DependentUpon>DisplaySettingsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Commands\SimpleCommand.cs" />
<Compile Include="TreeNodes\Analyzer\AnalyzeContextMenuEntry.cs" />
<Compile Include="TreeNodes\Analyzer\AnalyzedEventOverridesTreeNode.cs" />
<Compile Include="TreeNodes\Analyzer\AnalyzedEventTreeNode.cs" />
@@ -325,5 +334,6 @@
<Resource Include="Images\ResourceXsd.png" />
<Resource Include="Images\ResourceXslt.png" />
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
Please sign in to comment.
Something went wrong with that request. Please try again.