Browse Source

first implementation of ILSpyParser, ILSpyUnresolvedFile and ILSpyFullParseInformation

newNRILSpyDebugger
Siegfried Pammer 12 years ago
parent
commit
679da5bc6a
  1. 84
      SharpDevelop.Tests.sln
  2. 2
      src/AddIns/DisplayBindings/ILSpyAddIn/DebuggerTextOutput.cs
  3. 7
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyAddIn.addin
  4. 6
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyAddIn.csproj
  5. 2
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyAssemblyResolver.cs
  6. 98
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyDecompilerService.cs
  7. 26
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyFullParseInformation.cs
  8. 72
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyParser.cs
  9. 12
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs
  10. 109
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyUnresolvedFile.cs
  11. 51
      src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs

84
SharpDevelop.Tests.sln

@ -1,10 +1,8 @@ @@ -1,10 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.3
# SharpDevelop 5.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker35", "src\Main\ICSharpCode.SharpDevelop.BuildWorker35\ICSharpCode.SharpDevelop.BuildWorker35.csproj", "{B5F54272-49F0-40DB-845A-8D837875D3BA}"
EndProject
@ -27,8 +25,6 @@ EndProject @@ -27,8 +25,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDevelop", "src\Main\SharpDevelop\SharpDevelop.csproj", "{1152B71B-3C05-4598-B20D-823B5D40559E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{2A232EF1-EB95-41C6-B63A-C106E0C95D3C}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "src\Libraries\cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
EndProject
@ -58,20 +54,14 @@ EndProject @@ -58,20 +54,14 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Decompiler", "src\Libraries\ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj", "{984CC812-9470-4A13-AFF9-CC44068D666C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{39327899-ED91-4F7F-988C-4FE4E17C014D}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Version Control", "Version Control", "{F208FF4F-E5D8-41D5-A7C7-B463976F156E}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitAddIn", "src\AddIns\VersionControl\GitAddIn\GitAddIn.csproj", "{83F15BA7-8478-4664-81BB-A82F146D88B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubversionAddIn", "src\AddIns\VersionControl\SubversionAddIn\SubversionAddIn.csproj", "{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Language Bindings", "Language Bindings", "{E0646C25-36F2-4524-969F-FA621353AB94}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpBinding", "src\AddIns\BackendBindings\CSharpBinding\Project\CSharpBinding.csproj", "{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}"
EndProject
@ -100,8 +90,6 @@ EndProject @@ -100,8 +90,6 @@ EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VBBinding", "src\AddIns\BackendBindings\VBBinding\Project\VBBinding.vbproj", "{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{F3662720-9EA2-4591-BBC6-97361DCE50A9}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelpViewer", "src\AddIns\Misc\HelpViewer\HelpViewer.csproj", "{80F76D10-0B44-4D55-B4BD-DAEB5464090C}"
EndProject
@ -116,8 +104,6 @@ EndProject @@ -116,8 +104,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegExpTk", "src\AddIns\Misc\RegExpTk\Project\RegExpTk.csproj", "{64A3E5E6-90BF-47F6-94DF-68C94B62C817}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UsageDataCollector", "UsageDataCollector", "{DEFC8584-BEC3-4921-BD0F-40482E450B7B}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsageDataCollector", "src\AddIns\Misc\UsageDataCollector\UsageDataCollector\UsageDataCollector.csproj", "{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}"
EndProject
@ -130,8 +116,6 @@ EndProject @@ -130,8 +116,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextTemplating", "src\AddIns\Misc\TextTemplating\Project\TextTemplating.csproj", "{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageManagement", "PackageManagement", "{485A4CCF-55CF-49F4-BD6D-A22B788C67DA}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageManagement", "src\AddIns\Misc\PackageManagement\Project\PackageManagement.csproj", "{AE4AB0FA-6087-4480-AF37-0FA1452B3DA1}"
EndProject
@ -146,16 +130,12 @@ EndProject @@ -146,16 +130,12 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageManagement.Cmdlets.Tests", "src\AddIns\Misc\PackageManagement\Cmdlets\Test\PackageManagement.Cmdlets.Tests.csproj", "{11115C83-3DB1-431F-8B98-59040359238D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddInManager2", "AddInManager2", "{1F88F080-AD7C-4B03-9895-20C26282429D}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager2", "src\AddIns\Misc\AddInManager2\Project\AddInManager2.csproj", "{60480C2F-F228-4D86-B98F-AF75A7DCEC34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager2.Tests", "src\AddIns\Misc\AddInManager2\AddInManager2.Tests\AddInManager2.Tests.csproj", "{0D0CB6E5-1EAD-471F-96B9-BFF84057BCF5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Reports", "Reports", "{FEDD3FD9-0480-43CC-913C-4E0876DDA852}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reports.Addin", "src\AddIns\Misc\Reports\ICSharpCode.Reports.Addin\ICSharpCode.Reports.Addin.csproj", "{62033CC6-01CD-47A2-ADFD-188E9C524C0A}"
EndProject
@ -168,8 +148,6 @@ EndProject @@ -168,8 +148,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Irony", "src\AddIns\Misc\Reports\Irony\Irony.csproj", "{47B2D204-C993-4489-8B83-6DA7321CFAE0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display Bindings", "{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "src\AddIns\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}"
EndProject
@ -184,8 +162,6 @@ EndProject @@ -184,8 +162,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpyAddIn", "src\AddIns\DisplayBindings\ILSpyAddIn\ILSpyAddIn.csproj", "{8AA421C8-D7AF-4957-9F43-5135328ACB24}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{0F5192F2-0744-4BA9-A074-6BE82D111B8D}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.Addin", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.Addin\ICSharpCode.Data.Addin.csproj", "{A9F12710-24E4-46D4-832C-6ECB395B9EAD}"
EndProject
@ -200,8 +176,6 @@ EndProject @@ -200,8 +176,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.SQLServer", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.SQLServer\ICSharpCode.Data.SQLServer.csproj", "{AFE34868-AFA1-4E1C-9450-47AB4BE329D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WpfDesign", "WpfDesign", "{83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}"
EndProject
@ -218,8 +192,6 @@ EndProject @@ -218,8 +192,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "src\AddIns\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{AF5E0DC1-1FA0-4346-A436-0C817C68F7C1}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "src\AddIns\Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}"
EndProject
@ -228,8 +200,6 @@ EndProject @@ -228,8 +200,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Tests", "src\AddIns\Debugger\Debugger.Tests\Debugger.Tests.csproj", "{A4C858C8-51B6-4265-A695-A20FCEBA1D19}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analysis", "Analysis", "{B3352C08-3CB4-4DD9-996F-B9DCE4356BB9}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "src\AddIns\Analysis\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}"
EndProject
@ -250,8 +220,6 @@ EndProject @@ -250,8 +220,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeQuality", "src\AddIns\Analysis\CodeQuality\CodeQuality.csproj", "{0A029008-4973-4256-9150-9AF12845C547}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Profiler", "Profiler", "{7D16E1F9-0F9F-4A05-A162-A59C05E88B68}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Tests", "src\AddIns\Analysis\Profiler\Tests\Profiler.Tests\Profiler.Tests.csproj", "{DAEA4E6C-02CD-47DA-806B-1FCE1E9675EC}"
EndProject
@ -637,14 +605,6 @@ Global @@ -637,14 +605,6 @@ Global
{0A029008-4973-4256-9150-9AF12845C547}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A029008-4973-4256-9150-9AF12845C547}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A029008-4973-4256-9150-9AF12845C547}.Release|Any CPU.Build.0 = Release|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Release|Any CPU.Build.0 = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.Build.0 = Release|Any CPU
{DAEA4E6C-02CD-47DA-806B-1FCE1E9675EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DAEA4E6C-02CD-47DA-806B-1FCE1E9675EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DAEA4E6C-02CD-47DA-806B-1FCE1E9675EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -665,6 +625,14 @@ Global @@ -665,6 +625,14 @@ Global
{D7DB55CF-58F8-4164-A6C9-AE7456E5BEF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7DB55CF-58F8-4164-A6C9-AE7456E5BEF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7DB55CF-58F8-4164-A6C9-AE7456E5BEF3}.Release|Any CPU.Build.0 = Release|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Release|Any CPU.Build.0 = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -683,24 +651,19 @@ Global @@ -683,24 +651,19 @@ Global
{D68133BD-1E63-496E-9EDE-4FBDBF77B486} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{6222A3A1-83CE-47A3-A4E4-A018F82D44D8} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{53DCA265-3C3C-42F9-B647-F72BA678122B} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{63D3B27A-D966-4902-90B3-30290E1692F1} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{2FF700C2-A38A-48BD-A637-8CAFD4FE6237} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{984CC812-9470-4A13-AFF9-CC44068D666C} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{53DCA265-3C3C-42F9-B647-F72BA678122B} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{63D3B27A-D966-4902-90B3-30290E1692F1} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{F208FF4F-E5D8-41D5-A7C7-B463976F156E} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{AF5E0DC1-1FA0-4346-A436-0C817C68F7C1} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{B3352C08-3CB4-4DD9-996F-B9DCE4356BB9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{E2FD63DA-8478-4066-934C-DA82A852C83A} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{83F15BA7-8478-4664-81BB-A82F146D88B3} = {F208FF4F-E5D8-41D5-A7C7-B463976F156E}
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5} = {F208FF4F-E5D8-41D5-A7C7-B463976F156E}
{E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {E0646C25-36F2-4524-969F-FA621353AB94}
{E954F3CB-A446-492F-A664-2B376EBC86E8} = {E0646C25-36F2-4524-969F-FA621353AB94}
{70966F84-74C9-4067-A379-0C674A929233} = {E0646C25-36F2-4524-969F-FA621353AB94}
@ -714,6 +677,7 @@ Global @@ -714,6 +677,7 @@ Global
{85C09AD8-183B-403A-869A-7226646218A9} = {E0646C25-36F2-4524-969F-FA621353AB94}
{CAD4D128-5A67-444B-88AE-37E0AF79C57E} = {E0646C25-36F2-4524-969F-FA621353AB94}
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F} = {E0646C25-36F2-4524-969F-FA621353AB94}
{F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{80F76D10-0B44-4D55-B4BD-DAEB5464090C} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{9196DD8A-B4D4-4780-8742-C5762E547FC2} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
@ -721,27 +685,28 @@ Global @@ -721,27 +685,28 @@ Global
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{64A3E5E6-90BF-47F6-94DF-68C94B62C817} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{DEFC8584-BEC3-4921-BD0F-40482E450B7B} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{A569DCC1-C608-45FD-B770-4F79335EF154} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{5186325C-DD7F-4246-9BE7-3F384EFBF5A6} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{485A4CCF-55CF-49F4-BD6D-A22B788C67DA} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{1F88F080-AD7C-4B03-9895-20C26282429D} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{FEDD3FD9-0480-43CC-913C-4E0876DDA852} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{AE4AB0FA-6087-4480-AF37-0FA1452B3DA1} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{A406803B-C584-43A3-BCEE-A0BB3132CB5F} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{C3F15E22-5793-4129-AF8C-6229112B86D2} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{56E98A01-8398-4A08-9578-C7337711A52B} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{E0A5E80A-003B-4335-A9DC-A76E2E46D38D} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{11115C83-3DB1-431F-8B98-59040359238D} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{1F88F080-AD7C-4B03-9895-20C26282429D} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{60480C2F-F228-4D86-B98F-AF75A7DCEC34} = {1F88F080-AD7C-4B03-9895-20C26282429D}
{0D0CB6E5-1EAD-471F-96B9-BFF84057BCF5} = {1F88F080-AD7C-4B03-9895-20C26282429D}
{FEDD3FD9-0480-43CC-913C-4E0876DDA852} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{62033CC6-01CD-47A2-ADFD-188E9C524C0A} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{2EE63FDD-7F49-40BD-8A2E-240848B9FA83} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{0884566C-E013-4185-B223-47547AA75167} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{1491E558-9C19-4EAC-9406-868AB8181F38} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{47B2D204-C993-4489-8B83-6DA7321CFAE0} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{0162E499-42D0-409B-AA25-EED21F75336B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{E618A9CD-A39F-4925-A538-E8A3FEF24E54} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{DCA2703D-250A-463E-A68A-07ED105AE6BD} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
@ -749,23 +714,25 @@ Global @@ -749,23 +714,25 @@ Global
{DFB936AD-90EE-4B4F-941E-4F4A636F0D92} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{8AA421C8-D7AF-4957-9F43-5135328ACB24} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{0F5192F2-0744-4BA9-A074-6BE82D111B8D} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{A9F12710-24E4-46D4-832C-6ECB395B9EAD} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{B7823AE9-4B43-4859-8796-2EBDC116FBB8} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{BAD94D6E-4159-4CB6-B991-486F412D9BB6} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{5C70D6AB-0A33-43F9-B8B5-54558C35BBB1} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{EEF5E054-4192-4A57-8FBF-E860D808A51D} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{AFE34868-AFA1-4E1C-9450-47AB4BE329D5} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{66A378A1-E9F4-4AD5-8946-D0EC06C2902F} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{943DBBB3-E84E-4CF4-917C-C05AFA8743C1} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{78CC29AC-CC79-4355-B1F2-97936DF198AC} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{88DA149F-21B2-48AB-82C4-28FB6BDFD783} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{AF5E0DC1-1FA0-4346-A436-0C817C68F7C1} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {AF5E0DC1-1FA0-4346-A436-0C817C68F7C1}
{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {AF5E0DC1-1FA0-4346-A436-0C817C68F7C1}
{A4C858C8-51B6-4265-A695-A20FCEBA1D19} = {AF5E0DC1-1FA0-4346-A436-0C817C68F7C1}
{B3352C08-3CB4-4DD9-996F-B9DCE4356BB9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1F261725-6318-4434-A1B1-6C70CE4CD324} = {B3352C08-3CB4-4DD9-996F-B9DCE4356BB9}
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181} = {B3352C08-3CB4-4DD9-996F-B9DCE4356BB9}
{3EAA45A9-735C-4AC7-A799-947B93EA449D} = {B3352C08-3CB4-4DD9-996F-B9DCE4356BB9}
@ -781,5 +748,6 @@ Global @@ -781,5 +748,6 @@ Global
{CEFF8221-95D8-4F60-9D14-687019D0B2E8} = {7D16E1F9-0F9F-4A05-A162-A59C05E88B68}
{BD38E43B-947F-474B-8F6C-8BDAA9EE99A6} = {7D16E1F9-0F9F-4A05-A162-A59C05E88B68}
{D7DB55CF-58F8-4164-A6C9-AE7456E5BEF3} = {7D16E1F9-0F9F-4A05-A162-A59C05E88B68}
{E2FD63DA-8478-4066-934C-DA82A852C83A} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
EndGlobalSection
EndGlobal

2
src/AddIns/DisplayBindings/ILSpyAddIn/DebuggerTextOutput.cs

@ -10,7 +10,7 @@ using Mono.Cecil; @@ -10,7 +10,7 @@ using Mono.Cecil;
namespace ICSharpCode.ILSpyAddIn
{
sealed class DebuggerTextOutput : ITextOutput
public sealed class DebuggerTextOutput : ITextOutput
{
readonly ITextOutput output;

7
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyAddIn.addin

@ -20,6 +20,13 @@ @@ -20,6 +20,13 @@
<Class id="ILSpy" class="ICSharpCode.ILSpyAddIn.NavigateToDecompiledEntityService"/>
</Path>
<Path name = "/SharpDevelop/Parser">
<Parser id = "ILSpy"
insertbefore="C#"
supportedfilenamepattern="^ilspy\://"
class = "ICSharpCode.ILSpyAddIn.ILSpyParser" />
</Path>
<!-- Text editor context menu: Launch ILSpy command -->
<Path name="/SharpDevelop/EntityContextMenu">
<MenuItem id="ILSpy" icon="ILSpy" type="Item" label="${res:ILSpyAddIn.OpenILSpyCommand}" class="ICSharpCode.ILSpyAddIn.OpenInILSpyCommand"/>

6
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyAddIn.csproj

@ -66,8 +66,12 @@ @@ -66,8 +66,12 @@
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="DebuggerTextOutput.cs" />
<Compile Include="ILSpyDecompilerService.cs" />
<Compile Include="ILSpyAssemblyResolver.cs" />
<Compile Include="ILSpyFullParseInformation.cs" />
<Compile Include="ILSpyParser.cs" />
<Compile Include="ILSpySymbolSource.cs" />
<Compile Include="LaunchILSpy\ILSpyAssemblyResolver.cs" />
<Compile Include="ILSpyUnresolvedFile.cs" />
<Compile Include="NavigateToDecompiledEntityService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="LaunchILSpy\ILSpyController.cs" />

2
src/AddIns/DisplayBindings/ILSpyAddIn/LaunchILSpy/ILSpyAssemblyResolver.cs → src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyAssemblyResolver.cs

@ -11,7 +11,7 @@ using ICSharpCode.SharpDevelop; @@ -11,7 +11,7 @@ using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Parser;
using Mono.Cecil;
namespace ICSharpCode.ILSpyAddIn.LaunchILSpy
namespace ICSharpCode.ILSpyAddIn
{
class ILSpyAssemblyResolver : IAssemblyResolver
{

98
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyDecompilerService.cs

@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.Core;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Ast;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop;
using Mono.Cecil;
namespace ICSharpCode.ILSpyAddIn
{
/// <summary>
/// Description of DecompilerService.
/// </summary>
public class ILSpyDecompilerService
{
public static ILSpyUnresolvedFile DecompileType(DecompiledTypeReference name)
{
if (name == null)
throw new ArgumentNullException("entity");
return DoDecompile(name);
}
public static async Task<ILSpyUnresolvedFile> DecompileTypeAsync(DecompiledTypeReference name, CancellationToken cancellationToken)
{
return Task.Run(
delegate() { return DoDecompile(name, cancellationToken); },
cancellationToken).Result;
}
static AstBuilder CreateAstBuilder(DecompiledTypeReference name, CancellationToken cancellationToken = default(CancellationToken))
{
ReaderParameters readerParameters = new ReaderParameters();
// Use new assembly resolver instance so that the AssemblyDefinitions
// can be garbage-collected once the code is decompiled.
readerParameters.AssemblyResolver = new ILSpyAssemblyResolver(Path.GetDirectoryName(name.AssemblyFile));
ModuleDefinition module = ModuleDefinition.ReadModule(name.AssemblyFile, readerParameters);
TypeDefinition typeDefinition = module.GetType(name.Type.ReflectionName);
if (typeDefinition == null)
throw new InvalidOperationException("Could not find type");
DecompilerContext context = new DecompilerContext(module);
context.CancellationToken = cancellationToken;
AstBuilder astBuilder = new AstBuilder(context);
astBuilder.AddType(typeDefinition);
return astBuilder;
}
static ILSpyUnresolvedFile DoDecompile(DecompiledTypeReference name, CancellationToken cancellationToken = default(CancellationToken))
{
return ILSpyUnresolvedFile.Create(name, CreateAstBuilder(name, cancellationToken));
}
public static ILSpyFullParseInformation ParseDecompiledType(DecompiledTypeReference name, CancellationToken cancellationToken = default(CancellationToken))
{
var astBuilder = CreateAstBuilder(name, cancellationToken);
return new ILSpyFullParseInformation(ILSpyUnresolvedFile.Create(name, astBuilder), null, astBuilder.SyntaxTree);
}
}
public class DecompiledTypeReference
{
public FileName AssemblyFile { get; private set; }
public FullTypeName Type { get; private set; }
public DecompiledTypeReference(FileName assemblyFile, FullTypeName type)
{
this.AssemblyFile = assemblyFile;
this.Type = type;
}
public FileName ToFileName()
{
return FileName.Create("ilspy://" + AssemblyFile + "/" + Type.ReflectionName + ".cs");
}
static readonly Regex nameRegex = new Regex(@"^ilspy\://(.+)/(.+)\.cs$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static DecompiledTypeReference FromFileName(string filename)
{
var match = nameRegex.Match(filename);
if (!match.Success) return null;
string asm, typeName;
asm = match.Groups[1].Value;
typeName = match.Groups[2].Value;
return new DecompiledTypeReference(new FileName(asm), new FullTypeName(typeName));
}
}
}

26
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyFullParseInformation.cs

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.SharpDevelop.Parser;
namespace ICSharpCode.ILSpyAddIn
{
/// <summary>
/// Description of ILSpyFullParseInformation.
/// </summary>
public class ILSpyFullParseInformation : ParseInformation
{
SyntaxTree syntaxTree;
public ILSpyFullParseInformation(ILSpyUnresolvedFile unresolvedFile, ITextSourceVersion parsedVersion, SyntaxTree syntaxTree)
: base(unresolvedFile, parsedVersion, true)
{
this.syntaxTree = syntaxTree;
}
public SyntaxTree SyntaxTree { get { return syntaxTree; } }
}
}

72
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyParser.cs

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using ICSharpCode.Core;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.Semantics;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop.Editor.Search;
using ICSharpCode.SharpDevelop.Parser;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.ILSpyAddIn
{
/// <summary>
/// This class "parses" a decompiled type to provide the information required
/// by the ParserService.
/// </summary>
public class ILSpyParser : IParser
{
public bool CanParse(string fileName)
{
return fileName != null && fileName.StartsWith("ilspy://", StringComparison.OrdinalIgnoreCase);
}
public ParseInformation Parse(FileName fileName, ITextSource fileContent, bool fullParseInformationRequested, IProject parentProject, CancellationToken cancellationToken)
{
return ILSpyDecompilerService.ParseDecompiledType(DecompiledTypeReference.FromFileName(fileName), cancellationToken);
}
public ResolveResult Resolve(ParseInformation parseInfo, TextLocation location, ICompilation compilation, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public ResolveResult ResolveSnippet(ParseInformation parseInfo, TextLocation location, string codeSnippet, ICompilation compilation, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public void FindLocalReferences(ParseInformation parseInfo, ITextSource fileContent, IVariable variable, ICompilation compilation, Action<SearchResultMatch> callback, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
static readonly Lazy<IAssemblyReference[]> defaultReferences = new Lazy<IAssemblyReference[]>(
delegate {
Assembly[] assemblies = {
typeof(object).Assembly,
typeof(Uri).Assembly,
typeof(Enumerable).Assembly
};
return assemblies.Select(asm => new CecilLoader().LoadAssemblyFile(asm.Location)).ToArray();
});
public ICompilation CreateCompilationForSingleFile(FileName fileName, IUnresolvedFile unresolvedFile)
{
return new CSharpProjectContent()
.AddAssemblyReferences(defaultReferences.Value)
.AddOrUpdateFiles(unresolvedFile)
.CreateCompilation();
}
public IReadOnlyList<string> TaskListTokens { get; set; }
}
}

12
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs

@ -52,28 +52,28 @@ namespace ICSharpCode.ILSpyAddIn @@ -52,28 +52,28 @@ namespace ICSharpCode.ILSpyAddIn
seq = seqs.Where(p => p.ILRanges.Any(r => r.From <= iloffset && iloffset < r.To))
.OrderByDescending(p => p.ILRanges.Last().To - p.ILRanges.First().From)
.FirstOrDefault();
return seq.ToDebugger(symbols, content.VirtualFileName);
return seq.ToDebugger(symbols, content.PrimaryFileName);
}
return null;
}
public Debugger.SequencePoint GetSequencePoint(Module module, string filename, int line, int column)
{
var content = DecompiledViewContent.Get(new FileName(filename));
if (content == null)
var decompiledFile = ILSpyDecompilerService.DecompileType(DecompiledTypeReference.FromFileName(filename));
if (decompiledFile == null)
return null;
if (!FileUtility.IsEqualFileName(module.FullPath, content.AssemblyFile))
if (!FileUtility.IsEqualFileName(module.FullPath, decompiledFile.AssemblyFile))
return null;
TextLocation loc = new TextLocation(line, column);
foreach(var symbols in content.DebugSymbols.Values.Where(s => s.StartLocation <= loc && loc <= s.EndLocation)) {
foreach(var symbols in decompiledFile.DebugSymbols.Values.Where(s => s.StartLocation <= loc && loc <= s.EndLocation)) {
Decompiler.SequencePoint seq = null;
if (column != 0)
seq = symbols.SequencePoints.FirstOrDefault(p => p.StartLocation <= loc && loc <= p.EndLocation);
if (seq == null)
seq = symbols.SequencePoints.FirstOrDefault(p => line <= p.StartLocation.Line);
if (seq != null)
return seq.ToDebugger(symbols, content.VirtualFileName);
return seq.ToDebugger(symbols, decompiledFile.FileName);
}
return null;
}

109
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyUnresolvedFile.cs

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Ast;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.TypeSystem;
namespace ICSharpCode.ILSpyAddIn
{
/// <summary>
/// Description of ILSpyUnresolvedFile.
/// </summary>
public class ILSpyUnresolvedFile : IUnresolvedFile
{
DecompiledTypeReference name;
DebuggerTextOutput textOutput;
StringWriter writer;
IList<Error> errors;
IList<IUnresolvedTypeDefinition> topLevel;
public static ILSpyUnresolvedFile Create(DecompiledTypeReference name, AstBuilder builder)
{
var writer = new StringWriter();
var output = new DebuggerTextOutput(new PlainTextOutput(writer));
builder.GenerateCode(output);
ILSpyUnresolvedFile file = new ILSpyUnresolvedFile(name, builder.SyntaxTree.Errors);
builder.SyntaxTree.FileName = name.ToFileName();
var ts = builder.SyntaxTree.ToTypeSystem();
file.topLevel = ts.TopLevelTypeDefinitions;
file.textOutput = output;
file.writer = writer;
return file;
}
ILSpyUnresolvedFile(DecompiledTypeReference name, IList<Error> errors)
{
this.name = name;
this.errors = errors;
}
public DebuggerTextOutput TextOutput {
get { return textOutput; }
}
public StringWriter Writer {
get { return writer; }
}
public FileName AssemblyFile {
get { return name.AssemblyFile; }
}
public Dictionary<string, MethodDebugSymbols> DebugSymbols { get; private set; }
public IUnresolvedTypeDefinition GetTopLevelTypeDefinition(TextLocation location)
{
throw new NotImplementedException();
}
public IUnresolvedTypeDefinition GetInnermostTypeDefinition(TextLocation location)
{
throw new NotImplementedException();
}
public IUnresolvedMember GetMember(TextLocation location)
{
throw new NotImplementedException();
}
public string FileName {
get { return name.ToFileName(); }
}
public DateTime? LastWriteTime {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IList<IUnresolvedTypeDefinition> TopLevelTypeDefinitions {
get {
return topLevel;
}
}
public IList<IUnresolvedAttribute> AssemblyAttributes {
get {
throw new NotImplementedException();
}
}
public IList<IUnresolvedAttribute> ModuleAttributes {
get {
throw new NotImplementedException();
}
}
public IList<Error> Errors {
get { return errors; }
}
}
}

51
src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/DecompiledViewContent.cs

@ -16,7 +16,7 @@ using ICSharpCode.Decompiler.Ast; @@ -16,7 +16,7 @@ using ICSharpCode.Decompiler.Ast;
using ICSharpCode.Decompiler.Disassembler;
using ICSharpCode.NRefactory.Documentation;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.ILSpyAddIn.LaunchILSpy;
using ICSharpCode.ILSpyAddIn;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop;
@ -34,10 +34,10 @@ namespace ICSharpCode.ILSpyAddIn @@ -34,10 +34,10 @@ namespace ICSharpCode.ILSpyAddIn
{
readonly FileName assemblyFile;
readonly string fullTypeName;
public FileName VirtualFileName { get; private set; }
public DecompiledTypeReference DecompiledTypeName { get; private set; }
public override FileName PrimaryFileName {
get { return this.VirtualFileName; }
get { return this.DecompiledTypeName.ToFileName(); }
}
/// <summary>
@ -56,7 +56,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -56,7 +56,7 @@ namespace ICSharpCode.ILSpyAddIn
#region Constructor
public DecompiledViewContent(FileName assemblyFile, string fullTypeName, string entityTag)
{
this.VirtualFileName = FileName.Create("ilspy://" + assemblyFile + "/" + fullTypeName + ".cs");
this.DecompiledTypeName = new DecompiledTypeReference(assemblyFile, new FullTypeName(fullTypeName));
this.Services = codeEditor.GetRequiredService<IServiceContainer>();
@ -76,18 +76,12 @@ namespace ICSharpCode.ILSpyAddIn @@ -76,18 +76,12 @@ namespace ICSharpCode.ILSpyAddIn
SD.BookmarkManager.BookmarkRemoved += BookmarkManager_Removed;
SD.BookmarkManager.BookmarkAdded += BookmarkManager_Added;
this.codeEditor.FileName = this.VirtualFileName;
this.codeEditor.FileName = this.DecompiledTypeName.ToFileName();
this.codeEditor.ActiveTextEditor.IsReadOnly = true;
this.codeEditor.ActiveTextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
}
#endregion
public static DecompiledViewContent Get(FileName virtualFileName)
{
var viewContents = SD.Workbench.ViewContentCollection.OfType<DecompiledViewContent>();
return viewContents.FirstOrDefault(c => c.VirtualFileName == virtualFileName);
}
public static DecompiledViewContent Get(IEntity entity)
{
if (entity == null)
@ -201,11 +195,13 @@ namespace ICSharpCode.ILSpyAddIn @@ -201,11 +195,13 @@ namespace ICSharpCode.ILSpyAddIn
{
try {
StringWriter writer = new StringWriter();
RunDecompiler(assemblyFile, fullTypeName, new DebuggerTextOutput(new PlainTextOutput(writer)), cancellation.Token);
var file = ILSpyDecompilerService.DecompileType(DecompiledTypeName);
memberLocations = file.TextOutput.MemberLocations;
this.DebugSymbols = file.TextOutput.DebugSymbols;
// if (!cancellation.IsCancellationRequested) {
// SD.MainThread.InvokeAsyncAndForget(() => OnDecompilationFinished(writer));
// }
OnDecompilationFinished(writer);
OnDecompilationFinished(file.Writer);
} catch (OperationCanceledException) {
// ignore cancellation
} catch (Exception ex) {
@ -223,31 +219,6 @@ namespace ICSharpCode.ILSpyAddIn @@ -223,31 +219,6 @@ namespace ICSharpCode.ILSpyAddIn
}
}
void RunDecompiler(string assemblyFile, string fullTypeName, DebuggerTextOutput textOutput, CancellationToken cancellationToken)
{
ReaderParameters readerParameters = new ReaderParameters();
// Use new assembly resolver instance so that the AssemblyDefinitions can be garbage-collected
// once the code is decompiled.
readerParameters.AssemblyResolver = new ILSpyAssemblyResolver(Path.GetDirectoryName(assemblyFile));
ModuleDefinition module = ModuleDefinition.ReadModule(assemblyFile, readerParameters);
TypeDefinition typeDefinition = module.GetType(fullTypeName);
if (typeDefinition == null)
throw new InvalidOperationException("Could not find type");
DecompilerContext context = new DecompilerContext(module);
context.CancellationToken = cancellationToken;
AstBuilder astBuilder = new AstBuilder(context);
astBuilder.AddType(typeDefinition);
astBuilder.GenerateCode(textOutput);
// ReflectionDisassembler disasm = new ReflectionDisassembler(textOutput, true, cancellationToken);
// disasm.DisassembleType(typeDefinition);
// save decompilation data
memberLocations = textOutput.MemberLocations;
this.DebugSymbols = textOutput.DebugSymbols;
}
void OnDecompilationFinished(StringWriter output)
{
if (cancellation.IsCancellationRequested)
@ -280,7 +251,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -280,7 +251,7 @@ namespace ICSharpCode.ILSpyAddIn
codeView.IconBarManager.Bookmarks.Add(bookmark);
}
}
*/
*/
#endregion
#region Bookmarks
@ -296,7 +267,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -296,7 +267,7 @@ namespace ICSharpCode.ILSpyAddIn
void BookmarkManager_Added(object sender, BookmarkEventArgs e)
{
var mark = e.Bookmark;
if (mark != null && mark.FileName == VirtualFileName) {
if (mark != null && mark.FileName == PrimaryFileName) {
codeEditor.IconBarManager.Bookmarks.Add(mark);
mark.Document = this.codeEditor.Document;
}

Loading…
Cancel
Save