Skip to content
This repository
Browse code

Move classes to separate files & organize command functionality under…

… one folder.
  • Loading branch information...
commit 7ddf11ef7505323c5cddbe2785a15d88fcb6587d 1 parent 83b565a
Ed Harvey authored May 29, 2011
178  ILSpy/Commands.cs
... ...
@@ -1,178 +0,0 @@
1  
-// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
2  
-// 
3  
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4  
-// software and associated documentation files (the "Software"), to deal in the Software
5  
-// without restriction, including without limitation the rights to use, copy, modify, merge,
6  
-// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7  
-// to whom the Software is furnished to do so, subject to the following conditions:
8  
-// 
9  
-// The above copyright notice and this permission notice shall be included in all copies or
10  
-// substantial portions of the Software.
11  
-// 
12  
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13  
-// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14  
-// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15  
-// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16  
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17  
-// DEALINGS IN THE SOFTWARE.
18  
-
19  
-using System;
20  
-using System.ComponentModel.Composition;
21  
-using System.Diagnostics;
22  
-using System.Linq;
23  
-using System.Threading.Tasks;
24  
-using System.Windows.Input;
25  
-using ICSharpCode.ILSpy.TextView;
26  
-using ICSharpCode.ILSpy.TreeNodes;
27  
-
28  
-namespace ICSharpCode.ILSpy
29  
-{
30  
-	[ExportMainMenuCommand(Menu = "_File", Header = "E_xit", MenuOrder = 99999, MenuCategory = "Exit")]
31  
-	sealed class ExitCommand : SimpleCommand
32  
-	{
33  
-		public override void Execute(object parameter)
34  
-		{
35  
-			MainWindow.Instance.Close();
36  
-		}
37  
-	}
38  
-	
39  
-	[ExportToolbarCommand(ToolTip = "Back", ToolbarIcon = "Images/Back.png", ToolbarCategory = "Navigation", ToolbarOrder = 0)]
40  
-	sealed class BrowseBackCommand : CommandWrapper {
41  
-		public BrowseBackCommand() : base(NavigationCommands.BrowseBack) {}
42  
-	}
43  
-	
44  
-	[ExportToolbarCommand(ToolTip = "Forward", ToolbarIcon = "Images/Forward.png", ToolbarCategory = "Navigation", ToolbarOrder = 1)]
45  
-	sealed class BrowseForwardCommand : CommandWrapper {
46  
-		public BrowseForwardCommand() : base(NavigationCommands.BrowseForward) {}
47  
-	}
48  
-	
49  
-	[ExportToolbarCommand(ToolTip = "Open", ToolbarIcon = "Images/Open.png", ToolbarCategory = "Open", ToolbarOrder = 0)]
50  
-	[ExportMainMenuCommand(Menu = "_File", MenuIcon = "Images/Open.png", MenuCategory = "Open", MenuOrder = 0)]
51  
-	sealed class OpenCommand : CommandWrapper {
52  
-		public OpenCommand() : base(ApplicationCommands.Open) {}
53  
-	}
54  
-	
55  
-	[ExportMainMenuCommand(Menu = "_File", Header = "Open from _GAC", MenuCategory = "Open", MenuOrder = 1)]
56  
-	sealed class OpenFromGacCommand : SimpleCommand
57  
-	{
58  
-		public override void Execute(object parameter)
59  
-		{
60  
-			OpenFromGacDialog dlg = new OpenFromGacDialog();
61  
-			dlg.Owner = MainWindow.Instance;
62  
-			if (dlg.ShowDialog() == true) {
63  
-				MainWindow.Instance.OpenFiles(dlg.SelectedFileNames);
64  
-			}
65  
-		}
66  
-	}
67  
-	
68  
-	[ExportToolbarCommand(ToolTip = "Reload all assemblies", ToolbarIcon = "Images/Refresh.png", ToolbarCategory = "Open", ToolbarOrder = 2)]
69  
-	[ExportMainMenuCommand(Menu = "_File", Header = "Reload", MenuIcon = "Images/Refresh.png", MenuCategory = "Open", MenuOrder = 2)]
70  
-	sealed class RefreshCommand : CommandWrapper {
71  
-		public RefreshCommand() : base(NavigationCommands.Refresh) {}
72  
-	}
73  
-	
74  
-	[ExportMainMenuCommand(Menu = "_File", Header = "_Save Code...", MenuIcon = "Images/SaveFile.png", MenuCategory = "Save", MenuOrder = 0)]
75  
-	sealed class SaveCommand : CommandWrapper
76  
-	{
77  
-		public SaveCommand() : base(ApplicationCommands.Save) {}
78  
-	}
79  
-	
80  
-	#if DEBUG
81  
-	[ExportMainMenuCommand(Menu = "_File", Header = "DEBUG -- Decompile All", MenuCategory = "Open", MenuOrder = 2.5)]
82  
-	sealed class DecompileAllCommand : SimpleCommand
83  
-	{
84  
-		public override bool CanExecute(object parameter)
85  
-		{
86  
-			return System.IO.Directory.Exists("c:\\temp\\decompiled");
87  
-		}
88  
-		
89  
-		public override void Execute(object parameter)
90  
-		{
91  
-			MainWindow.Instance.TextView.RunWithCancellation(
92  
-				ct => Task<AvalonEditTextOutput>.Factory.StartNew(
93  
-					() => {
94  
-						AvalonEditTextOutput output = new AvalonEditTextOutput();
95  
-						Parallel.ForEach(
96  
-							MainWindow.Instance.CurrentAssemblyList.GetAssemblies(),
97  
-							new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount, CancellationToken = ct },
98  
-							delegate (LoadedAssembly asm) {
99  
-								if (!asm.HasLoadError) {
100  
-									Stopwatch w = Stopwatch.StartNew();
101  
-									Exception exception = null;
102  
-									using (var writer = new System.IO.StreamWriter("c:\\temp\\decompiled\\" + asm.ShortName + ".cs")) {
103  
-										try {
104  
-											new CSharpLanguage().DecompileAssembly(
105  
-												asm, new Decompiler.PlainTextOutput(writer),
106  
-												new DecompilationOptions { FullDecompilation = true, CancellationToken = ct });
107  
-										} catch (Exception ex) {
108  
-											writer.WriteLine(ex.ToString());
109  
-											exception = ex;
110  
-										}
111  
-									}
112  
-									lock (output) {
113  
-										output.Write(asm.ShortName + " - " + w.Elapsed);
114  
-										if (exception != null) {
115  
-											output.Write(" - ");
116  
-											output.Write(exception.GetType().Name);
117  
-										}
118  
-										output.WriteLine();
119  
-									}
120  
-								}
121  
-							});
122  
-						return output;
123  
-					}
124  
-				),
125  
-				task => MainWindow.Instance.TextView.ShowText(task.Result));
126  
-		}
127  
-	}
128  
-	#endif
129  
-	
130  
-	class CommandWrapper : ICommand
131  
-	{
132  
-		ICommand wrappedCommand;
133  
-		
134  
-		public CommandWrapper(ICommand wrappedCommand)
135  
-		{
136  
-			this.wrappedCommand = wrappedCommand;
137  
-		}
138  
-		
139  
-		public static ICommand Unwrap(ICommand command)
140  
-		{
141  
-			CommandWrapper w = command as CommandWrapper;
142  
-			if (w != null)
143  
-				return w.wrappedCommand;
144  
-			else
145  
-				return command;
146  
-		}
147  
-		
148  
-		public event EventHandler CanExecuteChanged {
149  
-			add { wrappedCommand.CanExecuteChanged += value; }
150  
-			remove { wrappedCommand.CanExecuteChanged -= value; }
151  
-		}
152  
-		
153  
-		public void Execute(object parameter)
154  
-		{
155  
-			wrappedCommand.Execute(parameter);
156  
-		}
157  
-		
158  
-		public bool CanExecute(object parameter)
159  
-		{
160  
-			return wrappedCommand.CanExecute(parameter);
161  
-		}
162  
-	}
163  
-	
164  
-	public abstract class SimpleCommand : ICommand
165  
-	{
166  
-		public event EventHandler CanExecuteChanged {
167  
-			add { CommandManager.RequerySuggested += value; }
168  
-			remove { CommandManager.RequerySuggested -= value; }
169  
-		}
170  
-		
171  
-		public abstract void Execute(object parameter);
172  
-		
173  
-		public virtual bool CanExecute(object parameter)
174  
-		{
175  
-			return true;
176  
-		}
177  
-	}
178  
-}
32  ILSpy/Commands/BrowseBackCommand.cs
... ...
@@ -0,0 +1,32 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+using System.Windows.Input;
  21
