示例#1
0
 void HandleCommandLineArgumentsAfterShowList(CommandLineArguments args)
 {
     if (args.NavigateTo != null)
     {
         bool found = false;
         if (args.NavigateTo.StartsWith("N:", StringComparison.Ordinal))
         {
             string namespaceName = args.NavigateTo.Substring(2);
             foreach (LoadedAssembly asm in commandLineLoadedAssemblies)
             {
                 AssemblyTreeNode asmNode = assemblyListTreeNode.FindAssemblyNode(asm);
                 if (asmNode != null)
                 {
                     NamespaceTreeNode nsNode = asmNode.FindNamespaceNode(namespaceName);
                     if (nsNode != null)
                     {
                         found = true;
                         SelectNode(nsNode);
                         break;
                     }
                 }
             }
         }
         else
         {
             foreach (LoadedAssembly asm in commandLineLoadedAssemblies)
             {
                 ModuleDefinition def = asm.GetModuleDefinitionOrNull();
                 if (def != null)
                 {
                     MemberReference mr = XmlDocKeyProvider.FindMemberByKey(def, args.NavigateTo);
                     if (mr != null)
                     {
                         found = true;
                         JumpToReference(mr);
                         break;
                     }
                 }
             }
         }
         if (!found)
         {
             AvalonEditTextOutput output = new AvalonEditTextOutput();
             output.Write(string.Format("Cannot find '{0}' in command line specified assemblies.", args.NavigateTo));
             decompilerTextView.ShowText(output);
         }
     }
     else if (commandLineLoadedAssemblies.Count == 1)
     {
         // NavigateTo == null and an assembly was given on the command-line:
         // Select the newly loaded assembly
         JumpToReference(commandLineLoadedAssemblies[0].GetModuleDefinitionOrNull());
     }
     if (args.Search != null)
     {
         SearchPane.Instance.SearchTerm = args.Search;
         SearchPane.Instance.Show();
     }
     commandLineLoadedAssemblies.Clear();             // clear references once we don't need them anymore
 }
示例#2
0
 void HandleCommandLineArgumentsAfterShowList(CommandLineArguments args)
 {
     if (args.NavigateTo != null)
     {
         bool found = false;
         foreach (LoadedAssembly asm in commandLineLoadedAssemblies)
         {
             AssemblyDefinition def = asm.AssemblyDefinition;
             if (def != null)
             {
                 MemberReference mr = XmlDocKeyProvider.FindMemberByKey(def.MainModule, args.NavigateTo);
                 if (mr != null)
                 {
                     found = true;
                     JumpToReference(mr);
                     break;
                 }
             }
         }
         if (!found)
         {
             AvalonEditTextOutput output = new AvalonEditTextOutput();
             output.Write("Cannot find " + args.NavigateTo);
             decompilerTextView.Show(output);
         }
     }
     commandLineLoadedAssemblies.Clear();             // clear references once we don't need them anymore
 }
示例#3
0
		static IEnumerable<string> GetXmlDocComments(IMemberRef mr)
		{
			if (mr == null || mr.Module == null)
				yield break;
			var xmldoc = XmlDocLoader.LoadDocumentation(mr.Module);
			if (xmldoc == null)
				yield break;
			string doc = xmldoc.GetDocumentation(XmlDocKeyProvider.GetKey(mr));
			if (doc == null)
				yield break;

			foreach (var line in AddXmlDocTransform.GetXmlDocLines(new StringReader(doc)))
				yield return line;
		}
示例#4
0
 void HandleCommandLineArgumentsAfterShowList(CommandLineArguments args)
 {
     if (args.NavigateTo != null)
     {
         bool found = false;
         if (args.NavigateTo.StartsWith("N:", StringComparison.Ordinal))
         {
             string namespaceName = args.NavigateTo.Substring(2);
             foreach (LoadedAssembly asm in commandLineLoadedAssemblies)
             {
                 AssemblyTreeNode asmNode = assemblyListTreeNode.FindAssemblyNode(asm);
                 if (asmNode != null)
                 {
                     NamespaceTreeNode nsNode = asmNode.FindNamespaceNode(namespaceName);
                     if (nsNode != null)
                     {
                         found = true;
                         SelectNode(nsNode);
                         break;
                     }
                 }
             }
         }
         else
         {
             foreach (LoadedAssembly asm in commandLineLoadedAssemblies)
             {
                 AssemblyDefinition def = asm.AssemblyDefinition;
                 if (def != null)
                 {
                     MemberReference mr = XmlDocKeyProvider.FindMemberByKey(def.MainModule, args.NavigateTo);
                     if (mr != null)
                     {
                         found = true;
                         JumpToReference(mr);
                         break;
                     }
                 }
             }
         }
         if (!found)
         {
             AvalonEditTextOutput output = new AvalonEditTextOutput();
             output.Write("Cannot find " + args.NavigateTo);
             decompilerTextView.ShowText(output);
         }
     }
     commandLineLoadedAssemblies.Clear();             // clear references once we don't need them anymore
 }
示例#5
0
 void HandleCommandLineArgumentsAfterShowList(CommandLineArguments args)
 {
     // if a SaveDirectory is given, do not start a second concurrent decompilation
     // by executing JumpoToReference (leads to https://github.com/icsharpcode/ILSpy/issues/710)
     if (!string.IsNullOrEmpty(args.SaveDirectory))
     {
         foreach (var x in commandLineLoadedAssemblies)
         {
             x.ContinueWhenLoaded((Task <ModuleDefinition> moduleTask) => {
                 OnExportAssembly(moduleTask, args.SaveDirectory);
             }, TaskScheduler.FromCurrentSynchronizationContext());
         }
     }
     else if (args.NavigateTo != null)
     {
         bool found = false;
         if (args.NavigateTo.StartsWith("N:", StringComparison.Ordinal))
         {
             string namespaceName = args.NavigateTo.Substring(2);
             foreach (LoadedAssembly asm in commandLineLoadedAssemblies)
             {
                 AssemblyTreeNode asmNode = assemblyListTreeNode.FindAssemblyNode(asm);
                 if (asmNode != null)
                 {
                     NamespaceTreeNode nsNode = asmNode.FindNamespaceNode(namespaceName);
                     if (nsNode != null)
                     {
                         found = true;
                         SelectNode(nsNode);
                         break;
                     }
                 }
             }
         }
         else
         {
             foreach (LoadedAssembly asm in commandLineLoadedAssemblies)
             {
                 ModuleDefinition def = asm.ModuleDefinition;
                 if (def != null)
                 {
                     MemberReference mr = XmlDocKeyProvider.FindMemberByKey(def, args.NavigateTo);
                     if (mr != null)
                     {
                         found = true;
                         JumpToReference(mr);
                         break;
                     }
                 }
             }
         }
         if (!found)
         {
             AvalonEditTextOutput output = new AvalonEditTextOutput();
             output.Write(string.Format("Cannot find '{0}' in command line specified assemblies.", args.NavigateTo));
             decompilerTextView.ShowText(output);
         }
     }
     else if (commandLineLoadedAssemblies.Count == 1)
     {
         // NavigateTo == null and an assembly was given on the command-line:
         // 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
 }