From 4e7d8067449f666ff7a1f2f792f4a8fbedb7734f Mon Sep 17 00:00:00 2001
From: Ronny Klier <ronnyklier@googlemail.com>
Date: Wed, 3 Dec 2014 11:24:40 +0100
Subject: [PATCH] Search as command line argument

---
 ILSpy/CommandLineArguments.cs | 3 +++
 ILSpy/MainWindow.xaml.cs      | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/ILSpy/CommandLineArguments.cs b/ILSpy/CommandLineArguments.cs
index a82b9eac1..4ee5c1af2 100644
--- a/ILSpy/CommandLineArguments.cs
+++ b/ILSpy/CommandLineArguments.cs
@@ -27,6 +27,7 @@ namespace ICSharpCode.ILSpy
 		public List<string> AssembliesToLoad = new List<string>();
 		public bool? SingleInstance;
 		public string NavigateTo;
+		public string Search;
 		public string Language;
 		public bool NoActivate;
 		
@@ -42,6 +43,8 @@ namespace ICSharpCode.ILSpy
 						this.SingleInstance = false;
 					else if (arg.StartsWith("/navigateTo:", StringComparison.OrdinalIgnoreCase))
 						this.NavigateTo = arg.Substring("/navigateTo:".Length);
+					else if (arg.StartsWith("/search:", StringComparison.OrdinalIgnoreCase))
+						this.Search = arg.Substring("/search:".Length);
 					else if (arg.StartsWith("/language:", StringComparison.OrdinalIgnoreCase))
 						this.Language = arg.Substring("/language:".Length);
 					else if (arg.Equals("/noActivate", StringComparison.OrdinalIgnoreCase))
diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs
index 78400b727..7dc1595e9 100644
--- a/ILSpy/MainWindow.xaml.cs
+++ b/ILSpy/MainWindow.xaml.cs
@@ -295,6 +295,11 @@ namespace ICSharpCode.ILSpy
 				// Select the newly loaded assembly
 				JumpToReference(commandLineLoadedAssemblies[0].ModuleDefinition);
 			}
+			if (args.Search != null)
+			{
+				SearchPane.Instance.SearchTerm = args.Search;
+				SearchPane.Instance.Show();
+			}
 			commandLineLoadedAssemblies.Clear(); // clear references once we don't need them anymore
 		}