+
  22
+namespace ICSharpCode.ILSpy
  23
+{
  24
+	[ExportToolbarCommand(ToolTip = "Back", ToolbarIcon = "Images/Back.png", ToolbarCategory = "Navigation", ToolbarOrder = 0)]
  25
+	sealed class BrowseBackCommand : CommandWrapper
  26
+	{
  27
+		public BrowseBackCommand()
  28
+			: base(NavigationCommands.BrowseBack)
  29
+		{
  30
+		}
  31
+	}
  32
+}
32  ILSpy/Commands/BrowseForwardCommand.cs
... ...
@@ -0,0 +1,32 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+using System.Windows.Input;
  21
+
  22
+namespace ICSharpCode.ILSpy
  23
+{
  24
+	[ExportToolbarCommand(ToolTip = "Forward", ToolbarIcon = "Images/Forward.png", ToolbarCategory = "Navigation", ToolbarOrder = 1)]
  25
+	sealed class BrowseForwardCommand : CommandWrapper
  26
+	{
  27
+		public BrowseForwardCommand()
  28
+			: base(NavigationCommands.BrowseForward)
  29
+		{
  30
+		}
  31
+	}
  32
+}
58  ILSpy/Commands/CommandWrapper.cs
... ...
@@ -0,0 +1,58 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+using System.Windows.Input;
  21
