|
|
|
@ -15,6 +15,8 @@
@@ -15,6 +15,8 @@
|
|
|
|
|
// 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.
|
|
|
|
|
#nullable enable |
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
|
|
|
|
|
using ICSharpCode.Decompiler.TypeSystem; |
|
|
|
@ -28,7 +30,8 @@ namespace ICSharpCode.ILSpy
@@ -28,7 +30,8 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
{ |
|
|
|
|
public void Execute(TextViewContext context) |
|
|
|
|
{ |
|
|
|
|
string asmName = GetAssembly(context); |
|
|
|
|
// asmName cannot be null here, because Execute is only called if IsEnabled/IsVisible return true.
|
|
|
|
|
string asmName = GetAssembly(context)!; |
|
|
|
|
string searchTerm = MainWindow.Instance.SearchPane.SearchTerm; |
|
|
|
|
string[] args = NativeMethods.CommandLineToArgumentArray(searchTerm); |
|
|
|
|
bool replaced = false; |
|
|
|
@ -62,10 +65,10 @@ namespace ICSharpCode.ILSpy
@@ -62,10 +65,10 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
return GetAssembly(context) != null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string GetAssembly(TextViewContext context) |
|
|
|
|
string? GetAssembly(TextViewContext context) |
|
|
|
|
{ |
|
|
|
|
if (context.Reference?.Reference is IEntity entity) |
|
|
|
|
return entity.ParentModule.AssemblyName; |
|
|
|
|
return entity.ParentModule?.AssemblyName; |
|
|
|
|
if (context.SelectedTreeNodes?.Length != 1) |
|
|
|
|
return null; |
|
|
|
|
switch (context.SelectedTreeNodes[0]) |
|
|
|
@ -73,7 +76,7 @@ namespace ICSharpCode.ILSpy
@@ -73,7 +76,7 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
case AssemblyTreeNode tn: |
|
|
|
|
return tn.LoadedAssembly.ShortName; |
|
|
|
|
case IMemberTreeNode member: |
|
|
|
|
return member.Member.ParentModule.AssemblyName; |
|
|
|
|
return member.Member?.ParentModule?.AssemblyName; |
|
|
|
|
default: |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|