+
  22
+namespace ICSharpCode.ILSpy
  23
+{
  24
+	class CommandWrapper : ICommand
  25
+	{
  26
+		private ICommand wrappedCommand;
  27
+
  28
+		public CommandWrapper(ICommand wrappedCommand)
  29
+		{
  30
+			this.wrappedCommand = wrappedCommand;
  31
+		}
  32
+
  33
+		public static ICommand Unwrap(ICommand command)
  34
+		{
  35
+			CommandWrapper w = command as CommandWrapper;
  36
+			if (w != null)
  37
+				return w.wrappedCommand;
  38
+			else
  39
+				return command;
  40
+		}
  41
+
  42
+		public event EventHandler CanExecuteChanged
  43
+		{
  44
+			add { wrappedCommand.CanExecuteChanged += value; }
  45
+			remove { wrappedCommand.CanExecuteChanged -= value; }
  46
+		}
  47
+
  48
+		public void Execute(object parameter)
  49
+		{
  50
+			wrappedCommand.Execute(parameter);
  51
+		}
  52
+
  53
+		public bool CanExecute(object parameter)
  54
+		{
  55
+			return wrappedCommand.CanExecute(parameter);
  56
+		}
  57
+	}
  58
+}
69  ILSpy/Commands/DecompileAllCommand.cs
... ...
@@ -0,0 +1,69 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+#if DEBUG
  20
+
  21
+using System;
  22
+using System.Diagnostics;
  23
+using System.Threading.Tasks;
  24
+using ICSharpCode.ILSpy.TextView;
  25
+
  26
+namespace ICSharpCode.ILSpy
  27
+{
  28
+	[ExportMainMenuCommand(Menu = "_File", Header = "DEBUG -- Decompile All", MenuCategory = "Open", MenuOrder = 2.5)]
  29
+	sealed class DecompileAllCommand : SimpleCommand
  30
+	{
  31
+		public override bool CanExecute(object parameter)
  32
+		{
  33
+			return System.IO.Directory.Exists("c:\\temp\\decompiled");
  34
+		}
  35
+
  36
+		public override void Execute(object parameter)
  37
+		{
  38
+			MainWindow.Instance.TextView.RunWithCancellation(ct => Task<AvalonEditTextOutput>.Factory.StartNew(() => {
  39
+				AvalonEditTextOutput output = new AvalonEditTextOutput();
  40
+				Parallel.ForEach(MainWindow.Instance.CurrentAssemblyList.GetAssemblies(), new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount, CancellationToken = ct }, delegate(LoadedAssembly asm) {
  41
+					if (!asm.HasLoadError) {
  42
+						Stopwatch w = Stopwatch.StartNew();
  43
+						Exception exception = null;
  44
+						using (var writer = new System.IO.StreamWriter("c:\\temp\\decompiled\\" + asm.ShortName + ".cs")) {
  45
+							try {
  46
+								new CSharpLanguage().DecompileAssembly(asm, new Decompiler.PlainTextOutput(writer), new DecompilationOptions { FullDecompilation = true, CancellationToken = ct });
  47
+							}
  48
+							catch (Exception ex) {
  49
+								writer.WriteLine(ex.ToString());
  50
+								exception = ex;
  51
+							}
  52
+						}
  53
+						lock (output) {
  54
+							output.Write(asm.ShortName + " - " + w.Elapsed);
  55
+							if (exception != null) {
  56
+								output.Write(" - ");
  57
+								output.Write(exception.GetType().Name);
  58
+							}
  59
+							output.WriteLine();
  60
+						}
  61
+					}
  62
+				});
  63
+				return output;
  64
+			}), task => MainWindow.Instance.TextView.ShowText(task.Result));
  65
+		}
  66
+	}
  67
+}
  68
+
  69
+#endif
31  ILSpy/Commands/ExitCommand.cs
... ...
@@ -0,0 +1,31 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+
  21
+namespace ICSharpCode.ILSpy
  22
+{
  23
+	[ExportMainMenuCommand(Menu = "_File", Header = "E_xit", MenuOrder = 99999, MenuCategory = "Exit")]
  24
+	sealed class ExitCommand : SimpleCommand
  25
+	{
  26
+		public override void Execute(object parameter)
  27
+		{
  28
+			MainWindow.Instance.Close();
  29
+		}
  30
+	}
  31
+}
0  ILSpy/ExportCommandAttribute.cs → ILSpy/Commands/ExportCommandAttribute.cs
File renamed without changes
33  ILSpy/Commands/OpenCommand.cs
... ...
@@ -0,0 +1,33 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+using System.Windows.Input;
  21
+
  22
+namespace ICSharpCode.ILSpy
  23
+{
  24
+	[ExportToolbarCommand(ToolTip = "Open", ToolbarIcon = "Images/Open.png", ToolbarCategory = "Open", ToolbarOrder = 0)]
  25
+	[ExportMainMenuCommand(Menu = "_File", MenuIcon = "Images/Open.png", MenuCategory = "Open", MenuOrder = 0)]
  26
+	sealed class OpenCommand : CommandWrapper
  27
+	{
  28
+		public OpenCommand()
  29
+			: base(ApplicationCommands.Open)
  30
+		{
  31
+		}
  32
+	}
  33
+}
34  ILSpy/Commands/OpenFromGacCommand.cs
... ...
@@ -0,0 +1,34 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+
  21
+namespace ICSharpCode.ILSpy
  22
+{
  23
+	[ExportMainMenuCommand(Menu = "_File", Header = "Open from _GAC", MenuCategory = "Open", MenuOrder = 1)]
  24
+	sealed class OpenFromGacCommand : SimpleCommand
  25
+	{
  26
+		public override void Execute(object parameter)
  27
+		{
  28
+			OpenFromGacDialog dlg = new OpenFromGacDialog();
  29
+			dlg.Owner = MainWindow.Instance;
  30
+			if (dlg.ShowDialog() == true)
  31
+				MainWindow.Instance.OpenFiles(dlg.SelectedFileNames);
  32
+		}
  33
+	}
  34
+}
33  ILSpy/Commands/RefreshCommand.cs
... ...
@@ -0,0 +1,33 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+using System.Windows.Input;
  21
+
  22
+namespace ICSharpCode.ILSpy
  23
+{
  24
+	[ExportToolbarCommand(ToolTip = "Reload all assemblies", ToolbarIcon = "Images/Refresh.png", ToolbarCategory = "Open", ToolbarOrder = 2)]
  25
+	[ExportMainMenuCommand(Menu = "_File", Header = "Reload", MenuIcon = "Images/Refresh.png", MenuCategory = "Open", MenuOrder = 2)]
  26
+	sealed class RefreshCommand : CommandWrapper
  27
+	{
  28
+		public RefreshCommand()
  29
+			: base(NavigationCommands.Refresh)
  30
+		{
  31
+		}
  32
+	}
  33
+}
32  ILSpy/Commands/SaveCommand.cs
... ...
@@ -0,0 +1,32 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+using System.Windows.Input;
  21
+
  22
+namespace ICSharpCode.ILSpy
  23
+{
  24
+	[ExportMainMenuCommand(Menu = "_File", Header = "_Save Code...", MenuIcon = "Images/SaveFile.png", MenuCategory = "Save", MenuOrder = 0)]
  25
+	sealed class SaveCommand : CommandWrapper
  26
+	{
  27
+		public SaveCommand()
  28
+			: base(ApplicationCommands.Save)
  29
+		{
  30
+		}
  31
+	}
  32
+}
39  ILSpy/Commands/SimpleCommand.cs
... ...
@@ -0,0 +1,39 @@
  1
+// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2
+// 
  3
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4
+// software and associated documentation files (the "Software"), to deal in the Software
  5
+// without restriction, including without limitation the rights to use, copy, modify, merge,
  6
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7
+// to whom the Software is furnished to do so, subject to the following conditions:
  8
+// 
  9
+// The above copyright notice and this permission notice shall be included in all copies or
  10
+// substantial portions of the Software.
  11
+// 
  12
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17
+// DEALINGS IN THE SOFTWARE.
  18
+
  19
+using System;
  20
+using System.Windows.Input;
  21
+
  22
+namespace ICSharpCode.ILSpy
  23
+{
  24
+	public abstract class SimpleCommand : ICommand
  25
+	{
  26
+		public event EventHandler CanExecuteChanged
  27
+		{
  28
+			add { CommandManager.RequerySuggested += value; }
  29
+			remove { CommandManager.RequerySuggested -= value; }
  30
+		}
  31
+
  32
+		public abstract void Execute(object parameter);
  33
+
  34
+		public virtual bool CanExecute(object parameter)
  35
+		{
  36
+			return true;
  37
+		}
  38
+	}
  39
+}
14  ILSpy/ILSpy.csproj
@@ -93,16 +93,20 @@
93 93
     </Compile>
94 94
     <Compile Include="AssemblyList.cs" />
95 95
     <Compile Include="AssemblyListManager.cs" />
  96
+    <Compile Include="Commands\BrowseBackCommand.cs" />
  97
+    <Compile Include="Commands\BrowseForwardCommand.cs" />
96 98
     <Compile Include="CommandLineArguments.cs" />
97  
-    <Compile Include="Commands.cs" />
  99
+    <Compile Include="Commands\ExitCommand.cs" />
  100
+    <Compile Include="Commands\CommandWrapper.cs" />
98 101
     <Compile Include="ConnectMethodDecompiler.cs" />
99 102
     <Compile Include="Controls\DockedPane.cs" />
  103
+    <Compile Include="Commands\DecompileAllCommand.cs" />
100 104
     <Compile Include="DecompilerSettingsPanel.xaml.cs">
101 105
       <DependentUpon>DecompilerSettingsPanel.xaml</DependentUpon>
102 106
       <SubType>Code</SubType>
103 107
     </Compile>
104 108
     <Compile Include="DisplaySettings.cs" />
105  
-    <Compile Include="ExportCommandAttribute.cs" />
  109
+    <Compile Include="Commands\ExportCommandAttribute.cs" />
106 110
     <Compile Include="Controls\SearchBox.cs" />
107 111
     <Compile Include="Controls\SortableGridViewColumn.cs" />
108 112
     <Compile Include="CSharpLanguage.cs" />
@@ -126,6 +130,8 @@
126 130
     <Compile Include="NativeMethods.cs" />
127 131
     <Compile Include="NavigationHistory.cs" />
128 132
     <Compile Include="NavigationState.cs" />
  133
+    <Compile Include="Commands\OpenCommand.cs" />
  134
+    <Compile Include="Commands\OpenFromGacCommand.cs" />
129 135
     <Compile Include="OpenFromGacDialog.xaml.cs">
130 136
       <DependentUpon>OpenFromGacDialog.xaml</DependentUpon>
131 137
       <SubType>Code</SubType>
@@ -135,6 +141,8 @@
135 141
       <SubType>Code</SubType>
136 142
     </Compile>
137 143
     <Compile Include="Properties\AssemblyInfo.cs" />
  144
+    <Compile Include="Commands\RefreshCommand.cs" />
  145
+    <Compile Include="Commands\SaveCommand.cs" />
138 146
     <Compile Include="SearchPane.cs">
139 147
       <SubType>Code</SubType>
140 148
     </Compile>
@@ -142,6 +150,7 @@
142 150
       <DependentUpon>DisplaySettingsPanel.xaml</DependentUpon>
143 151
       <SubType>Code</SubType>
144 152
     </Compile>
  153
+    <Compile Include="Commands\SimpleCommand.cs" />
145 154
     <Compile Include="TreeNodes\Analyzer\AnalyzeContextMenuEntry.cs" />
146 155
     <Compile Include="TreeNodes\Analyzer\AnalyzedEventOverridesTreeNode.cs" />
147 156
     <Compile Include="TreeNodes\Analyzer\AnalyzedEventTreeNode.cs" />
@@ -325,5 +334,6 @@
325 334
     <Resource Include="Images\ResourceXsd.png" />
326 335
     <Resource Include="Images\ResourceXslt.png" />
327 336
   </ItemGroup>
  337
+  <ItemGroup />
328 338
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
329 339
 </Project>

0 notes on commit 7ddf11e

Please sign in to comment.
Something went wrong with that request. Please try again.