Browse Source

Merge remote-tracking branch 'origin/master' into newNR.

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
e4a1e0b42d
  1. 148
      SharpDevelop.sln
  2. 17
      data/resources/StringResources.de.resx
  3. 37
      data/resources/StringResources.it.resx
  4. 54
      data/resources/StringResources.nl.resx
  5. 43
      data/resources/StringResources.resx
  6. 3191
      data/resources/StringResources.tr.resx
  7. 2
      data/templates/project/CSharp/ConsoleProject.xpt
  8. 2
      data/templates/project/CSharp/FormsProject.xpt
  9. 2
      data/templates/project/CSharp/NotifyIcon.xpt
  10. 27
      data/templates/project/CSharp/PortableAssemblyInfo.cs
  11. 58
      data/templates/project/CSharp/PortableLibrary.xpt
  12. 2
      data/templates/project/CSharp/Service.xpt
  13. 2
      data/templates/project/CSharp/WPFApplication.xpt
  14. 2
      data/templates/project/CSharp/WPFNavigationApplication.xpt
  15. 20
      data/templates/project/ComplexExample.xpt.test
  16. 2
      data/templates/project/VB/ConsoleProject.xpt
  17. 2
      data/templates/project/VB/FormsProject.xpt
  18. 2
      data/templates/project/VB/NotifyIcon.xpt
  19. 2
      data/templates/project/VB/Service.xpt
  20. 2
      data/templates/project/VB/WPFApplication.xpt
  21. 2
      data/templates/project/VB/WPFNavigationApplication.xpt
  22. 1
      src/AddIns/Analysis/UnitTesting/Test/Utils/MockCSharpProject.cs
  23. 87
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs
  24. 18
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs
  25. 40
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs
  26. 48
      src/AddIns/BackendBindings/VBNetBinding/Test/FormattingStrategy/IndentationTests.cs
  27. 2
      src/AddIns/BackendBindings/VBNetBinding/Test/MockTextEditor.cs
  28. 2
      src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/MockTextEditor.cs
  29. 4
      src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingSymbolsPanel.resx
  30. 9
      src/AddIns/Debugger/Debugger.Core/IDStringProvider.cs
  31. 7
      src/AddIns/Debugger/Debugger.Core/MetaData/DebugMethodInfo.cs
  32. 3
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
  33. 37
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs
  34. 34
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs
  35. 28
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs
  36. 5
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsBulbControl.xaml
  37. 91
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizableHighlightingColorizer.cs
  38. 10
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizedHighlightingColor.cs
  39. 2
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CodeEditorOptions.cs
  40. 93
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml
  41. 519
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
  42. 17
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml
  43. 69
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerService.cs
  44. 94
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/IO/EntityModelCodeGenerator.cs
  45. 36
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs
  46. 3
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  47. 39
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs
  48. 4
      src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/CodeView.cs
  49. 15
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs
  50. 20
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SelectedElementRectangleExtension.cs
  51. 68
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SizeDisplayExtension.cs
  52. 283
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/StackPanelPlacementSupport.cs
  53. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/DataManager/TableStragy/TableDataManagerFixture.cs
  54. 4
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/AggregateFunctionsFixture.cs
  55. 2
      src/AddIns/Misc/SharpRefactoring/Test/MockTextEditor.cs
  56. 7
      src/AddIns/VersionControl/SubversionAddIn/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs
  57. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/ImeSupport.cs
  58. 16
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingMargin.cs
  59. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd
  60. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
  61. 65
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/ColumnRulerRenderer.cs
  62. 71
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
  63. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineLinkText.cs
  64. 32
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs
  65. 16
      src/Libraries/ICSharpCode.Decompiler/Ast/AstBuilder.cs
  66. 6
      src/Libraries/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
  67. 1
      src/Libraries/ICSharpCode.Decompiler/Ast/DecompilerContext.cs
  68. 8
      src/Libraries/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs
  69. 1
      src/Libraries/ICSharpCode.Decompiler/Ast/Transforms/DelegateConstruction.cs
  70. 15
      src/Libraries/ICSharpCode.Decompiler/DecompilerSettings.cs
  71. 3
      src/Libraries/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
  72. 653
      src/Libraries/ICSharpCode.Decompiler/ILAst/AsyncDecompiler.cs
  73. 15
      src/Libraries/ICSharpCode.Decompiler/ILAst/ILAstOptimizer.cs
  74. 6
      src/Libraries/ICSharpCode.Decompiler/ILAst/ILCodes.cs
  75. 12
      src/Libraries/ICSharpCode.Decompiler/ILAst/PatternMatching.cs
  76. 310
      src/Libraries/ICSharpCode.Decompiler/ILAst/StateRange.cs
  77. 148
      src/Libraries/ICSharpCode.Decompiler/ILAst/SymbolicExecution.cs
  78. 21
      src/Libraries/ICSharpCode.Decompiler/ILAst/TypeAnalysis.cs
  79. 418
      src/Libraries/ICSharpCode.Decompiler/ILAst/YieldReturnDecompiler.cs
  80. 4
      src/Libraries/ICSharpCode.Decompiler/Properties/AssemblyInfo.cs
  81. 144
      src/Libraries/ICSharpCode.Decompiler/Tests/Async.cs
  82. 4
      src/Libraries/ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj
  83. 2
      src/Libraries/ICSharpCode.Decompiler/Tests/PropertiesAndEvents.cs
  84. 6
      src/Libraries/ICSharpCode.Decompiler/Tests/TestRunner.cs
  85. 20
      src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
  86. 16
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  87. 7
      src/Main/Base/Project/Src/Bookmarks/BookmarkManager.cs
  88. 2
      src/Main/Base/Project/Src/Bookmarks/SDMarkerBookmark.cs
  89. 5
      src/Main/Base/Project/Src/Editor/ISyntaxHighlighter.cs
  90. 16
      src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs
  91. 163
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs
  92. 13
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ProjectWithServiceReferences.cs
  93. 3
      src/Main/Base/Project/Src/Gui/Dialogs/TreeViewOptionsDialog.xaml.cs
  94. 20
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ProjectNodeCommands.cs
  95. 101
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ReferenceFolderNodeCommands.cs
  96. 4
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/AbstractProjectBrowserTreeNode.cs
  97. 2
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs
  98. 2
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs
  99. 62
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs
  100. 1
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs
  101. Some files were not shown because too many files have changed in this diff Show More

148
SharpDevelop.sln

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.2.0.8783
# SharpDevelop 4.3.0.8807-alpha
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@ -119,8 +119,6 @@ Global @@ -119,8 +119,6 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
@ -187,256 +185,232 @@ Global @@ -187,256 +185,232 @@ Global
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Debug|Win32.Build.0 = Debug|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Debug|Win32.ActiveCfg = Debug|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Debug|x86.Build.0 = Debug|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Debug|x86.ActiveCfg = Debug|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Release|Any CPU.Build.0 = Release|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Release|Win32.Build.0 = Release|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Release|Win32.ActiveCfg = Release|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Release|x86.Build.0 = Release|Any CPU
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Release|x86.ActiveCfg = Release|Any CPU
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Debug|Any CPU.Build.0 = Debug|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Debug|Any CPU.ActiveCfg = Debug|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Debug|Win32.Build.0 = Debug|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Debug|Win32.ActiveCfg = Debug|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Debug|x86.Build.0 = Debug|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Debug|x86.ActiveCfg = Debug|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Release|Any CPU.Build.0 = Release|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Release|Any CPU.ActiveCfg = Release|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Release|Win32.Build.0 = Release|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Release|Win32.ActiveCfg = Release|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Release|x86.Build.0 = Release|x86
{B5F54272-49F0-40DB-845A-8D837875D3BA}.Release|x86.ActiveCfg = Release|x86
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Debug|Win32.Build.0 = Debug|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Debug|Win32.ActiveCfg = Debug|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Debug|x86.Build.0 = Debug|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Debug|x86.ActiveCfg = Debug|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Release|Any CPU.Build.0 = Release|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Release|Win32.Build.0 = Release|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Release|Win32.ActiveCfg = Release|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Release|x86.Build.0 = Release|Any CPU
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}.Release|x86.ActiveCfg = Release|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Debug|Win32.Build.0 = Debug|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Debug|x86.Build.0 = Debug|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Debug|x86.ActiveCfg = Debug|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Release|Any CPU.Build.0 = Release|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Release|Win32.Build.0 = Release|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Release|Win32.ActiveCfg = Release|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Release|x86.Build.0 = Release|Any CPU
{83F15BA7-8478-4664-81BB-A82F146D88B3}.Release|x86.ActiveCfg = Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Win32.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Win32.ActiveCfg = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.ActiveCfg = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Win32.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Win32.ActiveCfg = net_4_0_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.ActiveCfg = net_4_0_Release|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Win32.Build.0 = Debug|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Win32.ActiveCfg = Debug|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|x86.Build.0 = Debug|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|x86.ActiveCfg = Debug|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.Build.0 = Release|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Win32.Build.0 = Release|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Win32.ActiveCfg = Release|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|x86.Build.0 = Release|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|x86.ActiveCfg = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Win32.Build.0 = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Win32.ActiveCfg = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.Build.0 = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.ActiveCfg = Debug|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.Build.0 = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Win32.Build.0 = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Win32.ActiveCfg = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.Build.0 = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.ActiveCfg = Release|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Win32.Build.0 = Debug|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Win32.ActiveCfg = Debug|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|x86.Build.0 = Debug|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|x86.ActiveCfg = Debug|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Any CPU.Build.0 = Release|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Win32.Build.0 = Release|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Win32.ActiveCfg = Release|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|x86.Build.0 = Release|Any CPU
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|x86.ActiveCfg = Release|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|Win32.Build.0 = Debug|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|Win32.ActiveCfg = Debug|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|x86.Build.0 = Debug|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|x86.ActiveCfg = Debug|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Release|Any CPU.Build.0 = Release|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Release|Win32.Build.0 = Release|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Release|Win32.ActiveCfg = Release|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Release|x86.Build.0 = Release|Any CPU
{E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Release|x86.ActiveCfg = Release|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Debug|Win32.Build.0 = Debug|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Debug|Win32.ActiveCfg = Debug|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Debug|x86.Build.0 = Debug|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Debug|x86.ActiveCfg = Debug|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Release|Any CPU.Build.0 = Release|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Release|Win32.Build.0 = Release|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Release|Win32.ActiveCfg = Release|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Release|x86.Build.0 = Release|Any CPU
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}.Release|x86.ActiveCfg = Release|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Debug|Win32.Build.0 = Debug|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Debug|Win32.ActiveCfg = Debug|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Debug|x86.Build.0 = Debug|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Debug|x86.ActiveCfg = Debug|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Release|Any CPU.Build.0 = Release|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Release|Win32.Build.0 = Release|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Release|Win32.ActiveCfg = Release|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Release|x86.Build.0 = Release|Any CPU
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6}.Release|x86.ActiveCfg = Release|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Debug|Win32.Build.0 = Debug|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Debug|Win32.ActiveCfg = Debug|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Debug|x86.Build.0 = Debug|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Debug|x86.ActiveCfg = Debug|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Release|Any CPU.Build.0 = Release|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Release|Win32.Build.0 = Release|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Release|Win32.ActiveCfg = Release|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Release|x86.Build.0 = Release|Any CPU
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}.Release|x86.ActiveCfg = Release|Any CPU
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Debug|Any CPU.Build.0 = Debug|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Debug|Any CPU.ActiveCfg = Debug|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Debug|Win32.Build.0 = Debug|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Debug|Win32.ActiveCfg = Debug|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Debug|x86.Build.0 = Debug|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Debug|x86.ActiveCfg = Debug|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Release|Any CPU.Build.0 = Release|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Release|Any CPU.ActiveCfg = Release|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Release|Win32.Build.0 = Release|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Release|Win32.ActiveCfg = Release|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Release|x86.Build.0 = Release|x86
{80F76D10-0B44-4D55-B4BD-DAEB5464090C}.Release|x86.ActiveCfg = Release|x86
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Win32.Build.0 = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Win32.ActiveCfg = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|x86.Build.0 = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|x86.ActiveCfg = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Any CPU.Build.0 = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Win32.Build.0 = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Win32.ActiveCfg = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|x86.Build.0 = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|x86.ActiveCfg = Release|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Debug|Win32.Build.0 = Debug|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Debug|Win32.ActiveCfg = Debug|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Debug|x86.Build.0 = Debug|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Debug|x86.ActiveCfg = Debug|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Release|Any CPU.Build.0 = Release|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Release|Win32.Build.0 = Release|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Release|Win32.ActiveCfg = Release|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Release|x86.Build.0 = Release|Any CPU
{64A3E5E6-90BF-47F6-94DF-68C94B62C817}.Release|x86.ActiveCfg = Release|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Debug|Win32.Build.0 = Debug|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Debug|Win32.ActiveCfg = Debug|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Debug|x86.Build.0 = Debug|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Debug|x86.ActiveCfg = Debug|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Release|Any CPU.Build.0 = Release|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Release|Win32.Build.0 = Release|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Release|Win32.ActiveCfg = Release|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Release|x86.Build.0 = Release|Any CPU
{E954F3CB-A446-492F-A664-2B376EBC86E8}.Release|x86.ActiveCfg = Release|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Debug|Win32.Build.0 = Debug|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Debug|Win32.ActiveCfg = Debug|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Debug|x86.Build.0 = Debug|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Debug|x86.ActiveCfg = Debug|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Release|Any CPU.Build.0 = Release|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Release|Win32.Build.0 = Release|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Release|Win32.ActiveCfg = Release|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Release|x86.Build.0 = Release|Any CPU
{70966F84-74C9-4067-A379-0C674A929233}.Release|x86.ActiveCfg = Release|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Debug|Win32.Build.0 = Debug|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Debug|Win32.ActiveCfg = Debug|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Debug|x86.Build.0 = Debug|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Debug|x86.ActiveCfg = Debug|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Release|Any CPU.Build.0 = Release|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Release|Win32.Build.0 = Release|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Release|Win32.ActiveCfg = Release|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Release|x86.Build.0 = Release|Any CPU
{DCA2703D-250A-463E-A68A-07ED105AE6BD}.Release|x86.ActiveCfg = Release|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Debug|Win32.Build.0 = Debug|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Debug|Win32.ActiveCfg = Debug|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Debug|x86.Build.0 = Debug|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Release|Any CPU.Build.0 = Release|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Release|Win32.Build.0 = Release|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Release|Win32.ActiveCfg = Release|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Release|x86.Build.0 = Release|Any CPU
{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}.Release|x86.ActiveCfg = Release|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Debug|Win32.Build.0 = Debug|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Debug|Win32.ActiveCfg = Debug|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Debug|x86.Build.0 = Debug|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Debug|x86.ActiveCfg = Debug|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Release|Any CPU.Build.0 = Release|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Release|Win32.Build.0 = Release|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Release|Win32.ActiveCfg = Release|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Release|x86.Build.0 = Release|Any CPU
{1152B71B-3C05-4598-B20D-823B5D40559E}.Release|x86.ActiveCfg = Release|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Win32.Build.0 = Debug|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Win32.ActiveCfg = Debug|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|x86.Build.0 = Debug|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|x86.ActiveCfg = Debug|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.Build.0 = Release|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Win32.Build.0 = Release|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Win32.ActiveCfg = Release|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|x86.Build.0 = Release|Any CPU
{1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|x86.ActiveCfg = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|x86.Build.0 = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|x86.ActiveCfg = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|x86.Build.0 = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|x86.ActiveCfg = Release|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|x86.Build.0 = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|x86.ActiveCfg = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Release|x86.Build.0 = Release|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Release|x86.ActiveCfg = Release|Any CPU
{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}.Debug|x86.Build.0 = Debug|Any CPU
{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}.Debug|x86.ActiveCfg = Debug|Any CPU
{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}.Release|x86.Build.0 = Release|Any CPU
{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}.Release|x86.ActiveCfg = Release|Any CPU
{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51}.Debug|x86.Build.0 = Debug|Any CPU
{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51}.Debug|x86.ActiveCfg = Debug|Any CPU
{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51}.Release|x86.Build.0 = Release|Any CPU
{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51}.Release|x86.ActiveCfg = Release|Any CPU
{9196DD8A-B4D4-4780-8742-C5762E547FC2}.Debug|x86.Build.0 = Debug|Any CPU
{9196DD8A-B4D4-4780-8742-C5762E547FC2}.Debug|x86.ActiveCfg = Debug|Any CPU
{9196DD8A-B4D4-4780-8742-C5762E547FC2}.Release|x86.Build.0 = Release|Any CPU
{9196DD8A-B4D4-4780-8742-C5762E547FC2}.Release|x86.ActiveCfg = Release|Any CPU
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Debug|x86.Build.0 = Debug|Any CPU
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Debug|x86.ActiveCfg = Debug|Any CPU
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Release|x86.Build.0 = Release|Any CPU
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Release|x86.ActiveCfg = Release|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|x86.Build.0 = Debug|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|x86.ActiveCfg = Debug|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|x86.Build.0 = Release|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|x86.ActiveCfg = Release|Any CPU
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|x86.Build.0 = Debug|Any CPU
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|x86.ActiveCfg = Debug|Any CPU
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Release|x86.Build.0 = Release|Any CPU
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Release|x86.ActiveCfg = Release|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.Build.0 = Debug|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.ActiveCfg = Debug|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.Build.0 = Release|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.ActiveCfg = Release|Any CPU
{2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Debug|x86.Build.0 = Debug|Any CPU
{2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Debug|x86.ActiveCfg = Debug|Any CPU
{2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|x86.Build.0 = Release|Any CPU
{2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|x86.ActiveCfg = Release|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|x86.Build.0 = Debug|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|x86.ActiveCfg = Debug|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|x86.Build.0 = Release|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|x86.ActiveCfg = Release|Any CPU
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.Build.0 = Debug|Any CPU
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.ActiveCfg = Debug|Any CPU
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.Build.0 = Release|Any CPU
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.ActiveCfg = Release|Any CPU
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|x86.Build.0 = Debug|Any CPU
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|x86.ActiveCfg = Debug|Any CPU
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|x86.Build.0 = Release|Any CPU
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|x86.ActiveCfg = Release|Any CPU
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|x86.Build.0 = Debug|Any CPU
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|x86.ActiveCfg = Debug|Any CPU
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|x86.Build.0 = Release|Any CPU
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|x86.ActiveCfg = Release|Any CPU
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.Build.0 = Debug|Any CPU
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.ActiveCfg = Debug|Any CPU
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.Build.0 = Release|Any CPU
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

17
data/resources/StringResources.de.resx

@ -1498,6 +1498,12 @@ Beispiele: "120", "MainClass", "Main.cs, 120".</value> @@ -1498,6 +1498,12 @@ Beispiele: "120", "MainClass", "Main.cs, 120".</value>
<data name="Dialog.HighlightingEditor.ColorDlg.Italic" xml:space="preserve">
<value>Kursiv</value>
</data>
<data name="Dialog.HighlightingEditor.Export" xml:space="preserve">
<value>Hervorhebungsfarben exportieren</value>
</data>
<data name="Dialog.HighlightingEditor.Import" xml:space="preserve">
<value>Hervorhebungsfarben importieren</value>
</data>
<data name="Dialog.HighlightingEditor.Properties.Value" xml:space="preserve">
<value>Wert</value>
</data>
@ -2181,11 +2187,14 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen?</value> @@ -2181,11 +2187,14 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen?</value>
<value>Deaktiviert</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.MarkersGroupBox" xml:space="preserve">
<value>Markierungen und Liniale</value>
<value>Markierungen</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.PanelName" xml:space="preserve">
<value>Markierungen und Liniale</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.RulersGroupBox" xml:space="preserve">
<value>Lineale</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.ShowHiddenDefinitionsCheckBox" xml:space="preserve">
<value>Verdeckte Definitionen anzeigen (nur geschweifte Klammern)</value>
</data>
@ -5393,6 +5402,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< @@ -5393,6 +5402,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension<
<data name="OpenFileTabEventHandler.OpenCommandPromptHere" xml:space="preserve">
<value>Kommandozeile hier öffnen</value>
</data>
<data name="PortableLibrary.ChooseTargetFrameworks" xml:space="preserve">
<value>Ziel-Frameworks wählen</value>
</data>
<data name="PortableLibrary.CouldNotFindTools" xml:space="preserve">
<value>Konnte die Portable Class Library Tools nicht finden.</value>
</data>
<data name="ProjectBrowser.Toolbar.CollapseAll" xml:space="preserve">
<value>Alle Knoten einklappen</value>
</data>

37
data/resources/StringResources.it.resx

@ -1860,6 +1860,9 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}?</value> @@ -1860,6 +1860,9 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}?</value>
<data name="Dialog.Options.IDEOptions.Debugging.Stepping" xml:space="preserve">
<value>Stepping</value>
</data>
<data name="Dialog.Options.IDEOptions.Debugging.Stepping.DecompileCodeWithoutSymbols" xml:space="preserve">
<value>Decompila codice senza simboli</value>
</data>
<data name="Dialog.Options.IDEOptions.Debugging.Stepping.EnableJustMyCode" xml:space="preserve">
<value>Usa 'Just My Code' per debug passo-passo</value>
</data>
@ -3692,7 +3695,7 @@ ${File} @@ -3692,7 +3695,7 @@ ${File}
<value>Proprietà Griglia</value>
</data>
<data name="ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.HeightLabel" xml:space="preserve">
<value>A&amp;ltezza</value>
<value>&amp;Altezza</value>
</data>
<data name="ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.GridOptionsPanel.InPlaceEditCheckBox" xml:space="preserve">
<value>Abilita modifica in-linea dei ToolStrips</value>
@ -4011,6 +4014,9 @@ Sono ammesse solo lettere, numeri, spazi, '.' o '_'.</value> @@ -4011,6 +4014,9 @@ Sono ammesse solo lettere, numeri, spazi, '.' o '_'.</value>
<data name="ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.PublicKeyToken.Description" xml:space="preserve">
<value>Il token di chiave pubblica</value>
</data>
<data name="ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.ReferenceOutputAssembly" xml:space="preserve">
<value>Referenzia assembly</value>
</data>
<data name="ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.SpecificVersion" xml:space="preserve">
<value>Versione Specifica</value>
</data>
@ -4056,6 +4062,9 @@ Sono ammesse solo lettere, numeri, spazi, '.' o '_'.</value> @@ -4056,6 +4062,9 @@ Sono ammesse solo lettere, numeri, spazi, '.' o '_'.</value>
<data name="ICSharpCode.SharpDevelop.LoadingFile" xml:space="preserve">
<value>Caricamento ${Filename}...</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.CloseSolution" xml:space="preserve">
<value>Chiudi soluzione</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.KeepOldSolution" xml:space="preserve">
<value>Mantieni aperta la vecchia soluzione</value>
</data>
@ -4089,6 +4098,13 @@ Sono ammesse solo lettere, numeri, spazi, '.' o '_'.</value> @@ -4089,6 +4098,13 @@ Sono ammesse solo lettere, numeri, spazi, '.' o '_'.</value>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.Title" xml:space="preserve">
<value>Aggiorna Progetto</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.UpdateOnLoadDueToMissingMSBuild" xml:space="preserve">
<value>Il progetto '${ProjectName}' usa MSBuild ${OldToolsVersion}, ma questa versione non è installata.
Vuoi aggiornare il progetto a MSBuild ${NewToolsVersion}? Il progetto non può essere aperto senza essere aggiornato.</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.UpdateToMSBuildButton" xml:space="preserve">
<value>Aggiorna a MSBuild ${NewToolsVersion}</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.UpgradeFromPreviousVersionDescription" xml:space="preserve">
<value>Questa soluzione è stata creata con una versione precedente di SharpDevelop. Potresti volerla aggiornare così da utilizzare le nuove funzionalità del linguaggio o del framework.</value>
</data>
@ -4169,7 +4185,7 @@ Vai a 'Opzioni-&gt;Stile visuale' e cambia l'attuale ambiente di linguaggio.</va @@ -4169,7 +4185,7 @@ Vai a 'Opzioni-&gt;Stile visuale' e cambia l'attuale ambiente di linguaggio.</va
<value>ASP.NET/IIS (Express) worker process ({0}) non trovato.</value>
</data>
<data name="ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction" xml:space="preserve">
<value>Non è stato specificato nessun Url di Progetto o programma esterno. Controlla il web server su Proprietà Progetto - Debug.</value>
<value>Non è stato specificato nessun Url di Progetto o programma esterno. Controlla il web server sulla linguetta Proprietà Progetto - Web.</value>
</data>
<data name="ICSharpCode.WebProjectOptionsPanel.Port" xml:space="preserve">
<value>Porta server:</value>
@ -4788,7 +4804,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< @@ -4788,7 +4804,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension<
<value>Non si può passare ad una funzione senza simboli di debug.</value>
</data>
<data name="MainWindow.Windows.Debug.CallStack.CannotSwitchWithoutSymbolsOrDecompiledCodeOptions" xml:space="preserve">
<value>Non puoi passare ad una funzione senza simboli senza attivare le opzioni di decompilazione del codice.</value>
<value>Non puoi passare ad una funzione senza simboli. Ricompila con i simboli o attiva "Decompila codice senza simboli" nelle opzioni.</value>
</data>
<data name="MainWindow.Windows.Debug.CallStack.ExternalMethods" xml:space="preserve">
<value>[Metodi esterni]</value>
@ -4946,6 +4962,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< @@ -4946,6 +4962,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension<
<data name="MainWindow.Windows.Debug.LocalVariables.CopyToClipboard" xml:space="preserve">
<value>Copia il valore negli Appunti</value>
</data>
<data name="MainWindow.Windows.Debug.LocalVariables.NameColumn" xml:space="preserve">
<value>Nome</value>
</data>
<data name="MainWindow.Windows.Debug.LocalVariables.NonPublicMembers" xml:space="preserve">
<value>Membro Non-Pubblico</value>
</data>
@ -4967,6 +4986,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< @@ -4967,6 +4986,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension<
<data name="MainWindow.Windows.Debug.LocalVariables.StaticMembers" xml:space="preserve">
<value>Membri statici</value>
</data>
<data name="MainWindow.Windows.Debug.LocalVariables.TypeColumn" xml:space="preserve">
<value>Tipo</value>
</data>
<data name="MainWindow.Windows.Debug.LocalVariables.ValueColumn" xml:space="preserve">
<value>Valore</value>
</data>
<data name="MainWindow.Windows.Debug.MemoryPad" xml:space="preserve">
<value>Memoria</value>
</data>
@ -5006,12 +5031,18 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< @@ -5006,12 +5031,18 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension<
<data name="MainWindow.Windows.Debug.Modules.AddressColumn" xml:space="preserve">
<value>Indirizzo</value>
</data>
<data name="MainWindow.Windows.Debug.Modules.DynamicModule" xml:space="preserve">
<value>(dinamico)</value>
</data>
<data name="MainWindow.Windows.Debug.Modules.HasNoSymbols" xml:space="preserve">
<value>Nessun simbolo caricato.</value>
</data>
<data name="MainWindow.Windows.Debug.Modules.HasSymbols" xml:space="preserve">
<value>Simboli caricati.</value>
</data>
<data name="MainWindow.Windows.Debug.Modules.InMemoryModule" xml:space="preserve">
<value>(in memoria)</value>
</data>
<data name="MainWindow.Windows.Debug.Modules.OrderColumn" xml:space="preserve">
<value>Ordine</value>
</data>

54
data/resources/StringResources.nl.resx

@ -1501,6 +1501,12 @@ Voorbeelden: "120", "MainClass", "Main.cs, 120".</value> @@ -1501,6 +1501,12 @@ Voorbeelden: "120", "MainClass", "Main.cs, 120".</value>
<data name="Dialog.HighlightingEditor.ColorDlg.Italic" xml:space="preserve">
<value>Cursief</value>
</data>
<data name="Dialog.HighlightingEditor.Export" xml:space="preserve">
<value>Selectie kleuren expoorteren</value>
</data>
<data name="Dialog.HighlightingEditor.Import" xml:space="preserve">
<value>Selectie kleuren importeren</value>
</data>
<data name="Dialog.HighlightingEditor.Properties.Value" xml:space="preserve">
<value>Waarde</value>
</data>
@ -2184,11 +2190,14 @@ Wilt u het nieuwe bestand toevoegen aan project ${CurrentProjectName}?</value> @@ -2184,11 +2190,14 @@ Wilt u het nieuwe bestand toevoegen aan project ${CurrentProjectName}?</value>
<value>Geen</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.MarkersGroupBox" xml:space="preserve">
<value>Markeringen en Linealen</value>
<value>Markeringen</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.PanelName" xml:space="preserve">
<value>Markeringen en Linealen</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.RulersGroupBox" xml:space="preserve">
<value>Linealen</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.ShowHiddenDefinitionsCheckBox" xml:space="preserve">
<value>Toon &amp;verborgen definities(alleen haakjes)</value>
</data>
@ -2355,7 +2364,7 @@ Wilt u het nieuwe bestand toevoegen aan project ${CurrentProjectName}?</value> @@ -2355,7 +2364,7 @@ Wilt u het nieuwe bestand toevoegen aan project ${CurrentProjectName}?</value>
<value>32 bit Intel-compatibele processor</value>
</data>
<data name="Dialog.ProjectOptions.Build.TargetFramework" xml:space="preserve">
<value>Doel Framework:</value>
<value>Doel raamwerk:</value>
</data>
<data name="Dialog.ProjectOptions.Build.TreatWarningsAsErrors" xml:space="preserve">
<value>Behandel waarschuwingen als fouten</value>
@ -3046,7 +3055,7 @@ Er kan worden gekozen voor opslag van de instellingen in het .user bestand inpla @@ -3046,7 +3055,7 @@ Er kan worden gekozen voor opslag van de instellingen in het .user bestand inpla
<value>Bezig met Code Analyse...</value>
</data>
<data name="ICSharpCode.Build.UnknownTargetMonoFrameworkVersion" xml:space="preserve">
<value>Onbekend doel Mono Framework Versie:</value>
<value>Onbekend doel Mono Raamwerk Versie:</value>
</data>
<data name="ICSharpCode.CodeAnalysis" xml:space="preserve">
<value>Code Analyse</value>
@ -4090,7 +4099,7 @@ Alleen letters, getallen, spatie, '.' of '_' zijn toegestaan.</value> @@ -4090,7 +4099,7 @@ Alleen letters, getallen, spatie, '.' of '_' zijn toegestaan.</value>
<value>Converteer geselecteerde &amp;projecten naar</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.ChangeTargetFrameworkLabel" xml:space="preserve">
<value>Wijzig doel framework</value>
<value>Wijzig doel Raamwerk:</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.ChangeVersionGroupBoxHeader" xml:space="preserve">
<value>Versie van geselecteerde projecten wijzigen</value>
@ -4105,7 +4114,7 @@ Alleen letters, getallen, spatie, '.' of '_' zijn toegestaan.</value> @@ -4105,7 +4114,7 @@ Alleen letters, getallen, spatie, '.' of '_' zijn toegestaan.</value>
<value>&lt;niet wijzigen&gt;</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.TargetFramework" xml:space="preserve">
<value>Doel framework</value>
<value>Doel Raamwerk</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.Title" xml:space="preserve">
<value>Project opwaarderen</value>
@ -4119,7 +4128,7 @@ Zonder opwaarderen kan het project niet geopend wordenh.</value> @@ -4119,7 +4128,7 @@ Zonder opwaarderen kan het project niet geopend wordenh.</value>
<value>Opwaarderen naar MSBuild ${NewToolsVersion}</value>
</data>
<data name="ICSharpCode.SharpDevelop.Project.UpgradeView.UpgradeFromPreviousVersionDescription" xml:space="preserve">
<value>Deze oplossing werd met een vorige versie van SharpDevelop gemaakt. Door te upgraden kan gebruik gemaakt worden van nieuwe taal of framework mogelijkheden.</value>
<value>Deze oplossing werd met een eerdere versie van SharpDevelop gemaakt. Door te upgraden kan gebruik gemaakt worden van nieuwe taal- of raamwerk mogelijkheden.</value>
</data>
<data name="ICSharpCode.SharpDevelop.Services.AmbienceService.AmbienceNotFoundError" xml:space="preserve">
<value>Momentele ambience niet gevonden.
@ -4427,7 +4436,7 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie</v @@ -4427,7 +4436,7 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie</v
<value>WiX localisatie bestanden</value>
</data>
<data name="ICSharpCode.WixBinding.WixNetFxExtensionTitle" xml:space="preserve">
<value>.NET Framework uitbreiding</value>
<value>.NET Raamwerk uitbreiding</value>
</data>
<data name="ICSharpCode.WixBinding.WixPackageFilesDiffControl.NoDiffFound" xml:space="preserve">
<value>Geen verschil gevonden.</value>
@ -5383,6 +5392,27 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie</v @@ -5383,6 +5392,27 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie</v
<data name="OpenFileTabEventHandler.OpenCommandPromptHere" xml:space="preserve">
<value>Open hier de commando prompt</value>
</data>
<data name="PortableLibrary.ChooseTargetFrameworks" xml:space="preserve">
<value>Selecteer doel-raamwerken.</value>
</data>
<data name="PortableLibrary.CouldNotFindTools" xml:space="preserve">
<value>Kan Portable Klasse-bibliotheek gereedschap niet vinden.</value>
</data>
<data name="PortableLibrary.PortableSubset" xml:space="preserve">
<value>.NET Portable subset</value>
</data>
<data name="PortableLibrary.SelectAtLeastTwoFrameworks" xml:space="preserve">
<value>Er moeten tenminste twee raamwerken worden geselecteerd.</value>
</data>
<data name="PortableLibrary.SelectedProfile" xml:space="preserve">
<value>Gekozen profiel:</value>
</data>
<data name="PortableLibrary.SelectProfileDialog.Title" xml:space="preserve">
<value>Kies een Portable Bibliotheek profiel.</value>
</data>
<data name="PortableLibrary.ToolsInstallationHelp" xml:space="preserve">
<value>Om de portabele Klassebibliotheek gereedschappen te installeren zonder Visual Studio te installeren, sla het download bestand op (PortableLibraryTools.exe) op uw computer en voer de installatie uit via de commndoregel. Inclusief de /bouwmachine schakeling op de commandoregel.</value>
</data>
<data name="ProjectBrowser.Toolbar.CollapseAll" xml:space="preserve">
<value>Alle knooppunten invouwen</value>
</data>
@ -6639,6 +6669,12 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze.</value> @@ -6639,6 +6669,12 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze.</value>
<data name="Templates.Project.GtkSharpProject.Name" xml:space="preserve">
<value>Gtk# toepassing</value>
</data>
<data name="Templates.Project.PortableLibrary.Description" xml:space="preserve">
<value>Bibliotheek, bruikbaar bij Windows, Silverlight, Windows Phone en Xbox.</value>
</data>
<data name="Templates.Project.PortableLibrary.Name" xml:space="preserve">
<value>Portable Klassen-bibliotheek</value>
</data>
<data name="Templates.Project.SetupProject.Description" xml:space="preserve">
<value>Windows installatie project om een MSI installatie programma te maken.</value>
</data>
@ -6790,7 +6826,7 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze.</value> @@ -6790,7 +6826,7 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze.</value>
<value>Ontkoppel</value>
</data>
<data name="XML.MainMenu.DebugMenu.Error.BadAssembly" xml:space="preserve">
<value>Kan .NET Framework versie van het programma niet krijgen. Ga na of het programma een beheerde assembly is.</value>
<value>Kan .NET Raamwerk versie van het programma niet oproepen. Ga na of het programma een gemanagede assembly is.</value>
</data>
<data name="XML.MainMenu.DebugMenu.Error.CannotAttachToProcess" xml:space="preserve">
<value>Kan niet bij proces aanhaken.</value>
@ -6805,7 +6841,7 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze.</value> @@ -6805,7 +6841,7 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze.</value>
<value>Kan SharpDevelop foutopsporing niet starten omdat kernel foutopsporing is aangezet. Om de kernel foutopsporing uit te zetten, dient de schakeling "/debug" uit bestand Boot.ini verwijderd te worden en de computer opnieuw te worden opgestart.</value>
</data>
<data name="XML.MainMenu.DebugMenu.Error.Net10NotSupported" xml:space="preserve">
<value>Foutopsporing bij .NET Framework 1.0 programmas is niet ondersteund.</value>
<value>Foutopsporing bij .NET Raamwerk 1.0 programmas is niet ondersteund.</value>
</data>
<data name="XML.MainMenu.DebugMenu.Error.NotDebugging" xml:space="preserve">
<value>Kan actie niet uitvoeren omdat er geen foutopsporing van een proces plaatsvindt.</value>

43
data/resources/StringResources.resx

@ -1550,6 +1550,12 @@ Examples: "120", "MainClass", "Main.cs, 120".</value> @@ -1550,6 +1550,12 @@ Examples: "120", "MainClass", "Main.cs, 120".</value>
<data name="Dialog.HighlightingEditor.ColorDlg.Italic" xml:space="preserve">
<value>Italic</value>
</data>
<data name="Dialog.HighlightingEditor.Export" xml:space="preserve">
<value>Export highlighting colors</value>
</data>
<data name="Dialog.HighlightingEditor.Import" xml:space="preserve">
<value>Import highlighting colors</value>
</data>
<data name="Dialog.HighlightingEditor.Properties.Value" xml:space="preserve">
<value>Value</value>
</data>
@ -2256,11 +2262,14 @@ system. I don't think that it needs translation.</comment> @@ -2256,11 +2262,14 @@ system. I don't think that it needs translation.</comment>
<value>None</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.MarkersGroupBox" xml:space="preserve">
<value>Markers and Rulers</value>
<value>Markers</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.PanelName" xml:space="preserve">
<value>Markers and Rulers</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.RulersGroupBox" xml:space="preserve">
<value>Rulers</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.ShowHiddenDefinitionsCheckBox" xml:space="preserve">
<value>Show &amp;hidden definitions (brackets only)</value>
</data>
@ -5698,6 +5707,32 @@ Removed the end part of the original message ", reason '${Message}'" since this @@ -5698,6 +5707,32 @@ Removed the end part of the original message ", reason '${Message}'" since this
<data name="OpenFileTabEventHandler.OpenCommandPromptHere" xml:space="preserve">
<value>Open command prompt here</value>
</data>
<data name="PortableLibrary.ChooseTargetFrameworks" xml:space="preserve">
<value>choose target frameworks</value>
<comment>Option in the "target framework" combobox in the "project upgrade" view that causes the "select portable profile" dialog to appear</comment>
</data>
<data name="PortableLibrary.CouldNotFindTools" xml:space="preserve">
<value>Could not find Portable Class Library Tools.</value>
</data>
<data name="PortableLibrary.PortableSubset" xml:space="preserve">
<value>.NET Portable Subset</value>
<comment>Name for the portable target framework, shown in Project Upgrade view</comment>
</data>
<data name="PortableLibrary.SelectAtLeastTwoFrameworks" xml:space="preserve">
<value>Two or more frameworks must be selected.</value>
<comment>Label shown when only 0 or 1 frameworks are selected</comment>
</data>
<data name="PortableLibrary.SelectedProfile" xml:space="preserve">
<value>Selected profile:</value>
<comment>Label that shows the selected portable library profile</comment>
</data>
<data name="PortableLibrary.SelectProfileDialog.Title" xml:space="preserve">
<value>Select Portable Library Profile</value>
<comment>Title of the dialog used to pick the target frameworks for a portable library project</comment>
</data>
<data name="PortableLibrary.ToolsInstallationHelp" xml:space="preserve">
<value>To install the Portable Class Library Tools without installing Visual Studio, save the download file (PortableLibraryTools.exe) on your computer, and run the installation program from a Command Prompt window. Include the /buildmachine switch on the command line.</value>
</data>
<data name="ProjectBrowser.Toolbar.CollapseAll" xml:space="preserve">
<value>Collapse all nodes</value>
</data>
@ -7012,6 +7047,12 @@ The resources files have been renamed/moved accordingly.</value> @@ -7012,6 +7047,12 @@ The resources files have been renamed/moved accordingly.</value>
<value>Gtk# Application</value>
<comment>Name of Gtk# project template.</comment>
</data>
<data name="Templates.Project.PortableLibrary.Description" xml:space="preserve">
<value>Library that can be used on Windows, Silverlight, Windows Phone, and Xbox.</value>
</data>
<data name="Templates.Project.PortableLibrary.Name" xml:space="preserve">
<value>Portable Class Library</value>
</data>
<data name="Templates.Project.SetupProject.Description" xml:space="preserve">
<value>A windows installer project for creating a MSI installer.</value>
</data>

3191
data/resources/StringResources.tr.resx

File diff suppressed because it is too large Load Diff

2
data/templates/project/CSharp/ConsoleProject.xpt

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
</Actions>
<!-- Template Content -->
<Project language = "C#">
<Project language = "C#" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

2
data/templates/project/CSharp/FormsProject.xpt

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
<Open filename = "MainForm.cs"/>
</Actions>
<Project language = "C#">
<Project language = "C#" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

2
data/templates/project/CSharp/NotifyIcon.xpt

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
<Open filename = "NotificationIcon.cs"/>
</Actions>
<Project language="C#">
<Project language="C#" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

27
data/templates/project/CSharp/PortableAssemblyInfo.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
#region Using directives
using System;
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("${ProjectName}")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("${ProjectName}")]
[assembly: AssemblyCopyright("Copyright ${DATE:yyyy}")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]

58
data/templates/project/CSharp/PortableLibrary.xpt

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
<?xml version="1.0"?>
<Template originator = "Daniel Grunwald" created = "05/17/2012">
<!-- Template Header -->
<TemplateConfiguration>
<Name>${res:Templates.Project.PortableLibrary.Name}</Name>
<Category>C#</Category>
<Icon>C#.Project.Library</Icon>
<Description>${res:Templates.Project.PortableLibrary.Description}</Description>
</TemplateConfiguration>
<!-- Actions -->
<Actions>
<Open filename = "MyClass.cs"/>
</Actions>
<!-- Template Content -->
<Project language="C#">
<PreCreateActions>
<RunCommand path="/SharpDevelop/BackendBindings/TemplateCommands/CheckPortableLibraryInstalled"/>
</PreCreateActions>
<PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile1</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup escapeValue="False">
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<ProjectItems />
<Imports clear="True">
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
</Imports>
<Files>
<File name="MyClass.cs"><![CDATA[${StandardHeader.C#}
using System;
using System.Collections.Generic;
namespace ${StandardNamespace}
{
/// <summary>
/// Description of MyClass.
/// </summary>
public class MyClass
{
}
}]]></File>
<File name="Properties\AssemblyInfo.cs" src="PortableAssemblyInfo.cs"/>
</Files>
</Project>
</Template>

2
data/templates/project/CSharp/Service.xpt

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
</Actions>
<!-- Template Content -->
<Project language = "C#">
<Project language = "C#" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />

2
data/templates/project/CSharp/WPFApplication.xpt

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
<Open filename = "Window1.xaml"/>
</Actions>
<Project language = "C#">
<Project language = "C#" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

2
data/templates/project/CSharp/WPFNavigationApplication.xpt

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
<Open filename = "Page1.xaml"/>
</Actions>
<Project language = "C#">
<Project language = "C#" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

20
data/templates/project/ComplexExample.xpt.test

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
<!-- Actions -->
<Actions>
<Open filename = "Main.cs"/>
<!-- Runs a command from the AddIn Tree. ICommand.Owner will be the ProjectCreateInformation -->
<RunCommand path = "/SharpDevelop/BackendBindings/TemplateCommands/PostCreationAction"/>
</Actions>
<!-- Template Content -->
@ -33,7 +35,17 @@ @@ -33,7 +35,17 @@
<!-- Solution folders can contain: nested solution folders and projects -->
<SolutionFolder name = "Nested Sub Folder"/>
<Project name = "VBNetProject" directory = "VBNetSubProject" language="VBNet">
<Project name = "VBNetProject" directory = "VBNetSubProject" language="VBNet" defaultPlatform="x86">
<!-- Actions that get executed before the project is created. ICommand.Owner will be the ProjectCreateInformation. -->
<PreCreateActions>
<RunCommand path = "/SharpDevelop/BackendBindings/TemplateCommands/CheckPortableLibraryInstalled"/>
</PreCreateActions>
<!-- Actions that get executed after the project was created. ICommand.Owner will be the IProject. -->
<CreateActions>
<RunCommand path = "/SharpDevelop/BackendBindings/TemplateCommands/PostCreationAction"/>
</CreateActions>
<!-- add a PropertyGroup to the project to set MSBuild properties -->
<PropertyGroup>
<OutputType>WinExe</OutputType>
@ -123,11 +135,7 @@ End Class @@ -123,11 +135,7 @@ End Class
</Project>
</SolutionFolder>
<Project name = "${ProjectName}" directory = "." language = "C#">
<CreateActions>
<RunCommand path = "/SharpDevelop/BackendBindings/TemplateCommands/AddDotNet35ReferencesIfTargetFrameworkIs35"/>
</CreateActions>
<Project name = "${ProjectName}" directory = "." language = "C#" defaultPlatform="AnyCPU">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

2
data/templates/project/VB/ConsoleProject.xpt

@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
<!-- Template Content -->
<Project language = "VBNet">
<Project language = "VBNet" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

2
data/templates/project/VB/FormsProject.xpt

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
</Actions>
<!-- Template Content -->
<Project language="VBNet">
<Project language="VBNet" defaultPlatform="x86">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>

2
data/templates/project/VB/NotifyIcon.xpt

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
<Open filename = "NotificationIcon.vb"/>
</Actions>
<Project language="VBNet">
<Project language="VBNet" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

2
data/templates/project/VB/Service.xpt

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
<Open filename = "${ProjectName}.vb"/>
</Actions>
<Project language="VBNet">
<Project language="VBNet" defaultPlatform="x86">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>

2
data/templates/project/VB/WPFApplication.xpt

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
<Open filename = "Window1.xaml"/>
</Actions>
<Project language = "VBNet">
<Project language = "VBNet" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

2
data/templates/project/VB/WPFNavigationApplication.xpt

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
<Open filename = "Page1.xaml"/>
</Actions>
<Project language = "VBNet">
<Project language = "VBNet" defaultPlatform="x86">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />

1
src/AddIns/Analysis/UnitTesting/Test/Utils/MockCSharpProject.cs

@ -21,6 +21,7 @@ namespace UnitTesting.Tests.Utils @@ -21,6 +21,7 @@ namespace UnitTesting.Tests.Utils
: base(new ProjectCreateInformation {
Solution = solution,
ProjectName = name,
Platform = "x86",
TargetFramework = TargetFramework.Net40Client,
OutputProjectFileName = "c:\\projects\\" + name + "\\" + name + ".csproj"
})

87
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs

@ -55,8 +55,7 @@ namespace CSharpBinding @@ -55,8 +55,7 @@ namespace CSharpBinding
InitializeProjectContent(new CSharpProjectContent());
}
public const string DefaultTargetsFile = @"$(MSBuildBinPath)\Microsoft.CSharp.Targets";
public const string ExtendedTargetsFile = @"$(SharpDevelopBinPath)\SharpDevelop.Build.CSharp.targets";
public const string DefaultTargetsFile = @"$(MSBuildToolsPath)\Microsoft.CSharp.targets";
public CSharpProject(ProjectCreateInformation info)
: base(info)
@ -92,13 +91,35 @@ namespace CSharpBinding @@ -92,13 +91,35 @@ namespace CSharpBinding
}
}
protected override ProjectBehavior CreateDefaultBehavior()
{
return new CSharpProjectBehavior(this, base.CreateDefaultBehavior());
}
}
public class CSharpProjectBehavior : ProjectBehavior
{
public CSharpProjectBehavior(CSharpProject project, ProjectBehavior next = null)
: base(project, next)
{
}
public override ItemType GetDefaultItemType(string fileName)
{
if (string.Equals(Path.GetExtension(fileName), ".cs", StringComparison.OrdinalIgnoreCase))
return ItemType.Compile;
else
return base.GetDefaultItemType(fileName);
}
static readonly CompilerVersion msbuild20 = new CompilerVersion(new Version(2, 0), "C# 2.0");
static readonly CompilerVersion msbuild35 = new CompilerVersion(new Version(3, 5), "C# 3.0");
static readonly CompilerVersion msbuild40 = new CompilerVersion(new Version(4, 0), DotnetDetection.IsDotnet45Installed() ? "C# 5.0" : "C# 4.0");
public override CompilerVersion CurrentCompilerVersion {
get {
switch (MinimumSolutionVersion) {
switch (Project.MinimumSolutionVersion) {
case Solution.SolutionVersionVS2005:
return msbuild20;
case Solution.SolutionVersionVS2008:
@ -123,66 +144,6 @@ namespace CSharpBinding @@ -123,66 +144,6 @@ namespace CSharpBinding
return versions;
}
/*
protected override void AddOrRemoveExtensions()
{
// Test if SharpDevelop-Build extensions are required
bool needExtensions = false;
foreach (var p in GetAllProperties("TargetFrameworkVersion")) {
if (p.IsImported == false) {
if (p.Value.StartsWith("CF")) {
needExtensions = true;
}
}
}
foreach (Microsoft.Build.BuildEngine.Import import in MSBuildProject.Imports) {
if (needExtensions) {
if (DefaultTargetsFile.Equals(import.ProjectPath, StringComparison.OrdinalIgnoreCase)) {
//import.ProjectPath = extendedTargets;
MSBuildInternals.SetImportProjectPath(this, import, ExtendedTargetsFile);
// Workaround for SD2-1490. It would be better if the project browser could refresh itself
// when necessary.
ProjectBrowserPad.Instance.ProjectBrowserControl.RefreshView();
break;
}
} else {
if (ExtendedTargetsFile.Equals(import.ProjectPath, StringComparison.OrdinalIgnoreCase)) {
//import.ProjectPath = defaultTargets;
MSBuildInternals.SetImportProjectPath(this, import, DefaultTargetsFile);
// Workaround for SD2-1490. It would be better if the project browser could refresh itself
// when necessary.
ProjectBrowserPad.Instance.ProjectBrowserControl.RefreshView();
break;
}
}
}
}
*/
protected override ProjectBehavior CreateDefaultBehavior()
{
return new CSharpProjectBehavior(this, base.CreateDefaultBehavior());
}
}
public class CSharpProjectBehavior : ProjectBehavior
{
public CSharpProjectBehavior(CSharpProject project, ProjectBehavior next = null)
: base(project, next)
{
}
public override ItemType GetDefaultItemType(string fileName)
{
if (string.Equals(Path.GetExtension(fileName), ".cs", StringComparison.OrdinalIgnoreCase))
return ItemType.Compile;
else
return base.GetDefaultItemType(fileName);
}
public override ISymbolSearch PrepareSymbolSearch(IEntity entity)
{
return CompositeSymbolSearch.Create(new CSharpSymbolSearch(Project, entity), base.PrepareSymbolSearch(entity));

18
src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs

@ -832,22 +832,14 @@ namespace ICSharpCode.VBNetBinding @@ -832,22 +832,14 @@ namespace ICSharpCode.VBNetBinding
internal static bool IsBlockEnd(Token current, Token prev)
{
if (current.Kind == Tokens.Next) {
if (prev.Kind == Tokens.Resume)
return false;
else
return true;
}
if (current.Kind == Tokens.Next)
return prev.Kind == Tokens.EOL || prev.Kind == Tokens.Colon;
if (current.Kind == Tokens.Loop)
return true;
return prev.Kind == Tokens.EOL || prev.Kind == Tokens.Colon;
if (blockTokens.Contains(current.Kind)) {
if (prev.Kind == Tokens.End)
return true;
else
return false;
}
if (blockTokens.Contains(current.Kind))
return prev.Kind == Tokens.End;
return IsSpecialCase(current, prev);
}

40
src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs

@ -50,8 +50,7 @@ namespace ICSharpCode.VBNetBinding @@ -50,8 +50,7 @@ namespace ICSharpCode.VBNetBinding
InitVB();
}
public const string DefaultTargetsFile = @"$(MSBuildBinPath)\Microsoft.VisualBasic.Targets";
public const string ExtendedTargetsFile = @"$(SharpDevelopBinPath)\SharpDevelop.Build.VisualBasic.targets";
public const string DefaultTargetsFile = @"$(MSBuildToolsPath)\Microsoft.VisualBasic.targets";
public VBNetProject(ProjectCreateInformation info)
: base(info)
@ -109,43 +108,6 @@ namespace ICSharpCode.VBNetBinding @@ -109,43 +108,6 @@ namespace ICSharpCode.VBNetBinding
}
}
/*
protected override void AddOrRemoveExtensions()
{
// Test if SharpDevelop-Build extensions are required
bool needExtensions = false;
foreach (var p in GetAllProperties("TargetFrameworkVersion")) {
if (p.IsImported == false) {
if (p.Value.StartsWith("CF")) {
needExtensions = true;
}
}
}
foreach (Microsoft.Build.BuildEngine.Import import in MSBuildProject.Imports) {
if (needExtensions) {
if (DefaultTargetsFile.Equals(import.ProjectPath, StringComparison.OrdinalIgnoreCase)) {
//import.ProjectPath = extendedTargets;
MSBuildInternals.SetImportProjectPath(this, import, ExtendedTargetsFile);
// Workaround for SD2-1490. It would be better if the project browser could refresh itself
// when necessary.
ProjectBrowserPad.Instance.ProjectBrowserControl.RefreshView();
break;
}
} else {
if (ExtendedTargetsFile.Equals(import.ProjectPath, StringComparison.OrdinalIgnoreCase)) {
//import.ProjectPath = defaultTargets;
MSBuildInternals.SetImportProjectPath(this, import, DefaultTargetsFile);
// Workaround for SD2-1490. It would be better if the project browser could refresh itself
// when necessary.
ProjectBrowserPad.Instance.ProjectBrowserControl.RefreshView();
break;
}
}
}
}*/
public Nullable<bool> OptionInfer {
get { return GetValue("OptionInfer", false); }
}

48
src/AddIns/BackendBindings/VBNetBinding/Test/FormattingStrategy/IndentationTests.cs

@ -524,6 +524,54 @@ End Module"; @@ -524,6 +524,54 @@ End Module";
RunFormatTest(code, expected);
}
[Test]
public void ForNextOneLine()
{
string expected = @"Module Core
Sub Main
Dim a = 1
For i = 0 To 10 : Console.WriteLine(i) : Next
Dim b = 2
End Sub
End Module";
string code = @"Module Core
Sub Main
Dim a = 1
For i = 0 To 10 : Console.WriteLine(i) : Next
Dim b = 2
End Sub
End Module";
RunFormatTest(code, expected);
}
[Test]
public void RandomNext()
{
string expected = @"Module Core
Public Function GetRandomNumber( _
Optional ByVal Low As Integer = 1, _
Optional ByVal High As Integer = 100) As Integer
' Returns a random number,
' between the optional Low and High parameters
Return objRandom.Next(Low, High + 1)
End Function
End Module";
string code = @"Module Core
Public Function GetRandomNumber( _
Optional ByVal Low As Integer = 1, _
Optional ByVal High As Integer = 100) As Integer
' Returns a random number,
' between the optional Low and High parameters
Return objRandom.Next(Low, High + 1)
End Function
End Module";
RunFormatTest(code, expected);
}
void RunFormatTest(string code, string expectedCode)
{
AvalonEditTextEditorAdapter editor = new AvalonEditTextEditorAdapter(new TextEditor());

2
src/AddIns/BackendBindings/VBNetBinding/Test/MockTextEditor.cs

@ -49,7 +49,7 @@ namespace ICSharpCode.VBNetBinding.Tests @@ -49,7 +49,7 @@ namespace ICSharpCode.VBNetBinding.Tests
}
}
this.TextEditor.TextArea.TextView.Services.AddService(typeof(ISyntaxHighlighter), new AvalonEditSyntaxHighlighterAdapter(this.TextEditor));
// this.TextEditor.TextArea.TextView.Services.AddService(typeof(ISyntaxHighlighter), new AvalonEditSyntaxHighlighterAdapter(this.TextEditor));
this.TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("VBNet");
new VBNetLanguageBinding().Attach(this);

2
src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/MockTextEditor.cs

@ -50,7 +50,7 @@ namespace ICSharpCode.XamlBinding.Tests @@ -50,7 +50,7 @@ namespace ICSharpCode.XamlBinding.Tests
}
}
this.TextEditor.TextArea.TextView.Services.AddService(typeof(ISyntaxHighlighter), new AvalonEditSyntaxHighlighterAdapter(this.TextEditor));
// this.TextEditor.TextArea.TextView.Services.AddService(typeof(ISyntaxHighlighter), new AvalonEditSyntaxHighlighterAdapter(this.TextEditor));
this.TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML");
new XamlLanguageBinding().Attach(this);

4
src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingSymbolsPanel.resx

@ -112,9 +112,9 @@ @@ -112,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

9
src/AddIns/Debugger/Debugger.Core/IDStringProvider.cs

@ -5,6 +5,7 @@ using System; @@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Debugger.MetaData;
namespace Debugger
{
@ -42,7 +43,11 @@ namespace Debugger @@ -42,7 +43,11 @@ namespace Debugger
MethodInfo mr = (MethodInfo)member;
if (mr.IsGenericMethod) {
b.Append("``");
b.Append(mr.GetGenericArguments().Length);
// DebugMethodInfo does not implement GetGenericArguments
if (mr is DebugMethodInfo)
b.Append(((DebugMethodInfo)mr).GenericParameterCount);
else
b.Append(mr.GetGenericArguments().Length);
}
parameters = mr.GetParameters();
if (mr.Name == "op_Implicit" || mr.Name == "op_Explicit") {
@ -73,7 +78,7 @@ namespace Debugger @@ -73,7 +78,7 @@ namespace Debugger
return;
}
if (type.IsGenericType) {
AppendTypeNameWithArguments(b, type.GetElementType(), type.GetGenericArguments());
AppendTypeNameWithArguments(b, type, type.GetGenericArguments());
} else if (type.HasElementType) {
AppendTypeName(b, type.GetElementType());
if (type.IsArray) {

7
src/AddIns/Debugger/Debugger.Core/MetaData/DebugMethodInfo.cs

@ -195,6 +195,13 @@ namespace Debugger.MetaData @@ -195,6 +195,13 @@ namespace Debugger.MetaData
get { return this.MethodDefSig.GenericParameterCount > 0; }
}
/// <summary>
/// Gets the number of generic parameters on this method.
/// </summary>
public int GenericParameterCount {
get { return this.MethodDefSig.GenericParameterCount; }
}
/// <inheritdoc/>
public override RuntimeMethodHandle MethodHandle {
get { throw new NotSupportedException(); }

3
src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj

@ -67,6 +67,9 @@ @@ -67,6 +67,9 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>

37
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs

@ -43,6 +43,35 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -43,6 +43,35 @@ namespace ICSharpCode.AvalonEdit.AddIn
}
}
#region Brushes
public static readonly DependencyProperty AddedLineBrushProperty =
DependencyProperty.Register("AddedLineBrush", typeof(Brush), typeof(ChangeMarkerMargin),
new FrameworkPropertyMetadata(Brushes.LightGreen));
public Brush AddedLineBrush {
get { return (Brush)GetValue(AddedLineBrushProperty); }
set { SetValue(AddedLineBrushProperty, value); }
}
public static readonly DependencyProperty ChangedLineBrushProperty =
DependencyProperty.Register("ChangedLineBrush", typeof(Brush), typeof(ChangeMarkerMargin),
new FrameworkPropertyMetadata(Brushes.LightBlue));
public Brush ChangedLineBrush {
get { return (Brush)GetValue(ChangedLineBrushProperty); }
set { SetValue(ChangedLineBrushProperty, value); }
}
public static readonly DependencyProperty UnsavedLineBrushProperty =
DependencyProperty.Register("UnsavedLineBrush", typeof(Brush), typeof(ChangeMarkerMargin),
new FrameworkPropertyMetadata(Brushes.Yellow));
public Brush UnsavedLineBrush {
get { return (Brush)GetValue(UnsavedLineBrushProperty); }
set { SetValue(UnsavedLineBrushProperty, value); }
}
#endregion
protected override void OnRender(DrawingContext drawingContext)
{
Size renderSize = this.RenderSize;
@ -52,7 +81,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -52,7 +81,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
var zeroLineInfo = changeWatcher.GetChange(0);
foreach (VisualLine line in textView.VisualLines) {
Rect rect = new Rect(0, line.VisualTop - textView.ScrollOffset.Y, 5, line.Height);
Rect rect = new Rect(0, line.VisualTop - textView.ScrollOffset.Y - 1, 5, line.Height + 2);
LineChangeInfo info = changeWatcher.GetChange(line.FirstDocumentLine.LineNumber);
@ -64,14 +93,14 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -64,14 +93,14 @@ namespace ICSharpCode.AvalonEdit.AddIn
case ChangeType.None:
break;
case ChangeType.Added:
drawingContext.DrawRectangle(Brushes.LightGreen, null, rect);
drawingContext.DrawRectangle(AddedLineBrush, null, rect);
break;
case ChangeType.Deleted:
case ChangeType.Modified:
drawingContext.DrawRectangle(Brushes.LightBlue, null, rect);
drawingContext.DrawRectangle(ChangedLineBrush, null, rect);
break;
case ChangeType.Unsaved:
drawingContext.DrawRectangle(Brushes.Yellow, null, rect);
drawingContext.DrawRectangle(UnsavedLineBrush, null, rect);
break;
default:
throw new Exception("Invalid value for ChangeType");

34
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs

@ -36,7 +36,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -36,7 +36,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
/// Integrates AvalonEdit with SharpDevelop.
/// Also provides support for Split-View (showing two AvalonEdit instances using the same TextDocument)
/// </summary>
public class CodeEditor : Grid, IDisposable, ICodeEditor
public class CodeEditor : Grid, IDisposable
{
const string contextMenuPath = "/SharpDevelop/ViewContent/AvalonEdit/ContextMenu";
@ -144,9 +144,9 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -144,9 +144,9 @@ namespace ICSharpCode.AvalonEdit.AddIn
SD.ParserService.ParseInformationUpdated += ParserServiceParseInformationUpdated;
this.FlowDirection = FlowDirection.LeftToRight; // code editing is always left-to-right
this.document = new TextDocument();
this.CommandBindings.Add(new CommandBinding(SharpDevelopRoutedCommands.SplitView, OnSplitView));
textMarkerService = new TextMarkerService(this);
textMarkerService = new TextMarkerService(document);
iconBarManager = new IconBarManager();
if (CodeEditorOptions.Instance.EnableChangeMarkerMargin) {
changeWatcher = new DefaultChangeWatcher();
@ -156,9 +156,6 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -156,9 +156,6 @@ namespace ICSharpCode.AvalonEdit.AddIn
Debug.Assert(primaryTextEditorAdapter != null);
activeTextEditor = primaryTextEditor;
this.Document = primaryTextEditor.Document;
primaryTextEditor.SetBinding(TextEditor.DocumentProperty, new Binding("Document") { Source = this });
this.ColumnDefinitions.Add(new ColumnDefinition());
this.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
this.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star), MinHeight = minRowHeight });
@ -180,6 +177,8 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -180,6 +177,8 @@ namespace ICSharpCode.AvalonEdit.AddIn
primaryTextEditor.UpdateCustomizedHighlighting();
if (secondaryTextEditor != null)
secondaryTextEditor.UpdateCustomizedHighlighting();
foreach (var bookmark in BookmarkManager.GetBookmarks(fileName).OfType<SDMarkerBookmark>())
bookmark.SetMarker();
}
/// <summary>
@ -190,6 +189,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -190,6 +189,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
CodeEditorView codeEditorView = new CodeEditorView();
CodeEditorAdapter adapter = new CodeEditorAdapter(this, codeEditorView);
codeEditorView.Adapter = adapter;
codeEditorView.Document = document;
TextView textView = codeEditorView.TextArea.TextView;
textView.Services.AddService(typeof(ITextEditor), adapter);
textView.Services.AddService(typeof(CodeEditor), this);
@ -304,11 +304,29 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -304,11 +304,29 @@ namespace ICSharpCode.AvalonEdit.AddIn
NewLineConsistencyCheck.StartConsistencyCheck(this);
}
bool documentFirstLoad = true;
bool clearUndoStackOnSwitch = true;
/// <summary>
/// Gets/Sets whether to clear the undo stack when reloading the document.
/// The default is true.
/// http://community.sharpdevelop.net/forums/t/15816.aspx
/// </summary>
public bool ClearUndoStackOnSwitch {
get { return clearUndoStackOnSwitch; }
set { clearUndoStackOnSwitch = value; }
}
void ReloadDocument(TextDocument document, string newContent)
{
var diff = new MyersDiffAlgorithm(new StringSequence(document.Text), new StringSequence(newContent));
document.Replace(0, document.TextLength, newContent, diff.GetEdits().ToOffsetChangeMap());
document.UndoStack.ClearAll();
if (this.ClearUndoStackOnSwitch || documentFirstLoad)
document.UndoStack.ClearAll();
if (documentFirstLoad)
documentFirstLoad = false;
}
public event EventHandler LoadedFileContent;
@ -331,8 +349,6 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -331,8 +349,6 @@ namespace ICSharpCode.AvalonEdit.AddIn
secondaryTextEditorAdapter = (CodeEditorAdapter)secondaryTextEditor.TextArea.GetService(typeof(ITextEditor));
Debug.Assert(primaryTextEditorAdapter != null);
secondaryTextEditor.SetBinding(TextEditor.DocumentProperty,
new Binding(TextEditor.DocumentProperty.Name) { Source = primaryTextEditor });
secondaryTextEditor.SetBinding(TextEditor.IsReadOnlyProperty,
new Binding(TextEditor.IsReadOnlyProperty.Name) { Source = primaryTextEditor });
secondaryTextEditor.SyntaxHighlighting = primaryTextEditor.SyntaxHighlighting;

28
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs

@ -14,6 +14,7 @@ using System.Windows.Controls; @@ -14,6 +14,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using ICSharpCode.AvalonEdit.AddIn.ContextActions;
@ -95,13 +96,17 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -95,13 +96,17 @@ namespace ICSharpCode.AvalonEdit.AddIn
protected override void OnOptionChanged(PropertyChangedEventArgs e)
{
base.OnOptionChanged(e);
if (e.PropertyName == "HighlightBrackets")
HighlightBrackets(null, e);
else if (e.PropertyName == "EnableFolding")
UpdateParseInformationForFolding();
else if (e.PropertyName == "HighlightSymbol") {
//if (this.caretReferencesRenderer != null)
// this.caretReferencesRenderer.ClearHighlight();
switch (e.PropertyName) {
case "HighlightBrackets":
HighlightBrackets(null, e);
break;
case "EnableFolding":
UpdateParseInformationForFolding();
break;
case "HighlightSymbol":
//if (this.caretReferencesRenderer != null)
// this.caretReferencesRenderer.ClearHighlight();
break;
}
}
@ -584,18 +589,13 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -584,18 +589,13 @@ namespace ICSharpCode.AvalonEdit.AddIn
string language = this.SyntaxHighlighting != null ? this.SyntaxHighlighting.Name : null;
CustomizableHighlightingColorizer.ApplyCustomizationsToDefaultElements(this, FetchCustomizations(language));
BracketHighlightRenderer.ApplyCustomizationsToRendering(this.bracketRenderer, FetchCustomizations(language));
HighlightingOptions.ApplyToFolding(this, FetchCustomizations(language));
HighlightingOptions.ApplyToRendering(this, FetchCustomizations(language));
this.TextArea.TextView.Redraw(); // manually redraw if default elements didn't change but customized highlightings did
}
static IEnumerable<CustomizedHighlightingColor> FetchCustomizations(string languageName)
{
// Access CustomizedHighlightingColor.ActiveColors within enumerator so that always the latest version is used.
// Using CustomizedHighlightingColor.ActiveColors.Where(...) would not work correctly!
foreach (CustomizedHighlightingColor color in CustomizedHighlightingColor.ActiveColors) {
if (color.Language == null || color.Language == languageName)
yield return color;
}
return CustomizedHighlightingColor.FetchCustomizations(languageName);
}
}
}

5
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsBulbControl.xaml

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn.ContextActions"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
<UserControl.Resources>
@ -225,9 +226,9 @@ @@ -225,9 +226,9 @@
</Border>
<!-- Content -->
<Border x:Name="ContentBorder" Padding="0 0 8 8" Grid.Row="1" Grid.Column="0" MinWidth="200" Background="White">
<Border x:Name="ContentBorder" Padding="0 0 8 8" Grid.Row="1" Grid.Column="0" MinWidth="200">
<aero:SystemDropShadowChrome>
<Border BorderThickness="1" Padding="0" Margin="0" BorderBrush="{StaticResource OuterBorderBrush}">
<Border BorderThickness="1" Padding="0" Margin="0" Background="White" BorderBrush="{StaticResource OuterBorderBrush}">
<StackPanel Orientation="Vertical">
<local:ContextActionsControl x:Name="ActionsTreeView"
DataContext="{Binding Actions}">

91
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizableHighlightingColorizer.cs

@ -28,6 +28,9 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -28,6 +28,9 @@ namespace ICSharpCode.AvalonEdit.AddIn
public const string SelectedText = "Selected text";
public const string NonPrintableCharacters = "Non-printable characters";
public const string LineNumbers = "Line numbers";
public const string LinkText = "Link text";
public const string BreakpointMarker = "Breakpoint";
public const string InstructionPointerMarker = "Current statement";
public static void ApplyCustomizationsToDefaultElements(TextEditor textEditor, IEnumerable<CustomizedHighlightingColor> customizations)
{
@ -38,6 +41,9 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -38,6 +41,9 @@ namespace ICSharpCode.AvalonEdit.AddIn
textEditor.TextArea.ClearValue(TextArea.SelectionBrushProperty);
textEditor.TextArea.ClearValue(TextArea.SelectionForegroundProperty);
textEditor.TextArea.TextView.ClearValue(TextView.NonPrintableCharacterBrushProperty);
textEditor.TextArea.TextView.ClearValue(TextView.LinkTextForegroundBrushProperty);
textEditor.TextArea.TextView.ClearValue(TextView.LinkTextBackgroundBrushProperty);
textEditor.TextArea.TextView.ClearValue(TextView.ColumnRulerBrushProperty);
// 'assigned' flags are used so that the first matching customization wins.
// This is necessary because more specific customizations come first in the list
@ -46,6 +52,9 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -46,6 +52,9 @@ namespace ICSharpCode.AvalonEdit.AddIn
bool assignedSelectedText = false;
bool assignedNonPrintableCharacter = false;
bool assignedLineNumbers = false;
bool assignedLinkText = false;
bool assignedColumnRulerColor = false;
foreach (CustomizedHighlightingColor color in customizations) {
switch (color.Name) {
case DefaultTextAndBackground:
@ -92,6 +101,22 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -92,6 +101,22 @@ namespace ICSharpCode.AvalonEdit.AddIn
if (color.Foreground != null)
textEditor.LineNumbersForeground = CreateFrozenBrush(color.Foreground.Value);
break;
case LinkText:
if (assignedLinkText)
continue;
assignedLinkText = true;
if (color.Foreground != null)
textEditor.TextArea.TextView.LinkTextForegroundBrush = CreateFrozenBrush(color.Foreground.Value);
if (color.Background != null)
textEditor.TextArea.TextView.LinkTextBackgroundBrush = CreateFrozenBrush(color.Background.Value);
break;
case ColumnRulerRenderer.Name:
if (assignedColumnRulerColor)
continue;
assignedColumnRulerColor = true;
if (color.Foreground != null)
textEditor.TextArea.TextView.ColumnRulerBrush = CreateFrozenBrush(color.Foreground.Value);
break;
}
}
}
@ -217,37 +242,11 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -217,37 +242,11 @@ namespace ICSharpCode.AvalonEdit.AddIn
line.MergeWith(h.HighlightLine(lineNumber));
}
foreach (HighlightedSection section in line.Sections) {
section.Color = CustomizeColor(section.Color);
section.Color = CustomizeColor(section.Color, customizations);
}
return line;
}
HighlightingColor CustomizeColor(HighlightingColor color)
{
if (color == null || color.Name == null)
return color;
foreach (CustomizedHighlightingColor customization in customizations) {
if (customization.Name == color.Name) {
return new HighlightingColor {
Name = color.Name,
Background = CreateBrush(customization.Background),
Foreground = CreateBrush(customization.Foreground),
FontWeight = customization.Bold ? FontWeights.Bold : FontWeights.Normal,
FontStyle = customization.Italic ? FontStyles.Italic : FontStyles.Normal
};
}
}
return color;
}
static HighlightingBrush CreateBrush(Color? color)
{
if (color == null)
return null;
else
return new CustomizedBrush(color.Value);
}
public void InvalidateLine(IDocumentLine line)
{
textView.Redraw(line, DispatcherPriority.Background);
@ -284,6 +283,42 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -284,6 +283,42 @@ namespace ICSharpCode.AvalonEdit.AddIn
}
return result;
}
public HighlightingColor GetNamedColor(string name)
{
return CustomizeColor(name, CustomizedHighlightingColor.FetchCustomizations(highlightingDefinition.Name));
}
}
internal static HighlightingColor CustomizeColor(HighlightingColor color, IEnumerable<CustomizedHighlightingColor> customizations)
{
if (color == null || color.Name == null)
return color;
return CustomizeColor(color.Name, customizations) ?? color;
}
internal static HighlightingColor CustomizeColor(string name, IEnumerable<CustomizedHighlightingColor> customizations)
{
foreach (CustomizedHighlightingColor customization in customizations) {
if (customization.Name == name) {
return new HighlightingColor {
Name = name,
Background = CreateBrush(customization.Background),
Foreground = CreateBrush(customization.Foreground),
FontWeight = customization.Bold ? FontWeights.Bold : FontWeights.Normal,
FontStyle = customization.Italic ? FontStyles.Italic : FontStyles.Normal
};
}
}
return null;
}
static HighlightingBrush CreateBrush(Color? color)
{
if (color == null)
return null;
else
return new CustomizedBrush(color.Value);
}
sealed class CustomizedBrush : HighlightingBrush

10
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizedHighlightingColor.cs

@ -61,6 +61,16 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -61,6 +61,16 @@ namespace ICSharpCode.AvalonEdit.AddIn
}
}
public static IEnumerable<CustomizedHighlightingColor> FetchCustomizations(string languageName)
{
// Access CustomizedHighlightingColor.ActiveColors within enumerator so that always the latest version is used.
// Using CustomizedHighlightingColor.ActiveColors.Where(...) would not work correctly!
foreach (CustomizedHighlightingColor color in CustomizedHighlightingColor.ActiveColors) {
if (color.Language == null || color.Language == languageName)
yield return color;
}
}
/// <summary>
/// Occurs when the set of customized highlighting colors was changed.
/// </summary>

2
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CodeEditorOptions.cs

@ -254,7 +254,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -254,7 +254,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
int ITextEditorOptions.VerticalRulerColumn {
get { return 120; }
get { return ColumnRulerPosition; }
}
}
}

93
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml

@ -1,45 +1,62 @@ @@ -1,45 +1,62 @@
<gui:OptionPanel x:Class="ICSharpCode.AvalonEdit.AddIn.Options.HighlightingOptions" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit" xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn.Options">
<gui:OptionPanel x:Class="ICSharpCode.AvalonEdit.AddIn.Options.HighlightingOptions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn.Options">
<FrameworkElement.Resources>
<BooleanToVisibilityConverter x:Key="boolToVisibility" />
</FrameworkElement.Resources>
<DockPanel>
<StackPanel DockPanel.Dock="Right" Margin="4,0,0,0" DataContext="{Binding SelectedItem, ElementName=listBox}">
<Grid Margin="0,0,8,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" MinWidth="75" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0"
Content="{core:StringParse ${res:Dialog.HighlightingEditor.ColorDlg.Foreground}:}"
Visibility="{Binding CanSetBackground, Converter={StaticResource boolToVisibility}}" />
<gui:ColorPickerButton Value="{Binding Foreground}"
Text="{Binding UseDefaultForeground, Converter={x:Static local:BooleanToDefaultStringConverter.Instance}}"
Grid.Column="1" Grid.Row="0"
Visibility="{Binding CanSetForeground, Converter={StaticResource boolToVisibility}}" />
<Label Grid.Column="0" Grid.Row="1"
Content="{core:StringParse ${res:Dialog.HighlightingEditor.ColorDlg.Background}:}"
Visibility="{Binding CanSetBackground, Converter={StaticResource boolToVisibility}}" />
<gui:ColorPickerButton Value="{Binding Background}"
Text="{Binding UseDefaultBackground, Converter={x:Static local:BooleanToDefaultStringConverter.Instance}}"
Grid.Column="1" Grid.Row="1"
Visibility="{Binding CanSetBackground, Converter={StaticResource boolToVisibility}}" />
</Grid>
<CheckBox IsEnabled="{Binding CanSetFont}" IsChecked="{Binding Bold}"
Content="{core:Localize Dialog.HighlightingEditor.ColorDlg.Bold}"/>
<CheckBox IsEnabled="{Binding CanSetFont}" IsChecked="{Binding Italic}"
Content="{core:Localize Dialog.HighlightingEditor.ColorDlg.Italic}"/>
<Button Name="resetButton" IsEnabled="{Binding IsCustomized}" HorizontalAlignment="Left"
Click="ResetButtonClick" Style="{x:Static core:GlobalStyles.ButtonStyle}" Margin="0,4"
Content="Reset" />
<Label Content="{core:StringParse ${res:Dialog.HighlightingEditor.SampleText}:}" />
<core:RestrictDesiredSize Height="50" MinWidth="200">
<avalonedit:TextEditor Name="textEditor" IsReadOnly="True" />
</core:RestrictDesiredSize>
</StackPanel>
<Grid DockPanel.Dock="Right" Margin="4,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel DataContext="{Binding SelectedItem, ElementName=listBox}">
<Grid Margin="0,0,8,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" MinWidth="75" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0"
Content="{core:StringParse ${res:Dialog.HighlightingEditor.ColorDlg.Foreground}:}"
Visibility="{Binding CanSetBackground, Converter={StaticResource boolToVisibility}}" />
<gui:ColorPickerButton Value="{Binding Foreground}"
Text="{Binding UseDefaultForeground, Converter={x:Static local:BooleanToDefaultStringConverter.Instance}}"
Grid.Column="1" Grid.Row="0"
Visibility="{Binding CanSetForeground, Converter={StaticResource boolToVisibility}}" />
<Label Grid.Column="0" Grid.Row="1"
Content="{core:StringParse ${res:Dialog.HighlightingEditor.ColorDlg.Background}:}"
Visibility="{Binding CanSetBackground, Converter={StaticResource boolToVisibility}}" />
<gui:ColorPickerButton Value="{Binding Background}"
Text="{Binding UseDefaultBackground, Converter={x:Static local:BooleanToDefaultStringConverter.Instance}}"
Grid.Column="1" Grid.Row="1"
Visibility="{Binding CanSetBackground, Converter={StaticResource boolToVisibility}}" />
</Grid>
<CheckBox IsEnabled="{Binding CanSetFont}" IsChecked="{Binding Bold}"
Content="{core:Localize Dialog.HighlightingEditor.ColorDlg.Bold}"/>
<CheckBox IsEnabled="{Binding CanSetFont}" IsChecked="{Binding Italic}"
Content="{core:Localize Dialog.HighlightingEditor.ColorDlg.Italic}"/>
<Button Name="resetButton" IsEnabled="{Binding IsCustomized}" HorizontalAlignment="Left"
Click="ResetButtonClick" Style="{x:Static core:GlobalStyles.ButtonStyle}" Margin="0,4"
Content="Reset" />
<Label Content="{core:StringParse ${res:Dialog.HighlightingEditor.SampleText}:}" />
<core:RestrictDesiredSize Height="50" MinWidth="200">
<avalonedit:TextEditor Name="textEditor" IsReadOnly="True" />
</core:RestrictDesiredSize>
</StackPanel>
<widgets:StackPanelWithSpacing Grid.Row="1" Orientation="Vertical" SpaceBetweenItems="5" Margin="0,5">
<Button Click="ImportButtonClick" Content="{core:Localize Dialog.HighlightingEditor.Import}" />
<Button Click="ExportButtonClick" Content="{core:Localize Dialog.HighlightingEditor.Export}" />
</widgets:StackPanelWithSpacing>
</Grid>
<ComboBox Name="languageComboBox" DockPanel.Dock="Top" SelectionChanged="LanguageComboBox_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>

519
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs

@ -5,22 +5,28 @@ using System; @@ -5,22 +5,28 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Xml;
using System.Xml.Linq;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Folding;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
using ICSharpCode.SharpDevelop.Gui;
using Microsoft.Win32;
namespace ICSharpCode.AvalonEdit.AddIn.Options
{
@ -33,18 +39,22 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -33,18 +39,22 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
InitializeComponent();
textEditor.Document.UndoStack.SizeLimit = 0;
textEditor.Options = CodeEditorOptions.Instance;
CodeEditorOptions.Instance.BindToTextEditor(textEditor);
textEditor.Options = new TextEditorOptions(CodeEditorOptions.Instance);
bracketHighlighter = new BracketHighlightRenderer(textEditor.TextArea.TextView);
foldingManager = FoldingManager.Install(textEditor.TextArea);
CodeEditorOptions.Instance.BindToTextEditor(textEditor);
textMarkerService = new TextMarkerService(textEditor.Document);
textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
textEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);
}
BracketHighlightRenderer bracketHighlighter;
FoldingManager foldingManager;
TextMarkerService textMarkerService;
ITextMarker marker;
List<CustomizedHighlightingColor> customizationList;
#region Folding
// TODO : probably move this to a separate class!
public const string FoldingControls = "Folding controls";
public const string FoldingSelectedControls = "Selected folding controls";
public const string FoldingTextMarkers = "Folding markers";
@ -56,7 +66,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -56,7 +66,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
return brush;
}
public static void ApplyToFolding(TextEditor editor, IEnumerable<CustomizedHighlightingColor> customisations)
public static void ApplyToRendering(TextEditor editor, IEnumerable<CustomizedHighlightingColor> customisations)
{
bool assignedFoldingMarker = false, assignedSelectedFoldingControls = false, assignedFoldingTextMarkers = false;
@ -67,6 +77,16 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -67,6 +77,16 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
FoldingElementGenerator.TextBrush = FoldingElementGenerator.DefaultTextBrush;
bool assignedErrorColor = false;
bool assignedWarningColor = false;
bool assignedMessageColor = false;
foreach (var instance in ErrorPainter.Instances) {
instance.ErrorColor = Colors.Red;
instance.WarningColor = Colors.Orange;
instance.MessageColor = Colors.Blue;
}
foreach (CustomizedHighlightingColor color in customisations) {
switch (color.Name) {
case FoldingControls:
@ -74,18 +94,22 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -74,18 +94,22 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
continue;
assignedFoldingMarker = true;
if (color.Foreground != null)
editor.SetValue(FoldingMargin.FoldingMarkerBrushProperty, CreateFrozenBrush(color.Foreground.Value));
editor.SetValue(FoldingMargin.FoldingMarkerBrushProperty,
CreateFrozenBrush(color.Foreground.Value));
if (color.Background != null)
editor.SetValue(FoldingMargin.FoldingMarkerBackgroundBrushProperty, CreateFrozenBrush(color.Background.Value));
editor.SetValue(FoldingMargin.FoldingMarkerBackgroundBrushProperty,
CreateFrozenBrush(color.Background.Value));
break;
case FoldingSelectedControls:
if (assignedSelectedFoldingControls)
continue;
assignedSelectedFoldingControls = true;
if (color.Foreground != null)
editor.SetValue(FoldingMargin.SelectedFoldingMarkerBrushProperty, CreateFrozenBrush(color.Foreground.Value));
editor.SetValue(FoldingMargin.SelectedFoldingMarkerBrushProperty,
CreateFrozenBrush(color.Foreground.Value));
if (color.Background != null)
editor.SetValue(FoldingMargin.SelectedFoldingMarkerBackgroundBrushProperty, CreateFrozenBrush(color.Background.Value));
editor.SetValue(FoldingMargin.SelectedFoldingMarkerBackgroundBrushProperty,
CreateFrozenBrush(color.Background.Value));
break;
case FoldingTextMarkers:
if (assignedFoldingTextMarkers)
@ -94,10 +118,39 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -94,10 +118,39 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
if (color.Foreground != null)
FoldingElementGenerator.TextBrush = CreateFrozenBrush(color.Foreground.Value);
break;
case ErrorPainter.ErrorColorName:
if (assignedErrorColor)
continue;
assignedErrorColor = true;
if (color.Foreground != null) {
foreach (var instance in ErrorPainter.Instances) {
instance.ErrorColor = color.Foreground.Value;
}
}
break;
case ErrorPainter.WarningColorName:
if (assignedWarningColor)
continue;
assignedWarningColor = true;
if (color.Foreground != null) {
foreach (var instance in ErrorPainter.Instances) {
instance.WarningColor = color.Foreground.Value;
}
}
break;
case ErrorPainter.MessageColorName:
if (assignedMessageColor)
continue;
assignedMessageColor = true;
if (color.Foreground != null) {
foreach (var instance in ErrorPainter.Instances) {
instance.MessageColor = color.Foreground.Value;
}
}
break;
}
}
}
#endregion
XshdSyntaxDefinition LoadBuiltinXshd(string name)
{
@ -130,6 +183,8 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -130,6 +183,8 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
customizationList = new List<CustomizedHighlightingColor>(CustomizedHighlightingColor.LoadColors());
CreateDefaultEntries(null, out defaultText, defaultEntries);
languageComboBox.Items.Clear();
languageComboBox.Items.Add(new XshdSyntaxDefinition { Name = "All languages" });
foreach (XshdSyntaxDefinition def in allSyntaxDefinitions)
@ -140,11 +195,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -140,11 +195,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
void LanguageComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
listBox.Items.Clear();
listBox.ItemsSource = null;
XshdSyntaxDefinition xshd = (XshdSyntaxDefinition)languageComboBox.SelectedItem;
if (xshd != null) {
IHighlightingItem defaultText;
CreateDefaultEntries(languageComboBox.SelectedIndex == 0 ? null : xshd.Name, out defaultText);
List<IHighlightingItem> list = new List<IHighlightingItem>();
CreateDefaultEntries(languageComboBox.SelectedIndex == 0 ? null : xshd.Name, out defaultText, list);
listBox.ItemsSource = list;
if (languageComboBox.SelectedIndex > 0) {
// Create entries for all customizable colors in the syntax highlighting definition
@ -168,18 +225,16 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -168,18 +225,16 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
}
void CreateDefaultEntries(string language, out IHighlightingItem defaultText)
void CreateDefaultEntries(string language, out IHighlightingItem defaultText, IList<IHighlightingItem> items)
{
// Create entry for "default text/background"
defaultText = new SimpleHighlightingItem(CustomizableHighlightingColorizer.DefaultTextAndBackground, ta => ta.Document.Text = "Normal text") {
Foreground = SystemColors.WindowTextColor,
Background = SystemColors.WindowColor
};
defaultText = new CustomizedHighlightingItem(customizationList, defaultText, null, canSetFont: false);
if (language != null)
defaultText = new CustomizedHighlightingItem(customizationList, defaultText, language, canSetFont: false);
defaultText = new CustomizedHighlightingItem(customizationList, defaultText, language, canSetFont: false);
defaultText.PropertyChanged += item_PropertyChanged;
listBox.Items.Add(defaultText);
items.Add(defaultText);
// Create entry for "Selected text"
IHighlightingItem selectedText = new SimpleHighlightingItem(
@ -192,11 +247,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -192,11 +247,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
Foreground = SystemColors.HighlightTextColor,
Background = SystemColors.HighlightColor
};
selectedText = new CustomizedHighlightingItem(customizationList, selectedText, null, canSetFont: false);
if (language != null)
selectedText = new CustomizedHighlightingItem(customizationList, selectedText, language, canSetFont: false);
selectedText = new CustomizedHighlightingItem(customizationList, selectedText, language, canSetFont: false);
selectedText.PropertyChanged += item_PropertyChanged;
listBox.Items.Add(selectedText);
items.Add(selectedText);
// Create entry for "Non-printable characters"
IHighlightingItem nonPrintChars = new SimpleHighlightingItem(
@ -207,11 +260,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -207,11 +260,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
{
Foreground = Colors.LightGray
};
nonPrintChars = new CustomizedHighlightingItem(customizationList, nonPrintChars, null, canSetFont: false, canSetBackground: false);
if (language != null)
nonPrintChars = new CustomizedHighlightingItem(customizationList, nonPrintChars, language, canSetFont: false);
nonPrintChars = new CustomizedHighlightingItem(customizationList, nonPrintChars, language, canSetFont: false, canSetBackground: false);
nonPrintChars.PropertyChanged += item_PropertyChanged;
listBox.Items.Add(nonPrintChars);
items.Add(nonPrintChars);
// Create entry for "Line numbers"
IHighlightingItem lineNumbers = new SimpleHighlightingItem(
@ -225,11 +276,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -225,11 +276,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
{
Foreground = Colors.Gray
};
lineNumbers = new CustomizedHighlightingItem(customizationList, lineNumbers, null, canSetFont: false, canSetBackground: false);
if (language != null)
lineNumbers = new CustomizedHighlightingItem(customizationList, lineNumbers, language, canSetFont: false);
lineNumbers = new CustomizedHighlightingItem(customizationList, lineNumbers, language, canSetFont: false, canSetBackground: false);
lineNumbers.PropertyChanged += item_PropertyChanged;
listBox.Items.Add(lineNumbers);
items.Add(lineNumbers);
// Create entry for "Bracket highlight"
IHighlightingItem bracketHighlight = new SimpleHighlightingItem(
@ -247,11 +296,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -247,11 +296,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
Foreground = BracketHighlightRenderer.DefaultBorder,
Background = BracketHighlightRenderer.DefaultBackground
};
bracketHighlight = new CustomizedHighlightingItem(customizationList, bracketHighlight, null, canSetFont: false);
if (language != null)
bracketHighlight = new CustomizedHighlightingItem(customizationList, bracketHighlight, language, canSetFont: false);
bracketHighlight = new CustomizedHighlightingItem(customizationList, bracketHighlight, language, canSetFont: false);
bracketHighlight.PropertyChanged += item_PropertyChanged;
listBox.Items.Add(bracketHighlight);
items.Add(bracketHighlight);
// Create entry for "Folding controls"
IHighlightingItem foldingControls = new SimpleHighlightingItem(
@ -266,11 +313,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -266,11 +313,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
Foreground = Colors.Gray,
Background = Colors.White
};
foldingControls = new CustomizedHighlightingItem(customizationList, foldingControls, null, canSetFont: false);
if (language != null)
foldingControls = new CustomizedHighlightingItem(customizationList, foldingControls, language, canSetFont: false);
foldingControls = new CustomizedHighlightingItem(customizationList, foldingControls, language, canSetFont: false);
foldingControls.PropertyChanged += item_PropertyChanged;
listBox.Items.Add(foldingControls);
items.Add(foldingControls);
// Create entry for "Selected folding controls"
IHighlightingItem selectedFoldingControls = new SimpleHighlightingItem(
@ -285,11 +330,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -285,11 +330,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
Foreground = Colors.Black,
Background = Colors.White
};
selectedFoldingControls = new CustomizedHighlightingItem(customizationList, selectedFoldingControls, null, canSetFont: false);
if (language != null)
selectedFoldingControls = new CustomizedHighlightingItem(customizationList, selectedFoldingControls, language, canSetFont: false);
selectedFoldingControls = new CustomizedHighlightingItem(customizationList, selectedFoldingControls, language, canSetFont: false);
selectedFoldingControls.PropertyChanged += item_PropertyChanged;
listBox.Items.Add(selectedFoldingControls);
items.Add(selectedFoldingControls);
// Create entry for "Folding text markers"
IHighlightingItem foldingTextMarker = new SimpleHighlightingItem(
@ -303,14 +346,106 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -303,14 +346,106 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
{
Foreground = Colors.Gray
};
foldingTextMarker = new CustomizedHighlightingItem(customizationList, foldingTextMarker, null, canSetFont: false, canSetBackground: false);
if (language != null)
foldingControls = new CustomizedHighlightingItem(customizationList, foldingTextMarker, language, canSetFont: false, canSetBackground: false);
foldingTextMarker = new CustomizedHighlightingItem(customizationList, foldingTextMarker, language, canSetFont: false, canSetBackground: false);
foldingTextMarker.PropertyChanged += item_PropertyChanged;
listBox.Items.Add(foldingTextMarker);
items.Add(foldingTextMarker);
IHighlightingItem linkText = new SimpleHighlightingItem(
CustomizableHighlightingColorizer.LinkText,
ta => {
ta.Document.Text = "http://icsharpcode.net" + Environment.NewLine + "me@example.com";
})
{
Foreground = Colors.Blue,
Background = Colors.Transparent
};
linkText = new CustomizedHighlightingItem(customizationList, linkText, language, canSetFont: false);
linkText.PropertyChanged += item_PropertyChanged;
items.Add(linkText);
IHighlightingItem errorMarker = new SimpleHighlightingItem(
ErrorPainter.ErrorColorName,
ta => {
ta.Document.Text = "some error";
marker = textMarkerService.Create(0, 5);
})
{
Foreground = Colors.Red
};
errorMarker = new CustomizedHighlightingItem(customizationList, errorMarker, language, canSetFont: false, canSetBackground: false);
errorMarker.PropertyChanged += item_PropertyChanged;
items.Add(errorMarker);
IHighlightingItem warningMarker = new SimpleHighlightingItem(
ErrorPainter.WarningColorName,
ta => {
ta.Document.Text = "some warning";
marker = textMarkerService.Create(0, 5);
})
{
Foreground = Colors.Orange
};
warningMarker = new CustomizedHighlightingItem(customizationList, warningMarker, language, canSetFont: false, canSetBackground: false);
warningMarker.PropertyChanged += item_PropertyChanged;
items.Add(warningMarker);
IHighlightingItem messageMarker = new SimpleHighlightingItem(
ErrorPainter.MessageColorName,
ta => {
ta.Document.Text = "some message";
marker = textMarkerService.Create(0, 5);
})
{
Foreground = Colors.Blue
};
messageMarker = new CustomizedHighlightingItem(customizationList, messageMarker, language, canSetFont: false, canSetBackground: false);
messageMarker.PropertyChanged += item_PropertyChanged;
items.Add(messageMarker);
IHighlightingItem breakpointMarker = new SimpleHighlightingItem(
BreakpointBookmark.BreakpointMarker,
ta => {
ta.Document.Text = "some code with a breakpoint";
marker = textMarkerService.Create(0, ta.Document.TextLength);
})
{
Background = BreakpointBookmark.DefaultBackground,
Foreground = BreakpointBookmark.DefaultForeground
};
breakpointMarker = new CustomizedHighlightingItem(customizationList, breakpointMarker, language, canSetFont: false);
breakpointMarker.PropertyChanged += item_PropertyChanged;
items.Add(breakpointMarker);
IHighlightingItem currentStatementMarker = new SimpleHighlightingItem(
CurrentLineBookmark.Name,
ta => {
ta.Document.Text = "current statement line";
marker = textMarkerService.Create(0, ta.Document.TextLength);
})
{
Background = CurrentLineBookmark.DefaultBackground,
Foreground = CurrentLineBookmark.DefaultForeground
};
currentStatementMarker = new CustomizedHighlightingItem(customizationList, currentStatementMarker, language, canSetFont: false);
currentStatementMarker.PropertyChanged += item_PropertyChanged;
items.Add(currentStatementMarker);
IHighlightingItem columnRuler = new SimpleHighlightingItem(
ColumnRulerRenderer.Name,
ta => {
ta.Document.Text = "some line with a lot of text";
ta.TextView.Options.ColumnRulerPosition = 15;
ta.TextView.Options.ShowColumnRuler = true;
})
{
Foreground = ColumnRulerRenderer.DefaultForeground
};
columnRuler = new CustomizedHighlightingItem(customizationList, columnRuler, language, canSetFont: false, canSetBackground: false);
columnRuler.PropertyChanged += item_PropertyChanged;
items.Add(columnRuler);
}
void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
void item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
UpdatePreview();
}
@ -341,10 +476,12 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -341,10 +476,12 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
if (xshd != null) {
var customizationsForCurrentLanguage = customizationList.Where(c => c.Language == null || c.Language == xshd.Name);
CustomizableHighlightingColorizer.ApplyCustomizationsToDefaultElements(textEditor, customizationsForCurrentLanguage);
ApplyToFolding(textEditor, customizationsForCurrentLanguage);
ApplyToRendering(textEditor, customizationsForCurrentLanguage);
var item = (IHighlightingItem)listBox.SelectedItem;
TextView textView = textEditor.TextArea.TextView;
foldingManager.Clear();
textMarkerService.RemoveAll(m => true);
marker = null;
textView.LineTransformers.Remove(colorizer);
colorizer = null;
if (item != null) {
@ -355,8 +492,294 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -355,8 +492,294 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
textEditor.Select(0, 0);
bracketHighlighter.SetHighlight(null);
item.ShowExample(textEditor.TextArea);
if (marker != null) {
switch (item.Name) {
case ErrorPainter.ErrorColorName:
case ErrorPainter.WarningColorName:
case ErrorPainter.MessageColorName:
marker.MarkerTypes = TextMarkerTypes.SquigglyUnderline;
marker.ForegroundColor = item.Foreground;
marker.BackgroundColor = item.Background;
break;
default:
marker.MarkerTypes = TextMarkerTypes.None;
marker.ForegroundColor = item.Foreground;
marker.BackgroundColor = item.Background;
break;
}
}
}
}
}
void ImportButtonClick(object sender, RoutedEventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog {
Filter = @"All known settings|*.vssettings;*.sdsettings|Visual Studio settings (*.vssettings)|*.vssettings|SharpDevelop settings (*.sdsettings)|*.sdsettings",
CheckFileExists = true
};
if (dialog.ShowDialog() != true)
return;
switch (Path.GetExtension(dialog.FileName).ToUpperInvariant()) {
case ".VSSETTINGS":
LoadVSSettings(XDocument.Load(dialog.FileName));
break;
case ".SDSETTINGS":
LoadSDSettings(XDocument.Load(dialog.FileName));
break;
}
}
#region VSSettings
void LoadVSSettings(XDocument document)
{
XElement[] items;
if (!CheckVersionAndFindCategory(document, out items) || items == null) {
Core.MessageService.ShowError("Settings version not supported!");
return;
}
bool? replaceCustomizations = null;
foreach (var item in items) {
string key = item.Attribute("Name").Value;
var entry = ParseEntry(item);
foreach (var sdKey in mapping[key]) {
IHighlightingItem color;
if (FindSDColor(sdKey, out color)) {
if (color.IsCustomized) {
if (!replaceCustomizations.HasValue) {
replaceCustomizations =
MessageService.AskQuestion("There are already one or more existing customizations. " +
"Do you want to replace them with the imported values? " +
"Colors that are not yet customized will be imported anyway.");
}
if (replaceCustomizations == false)
continue;
}
color.Bold = entry.Item3;
color.Foreground = entry.Item1;
color.Background = entry.Item2;
}
}
}
}
readonly List<IHighlightingItem> defaultEntries = new List<IHighlightingItem>();
IHighlightingItem defaultText;
bool FindSDColor(string sdKey, out IHighlightingItem item)
{
string language = null;
int dot = sdKey.IndexOf('.');
if (dot > 0) {
language = sdKey.Substring(0, dot);
sdKey = sdKey.Substring(dot + 1);
}
if ((language == null && languageComboBox.SelectedIndex == 0)
|| (language == ((XshdSyntaxDefinition)languageComboBox.SelectedItem).Name)) {
item = listBox.Items.OfType<IHighlightingItem>().FirstOrDefault(i => i.Name == sdKey);
} else if (language == null) {
item = defaultEntries.FirstOrDefault(i => i.Name == sdKey);
} else {
var def = allSyntaxDefinitions.FirstOrDefault(d => d.Name == language);
var highlighting = HighlightingManager.Instance.GetDefinition(language);
item = null;
if (def != null && highlighting != null) {
var color = def.Elements.OfType<XshdColor>().FirstOrDefault(i => i.Name == sdKey);
if (color != null) {
item = new NamedColorHighlightingItem(defaultText, color) { ParentDefinition = highlighting };
item = new CustomizedHighlightingItem(customizationList, item, language);
}
}
}
return item != null;
}
// VS => SD
static readonly MultiDictionary<string, string> mapping = new MultiDictionary<string, string>(StringComparer.Ordinal) {
{ "Brace Matching (Rectangle)", BracketHighlightRenderer.BracketHighlight },
{ "Collapsible Text", FoldingTextMarkers },
{ "Comment", "XML.Comment" },
{ "Comment", "VBNET.Comment" },
{ "Comment", "C#.Comment" },
{ "Compiler Error", ErrorPainter.ErrorColorName },
{ "CSS Comment", "CSS.Comment" },
{ "CSS Keyword", "" },
{ "CSS Property Name", "" },
{ "CSS Property Value", "" },
{ "CSS Selector", "" },
{ "CSS String Value", "" },
{ "Excluded Code", "" },
{ "HTML Attribute Value", "" },
{ "HTML Attribute", "" },
{ "HTML Comment", "" },
{ "HTML Element Name", "" },
{ "HTML Entity", "" },
{ "HTML Operator", "" },
{ "HTML Server-Side Script", "" },
{ "HTML Tag Delimiter", "" },
{ "Identifier", "" },
{ "Inactive Selected Text", "" },
{ "Indicator Margin", "" },
{ "Keyword", "C#.ThisOrBaseReference" },
{ "Keyword", "C#.NullOrValueKeywords" },
{ "Keyword", "C#.Keywords" },
{ "Keyword", "C#.GotoKeywords" },
{ "Keyword", "C#.ContextKeywords" },
{ "Keyword", "C#.ExceptionKeywords" },
{ "Keyword", "C#.CheckedKeyword" },
{ "Keyword", "C#.UnsafeKeywords" },
{ "Keyword", "C#.OperatorKeywords" },
{ "Keyword", "C#.ParameterModifiers" },
{ "Keyword", "C#.Modifiers" },
{ "Keyword", "C#.Visibility" },
{ "Keyword", "C#.NamespaceKeywords" },
{ "Keyword", "C#.GetSetAddRemove" },
{ "Keyword", "C#.TrueFalse" },
{ "Keyword", "C#.TypeKeywords" },
{ "Keyword", "VBNET.DateLiteral" },
{ "Keyword", "VBNET.Preprocessor" },
{ "Keyword", "VBNET.DataTypes" },
{ "Keyword", "VBNET.Operators" },
{ "Keyword", "VBNET.Constants" },
{ "Keyword", "VBNET.Keywords" },
{ "Keyword", "VBNET.FunctionKeywords" },
{ "Keyword", "VBNET.ContextKeywords" },
{ "Line Numbers", CustomizableHighlightingColorizer.LineNumbers },
{ "MarkerFormatDefinition/HighlightedReference", "" },
{ "Number", "C#.NumberLiteral" },
{ "Operator", "C#.Punctuation" },
{ "outlining.collapsehintadornment", "" },
{ "outlining.square", FoldingControls },
{ "outlining.square", FoldingSelectedControls },
{ "outlining.verticalrule", "" },
{ "Plain Text", "" },
{ "Plain Text", CustomizableHighlightingColorizer.DefaultTextAndBackground },
{ "Preprocessor Keyword", "" },
{ "Preprocessor Keyword", "C#.Preprocessor" },
{ "Razor Code", "" },
{ "Script Comment", "" },
{ "Script Identifier", "" },
{ "Script Keyword", "" },
{ "Script Number", "" },
{ "Script Operator", "" },
{ "Script String", "" },
{ "Selected Text", "" },
{ "Selected Text", CustomizableHighlightingColorizer.SelectedText },
{ "String", "VBNET.String" },
{ "String", "C#.String" },
{ "String(C# @ Verbatim)", "" },
{ "Syntax Error", "" },
{ "urlformat", CustomizableHighlightingColorizer.LinkText },
{ "User Types", "" },
{ "User Types(Delegates)", "" },
{ "User Types(Enums)", "" },
{ "User Types(Interfaces)", "" },
{ "User Types(Value types)", "" },
{ "Warning", ErrorPainter.WarningColorName },
{ "XAML Attribute Quotes", "" },
{ "XAML Attribute Value", "" },
{ "XAML Attribute", "" },
{ "XAML CData Section", "" },
{ "XAML Comment", "" },
{ "XAML Delimiter", "" },
{ "XAML Markup Extension Class", "" },
{ "XAML Markup Extension Parameter Name", "" },
{ "XAML Markup Extension Parameter Value", "" },
{ "XAML Name", "" },
{ "XAML Text", "" },
{ "XML Attribute Quotes", "" },
{ "XML Attribute Value", "XML." },
{ "XML Attribute", "" },
{ "XML CData Section", "" },
{ "XML Comment", "" },
{ "XML Delimiter", "" },
{ "XML Doc Comment", "" },
{ "XML Doc Tag", "" },
{ "XML Name", "" },
{ "XML Text", "" },
};
Tuple<Color, Color, bool> ParseEntry(XElement element)
{
Color fore = Colors.Transparent;
Color back = Colors.Transparent;
bool isBold = false;
var attribute = element.Attribute("Foreground");
if (attribute != null)
fore = ParseColor(attribute.Value);
attribute = element.Attribute("Background");
if (attribute != null)
back = ParseColor(attribute.Value);
attribute = element.Attribute("BoldFont");
if (attribute != null)
isBold = attribute.Value == "Yes";
return Tuple.Create(fore, back, isBold);
}
Color ParseColor(string s)
{
if (string.IsNullOrWhiteSpace(s))
return Colors.Transparent;
if (s.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
s = s.Substring(2);
if (s.Substring(0, 2) == "02")
return Colors.Transparent;
try {
byte b = byte.Parse(s.Substring(2, 2), NumberStyles.HexNumber);
byte g = byte.Parse(s.Substring(4, 2), NumberStyles.HexNumber);
byte r = byte.Parse(s.Substring(6, 2), NumberStyles.HexNumber);
return Color.FromRgb(r, g, b);
} catch (FormatException) {
return Colors.Transparent;
}
}
bool CheckVersionAndFindCategory(XDocument document, out XElement[] categoryItems)
{
categoryItems = null;
var node = document.Root;
var appID = document.Root.Element("ApplicationIdentity");
var category = document.Root.Descendants("Category").FirstOrDefault(e => e.Attribute("GUID") != null && e.Attribute("GUID").Value == "{A27B4E24-A735-4D1D-B8E7-9716E1E3D8E0}");
if (category != null)
categoryItems = category.Descendants("Item").ToArray();
if (node.Name != "UserSettings" || appID == null || category == null)
return false;
return appID.Attribute("version") != null && appID.Attribute("version").Value == "10.0";
}
#endregion
#region SDSettings
void LoadSDSettings(XDocument document)
{
var version = document.Root.Attribute("version");
if (version != null && version.Value != Properties.FileVersion.ToString()) {
Core.MessageService.ShowError("Settings version not supported!");
return;
}
var p = Properties.Load(document.Root);
customizationList = p.GetList<CustomizedHighlightingColor>("CustomizedHighlightingRules").ToList();
LanguageComboBox_SelectionChanged(null, null);
}
#endregion
void ExportButtonClick(object sender, RoutedEventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog {
Filter = @"SharpDevelop settings (*.sdsettings)|*.sdsettings",
};
if (dialog.ShowDialog() != true)
return;
Save(dialog.FileName);
}
void Save(string fileName)
{
Properties p = new Properties();
p.SetList("CustomizedHighlightingRules", customizationList);
XElement root = p.Save();
root.SetAttributeValue("version", Properties.FileVersion.ToString());
new XDocument(root).Save(fileName);
}
}
}

17
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/TextViewOptions.xaml

@ -29,5 +29,22 @@ @@ -29,5 +29,22 @@
Content="{core:Localize Dialog.Options.IDEOptions.TextEditor.Markers.EnableAnimationsCheckBox}" />
</widgets:StackPanelWithSpacing>
</GroupBox>
<GroupBox
Header="{core:Localize Dialog.Options.IDEOptions.TextEditor.Markers.MarkersGroupBox}">
<widgets:StackPanelWithSpacing SpaceBetweenItems="5">
<StackPanel Orientation="Horizontal">
<CheckBox
Margin="0, 10"
IsChecked="{core:OptionBinding local:CodeEditorOptions.ShowColumnRuler}"
Content="{core:Localize Dialog.Options.IDEOptions.TextEditor.Markers.VerticalRulerCheckBox}" />
<Label
Margin="0, 5"
Content="{core:Localize Dialog.Options.IDEOptions.TextEditor.Markers.AtRowLabel}" />
<widgets:NumericUpDown
Margin="0, 5"
Value="{core:OptionBinding local:CodeEditorOptions.ColumnRulerPosition}" />
</StackPanel>
</widgets:StackPanelWithSpacing>
</GroupBox>
</StackPanel>
</gui:OptionPanel>

69
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerService.cs

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Media;
@ -15,57 +16,29 @@ using ICSharpCode.SharpDevelop.Editor; @@ -15,57 +16,29 @@ using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.AvalonEdit.AddIn
{
/// <summary>
/// Interface the text marker service uses to access the code editor.
/// </summary>
public interface ICodeEditor
{
TextDocument Document { get; }
void Redraw(ISegment segment, DispatcherPriority priority);
event EventHandler DocumentChanged;
}
/// <summary>
/// Handles the text markers for a code editor.
/// </summary>
public sealed class TextMarkerService : DocumentColorizingTransformer, IBackgroundRenderer, ITextMarkerService
public sealed class TextMarkerService : DocumentColorizingTransformer, IBackgroundRenderer, ITextMarkerService, ITextViewConnect
{
readonly ICodeEditor codeEditor;
TextSegmentCollection<TextMarker> markers;
TextDocument document;
public TextMarkerService(ICodeEditor codeEditor)
public TextMarkerService(TextDocument document)
{
if (codeEditor == null)
throw new ArgumentNullException("codeEditor");
this.codeEditor = codeEditor;
codeEditor.DocumentChanged += codeEditor_DocumentChanged;
codeEditor_DocumentChanged(null, null);
if (document == null)
throw new ArgumentNullException("document");
this.document = document;
this.markers = new TextSegmentCollection<TextMarker>(document);
}
#region Document Changed - recreate marker collection
void codeEditor_DocumentChanged(object sender, EventArgs e)
{
if (markers != null) {
foreach (TextMarker m in markers.ToArray()) {
m.Delete();
}
}
if (codeEditor.Document == null)
markers = null;
else
markers = new TextSegmentCollection<TextMarker>(codeEditor.Document);
}
#endregion
#region ITextMarkerService
public ITextMarker Create(int startOffset, int length)
{
if (markers == null)
throw new InvalidOperationException("Cannot create a marker when not attached to a document");
int textLength = codeEditor.Document.TextLength;
int textLength = document.TextLength;
if (startOffset < 0 || startOffset > textLength)
throw new ArgumentOutOfRangeException("startOffset", startOffset, "Value must be between 0 and " + textLength);
if (length < 0 || startOffset + length > textLength)
@ -117,7 +90,9 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -117,7 +90,9 @@ namespace ICSharpCode.AvalonEdit.AddIn
/// </summary>
internal void Redraw(ISegment segment)
{
codeEditor.Redraw(segment, DispatcherPriority.Normal);
foreach (var view in textViews) {
view.Redraw(segment, DispatcherPriority.Normal);
}
if (RedrawRequested != null)
RedrawRequested(this, EventArgs.Empty);
}
@ -223,6 +198,26 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -223,6 +198,26 @@ namespace ICSharpCode.AvalonEdit.AddIn
yield return new Point(start.X + i * offset, start.Y - ((i + 1) % 2 == 0 ? offset : 0));
}
#endregion
#region ITextViewConnect
readonly List<TextView> textViews = new List<TextView>();
void ITextViewConnect.AddToTextView(TextView textView)
{
if (textView != null && !textViews.Contains(textView)) {
Debug.Assert(textView.Document == document);
textViews.Add(textView);
}
}
void ITextViewConnect.RemoveFromTextView(TextView textView)
{
if (textView != null) {
Debug.Assert(textView.Document == document);
textViews.Remove(textView);
}
}
#endregion
}
public sealed class TextMarker : TextSegment, ITextMarker

94
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/IO/EntityModelCodeGenerator.cs

@ -1,51 +1,67 @@ @@ -1,51 +1,67 @@
#region Usings
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICSharpCode.SharpDevelop.Project;
using System.Data.Entity.Design;
using System.CodeDom;
using System.Data.Metadata.Edm;
using System.Xml.Linq;
using System.IO;
using System.Xml.Linq;
#endregion
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Data.EDMDesigner.Core.IO
{
public class EntityModelCodeGenerator : IO, ICustomTool
{
#region ICustomTool Member
public void GenerateCode(FileProjectItem item, CustomToolContext context)
{
LanguageOption languageToGenerateCode = LanguageOption.GenerateCSharpCode;
if (item.Project.Language != "C#")
languageToGenerateCode = LanguageOption.GenerateVBCode;
XDocument edmxDocument = XDocument.Load(item.FileName);
XElement conceptualModelsElement = EDMXIO.ReadSection(edmxDocument, EDMXIO.EDMXSection.CSDL);
if (conceptualModelsElement == null)
throw new ArgumentException("Input file is not a valid EDMX file.");
XDocument csdlDocument = new XDocument(new XDeclaration("1.0", "utf-8", null), conceptualModelsElement.Element(XName.Get("Schema", csdlNamespace.NamespaceName)));
string tempFileName = IO.GetTempFilenameWithExtension("csdl");
csdlDocument.Save(tempFileName);
public class EntityModelCodeGenerator : IO, ICustomTool
{
public void GenerateCode(FileProjectItem item, CustomToolContext context)
{
XElement schema = GetModelSchema(item);
XDocument csdlDocument = CreateCsdlDocument(schema);
string tempFileName = IO.GetTempFilenameWithExtension("csdl");
csdlDocument.Save(tempFileName);
string outputFileName = context.GetOutputFileName(item, "Designer");
LanguageOption languageToGenerateCode = GetLanguageOption(item);
string outputFileName = context.GetOutputFileName(item, "Designer");
EntityCodeGenerator entityCodeGenerator = new EntityCodeGenerator(languageToGenerateCode);
IList<EdmSchemaError> edmSchemaErrors = entityCodeGenerator.GenerateCode(tempFileName, outputFileName);
File.Delete(tempFileName);
context.EnsureOutputFileIsInProject(item, outputFileName);
}
EntityCodeGenerator entityCodeGenerator = new EntityCodeGenerator(languageToGenerateCode);
AddNamespaceMapping(entityCodeGenerator, schema, context.OutputNamespace);
IList<EdmSchemaError> edmSchemaErrors = entityCodeGenerator.GenerateCode(tempFileName, outputFileName);
File.Delete(tempFileName);
context.EnsureOutputFileIsInProject(item, outputFileName);
}
XElement GetModelSchema(FileProjectItem item)
{
XDocument edmxDocument = XDocument.Load(item.FileName);
XElement conceptualModelsElement = EDMXIO.ReadSection(edmxDocument, EDMXIO.EDMXSection.CSDL);
if (conceptualModelsElement == null)
throw new ArgumentException("Input file is not a valid EDMX file.");
#endregion
}
return conceptualModelsElement.Element(XName.Get("Schema", csdlNamespace.NamespaceName));
}
XDocument CreateCsdlDocument(XElement schema)
{
return new XDocument(new XDeclaration("1.0", "utf-8", null), schema);
}
LanguageOption GetLanguageOption(FileProjectItem item)
{
if (item.Project.Language != "C#")
return LanguageOption.GenerateVBCode;
return LanguageOption.GenerateCSharpCode;
}
void AddNamespaceMapping(EntityCodeGenerator entityCodeGenerator, XElement schema, string outputNamespace)
{
if (!String.IsNullOrEmpty(outputNamespace))
AddNamespaceMapping(entityCodeGenerator, schema.Attribute(XName.Get("Namespace")), outputNamespace);
}
void AddNamespaceMapping(EntityCodeGenerator entityCodeGenerator, XAttribute edmNamespace, string outputNamespace)
{
if (edmNamespace != null)
entityCodeGenerator.EdmToObjectNamespaceMap.Add(edmNamespace.Value, outputNamespace);
}
}
}

36
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

@ -317,7 +317,7 @@ namespace ICSharpCode.FormsDesigner @@ -317,7 +317,7 @@ namespace ICSharpCode.FormsDesigner
/// code that is not supported in a previous version of .NET. (3.5 and below)
/// Currently it fixes:
/// - remove calls to ISupportInitialize.BeginInit/EndInit, if the interface is not implemented by the type in the target framework.
/// </summary>
/// </summary>
/// <remarks>When adding new workarounds make sure that the code does not remove too much code!</remarks>
void RemoveUnsupportedCode(CodeTypeDeclaration formClass, CodeMemberMethod initializeComponent)
{
@ -339,16 +339,9 @@ namespace ICSharpCode.FormsDesigner @@ -339,16 +339,9 @@ namespace ICSharpCode.FormsDesigner
CodeMethodInvokeExpression invocation = (CodeMethodInvokeExpression)stmt.Expression;
CodeCastExpression expr = invocation.Method.TargetObject as CodeCastExpression;
if (expr != null) {
CodeFieldReferenceExpression fieldRef = expr.Expression as CodeFieldReferenceExpression;
if (fieldRef == null || !(fieldRef.TargetObject is CodeThisReferenceExpression))
continue;
if (expr.TargetType.BaseType != "System.ComponentModel.ISupportInitialize")
continue;
IField field = this.formClass.DefaultReturnType.GetFields()
.First(f => this.formClass.ProjectContent.Language.NameComparer.Equals(fieldRef.FieldName, f.Name));
if (field.ReturnType == null)
continue;
IClass fieldType = field.ReturnType.GetUnderlyingClass();
var fieldType = GetTypeOfControl(expr.Expression, initializeComponent, formClass);
if (fieldType == null)
continue;
if (!fieldType.IsTypeInInheritanceTree(iSupportInitializeInterface))
@ -361,6 +354,31 @@ namespace ICSharpCode.FormsDesigner @@ -361,6 +354,31 @@ namespace ICSharpCode.FormsDesigner
}
}
/// <summary>
/// Tries to find the type of the expression.
/// </summary>
IClass GetTypeOfControl(CodeExpression expression, CodeMemberMethod initializeComponentMethod, CodeTypeDeclaration formTypeDeclaration)
{
StringComparer comparer = formClass.ProjectContent.Language.NameComparer;
if (expression is CodeVariableReferenceExpression) {
string name = ((CodeVariableReferenceExpression)expression).VariableName;
var decl = initializeComponentMethod.Statements.OfType<CodeVariableDeclarationStatement>().Single(v => comparer.Equals(v.Name, name));
return formClass.ProjectContent.GetClass(decl.Type.BaseType, 0);
}
if (expression is CodeFieldReferenceExpression && ((CodeFieldReferenceExpression)expression).TargetObject is CodeThisReferenceExpression) {
string name = ((CodeFieldReferenceExpression)expression).FieldName;
var decl = formTypeDeclaration.Members.OfType<CodeMemberField>().FirstOrDefault(f => comparer.Equals(name, f.Name));
if (decl != null)
return formClass.ProjectContent.GetClass(decl.Type.BaseType, 0);
var field = formClass.DefaultReturnType.GetFields()
.First(f => comparer.Equals(f.Name, name));
if (field.ReturnType == null)
return null;
return field.ReturnType.GetUnderlyingClass();
}
return null;
}
/// <summary>
/// Compares the SharpDevelop.Dom field declaration oldField to
/// the CodeDom field declaration newField.

3
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -159,6 +159,9 @@ namespace ICSharpCode.FormsDesigner @@ -159,6 +159,9 @@ namespace ICSharpCode.FormsDesigner
{
LoggingService.Debug("Forms designer: Load " + file.FileName + "; inMasterLoadOperation=" + this.inMasterLoadOperation);
if (this.typeResolutionService != null)
this.typeResolutionService.ClearCaches();
if (inMasterLoadOperation) {
if (this.sourceCodeStorage.ContainsFile(file)) {

39
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs

@ -361,6 +361,19 @@ namespace ICSharpCode.FormsDesigner.Services @@ -361,6 +361,19 @@ namespace ICSharpCode.FormsDesigner.Services
return GetType(name, throwOnError, false);
}
#if DEBUG
int count = 0;
#endif
Dictionary<string, Type> typeCache = new Dictionary<string, Type>(StringComparer.Ordinal);
Dictionary<string, Type> typeCacheIgnoreCase = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
public void ClearCaches()
{
typeCacheIgnoreCase.Clear();
typeCache.Clear();
}
public Type GetType(string name, bool throwOnError, bool ignoreCase)
{
if (name == null || name.Length == 0) {
@ -369,9 +382,19 @@ namespace ICSharpCode.FormsDesigner.Services @@ -369,9 +382,19 @@ namespace ICSharpCode.FormsDesigner.Services
if (IgnoreType(name)) {
return null;
}
if (ignoreCase) {
Type cachedType;
if (typeCacheIgnoreCase.TryGetValue(name, out cachedType))
return cachedType;
} else {
Type cachedType;
if (typeCache.TryGetValue(name, out cachedType))
return cachedType;
}
#if DEBUG
if (!name.StartsWith("System.")) {
LoggingService.Debug("TypeResolutionService: Looking for " + name);
count++;
LoggingService.Debug(count + " TypeResolutionService: Looking for " + name);
}
#endif
try {
@ -436,6 +459,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -436,6 +459,7 @@ namespace ICSharpCode.FormsDesigner.Services
try {
Type t = asm.GetType(name, false);
if (t != null) {
AddToCache(name, t, ignoreCase);
return t;
}
} catch (FileNotFoundException) {
@ -449,7 +473,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -449,7 +473,7 @@ namespace ICSharpCode.FormsDesigner.Services
if (throwOnError && type == null)
throw new TypeLoadException(name + " not found by TypeResolutionService");
AddToCache(name, type, ignoreCase);
return type;
} catch (Exception e) {
LoggingService.Error(e);
@ -457,6 +481,17 @@ namespace ICSharpCode.FormsDesigner.Services @@ -457,6 +481,17 @@ namespace ICSharpCode.FormsDesigner.Services
return null;
}
void AddToCache(string name, Type type, bool ignoreCase)
{
if (type == null)
return;
if (ignoreCase) {
typeCacheIgnoreCase.Add(name, type);
} else {
typeCache.Add(name, type);
}
}
public void ReferenceAssembly(AssemblyName name)
{
ICSharpCode.Core.LoggingService.Warn("TODO: Add Assembly reference : " + name);

4
src/AddIns/DisplayBindings/ILSpyAddIn/ViewContent/CodeView.cs

@ -36,7 +36,7 @@ namespace ICSharpCode.ILSpyAddIn.ViewContent @@ -36,7 +36,7 @@ namespace ICSharpCode.ILSpyAddIn.ViewContent
/// <summary>
/// Equivalent to AE.AddIn CodeEditor, but without editing capabilities.
/// </summary>
class CodeView : Grid, IDisposable, ICodeEditor, IPositionable
class CodeView : Grid, IDisposable, IPositionable
{
public event EventHandler DocumentChanged;
@ -59,7 +59,7 @@ namespace ICSharpCode.ILSpyAddIn.ViewContent @@ -59,7 +59,7 @@ namespace ICSharpCode.ILSpyAddIn.ViewContent
this.adapter.TextEditor.TextArea.TextView.VisualLinesChanged += delegate { iconMargin.InvalidateVisual(); };
// add marker service
this.textMarkerService = new TextMarkerService(this);
this.textMarkerService = new TextMarkerService(adapter.TextEditor.Document);
this.adapter.TextEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
this.adapter.TextEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);

15
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs

@ -60,6 +60,7 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -60,6 +60,7 @@ namespace ICSharpCode.WpfDesign.AddIn
protected override void LoadInternal(OpenedFile file, System.IO.Stream stream)
{
wasChangedInDesigner = false;
Debug.Assert(file == this.PrimaryFile);
_stream = new MemoryStream();
@ -108,10 +109,11 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -108,10 +109,11 @@ namespace ICSharpCode.WpfDesign.AddIn
}
private MemoryStream _stream;
bool wasChangedInDesigner;
protected override void SaveInternal(OpenedFile file, System.IO.Stream stream)
{
if (IsDirty && designer.DesignContext != null) {
if (wasChangedInDesigner && designer.DesignContext != null) {
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = EditorControlService.GlobalOptions.IndentationString;
@ -120,12 +122,10 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -120,12 +122,10 @@ namespace ICSharpCode.WpfDesign.AddIn
designer.SaveDesigner(xmlWriter);
}
} else {
if (_stream.CanRead) {
_stream.Position = 0;
using (var reader = new StreamReader(_stream)) {
using (var writer = new StreamWriter(stream)) {
writer.Write(reader.ReadToEnd());
}
_stream.Position = 0;
using (var reader = new StreamReader(new UnclosableStream(_stream))) {
using (var writer = new StreamWriter(stream)) {
writer.Write(reader.ReadToEnd());
}
}
}
@ -153,6 +153,7 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -153,6 +153,7 @@ namespace ICSharpCode.WpfDesign.AddIn
void OnUndoStackChanged(object sender, EventArgs e)
{
wasChangedInDesigner = true;
this.PrimaryFile.MakeDirty();
}

20
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SelectedElementRectangleExtension.cs

@ -23,18 +23,18 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -23,18 +23,18 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
public SelectedElementRectangleExtension()
{
Rectangle selectionRect = new Rectangle();
selectionRect.SnapsToDevicePixels = true;
selectionRect.Stroke = new SolidColorBrush(Color.FromRgb(0x47, 0x47, 0x47));
selectionRect.StrokeThickness = 1.5;
selectionRect.IsHitTestVisible = false;
selectionRect.SnapsToDevicePixels = true;
selectionRect.Stroke = new SolidColorBrush(Color.FromRgb(0x47, 0x47, 0x47));
selectionRect.StrokeThickness = 1.5;
selectionRect.IsHitTestVisible = false;
RelativePlacement placement = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Stretch);
placement.XOffset = -1;
placement.YOffset = -1;
placement.WidthOffset = 2;
placement.HeightOffset = 2;
RelativePlacement placement = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Stretch);
placement.XOffset = -1;
placement.YOffset = -1;
placement.WidthOffset = 2;
placement.HeightOffset = 2;
this.AddAdorners(placement, selectionRect);
this.AddAdorners(placement, selectionRect);
}
}
}

68
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SizeDisplayExtension.cs

@ -17,40 +17,40 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -17,40 +17,40 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
/// <summary>
/// Display Height/Width on the primary selection
/// </summary>
[ExtensionFor(typeof(UIElement))]
class SizeDisplayExtension : PrimarySelectionAdornerProvider
{
HeightDisplay _heightDisplay;
WidthDisplay _widthDisplay;
public HeightDisplay HeightDisplay{
get { return _heightDisplay; }
}
public WidthDisplay WidthDisplay{
get { return _widthDisplay; }
}
protected override void OnInitialized()
{
base.OnInitialized();
if (this.ExtendedItem != null)
{
RelativePlacement placementHeight = new RelativePlacement(HorizontalAlignment.Right, VerticalAlignment.Stretch);
placementHeight.XOffset = 10;
_heightDisplay = new HeightDisplay();
_heightDisplay.DataContext = this.ExtendedItem.Component;
[ExtensionFor(typeof(UIElement))]
class SizeDisplayExtension : PrimarySelectionAdornerProvider
{
HeightDisplay _heightDisplay;
WidthDisplay _widthDisplay;
public HeightDisplay HeightDisplay{
get { return _heightDisplay; }
}
public WidthDisplay WidthDisplay{
get { return _widthDisplay; }
}
protected override void OnInitialized()
{
base.OnInitialized();
if (this.ExtendedItem != null)
{
RelativePlacement placementHeight = new RelativePlacement(HorizontalAlignment.Right, VerticalAlignment.Stretch);
placementHeight.XOffset = 10;
_heightDisplay = new HeightDisplay();
_heightDisplay.DataContext = this.ExtendedItem.Component;
RelativePlacement placementWidth = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Bottom);
placementWidth.YOffset = 10;
_widthDisplay = new WidthDisplay();
_widthDisplay.DataContext = this.ExtendedItem.Component;
RelativePlacement placementWidth = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Bottom);
placementWidth.YOffset = 10;
_widthDisplay = new WidthDisplay();
_widthDisplay.DataContext = this.ExtendedItem.Component;
this.AddAdorners(placementHeight, _heightDisplay);
this.AddAdorners(placementWidth, _widthDisplay);
_heightDisplay.Visibility=Visibility.Hidden;
_widthDisplay.Visibility=Visibility.Hidden;
}
}
}
this.AddAdorners(placementHeight, _heightDisplay);
this.AddAdorners(placementWidth, _widthDisplay);
_heightDisplay.Visibility=Visibility.Hidden;
_widthDisplay.Visibility=Visibility.Hidden;
}
}
}
}

283
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/StackPanelPlacementSupport.cs

@ -18,156 +18,157 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -18,156 +18,157 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
/// Provides <see cref="IPlacementBehavior"/> for <see cref="StackPanel"/>.
/// </summary>
[ExtensionFor(typeof (StackPanel), OverrideExtension = typeof (DefaultPlacementBehavior))]
public class StackPanelPlacementSupport : DefaultPlacementBehavior
{
private StackPanel _stackPanel;
private AdornerPanel _adornerPanel;
private Rectangle _rectangle = new Rectangle(); // Draws a rectangle to indicate the position of insertion.
private readonly List<Rect> _rects = new List<Rect>(); // Contains the Rect of all the children of StackPanel.
private bool _isItemGettingResized; // Indicates whether any children is getting resized.
private int _indexToInsert; // Postion where to insert the element.
public class StackPanelPlacementSupport : DefaultPlacementBehavior
{
private StackPanel _stackPanel;
private AdornerPanel _adornerPanel;
private Rectangle _rectangle = new Rectangle(); // Draws a rectangle to indicate the position of insertion.
private readonly List<Rect> _rects = new List<Rect>(); // Contains the Rect of all the children of StackPanel.
private bool _isItemGettingResized; // Indicates whether any children is getting resized.
private int _indexToInsert; // Postion where to insert the element.
protected override void OnInitialized()
{
base.OnInitialized();
_stackPanel = this.ExtendedItem.View as StackPanel;
var children = this.ExtendedItem.ContentProperty.CollectionElements;
foreach (var child in children) {
Point p = child.View.TranslatePoint(new Point(0, 0), this.ExtendedItem.View);
_rects.Add(new Rect(p, child.View.RenderSize));
}
}
protected override void OnInitialized()
{
base.OnInitialized();
_stackPanel = this.ExtendedItem.View as StackPanel;
var children = this.ExtendedItem.ContentProperty.CollectionElements;
foreach (var child in children) {
Point p = child.View.TranslatePoint(new Point(0, 0), this.ExtendedItem.View);
_rects.Add(new Rect(p, child.View.RenderSize));
}
}
public override void BeginPlacement(PlacementOperation operation)
{
base.BeginPlacement(operation);
if (_rects.Count > 0)
_rects.Clear();
/* Add Rect of all children to _rects */
var children = this.ExtendedItem.ContentProperty.CollectionElements;
foreach (var child in children) {
Point p = child.View.TranslatePoint(new Point(0, 0), this.ExtendedItem.View);
_rects.Add(new Rect(p, child.View.RenderSize));
}
if (_adornerPanel != null && this.ExtendedItem.Services.DesignPanel.Adorners.Contains(_adornerPanel))
this.ExtendedItem.Services.DesignPanel.Adorners.Remove(_adornerPanel);
/* Place the Rectangle */
_adornerPanel = new AdornerPanel();
_rectangle = new Rectangle();
_adornerPanel.SetAdornedElement(this.ExtendedItem.View, this.ExtendedItem);
_adornerPanel.Children.Add(_rectangle);
this.ExtendedItem.Services.DesignPanel.Adorners.Add(_adornerPanel);
}
public override void BeginPlacement(PlacementOperation operation)
{
base.BeginPlacement(operation);
if (_rects.Count > 0)
_rects.Clear();
/* Add Rect of all children to _rects */
var children = this.ExtendedItem.ContentProperty.CollectionElements;
foreach (var child in children) {
Point p = child.View.TranslatePoint(new Point(0, 0), this.ExtendedItem.View);
_rects.Add(new Rect(p, child.View.RenderSize));
}
if (_adornerPanel != null && this.ExtendedItem.Services.DesignPanel.Adorners.Contains(_adornerPanel))
this.ExtendedItem.Services.DesignPanel.Adorners.Remove(_adornerPanel);
/* Place the Rectangle */
_adornerPanel = new AdornerPanel();
_rectangle = new Rectangle();
_adornerPanel.SetAdornedElement(this.ExtendedItem.View, this.ExtendedItem);
_adornerPanel.Children.Add(_rectangle);
this.ExtendedItem.Services.DesignPanel.Adorners.Add(_adornerPanel);
}
public override void EndPlacement(PlacementOperation operation)
{
base.EndPlacement(operation);
if (_adornerPanel != null && this.ExtendedItem.Services.DesignPanel.Adorners.Contains(_adornerPanel))
this.ExtendedItem.Services.DesignPanel.Adorners.Remove(_adornerPanel);
}
public override void EndPlacement(PlacementOperation operation)
{
base.EndPlacement(operation);
if (_adornerPanel != null && this.ExtendedItem.Services.DesignPanel.Adorners.Contains(_adornerPanel))
this.ExtendedItem.Services.DesignPanel.Adorners.Remove(_adornerPanel);
}
public override void EnterContainer(PlacementOperation operation)
{
base.EnterContainer(operation);
foreach (var info in operation.PlacedItems) {
info.Item.Properties[FrameworkElement.MarginProperty].Reset();
info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].Reset();
}
_rectangle.Visibility = Visibility.Visible;
}
public override void EnterContainer(PlacementOperation operation)
{
base.EnterContainer(operation);
foreach (var info in operation.PlacedItems) {
info.Item.Properties[FrameworkElement.MarginProperty].Reset();
info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].Reset();
}
_rectangle.Visibility = Visibility.Visible;
}
public override void LeaveContainer(PlacementOperation operation)
{
base.LeaveContainer(operation);
/* Hide the rectangle in case switching to the other container
* otherwise it will show up intersecting with the container */
_rectangle.Visibility = Visibility.Hidden;
}
public override void LeaveContainer(PlacementOperation operation)
{
base.LeaveContainer(operation);
/* Hide the rectangle in case switching to the other container
* otherwise it will show up intersecting with the container */
_rectangle.Visibility = Visibility.Hidden;
}
public override void SetPosition(PlacementInformation info)
{
base.SetPosition(info);
public override void SetPosition(PlacementInformation info)
{
base.SetPosition(info);
var resizeExtensions = info.Item.Extensions.OfType<ResizeThumbExtension>();
if (resizeExtensions != null && resizeExtensions.Count() != 0) {
var resizeExtension = resizeExtensions.First();
_isItemGettingResized = resizeExtension.IsResizing;
}
var resizeExtensions = info.Item.Extensions.OfType<ResizeThumbExtension>();
if (resizeExtensions != null && resizeExtensions.Count() != 0) {
var resizeExtension = resizeExtensions.First();
_isItemGettingResized = resizeExtension.IsResizing;
}
if (_stackPanel != null && !_isItemGettingResized) {
if (_stackPanel.Orientation == Orientation.Vertical) {
var offset = FindHorizontalRectanglePlacementOffset(info.Bounds);
DrawHorizontalRectangle(offset);
} else {
var offset = FindVerticalRectanglePlacementOffset(info.Bounds);
DrawVerticalRectangle(offset);
}
if (_stackPanel != null && !_isItemGettingResized) {
if (_stackPanel.Orientation == Orientation.Vertical) {
var offset = FindHorizontalRectanglePlacementOffset(info.Bounds);
DrawHorizontalRectangle(offset);
} else {
var offset = FindVerticalRectanglePlacementOffset(info.Bounds);
DrawVerticalRectangle(offset);
}
ChangePostionTo(info.Item.View, _indexToInsert);
}
}
ChangePositionTo(info.Item, _indexToInsert);
}
}
private void ChangePostionTo(UIElement element, int index)
{
int elementIndex = 0;
if (_stackPanel.Children.Contains(element))
elementIndex = _stackPanel.Children.IndexOf(element);
if (index > elementIndex)
index--;
_stackPanel.Children.Remove(element);
_stackPanel.Children.Insert(index, element);
}
private double FindHorizontalRectanglePlacementOffset(Rect rect)
{
_rects.Sort((r1, r2) => r1.Top.CompareTo(r2.Top));
var itemCenter = (rect.Top + rect.Bottom)/2;
for (int i = 0; i < _rects.Count; i++) {
var rectCenter = (_rects[i].Top + _rects[i].Bottom)/2;
if (rectCenter >= itemCenter) {
_indexToInsert = i;
return _rects[i].Top;
}
}
_indexToInsert = _rects.Count;
return _rects.Count > 0 ? _rects.Last().Bottom : 0;
}
private double FindVerticalRectanglePlacementOffset(Rect rect)
{
_rects.Sort((r1, r2) => r1.Left.CompareTo(r2.Left));
var itemCenter = (rect.Left + rect.Right)/2;
for (int i = 0; i < _rects.Count; i++) {
var rectCenter = (_rects[i].Left + _rects[i].Top)/2;
if (rectCenter >= itemCenter) {
_indexToInsert = i;
return _rects[i].Left;
}
}
_indexToInsert = _rects.Count;
return _rects.Count > 0 ? _rects.Last().Right : 0;
}
private void DrawHorizontalRectangle(double offset)
{
_rectangle.Height = 2;
_rectangle.Fill = Brushes.Black;
var placement = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Top) {YOffset = offset};
AdornerPanel.SetPlacement(_rectangle, placement);
}
private void DrawVerticalRectangle(double offset)
{
_rectangle.Width = 2;
_rectangle.Fill = Brushes.Black;
var placement = new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Stretch) {XOffset = offset};
AdornerPanel.SetPlacement(_rectangle, placement);
}
}
private void ChangePositionTo(DesignItem element, int index)
{
if (this.ExtendedItem.ContentProperty == null || !this.ExtendedItem.ContentProperty.IsCollection)
return;
var elements = this.ExtendedItem.ContentProperty.CollectionElements;
int elementIndex = elements.IndexOf(element);
if (elementIndex >= 0 && index > elementIndex)
index--;
elements.Remove(element);
elements.Insert(index, element);
}
private double FindHorizontalRectanglePlacementOffset(Rect rect)
{
_rects.Sort((r1, r2) => r1.Top.CompareTo(r2.Top));
var itemCenter = (rect.Top + rect.Bottom)/2;
for (int i = 0; i < _rects.Count; i++) {
var rectCenter = (_rects[i].Top + _rects[i].Bottom)/2;
if (rectCenter >= itemCenter) {
_indexToInsert = i;
return _rects[i].Top;
}
}
_indexToInsert = _rects.Count;
return _rects.Count > 0 ? _rects.Last().Bottom : 0;
}
private double FindVerticalRectanglePlacementOffset(Rect rect)
{
_rects.Sort((r1, r2) => r1.Left.CompareTo(r2.Left));
var itemCenter = (rect.Left + rect.Right)/2;
for (int i = 0; i < _rects.Count; i++) {
var rectCenter = (_rects[i].Left + _rects[i].Top)/2;
if (rectCenter >= itemCenter) {
_indexToInsert = i;
return _rects[i].Left;
}
}
_indexToInsert = _rects.Count;
return _rects.Count > 0 ? _rects.Last().Right : 0;
}
private void DrawHorizontalRectangle(double offset)
{
_rectangle.Height = 2;
_rectangle.Fill = Brushes.Black;
var placement = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Top) {YOffset = offset};
AdornerPanel.SetPlacement(_rectangle, placement);
}
private void DrawVerticalRectangle(double offset)
{
_rectangle.Width = 2;
_rectangle.Fill = Brushes.Black;
var placement = new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Stretch) {XOffset = offset};
AdornerPanel.SetPlacement(_rectangle, placement);
}
}
}

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/DataManager/TableStragy/TableDataManagerFixture.cs

@ -320,8 +320,8 @@ namespace ICSharpCode.Reports.Core.Test.DataManager.TableStrategy @@ -320,8 +320,8 @@ namespace ICSharpCode.Reports.Core.Test.DataManager.TableStrategy
{
if (this.table != null) {
this.table = null;
this.table.Dispose();
this.table = null;
}
}

4
src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/AggregateFunctionsFixture.cs

@ -15,7 +15,7 @@ namespace ICSharpCode.Reports.Core.Test.ReportingLanguage.IntegrationTests @@ -15,7 +15,7 @@ namespace ICSharpCode.Reports.Core.Test.ReportingLanguage.IntegrationTests
{
[TestFixture]
// [SetCulture("de-DE")]
[SetCulture("en-US")]
public class AggregateFunctionsFromTableFixture
{
@ -107,7 +107,7 @@ namespace ICSharpCode.Reports.Core.Test.ReportingLanguage.IntegrationTests @@ -107,7 +107,7 @@ namespace ICSharpCode.Reports.Core.Test.ReportingLanguage.IntegrationTests
const string expression = "=max(amount)";
//var s = this.evaluator.Evaluate(expression);
Assert.That(this.evaluator.Evaluate(expression),
Is.EqualTo("400,5"));
Is.EqualTo("400.5"));
}

2
src/AddIns/Misc/SharpRefactoring/Test/MockTextEditor.cs

@ -32,7 +32,7 @@ namespace SharpRefactoring.Tests @@ -32,7 +32,7 @@ namespace SharpRefactoring.Tests
pc = new DefaultProjectContent();
pc.ReferencedContents.Add(AssemblyParserService.DefaultProjectContentRegistry.Mscorlib);
this.TextEditor.TextArea.TextView.Services.AddService(typeof(ISyntaxHighlighter), new AvalonEditSyntaxHighlighterAdapter(this.TextEditor));
// this.TextEditor.TextArea.TextView.Services.AddService(typeof(ISyntaxHighlighter), new AvalonEditSyntaxHighlighterAdapter(this.TextEditor));
this.TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
}

7
src/AddIns/VersionControl/SubversionAddIn/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs

@ -192,7 +192,12 @@ namespace ICSharpCode.Svn @@ -192,7 +192,12 @@ namespace ICSharpCode.Svn
}
}
return client.SingleStatus(fileName).TextStatus;
try {
return client.SingleStatus(fileName).TextStatus;
} catch (SvnClientException ex) {
LoggingService.Warn(ex);
return StatusKind.None;
}
}
}

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/ImeSupport.cs

@ -51,6 +51,7 @@ namespace ICSharpCode.AvalonEdit.Editing @@ -51,6 +51,7 @@ namespace ICSharpCode.AvalonEdit.Editing
if (textArea != null) {
textArea.GotKeyboardFocus -= TextAreaGotKeyboardFocus;
textArea.LostKeyboardFocus -= TextAreaLostKeyboardFocus;
textArea.OptionChanged -= TextAreaOptionChanged;
textArea = null;
}
ClearContext();

16
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingMargin.cs

@ -3,12 +3,12 @@ @@ -3,12 +3,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.TextFormatting;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.AvalonEdit.Utils;
@ -92,10 +92,16 @@ namespace ICSharpCode.AvalonEdit.Folding @@ -92,10 +92,16 @@ namespace ICSharpCode.AvalonEdit.Folding
static void OnUpdateBrushes(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
FoldingMargin m = null;
if (d is FoldingMargin)
m = (FoldingMargin)d;
else if (d is TextEditor)
m = ((TextEditor)d).TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin;
if (m == null) return;
if (e.Property.Name == FoldingMarkerBrushProperty.Name)
foldingControlPen = MakeFrozenPen((Brush)e.NewValue);
m.foldingControlPen = MakeFrozenPen((Brush)e.NewValue);
if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name)
selectedFoldingControlPen = MakeFrozenPen((Brush)e.NewValue);
m.selectedFoldingControlPen = MakeFrozenPen((Brush)e.NewValue);
}
#endregion
@ -181,8 +187,8 @@ namespace ICSharpCode.AvalonEdit.Folding @@ -181,8 +187,8 @@ namespace ICSharpCode.AvalonEdit.Folding
return markers[index];
}
static Pen foldingControlPen = MakeFrozenPen((Brush)FoldingMarkerBrushProperty.DefaultMetadata.DefaultValue);
static Pen selectedFoldingControlPen = MakeFrozenPen((Brush)SelectedFoldingMarkerBrushProperty.DefaultMetadata.DefaultValue);
Pen foldingControlPen = MakeFrozenPen((Brush)FoldingMarkerBrushProperty.DefaultMetadata.DefaultValue);
Pen selectedFoldingControlPen = MakeFrozenPen((Brush)SelectedFoldingMarkerBrushProperty.DefaultMetadata.DefaultValue);
static Pen MakeFrozenPen(Brush brush)
{

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
<Span color="Preprocessor">
<Begin>\#</Begin>
<RuleSet name="PreprocessorSet">
<Span> <!-- preprocessor directives that allow comments -->
<Span> <!-- preprocessor directives that allows comments -->
<Begin fontWeight="bold">
(define|undef|if|elif|else|endif|line)\b
</Begin>
@ -97,7 +97,7 @@ @@ -97,7 +97,7 @@
</Span>
<Span color="String" multiline="true">
<Begin color="String">@"</Begin>
<Begin>@"</Begin>
<End>"</End>
<RuleSet>
<!-- span for escape sequences -->

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj

@ -232,6 +232,7 @@ @@ -232,6 +232,7 @@
<Compile Include="Rendering\ColorizingTransformer.cs">
<DependentUpon>IVisualLineTransformer.cs</DependentUpon>
</Compile>
<Compile Include="Rendering\ColumnRulerRenderer.cs" />
<Compile Include="Rendering\DocumentColorizingTransformer.cs">
<DependentUpon>IVisualLineTransformer.cs</DependentUpon>
</Compile>

65
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/ColumnRulerRenderer.cs

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
// 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.Windows;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.AvalonEdit.Utils;
namespace ICSharpCode.AvalonEdit
{
/// <summary>
/// Renders a ruler at a certain column.
/// </summary>
public class ColumnRulerRenderer : IBackgroundRenderer
{
Pen pen;
int column;
TextView textView;
public const string Name = "Column ruler";
public static readonly Color DefaultForeground = Colors.LightGray;
public ColumnRulerRenderer(TextView textView)
{
if (textView == null)
throw new ArgumentNullException("textView");
this.pen = new Pen(new SolidColorBrush(DefaultForeground), 1);
this.pen.Freeze();
this.textView = textView;
this.textView.BackgroundRenderers.Add(this);
}
public KnownLayer Layer {
get { return KnownLayer.Background; }
}
public void SetRuler(int column, Brush brush)
{
if (this.column != column) {
this.column = column;
textView.InvalidateLayer(this.Layer);
}
if (pen.Brush != brush) {
this.pen = new Pen(brush, 1);
this.pen.Freeze();
textView.InvalidateLayer(this.Layer);
}
}
public void Draw(TextView textView, System.Windows.Media.DrawingContext drawingContext)
{
if (column < 1) return;
double offset = textView.WideSpaceWidth * column;
Size pixelSize = PixelSnapHelpers.GetPixelSize(textView);
double markerXPos = PixelSnapHelpers.PixelAlign(offset, pixelSize.Width);
Point start = new Point(markerXPos, 0);
Point end = new Point(markerXPos, Math.Max(textView.DocumentHeight, textView.ActualHeight));
drawingContext.DrawLine(pen, start, end);
}
}
}

71
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs

@ -40,6 +40,8 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -40,6 +40,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
FocusableProperty.OverrideMetadata(typeof(TextView), new FrameworkPropertyMetadata(Boxes.False));
}
ColumnRulerRenderer columnRulerRenderer;
/// <summary>
/// Creates a new TextView instance.
/// </summary>
@ -50,7 +52,10 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -50,7 +52,10 @@ namespace ICSharpCode.AvalonEdit.Rendering
elementGenerators = new ObserveAddRemoveCollection<VisualLineElementGenerator>(ElementGenerator_Added, ElementGenerator_Removed);
lineTransformers = new ObserveAddRemoveCollection<IVisualLineTransformer>(LineTransformer_Added, LineTransformer_Removed);
backgroundRenderers = new ObserveAddRemoveCollection<IBackgroundRenderer>(BackgroundRenderer_Added, BackgroundRenderer_Removed);
columnRulerRenderer = new ColumnRulerRenderer(this);
this.Options = new TextEditorOptions();
this.columnRulerRenderer.SetRuler(Options.ColumnRulerPosition, ColumnRulerBrush);
Debug.Assert(singleCharacterElementGenerator != null); // assert that the option change created the builtin element generators
layers = new LayerCollection(this);
@ -178,7 +183,7 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -178,7 +183,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
new FrameworkPropertyMetadata(OnOptionsChanged));
/// <summary>
/// Gets/Sets the document displayed by the text editor.
/// Gets/Sets the options used by the text editor.
/// </summary>
public TextEditorOptions Options {
get { return (TextEditorOptions)GetValue(OptionsProperty); }
@ -198,6 +203,15 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -198,6 +203,15 @@ namespace ICSharpCode.AvalonEdit.Rendering
if (OptionChanged != null) {
OptionChanged(this, e);
}
// PropertyName == null means all properties are changed
if (e.PropertyName == null || e.PropertyName == "ColumnRulerPosition" || e.PropertyName == "ShowColumnRuler") {
if (Options.ShowColumnRuler)
columnRulerRenderer.SetRuler(Options.ColumnRulerPosition, ColumnRulerBrush);
else
columnRulerRenderer.SetRuler(-1, ColumnRulerBrush);
}
UpdateBuiltinElementGeneratorsFromOptions();
Redraw();
}
@ -538,6 +552,36 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -538,6 +552,36 @@ namespace ICSharpCode.AvalonEdit.Rendering
get { return (Brush)GetValue(NonPrintableCharacterBrushProperty); }
set { SetValue(NonPrintableCharacterBrushProperty, value); }
}
/// <summary>
/// LinkTextForegroundBrush dependency property.
/// </summary>
public static readonly DependencyProperty LinkTextForegroundBrushProperty =
DependencyProperty.Register("LinkTextForegroundBrush", typeof(Brush), typeof(TextView),
new FrameworkPropertyMetadata(Brushes.Blue));
/// <summary>
/// Gets/sets the Brush used for displaying link texts.
/// </summary>
public Brush LinkTextForegroundBrush {
get { return (Brush)GetValue(LinkTextForegroundBrushProperty); }
set { SetValue(LinkTextForegroundBrushProperty, value); }
}
/// <summary>
/// LinkTextBackgroundBrush dependency property.
/// </summary>
public static readonly DependencyProperty LinkTextBackgroundBrushProperty =
DependencyProperty.Register("LinkTextBackgroundBrush", typeof(Brush), typeof(TextView),
new FrameworkPropertyMetadata(Brushes.Transparent));
/// <summary>
/// Gets/sets the Brush used for the background of link texts.
/// </summary>
public Brush LinkTextBackgroundBrush {
get { return (Brush)GetValue(LinkTextBackgroundBrushProperty); }
set { SetValue(LinkTextBackgroundBrushProperty, value); }
}
#endregion
#region Redraw methods / VisualLine invalidation
@ -899,7 +943,8 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -899,7 +943,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
// number of pixels clipped from the first visual line(s)
clippedPixelsOnTop = scrollOffset.Y - heightTree.GetVisualPosition(firstLineInView);
Debug.Assert(clippedPixelsOnTop >= 0);
// clippedPixelsOnTop should be >= 0, except for floating point inaccurracy.
Debug.Assert(clippedPixelsOnTop >= -ExtensionMethods.Epsilon);
newVisualLines = new List<VisualLine>();
@ -1886,7 +1931,9 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -1886,7 +1931,9 @@ namespace ICSharpCode.AvalonEdit.Rendering
// and we need to re-measure the font metrics:
InvalidateDefaultTextMetrics();
} else if (e.Property == Control.ForegroundProperty
|| e.Property == TextView.NonPrintableCharacterBrushProperty)
|| e.Property == TextView.NonPrintableCharacterBrushProperty
|| e.Property == TextView.LinkTextBackgroundBrushProperty
|| e.Property == TextView.LinkTextForegroundBrushProperty)
{
// changing brushes requires recreating the cached elements
RecreateCachedElements();
@ -1905,5 +1952,23 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -1905,5 +1952,23 @@ namespace ICSharpCode.AvalonEdit.Rendering
Redraw();
}
}
public static readonly DependencyProperty ColumnRulerBrushProperty =
DependencyProperty.Register("ColumnRulerBrush", typeof(Brush), typeof(TextView),
new FrameworkPropertyMetadata(Brushes.LightGray, OnUpdateBrushes));
public Brush ColumnRulerBrush {
get { return (Brush)GetValue(ColumnRulerBrushProperty); }
set { SetValue(ColumnRulerBrushProperty, value); }
}
public static void OnUpdateBrushes(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
TextView view = d as TextView;
if (view == null) return;
if (e.Property == ColumnRulerBrushProperty)
view.columnRulerRenderer.SetRuler(view.Options.ColumnRulerPosition, (Brush)e.NewValue);
}
}
}

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineLinkText.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Documents;
@ -46,7 +47,8 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -46,7 +47,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
/// <inheritdoc/>
public override TextRun CreateTextRun(int startVisualColumn, ITextRunConstructionContext context)
{
this.TextRunProperties.SetForegroundBrush(Brushes.Blue);
this.TextRunProperties.SetForegroundBrush(context.TextView.LinkTextForegroundBrush);
this.TextRunProperties.SetBackgroundBrush(context.TextView.LinkTextBackgroundBrush);
this.TextRunProperties.SetTextDecorations(TextDecorations.Underline);
return base.CreateTextRun(startVisualColumn, context);
}

32
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs

@ -398,5 +398,37 @@ namespace ICSharpCode.AvalonEdit @@ -398,5 +398,37 @@ namespace ICSharpCode.AvalonEdit
}
}
}
bool showColumnRuler = false;
/// <summary>
/// Gets/Sets whether the column ruler should be shown.
/// </summary>
[DefaultValue(false)]
public virtual bool ShowColumnRuler {
get { return showColumnRuler; }
set {
if (showColumnRuler != value) {
showColumnRuler = value;
OnPropertyChanged("ShowColumnRuler");
}
}
}
int columnRulerPosition = 80;
/// <summary>
/// Gets/Sets where the column ruler should be shown.
/// </summary>
[DefaultValue(80)]
public virtual int ColumnRulerPosition {
get { return columnRulerPosition; }
set {
if (columnRulerPosition != value) {
columnRulerPosition = value;
OnPropertyChanged("ColumnRulerPosition");
}
}
}
}
}

16
src/Libraries/ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -81,6 +81,8 @@ namespace ICSharpCode.Decompiler.Ast @@ -81,6 +81,8 @@ namespace ICSharpCode.Decompiler.Ast
return true;
if (settings.YieldReturn && YieldReturnDecompiler.IsCompilerGeneratorEnumerator(type))
return true;
if (settings.AsyncAwait && AsyncDecompiler.IsCompilerGeneratedStateMachine(type))
return true;
} else if (type.IsCompilerGenerated()) {
if (type.Name.StartsWith("<PrivateImplementationDetails>", StringComparison.Ordinal))
return true;
@ -770,6 +772,10 @@ namespace ICSharpCode.Decompiler.Ast @@ -770,6 +772,10 @@ namespace ICSharpCode.Decompiler.Ast
SetNewModifier(astMethod);
}
astMethod.Body = CreateMethodBody(methodDef, astMethod.Parameters);
if (context.CurrentMethodIsAsync) {
astMethod.Modifiers |= Modifiers.Async;
context.CurrentMethodIsAsync = false;
}
}
ConvertAttributes(astMethod, methodDef);
if (methodDef.HasCustomAttributes && astMethod.Parameters.Count > 0) {
@ -1342,6 +1348,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -1342,6 +1348,7 @@ namespace ICSharpCode.Decompiler.Ast
static void ConvertCustomAttributes(AstNode attributedNode, ICustomAttributeProvider customAttributeProvider, string attributeTarget = null)
{
EntityDeclaration entityDecl = attributedNode as EntityDeclaration;
if (customAttributeProvider.HasCustomAttributes) {
var attributes = new List<ICSharpCode.NRefactory.CSharp.Attribute>();
foreach (var customAttribute in customAttributeProvider.CustomAttributes.OrderBy(a => a.AttributeType.FullName)) {
@ -1353,6 +1360,15 @@ namespace ICSharpCode.Decompiler.Ast @@ -1353,6 +1360,15 @@ namespace ICSharpCode.Decompiler.Ast
// don't show the ParamArrayAttribute (it's converted to the 'params' modifier)
continue;
}
// if the method is async, remove [DebuggerStepThrough] and [Async
if (entityDecl != null && entityDecl.HasModifier(Modifiers.Async)) {
if (customAttribute.AttributeType.Name == "DebuggerStepThroughAttribute" && customAttribute.AttributeType.Namespace == "System.Diagnostics") {
continue;
}
if (customAttribute.AttributeType.Name == "AsyncStateMachineAttribute" && customAttribute.AttributeType.Namespace == "System.Runtime.CompilerServices") {
continue;
}
}
var attribute = new ICSharpCode.NRefactory.CSharp.Attribute();
attribute.AddAnnotation(customAttribute);

6
src/Libraries/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -58,6 +58,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -58,6 +58,7 @@ namespace ICSharpCode.Decompiler.Ast
MethodDefinition oldCurrentMethod = context.CurrentMethod;
Debug.Assert(oldCurrentMethod == null || oldCurrentMethod == methodDef);
context.CurrentMethod = methodDef;
context.CurrentMethodIsAsync = false;
try {
AstMethodBodyBuilder builder = new AstMethodBodyBuilder();
builder.methodDef = methodDef;
@ -847,8 +848,11 @@ namespace ICSharpCode.Decompiler.Ast @@ -847,8 +848,11 @@ namespace ICSharpCode.Decompiler.Ast
case ILCode.ExpressionTreeParameterDeclarations:
args[args.Count - 1].AddAnnotation(new ParameterDeclarationAnnotation(byteCode));
return args[args.Count - 1];
case ILCode.Await:
return new UnaryOperatorExpression(UnaryOperatorType.Await, arg1);
case ILCode.NullableOf:
case ILCode.ValueOf: return arg1;
case ILCode.ValueOf:
return arg1;
default:
throw new Exception("Unknown OpCode: " + byteCode.Code);
}

1
src/Libraries/ICSharpCode.Decompiler/Ast/DecompilerContext.cs

@ -33,6 +33,7 @@ namespace ICSharpCode.Decompiler @@ -33,6 +33,7 @@ namespace ICSharpCode.Decompiler
public TypeDefinition CurrentType;
public MethodDefinition CurrentMethod;
public DecompilerSettings Settings = new DecompilerSettings();
public bool CurrentMethodIsAsync;
// public ITypeResolveContext TypeResolveContext;
// public IProjectContent ProjectContent;

8
src/Libraries/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs

@ -114,6 +114,9 @@ namespace ICSharpCode.Decompiler.Ast @@ -114,6 +114,9 @@ namespace ICSharpCode.Decompiler.Ast
object GetCurrentLocalDefinition()
{
AstNode node = nodeStack.Peek();
if (node is Identifier && node.Parent != null)
node = node.Parent;
var parameterDef = node.Annotation<ParameterDefinition>();
if (parameterDef != null)
return parameterDef;
@ -126,14 +129,11 @@ namespace ICSharpCode.Decompiler.Ast @@ -126,14 +129,11 @@ namespace ICSharpCode.Decompiler.Ast
//if (variable.OriginalVariable != null)
// return variable.OriginalVariable;
return variable;
} else {
}
}
var label = node as LabelStatement;
if (label != null)
{
if (label != null) {
var method = nodeStack.Select(nd => nd.Annotation<MethodReference>()).FirstOrDefault(mr => mr != null);
if (method != null)
return method.ToString() + label.Label;

1
src/Libraries/ICSharpCode.Decompiler/Ast/Transforms/DelegateConstruction.cs

@ -151,6 +151,7 @@ namespace ICSharpCode.Decompiler.Ast.Transforms @@ -151,6 +151,7 @@ namespace ICSharpCode.Decompiler.Ast.Transforms
DecompilerContext subContext = context.Clone();
subContext.CurrentMethod = method;
subContext.CurrentMethodIsAsync = false;
subContext.ReservedVariableNames.AddRange(currentlyUsedVariableNames);
BlockStatement body = AstMethodBodyBuilder.CreateMethodBody(method, subContext, ame.Parameters);
TransformationPipeline.RunTransformationsUntil(body, v => v is DelegateConstruction, subContext);

15
src/Libraries/ICSharpCode.Decompiler/DecompilerSettings.cs

@ -72,6 +72,21 @@ namespace ICSharpCode.Decompiler @@ -72,6 +72,21 @@ namespace ICSharpCode.Decompiler
}
}
bool asyncAwait = true;
/// <summary>
/// Decompile async methods.
/// </summary>
public bool AsyncAwait {
get { return asyncAwait; }
set {
if (asyncAwait != value) {
asyncAwait = value;
OnPropertyChanged("AsyncAwait");
}
}
}
bool automaticProperties = true;
/// <summary>

3
src/Libraries/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -101,6 +101,7 @@ @@ -101,6 +101,7 @@
<Compile Include="FlowAnalysis\SsaOptimization.cs" />
<Compile Include="FlowAnalysis\SsaVariable.cs" />
<Compile Include="FlowAnalysis\TransformToSsa.cs" />
<Compile Include="ILAst\AsyncDecompiler.cs" />
<Compile Include="ILAst\LiftedOperators.cs" />
<Compile Include="ILAst\InitializerPeepholeTransforms.cs" />
<Compile Include="ILAst\DefaultDictionary.cs" />
@ -114,6 +115,8 @@ @@ -114,6 +115,8 @@
<Compile Include="ILAst\PatternMatching.cs" />
<Compile Include="ILAst\PeepholeTransform.cs" />
<Compile Include="ILAst\SimpleControlFlow.cs" />
<Compile Include="ILAst\StateRange.cs" />
<Compile Include="ILAst\SymbolicExecution.cs" />
<Compile Include="ILAst\TypeAnalysis.cs" />
<Compile Include="ILAst\YieldReturnDecompiler.cs" />
<Compile Include="ITextOutput.cs" />

653
src/Libraries/ICSharpCode.Decompiler/ILAst/AsyncDecompiler.cs

@ -0,0 +1,653 @@ @@ -0,0 +1,653 @@
// Copyright (c) 2012 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// 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.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace ICSharpCode.Decompiler.ILAst
{
/// <summary>
/// Decompiler step for C# 5 async/await.
/// </summary>
class AsyncDecompiler
{
public static bool IsCompilerGeneratedStateMachine(TypeDefinition type)
{
if (!(type.DeclaringType != null && type.IsCompilerGenerated()))
return false;
foreach (TypeReference i in type.Interfaces) {
if (i.Namespace == "System.Runtime.CompilerServices" && i.Name == "IAsyncStateMachine")
return true;
}
return false;
}
enum AsyncMethodType
{
Void,
Task,
TaskOfT
}
DecompilerContext context;
// These fields are set by MatchTaskCreationPattern()
AsyncMethodType methodType;
int initialState;
TypeDefinition stateMachineStruct;
MethodDefinition moveNextMethod;
FieldDefinition builderField;
FieldDefinition stateField;
Dictionary<FieldDefinition, ILVariable> fieldToParameterMap = new Dictionary<FieldDefinition, ILVariable>();
// These fields are set by AnalyzeMoveNext()
int finalState = -2;
ILTryCatchBlock mainTryCatch;
ILLabel setResultAndExitLabel;
ILLabel exitLabel;
ILExpression resultExpr;
#region RunStep1() method
public static void RunStep1(DecompilerContext context, ILBlock method)
{
if (!context.Settings.AsyncAwait)
return; // abort if async decompilation is disabled
var yrd = new AsyncDecompiler();
yrd.context = context;
if (!yrd.MatchTaskCreationPattern(method))
return;
#if DEBUG
if (Debugger.IsAttached) {
yrd.Run();
} else {
#endif
try {
yrd.Run();
} catch (SymbolicAnalysisFailedException) {
return;
}
#if DEBUG
}
#endif
context.CurrentMethodIsAsync = true;
method.Body.Clear();
method.EntryGoto = null;
method.Body.AddRange(yrd.newTopLevelBody);
ILAstOptimizer.RemoveRedundantCode(method);
}
void Run()
{
AnalyzeMoveNext();
ValidateCatchBlock(mainTryCatch.CatchBlocks[0]);
AnalyzeStateMachine(mainTryCatch.TryBlock);
// AnalyzeStateMachine invokes ConvertBody
MarkGeneratedVariables();
YieldReturnDecompiler.TranslateFieldsToLocalAccess(newTopLevelBody, fieldToParameterMap);
}
#endregion
#region MatchTaskCreationPattern
bool MatchTaskCreationPattern(ILBlock method)
{
if (method.Body.Count < 5)
return false;
// Check the second-to-last instruction (the start call) first, as we can get the most information from that
MethodReference startMethod;
ILExpression loadStartTarget, loadStartArgument;
// call(AsyncTaskMethodBuilder::Start, ldloca(builder), ldloca(stateMachine))
if (!method.Body[method.Body.Count - 2].Match(ILCode.Call, out startMethod, out loadStartTarget, out loadStartArgument))
return false;
if (startMethod.Name != "Start" || startMethod.DeclaringType == null || startMethod.DeclaringType.Namespace != "System.Runtime.CompilerServices")
return false;
switch (startMethod.DeclaringType.Name) {
case "AsyncTaskMethodBuilder`1":
methodType = AsyncMethodType.TaskOfT;
break;
case "AsyncTaskMethodBuilder":
methodType = AsyncMethodType.Task;
break;
case "AsyncVoidMethodBuilder":
methodType = AsyncMethodType.Void;
break;
default:
return false;
}
ILVariable stateMachineVar, builderVar;
if (!loadStartTarget.Match(ILCode.Ldloca, out builderVar))
return false;
if (!loadStartArgument.Match(ILCode.Ldloca, out stateMachineVar))
return false;
stateMachineStruct = stateMachineVar.Type.ResolveWithinSameModule();
if (stateMachineStruct == null || !stateMachineStruct.IsValueType)
return false;
moveNextMethod = stateMachineStruct.Methods.FirstOrDefault(f => f.Name == "MoveNext");
if (moveNextMethod == null)
return false;
// Check third-to-last instruction (copy of builder):
// stloc(builder, ldfld(StateMachine::<>t__builder, ldloca(stateMachine)))
ILExpression loadBuilderExpr;
if (!method.Body[method.Body.Count - 3].MatchStloc(builderVar, out loadBuilderExpr))
return false;
FieldReference builderFieldRef;
ILExpression loadStateMachineForBuilderExpr;
if (!loadBuilderExpr.Match(ILCode.Ldfld, out builderFieldRef, out loadStateMachineForBuilderExpr))
return false;
if (!loadStateMachineForBuilderExpr.MatchLdloca(stateMachineVar))
return false;
builderField = builderFieldRef.ResolveWithinSameModule();
if (builderField == null)
return false;
// Check the last instruction (ret)
if (methodType == AsyncMethodType.Void) {
if (!method.Body[method.Body.Count - 1].Match(ILCode.Ret))
return false;
} else {
// ret(call(AsyncTaskMethodBuilder::get_Task, ldflda(StateMachine::<>t__builder, ldloca(stateMachine))))
ILExpression returnValue;
if (!method.Body[method.Body.Count - 1].Match(ILCode.Ret, out returnValue))
return false;
MethodReference getTaskMethod;
ILExpression builderExpr;
if (!returnValue.Match(ILCode.Call, out getTaskMethod, out builderExpr))
return false;
ILExpression loadStateMachineForBuilderExpr2;
FieldReference builderField2;
if (!builderExpr.Match(ILCode.Ldflda, out builderField2, out loadStateMachineForBuilderExpr2))
return false;
if (builderField2.ResolveWithinSameModule() != builderField || !loadStateMachineForBuilderExpr2.MatchLdloca(stateMachineVar))
return false;
}
// Check the last field assignment - this should be the state field
ILExpression initialStateExpr;
if (!MatchStFld(method.Body[method.Body.Count - 4], stateMachineVar, out stateField, out initialStateExpr))
return false;
if (!initialStateExpr.Match(ILCode.Ldc_I4, out initialState))
return false;
if (initialState != -1)
return false;
// Check the second-to-last field assignment - this should be the builder field
FieldDefinition builderField3;
ILExpression builderInitialization;
if (!MatchStFld(method.Body[method.Body.Count - 5], stateMachineVar, out builderField3, out builderInitialization))
return false;
MethodReference createMethodRef;
if (builderField3 != builderField || !builderInitialization.Match(ILCode.Call, out createMethodRef))
return false;
if (createMethodRef.Name != "Create")
return false;
for (int i = 0; i < method.Body.Count - 5; i++) {
FieldDefinition field;
ILExpression fieldInit;
if (!MatchStFld(method.Body[i], stateMachineVar, out field, out fieldInit))
return false;
ILVariable v;
if (!fieldInit.Match(ILCode.Ldloc, out v))
return false;
if (!v.IsParameter)
return false;
fieldToParameterMap[field] = v;
}
return true;
}
static bool MatchStFld(ILNode stfld, ILVariable stateMachineVar, out FieldDefinition field, out ILExpression expr)
{
field = null;
FieldReference fieldRef;
ILExpression ldloca;
if (!stfld.Match(ILCode.Stfld, out fieldRef, out ldloca, out expr))
return false;
field = fieldRef.ResolveWithinSameModule();
return field != null && ldloca.MatchLdloca(stateMachineVar);
}
#endregion
#region Analyze MoveNext
void AnalyzeMoveNext()
{
ILBlock ilMethod = CreateILAst(moveNextMethod);
if (ilMethod.Body.Count != 6)
throw new SymbolicAnalysisFailedException();
mainTryCatch = ilMethod.Body[0] as ILTryCatchBlock;
if (mainTryCatch == null || mainTryCatch.CatchBlocks.Count != 1)
throw new SymbolicAnalysisFailedException();
if (mainTryCatch.FaultBlock != null || mainTryCatch.FinallyBlock != null)
throw new SymbolicAnalysisFailedException();
setResultAndExitLabel = ilMethod.Body[1] as ILLabel;
if (setResultAndExitLabel == null)
throw new SymbolicAnalysisFailedException();
if (!MatchStateAssignment(ilMethod.Body[2], out finalState))
throw new SymbolicAnalysisFailedException();
// call(AsyncTaskMethodBuilder`1::SetResult, ldflda(StateMachine::<>t__builder, ldloc(this)), ldloc(<>t__result))
MethodReference setResultMethod;
ILExpression builderExpr;
if (methodType == AsyncMethodType.TaskOfT) {
if (!ilMethod.Body[3].Match(ILCode.Call, out setResultMethod, out builderExpr, out resultExpr))
throw new SymbolicAnalysisFailedException();
} else {
if (!ilMethod.Body[3].Match(ILCode.Call, out setResultMethod, out builderExpr))
throw new SymbolicAnalysisFailedException();
}
if (!(setResultMethod.Name == "SetResult" && IsBuilderFieldOnThis(builderExpr)))
throw new SymbolicAnalysisFailedException();
exitLabel = ilMethod.Body[4] as ILLabel;
if (exitLabel == null)
throw new SymbolicAnalysisFailedException();
}
/// <summary>
/// Creates ILAst for the specified method, optimized up to before the 'YieldReturn' step.
/// </summary>
ILBlock CreateILAst(MethodDefinition method)
{
if (method == null || !method.HasBody)
throw new SymbolicAnalysisFailedException();
ILBlock ilMethod = new ILBlock();
ILAstBuilder astBuilder = new ILAstBuilder();
ilMethod.Body = astBuilder.Build(method, true, context);
ILAstOptimizer optimizer = new ILAstOptimizer();
optimizer.Optimize(context, ilMethod, ILAstOptimizationStep.YieldReturn);
return ilMethod;
}
void ValidateCatchBlock(ILTryCatchBlock.CatchBlock catchBlock)
{
if (catchBlock.ExceptionType == null || catchBlock.ExceptionType.Name != "Exception")
throw new SymbolicAnalysisFailedException();
if (catchBlock.Body.Count != 3)
throw new SymbolicAnalysisFailedException();
int stateID;
if (!(MatchStateAssignment(catchBlock.Body[0], out stateID) && stateID == finalState))
throw new SymbolicAnalysisFailedException();
MethodReference setExceptionMethod;
ILExpression builderExpr, exceptionExpr;
if (!catchBlock.Body[1].Match(ILCode.Call, out setExceptionMethod, out builderExpr, out exceptionExpr))
throw new SymbolicAnalysisFailedException();
if (!(setExceptionMethod.Name == "SetException" && IsBuilderFieldOnThis(builderExpr) && exceptionExpr.MatchLdloc(catchBlock.ExceptionVariable)))
throw new SymbolicAnalysisFailedException();
ILLabel label;
if (!(catchBlock.Body[2].Match(ILCode.Leave, out label) && label == exitLabel))
throw new SymbolicAnalysisFailedException();
}
bool IsBuilderFieldOnThis(ILExpression builderExpr)
{
// ldflda(StateMachine::<>t__builder, ldloc(this))
FieldReference fieldRef;
ILExpression target;
return builderExpr.Match(ILCode.Ldflda, out fieldRef, out target)
&& fieldRef.ResolveWithinSameModule() == builderField
&& target.MatchThis();
}
bool MatchStateAssignment(ILNode stfld, out int stateID)
{
// stfld(StateMachine::<>1__state, ldloc(this), ldc.i4(-2))
stateID = 0;
FieldReference fieldRef;
ILExpression target, val;
if (stfld.Match(ILCode.Stfld, out fieldRef, out target, out val)) {
return fieldRef.ResolveWithinSameModule() == stateField
&& target.MatchThis()
&& val.Match(ILCode.Ldc_I4, out stateID);
}
return false;
}
#endregion
#region AnalyzeStateMachine
ILVariable doFinallyBodies;
List<ILNode> newTopLevelBody;
void AnalyzeStateMachine(ILBlock block)
{
var body = block.Body;
if (body.Count == 0)
throw new SymbolicAnalysisFailedException();
if (DetectDoFinallyBodies(body)) {
body.RemoveAt(0);
if (body.Count == 0)
throw new SymbolicAnalysisFailedException();
}
StateRangeAnalysis rangeAnalysis = new StateRangeAnalysis(body[0], StateRangeAnalysisMode.AsyncMoveNext, stateField);
int bodyLength = block.Body.Count;
int pos = rangeAnalysis.AssignStateRanges(body, bodyLength);
rangeAnalysis.EnsureLabelAtPos(body, ref pos, ref bodyLength);
var labelStateRangeMapping = rangeAnalysis.CreateLabelRangeMapping(body, pos, bodyLength);
newTopLevelBody = ConvertBody(body, pos, bodyLength, labelStateRangeMapping);
newTopLevelBody.Insert(0, MakeGoTo(labelStateRangeMapping, initialState));
newTopLevelBody.Add(setResultAndExitLabel);
if (methodType == AsyncMethodType.TaskOfT) {
newTopLevelBody.Add(new ILExpression(ILCode.Ret, null, resultExpr));
} else {
newTopLevelBody.Add(new ILExpression(ILCode.Ret, null));
}
}
bool DetectDoFinallyBodies(List<ILNode> body)
{
ILVariable v;
ILExpression initExpr;
if (!body[0].Match(ILCode.Stloc, out v, out initExpr))
return false;
int initialValue;
if (!(initExpr.Match(ILCode.Ldc_I4, out initialValue) && initialValue == 1))
return false;
doFinallyBodies = v;
return true;
}
#endregion
#region ConvertBody
ILExpression MakeGoTo(LabelRangeMapping mapping, int state)
{
foreach (var pair in mapping) {
if (pair.Value.Contains(state))
return new ILExpression(ILCode.Br, pair.Key);
}
throw new SymbolicAnalysisFailedException();
}
List<ILNode> ConvertBody(List<ILNode> body, int startPos, int bodyLength, LabelRangeMapping mapping)
{
List<ILNode> newBody = new List<ILNode>();
// Copy all instructions from the old body to newBody.
for (int pos = startPos; pos < bodyLength; pos++) {
ILTryCatchBlock tryCatchBlock = body[pos] as ILTryCatchBlock;
ILExpression expr = body[pos] as ILExpression;
if (expr != null && expr.Code == ILCode.Leave && expr.Operand == exitLabel) {
ILVariable awaiterVar;
FieldDefinition awaiterField;
int targetStateID;
HandleAwait(newBody, out awaiterVar, out awaiterField, out targetStateID);
MarkAsGeneratedVariable(awaiterVar);
newBody.Add(new ILExpression(ILCode.Await, null, new ILExpression(ILCode.Ldloca, awaiterVar)));
newBody.Add(MakeGoTo(mapping, targetStateID));
} else if (tryCatchBlock != null) {
ILTryCatchBlock newTryCatchBlock = new ILTryCatchBlock();
var tryBody = tryCatchBlock.TryBlock.Body;
if (tryBody.Count == 0)
throw new SymbolicAnalysisFailedException();
StateRangeAnalysis rangeAnalysis = new StateRangeAnalysis(tryBody[0], StateRangeAnalysisMode.AsyncMoveNext, stateField);
int tryBodyLength = tryBody.Count;
int posInTryBody = rangeAnalysis.AssignStateRanges(tryBody, tryBodyLength);
rangeAnalysis.EnsureLabelAtPos(tryBody, ref posInTryBody, ref tryBodyLength);
var mappingInTryBlock = rangeAnalysis.CreateLabelRangeMapping(tryBody, posInTryBody, tryBodyLength);
var newTryBody = ConvertBody(tryBody, posInTryBody, tryBodyLength, mappingInTryBlock);
newTryBody.Insert(0, MakeGoTo(mappingInTryBlock, initialState));
// If there's a label at the beginning of the state dispatcher, copy that
if (posInTryBody > 0 && tryBody.FirstOrDefault() is ILLabel)
newTryBody.Insert(0, tryBody.First());
newTryCatchBlock.TryBlock = new ILBlock(newTryBody);
newTryCatchBlock.CatchBlocks = new List<ILTryCatchBlock.CatchBlock>(tryCatchBlock.CatchBlocks);
newTryCatchBlock.FaultBlock = tryCatchBlock.FaultBlock;
if (tryCatchBlock.FinallyBlock != null)
newTryCatchBlock.FinallyBlock = new ILBlock(ConvertFinally(tryCatchBlock.FinallyBlock.Body));
newBody.Add(newTryCatchBlock);
} else {
newBody.Add(body[pos]);
}
}
return newBody;
}
List<ILNode> ConvertFinally(List<ILNode> body)
{
List<ILNode> newBody = new List<ILNode>(body);
ILLabel endFinallyLabel;
ILExpression ceqExpr;
if (newBody.Count > 0 && newBody[0].Match(ILCode.Brtrue, out endFinallyLabel, out ceqExpr)) {
ILExpression loadDoFinallyBodies, loadZero;
object unused;
if (ceqExpr.Match(ILCode.Ceq, out unused, out loadDoFinallyBodies, out loadZero)) {
int num;
if (loadDoFinallyBodies.MatchLdloc(doFinallyBodies) && loadZero.Match(ILCode.Ldc_I4, out num) && num == 0) {
newBody.RemoveAt(0);
}
} else if (ceqExpr.Match(ILCode.LogicNot, out loadDoFinallyBodies)) {
if (loadDoFinallyBodies.MatchLdloc(doFinallyBodies)) {
newBody.RemoveAt(0);
}
}
}
return newBody;
}
void HandleAwait(List<ILNode> newBody, out ILVariable awaiterVar, out FieldDefinition awaiterField, out int targetStateID)
{
// Handle the instructions prior to the exit out of the method to detect what is being awaited.
// (analyses the last instructions in newBody and removes the analyzed instructions from newBody)
if (doFinallyBodies != null) {
// stloc(<>t__doFinallyBodies, ldc.i4(0))
ILExpression dfbInitExpr;
if (!newBody.LastOrDefault().MatchStloc(doFinallyBodies, out dfbInitExpr))
throw new SymbolicAnalysisFailedException();
int val;
if (!(dfbInitExpr.Match(ILCode.Ldc_I4, out val) && val == 0))
throw new SymbolicAnalysisFailedException();
newBody.RemoveAt(newBody.Count - 1); // remove doFinallyBodies assignment
}
// call(AsyncTaskMethodBuilder::AwaitUnsafeOnCompleted, ldflda(StateMachine::<>t__builder, ldloc(this)), ldloca(CS$0$0001), ldloc(this))
ILExpression callAwaitUnsafeOnCompleted = newBody.LastOrDefault() as ILExpression;
newBody.RemoveAt(newBody.Count - 1); // remove AwaitUnsafeOnCompleted call
if (callAwaitUnsafeOnCompleted == null || callAwaitUnsafeOnCompleted.Code != ILCode.Call)
throw new SymbolicAnalysisFailedException();
if (((MethodReference)callAwaitUnsafeOnCompleted.Operand).Name != "AwaitUnsafeOnCompleted")
throw new SymbolicAnalysisFailedException();
if (callAwaitUnsafeOnCompleted.Arguments.Count != 3)
throw new SymbolicAnalysisFailedException();
if (!callAwaitUnsafeOnCompleted.Arguments[1].Match(ILCode.Ldloca, out awaiterVar))
throw new SymbolicAnalysisFailedException();
// stfld(StateMachine::<>u__$awaiter6, ldloc(this), ldloc(CS$0$0001))
FieldReference awaiterFieldRef;
ILExpression loadThis, loadAwaiterVar;
if (!newBody.LastOrDefault().Match(ILCode.Stfld, out awaiterFieldRef, out loadThis, out loadAwaiterVar))
throw new SymbolicAnalysisFailedException();
newBody.RemoveAt(newBody.Count - 1); // remove awaiter field assignment
awaiterField = awaiterFieldRef.ResolveWithinSameModule();
if (!(awaiterField != null && loadThis.MatchThis() && loadAwaiterVar.MatchLdloc(awaiterVar)))
throw new SymbolicAnalysisFailedException();
// stfld(StateMachine::<>1__state, ldloc(this), ldc.i4(0))
if (!MatchStateAssignment(newBody.LastOrDefault(), out targetStateID))
throw new SymbolicAnalysisFailedException();
newBody.RemoveAt(newBody.Count - 1); // remove awaiter field assignment
}
#endregion
#region MarkGeneratedVariables
int smallestGeneratedVariableIndex = int.MaxValue;
void MarkAsGeneratedVariable(ILVariable v)
{
if (v.OriginalVariable != null && v.OriginalVariable.Index >= 0) {
smallestGeneratedVariableIndex = Math.Min(smallestGeneratedVariableIndex, v.OriginalVariable.Index);
}
}
void MarkGeneratedVariables()
{
var expressions = new ILBlock(newTopLevelBody).GetSelfAndChildrenRecursive<ILExpression>();
foreach (var v in expressions.Select(e => e.Operand).OfType<ILVariable>()) {
if (v.OriginalVariable != null && v.OriginalVariable.Index >= smallestGeneratedVariableIndex)
v.IsGenerated = true;
}
}
#endregion
#region RunStep2() method
public static void RunStep2(DecompilerContext context, ILBlock method)
{
if (context.CurrentMethodIsAsync) {
Step2(method.Body);
ILAstOptimizer.RemoveRedundantCode(method);
// Repeat the inlining/copy propagation optimization because the conversion of field access
// to local variables can open up additional inlining possibilities.
ILInlining inlining = new ILInlining(method);
inlining.InlineAllVariables();
inlining.CopyPropagation();
}
}
static void Step2(List<ILNode> body)
{
for (int pos = 0; pos < body.Count; pos++) {
ILTryCatchBlock tc = body[pos] as ILTryCatchBlock;
if (tc != null) {
Step2(tc.TryBlock.Body);
} else {
Step2(body, ref pos);
}
}
}
static bool Step2(List<ILNode> body, ref int pos)
{
// stloc(CS$0$0001, callvirt(class System.Threading.Tasks.Task`1<bool>::GetAwaiter, awaiterExpr)
// brtrue(IL_7C, call(valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter`1<bool>::get_IsCompleted, ldloca(CS$0$0001)))
// await(ldloca(CS$0$0001))
// ...
// IL_7C:
// arg_8B_0 = call(valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter`1<bool>::GetResult, ldloca(CS$0$0001))
// initobj(valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter`1<bool>, ldloca(CS$0$0001))
ILExpression loadAwaiter;
ILVariable awaiterVar;
if (!body[pos].Match(ILCode.Await, out loadAwaiter))
return false;
if (!loadAwaiter.Match(ILCode.Ldloca, out awaiterVar))
return false;
ILVariable stackVar;
ILExpression stackExpr;
while (pos >= 1 && body[pos - 1].Match(ILCode.Stloc, out stackVar, out stackExpr))
pos--;
// stloc(CS$0$0001, callvirt(class System.Threading.Tasks.Task`1<bool>::GetAwaiter, awaiterExpr)
ILExpression getAwaiterCall;
if (!(pos >= 2 && body[pos - 2].MatchStloc(awaiterVar, out getAwaiterCall)))
return false;
MethodReference getAwaiterMethod;
ILExpression awaitedExpr;
if (!(getAwaiterCall.Match(ILCode.Call, out getAwaiterMethod, out awaitedExpr) || getAwaiterCall.Match(ILCode.Callvirt, out getAwaiterMethod, out awaitedExpr)))
return false;
if (awaitedExpr.Code == ILCode.AddressOf) {
// remove 'AddressOf()' when calling GetAwaiter() on a value type
awaitedExpr = awaitedExpr.Arguments[0];
}
// brtrue(IL_7C, call(valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter`1<bool>::get_IsCompleted, ldloca(CS$0$0001)))
ILLabel label;
ILExpression getIsCompletedCall;
if (!(pos >= 1 && body[pos - 1].Match(ILCode.Brtrue, out label, out getIsCompletedCall)))
return false;
int labelPos = body.IndexOf(label);
if (labelPos < pos)
return false;
for (int i = pos + 1; i < labelPos; i++) {
// validate that we aren't deleting any unexpected instructions -
// between the await and the label, there should only be the stack, awaiter and state logic
ILExpression expr = body[i] as ILExpression;
if (expr == null)
return false;
switch (expr.Code) {
case ILCode.Stloc:
case ILCode.Initobj:
case ILCode.Stfld:
case ILCode.Await:
// e.g.
// stloc(CS$0$0001, ldfld(StateMachine::<>u__$awaitere, ldloc(this)))
// initobj(valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter`1<bool>, ldloca(CS$0$0002_66))
// stfld('<AwaitInLoopCondition>d__d'::<>u__$awaitere, ldloc(this), ldloc(CS$0$0002_66))
// stfld('<AwaitInLoopCondition>d__d'::<>1__state, ldloc(this), ldc.i4(-1))
break;
default:
return false;
}
}
if (labelPos + 1 >= body.Count)
return false;
ILExpression resultAssignment = body[labelPos + 1] as ILExpression;
ILVariable resultVar;
ILExpression getResultCall;
bool isResultAssignment = resultAssignment.Match(ILCode.Stloc, out resultVar, out getResultCall);
if (!isResultAssignment)
getResultCall = resultAssignment;
if (!(getResultCall.Operand is MethodReference && ((MethodReference)getResultCall.Operand).Name == "GetResult"))
return false;
pos -= 2; // also delete 'stloc', 'brtrue' and 'await'
body.RemoveRange(pos, labelPos - pos);
Debug.Assert(body[pos] == label);
pos++;
if (isResultAssignment) {
Debug.Assert(body[pos] == resultAssignment);
resultAssignment.Arguments[0] = new ILExpression(ILCode.Await, null, awaitedExpr);
} else {
body[pos] = new ILExpression(ILCode.Await, null, awaitedExpr);
}
// if the awaiter variable is cleared out in the next instruction, remove that instruction
if (IsVariableReset(body.ElementAtOrDefault(pos + 1), awaiterVar)) {
body.RemoveAt(pos + 1);
}
return true;
}
static bool IsVariableReset(ILNode expr, ILVariable variable)
{
object unused;
ILExpression ldloca;
return expr.Match(ILCode.Initobj, out unused, out ldloca) && ldloca.MatchLdloca(variable);
}
#endregion
}
}

15
src/Libraries/ICSharpCode.Decompiler/ILAst/ILAstOptimizer.cs

@ -35,6 +35,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -35,6 +35,7 @@ namespace ICSharpCode.Decompiler.ILAst
InlineVariables,
CopyPropagation,
YieldReturn,
AsyncAwait,
PropertyAccessInstructions,
SplitToMovableBlocks,
TypeInference,
@ -107,6 +108,10 @@ namespace ICSharpCode.Decompiler.ILAst @@ -107,6 +108,10 @@ namespace ICSharpCode.Decompiler.ILAst
if (abortBeforeStep == ILAstOptimizationStep.YieldReturn) return;
YieldReturnDecompiler.Run(context, method);
AsyncDecompiler.RunStep1(context, method);
if (abortBeforeStep == ILAstOptimizationStep.AsyncAwait) return;
AsyncDecompiler.RunStep2(context, method);
if (abortBeforeStep == ILAstOptimizationStep.PropertyAccessInstructions) return;
IntroducePropertyAccessInstructions(method);
@ -256,7 +261,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -256,7 +261,7 @@ namespace ICSharpCode.Decompiler.ILAst
/// Ignore arguments of 'leave'
/// </summary>
/// <param name="method"></param>
void RemoveRedundantCode(ILBlock method)
internal static void RemoveRedundantCode(ILBlock method)
{
Dictionary<ILLabel, int> labelRefCount = new Dictionary<ILLabel, int>();
foreach (ILLabel target in method.GetSelfAndChildrenRecursive<ILExpression>(e => e.IsBranch()).SelectMany(e => e.GetBranchTargets())) {
@ -286,7 +291,13 @@ namespace ICSharpCode.Decompiler.ILAst @@ -286,7 +291,13 @@ namespace ICSharpCode.Decompiler.ILAst
prevExpr.ILRanges.AddRange(((ILExpression)body[i]).ILRanges);
// Ignore pop
} else {
newBody.Add(body[i]);
ILLabel label = body[i] as ILLabel;
if (label != null) {
if (labelRefCount.GetOrDefault(label) > 0)
newBody.Add(label);
} else {
newBody.Add(body[i]);
}
}
}
block.Body = newBody;

6
src/Libraries/ICSharpCode.Decompiler/ILAst/ILCodes.cs

@ -333,7 +333,11 @@ namespace ICSharpCode.Decompiler.ILAst @@ -333,7 +333,11 @@ namespace ICSharpCode.Decompiler.ILAst
/// The last child of this node is the call constructing the expression tree, all other children are the
/// assignments to the ParameterExpression variables.
/// </summary>
ExpressionTreeParameterDeclarations
ExpressionTreeParameterDeclarations,
/// <summary>
/// C# 5 await
/// </summary>
Await
}
public static class ILCodeUtil

12
src/Libraries/ICSharpCode.Decompiler/ILAst/PatternMatching.cs

@ -155,5 +155,17 @@ namespace ICSharpCode.Decompiler.ILAst @@ -155,5 +155,17 @@ namespace ICSharpCode.Decompiler.ILAst
ILVariable v;
return node.Match(ILCode.Ldloc, out v) && v == expectedVar;
}
public static bool MatchLdloca(this ILNode node, ILVariable expectedVar)
{
ILVariable v;
return node.Match(ILCode.Ldloca, out v) && v == expectedVar;
}
public static bool MatchStloc(this ILNode node, ILVariable expectedVar, out ILExpression expr)
{
ILVariable v;
return node.Match(ILCode.Stloc, out v, out expr) && v == expectedVar;
}
}
}

310
src/Libraries/ICSharpCode.Decompiler/ILAst/StateRange.cs

@ -0,0 +1,310 @@ @@ -0,0 +1,310 @@
// Copyright (c) 2012 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// 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.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Mono.Cecil;
namespace ICSharpCode.Decompiler.ILAst
{
struct Interval
{
public readonly int Start, End;
public Interval(int start, int end)
{
Debug.Assert(start <= end || (start == 0 && end == -1));
this.Start = start;
this.End = end;
}
public override string ToString()
{
return string.Format("({0} to {1})", Start, End);
}
}
class StateRange
{
readonly List<Interval> data = new List<Interval>();
public StateRange()
{
}
public StateRange(int start, int end)
{
this.data.Add(new Interval(start, end));
}
public bool IsEmpty {
get { return data.Count == 0; }
}
public bool Contains(int val)
{
foreach (Interval v in data) {
if (v.Start <= val && val <= v.End)
return true;
}
return false;
}
public void UnionWith(StateRange other)
{
data.AddRange(other.data);
}
/// <summary>
/// Unions this state range with (other intersect (minVal to maxVal))
/// </summary>
public void UnionWith(StateRange other, int minVal, int maxVal)
{
foreach (Interval v in other.data) {
int start = Math.Max(v.Start, minVal);
int end = Math.Min(v.End, maxVal);
if (start <= end)
data.Add(new Interval(start, end));
}
}
/// <summary>
/// Merges overlapping interval ranges.
/// </summary>
public void Simplify()
{
if (data.Count < 2)
return;
data.Sort((a, b) => a.Start.CompareTo(b.Start));
Interval prev = data[0];
int prevIndex = 0;
for (int i = 1; i < data.Count; i++) {
Interval next = data[i];
Debug.Assert(prev.Start <= next.Start);
if (next.Start <= prev.End + 1) { // intervals overlapping or touching
prev = new Interval(prev.Start, Math.Max(prev.End, next.End));
data[prevIndex] = prev;
data[i] = new Interval(0, -1); // mark as deleted
} else {
prev = next;
prevIndex = i;
}
}
data.RemoveAll(i => i.Start > i.End); // remove all entries that were marked as deleted
}
public override string ToString()
{
return string.Join(",", data);
}
public Interval ToEnclosingInterval()
{
if (data.Count == 0)
throw new SymbolicAnalysisFailedException();
return new Interval(data[0].Start, data[data.Count - 1].End);
}
}
enum StateRangeAnalysisMode
{
IteratorMoveNext,
IteratorDispose,
AsyncMoveNext
}
class StateRangeAnalysis
{
readonly StateRangeAnalysisMode mode;
readonly FieldDefinition stateField;
internal DefaultDictionary<ILNode, StateRange> ranges;
SymbolicEvaluationContext evalContext;
internal Dictionary<MethodDefinition, Interval> finallyMethodToStateInterval; // used only for IteratorDispose
/// <summary>
/// Initializes the state range logic:
/// Clears 'ranges' and sets 'ranges[entryPoint]' to the full range (int.MinValue to int.MaxValue)
/// </summary>
public StateRangeAnalysis(ILNode entryPoint, StateRangeAnalysisMode mode, FieldDefinition stateField)
{
this.mode = mode;
this.stateField = stateField;
if (mode == StateRangeAnalysisMode.IteratorDispose) {
finallyMethodToStateInterval = new Dictionary<MethodDefinition, Interval>();
}
ranges = new DefaultDictionary<ILNode, StateRange>(n => new StateRange());
ranges[entryPoint] = new StateRange(int.MinValue, int.MaxValue);
evalContext = new SymbolicEvaluationContext(stateField);
}
public int AssignStateRanges(List<ILNode> body, int bodyLength)
{
if (bodyLength == 0)
return 0;
for (int i = 0; i < bodyLength; i++) {
StateRange nodeRange = ranges[body[i]];
nodeRange.Simplify();
ILLabel label = body[i] as ILLabel;
if (label != null) {
ranges[body[i + 1]].UnionWith(nodeRange);
continue;
}
ILTryCatchBlock tryFinally = body[i] as ILTryCatchBlock;
if (tryFinally != null) {
if (mode == StateRangeAnalysisMode.IteratorDispose) {
if (tryFinally.CatchBlocks.Count != 0 || tryFinally.FaultBlock != null || tryFinally.FinallyBlock == null)
throw new SymbolicAnalysisFailedException();
ranges[tryFinally.TryBlock].UnionWith(nodeRange);
if (tryFinally.TryBlock.Body.Count != 0) {
ranges[tryFinally.TryBlock.Body[0]].UnionWith(nodeRange);
AssignStateRanges(tryFinally.TryBlock.Body, tryFinally.TryBlock.Body.Count);
}
continue;
} else if (mode == StateRangeAnalysisMode.AsyncMoveNext) {
return i;
} else {
throw new SymbolicAnalysisFailedException();
}
}
ILExpression expr = body[i] as ILExpression;
if (expr == null)
throw new SymbolicAnalysisFailedException();
switch (expr.Code) {
case ILCode.Switch:
{
SymbolicValue val = evalContext.Eval(expr.Arguments[0]);
if (val.Type != SymbolicValueType.State)
goto default;
ILLabel[] targetLabels = (ILLabel[])expr.Operand;
for (int j = 0; j < targetLabels.Length; j++) {
int state = j - val.Constant;
ranges[targetLabels[j]].UnionWith(nodeRange, state, state);
}
StateRange nextRange = ranges[body[i + 1]];
nextRange.UnionWith(nodeRange, int.MinValue, -1 - val.Constant);
nextRange.UnionWith(nodeRange, targetLabels.Length - val.Constant, int.MaxValue);
break;
}
case ILCode.Br:
case ILCode.Leave:
ranges[(ILLabel)expr.Operand].UnionWith(nodeRange);
break;
case ILCode.Brtrue:
{
SymbolicValue val = evalContext.Eval(expr.Arguments[0]);
if (val.Type == SymbolicValueType.StateEquals) {
ranges[(ILLabel)expr.Operand].UnionWith(nodeRange, val.Constant, val.Constant);
StateRange nextRange = ranges[body[i + 1]];
nextRange.UnionWith(nodeRange, int.MinValue, val.Constant - 1);
nextRange.UnionWith(nodeRange, val.Constant + 1, int.MaxValue);
break;
} else if (val.Type == SymbolicValueType.StateInEquals) {
ranges[body[i + 1]].UnionWith(nodeRange, val.Constant, val.Constant);
StateRange targetRange = ranges[(ILLabel)expr.Operand];
targetRange.UnionWith(nodeRange, int.MinValue, val.Constant - 1);
targetRange.UnionWith(nodeRange, val.Constant + 1, int.MaxValue);
break;
} else {
goto default;
}
}
case ILCode.Nop:
ranges[body[i + 1]].UnionWith(nodeRange);
break;
case ILCode.Ret:
break;
case ILCode.Stloc:
{
SymbolicValue val = evalContext.Eval(expr.Arguments[0]);
if (val.Type == SymbolicValueType.State && val.Constant == 0) {
evalContext.AddStateVariable((ILVariable)expr.Operand);
goto case ILCode.Nop;
} else {
goto default;
}
}
case ILCode.Call:
// in some cases (e.g. foreach over array) the C# compiler produces a finally method outside of try-finally blocks
if (mode == StateRangeAnalysisMode.IteratorDispose) {
MethodDefinition mdef = (expr.Operand as MethodReference).ResolveWithinSameModule();
if (mdef == null || finallyMethodToStateInterval.ContainsKey(mdef))
throw new SymbolicAnalysisFailedException();
finallyMethodToStateInterval.Add(mdef, nodeRange.ToEnclosingInterval());
break;
} else {
goto default;
}
default:
if (mode == StateRangeAnalysisMode.IteratorDispose) {
throw new SymbolicAnalysisFailedException();
} else {
return i;
}
}
}
return bodyLength;
}
public void EnsureLabelAtPos(List<ILNode> body, ref int pos, ref int bodyLength)
{
if (pos > 0 && body[pos - 1] is ILLabel) {
pos--;
} else {
// ensure that the first element at body[pos] is a label:
ILLabel newLabel = new ILLabel();
newLabel.Name = "YieldReturnEntryPoint";
ranges[newLabel] = ranges[body[pos]]; // give the label the range of the instruction at body[pos]
body.Insert(pos, newLabel);
bodyLength++;
}
}
public LabelRangeMapping CreateLabelRangeMapping(List<ILNode> body, int pos, int bodyLength)
{
LabelRangeMapping result = new LabelRangeMapping();
CreateLabelRangeMapping(body, pos, bodyLength, result, false);
return result;
}
void CreateLabelRangeMapping(List<ILNode> body, int pos, int bodyLength, LabelRangeMapping result, bool onlyInitialLabels)
{
for (int i = pos; i < bodyLength; i++) {
ILLabel label = body[i] as ILLabel;
if (label != null) {
result.Add(new KeyValuePair<ILLabel, StateRange>(label, ranges[label]));
} else {
ILTryCatchBlock tryCatchBlock = body[i] as ILTryCatchBlock;
if (tryCatchBlock != null) {
CreateLabelRangeMapping(tryCatchBlock.TryBlock.Body, 0, tryCatchBlock.TryBlock.Body.Count, result, true);
} else if (onlyInitialLabels) {
break;
}
}
}
}
}
class LabelRangeMapping : List<KeyValuePair<ILLabel, StateRange>> {}
}

148
src/Libraries/ICSharpCode.Decompiler/ILAst/SymbolicExecution.cs

@ -0,0 +1,148 @@ @@ -0,0 +1,148 @@
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// 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.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Mono.Cecil;
namespace ICSharpCode.Decompiler.ILAst
{
/// <summary>
/// This exception is thrown when we find something else than we expect from the C# compiler.
/// This aborts the analysis and makes the whole transform fail.
/// </summary>
class SymbolicAnalysisFailedException : Exception {}
enum SymbolicValueType
{
/// <summary>
/// Unknown value
/// </summary>
Unknown,
/// <summary>
/// int: Constant (result of ldc.i4)
/// </summary>
IntegerConstant,
/// <summary>
/// int: State + Constant
/// </summary>
State,
/// <summary>
/// This pointer (result of ldarg.0)
/// </summary>
This,
/// <summary>
/// bool: State == Constant
/// </summary>
StateEquals,
/// <summary>
/// bool: State != Constant
/// </summary>
StateInEquals
}
struct SymbolicValue
{
public readonly int Constant;
public readonly SymbolicValueType Type;
public SymbolicValue(SymbolicValueType type, int constant = 0)
{
this.Type = type;
this.Constant = constant;
}
public override string ToString()
{
return string.Format("[SymbolicValue {0}: {1}]", this.Type, this.Constant);
}
}
class SymbolicEvaluationContext
{
readonly FieldDefinition stateField;
readonly List<ILVariable> stateVariables = new List<ILVariable>();
public SymbolicEvaluationContext(FieldDefinition stateField)
{
this.stateField = stateField;
}
public void AddStateVariable(ILVariable v)
{
if (!stateVariables.Contains(v))
stateVariables.Add(v);
}
SymbolicValue Failed()
{
return new SymbolicValue(SymbolicValueType.Unknown);
}
public SymbolicValue Eval(ILExpression expr)
{
SymbolicValue left, right;
switch (expr.Code) {
case ILCode.Sub:
left = Eval(expr.Arguments[0]);
right = Eval(expr.Arguments[1]);
if (left.Type != SymbolicValueType.State && left.Type != SymbolicValueType.IntegerConstant)
return Failed();
if (right.Type != SymbolicValueType.IntegerConstant)
return Failed();
return new SymbolicValue(left.Type, unchecked ( left.Constant - right.Constant ));
case ILCode.Ldfld:
if (Eval(expr.Arguments[0]).Type != SymbolicValueType.This)
return Failed();
if (CecilExtensions.ResolveWithinSameModule(expr.Operand as FieldReference) != stateField)
return Failed();
return new SymbolicValue(SymbolicValueType.State);
case ILCode.Ldloc:
ILVariable loadedVariable = (ILVariable)expr.Operand;
if (stateVariables.Contains(loadedVariable))
return new SymbolicValue(SymbolicValueType.State);
else if (loadedVariable.IsParameter && loadedVariable.OriginalParameter.Index < 0)
return new SymbolicValue(SymbolicValueType.This);
else
return Failed();
case ILCode.Ldc_I4:
return new SymbolicValue(SymbolicValueType.IntegerConstant, (int)expr.Operand);
case ILCode.Ceq:
case ILCode.Cne:
left = Eval(expr.Arguments[0]);
right = Eval(expr.Arguments[1]);
if (left.Type != SymbolicValueType.State || right.Type != SymbolicValueType.IntegerConstant)
return Failed();
// bool: (state + left.Constant == right.Constant)
// bool: (state == right.Constant - left.Constant)
return new SymbolicValue(expr.Code == ILCode.Ceq ? SymbolicValueType.StateEquals : SymbolicValueType.StateInEquals, unchecked(right.Constant - left.Constant));
case ILCode.LogicNot:
SymbolicValue val = Eval(expr.Arguments[0]);
if (val.Type == SymbolicValueType.StateEquals)
return new SymbolicValue(SymbolicValueType.StateInEquals, val.Constant);
else if (val.Type == SymbolicValueType.StateInEquals)
return new SymbolicValue(SymbolicValueType.StateEquals, val.Constant);
else
return Failed();
default:
return Failed();
}
}
}
}

21
src/Libraries/ICSharpCode.Decompiler/ILAst/TypeAnalysis.cs

@ -790,8 +790,17 @@ namespace ICSharpCode.Decompiler.ILAst @@ -790,8 +790,17 @@ namespace ICSharpCode.Decompiler.ILAst
case ILCode.YieldBreak:
return null;
case ILCode.Ret:
if (forceInferChildren && expr.Arguments.Count == 1)
InferTypeForExpression(expr.Arguments[0], context.CurrentMethod.ReturnType);
if (forceInferChildren && expr.Arguments.Count == 1) {
TypeReference returnType = context.CurrentMethod.ReturnType;
if (context.CurrentMethodIsAsync && returnType != null && returnType.Namespace == "System.Threading.Tasks") {
if (returnType.Name == "Task") {
returnType = typeSystem.Void;
} else if (returnType.Name == "Task`1" && returnType.IsGenericInstance) {
returnType = ((GenericInstanceType)returnType).GenericArguments[0];
}
}
InferTypeForExpression(expr.Arguments[0], returnType);
}
return null;
case ILCode.YieldReturn:
if (forceInferChildren) {
@ -803,6 +812,14 @@ namespace ICSharpCode.Decompiler.ILAst @@ -803,6 +812,14 @@ namespace ICSharpCode.Decompiler.ILAst
}
}
return null;
case ILCode.Await:
{
TypeReference taskType = InferTypeForExpression(expr.Arguments[0], null);
if (taskType.Name == "Task`1" && taskType.IsGenericInstance && taskType.Namespace == "System.Threading.Tasks") {
return ((GenericInstanceType)taskType).GenericArguments[0];
}
return null;
}
#endregion
case ILCode.Pop:
return null;

418
src/Libraries/ICSharpCode.Decompiler/ILAst/YieldReturnDecompiler.cs

@ -24,7 +24,7 @@ using Mono.Cecil; @@ -24,7 +24,7 @@ using Mono.Cecil;
namespace ICSharpCode.Decompiler.ILAst
{
public class YieldReturnDecompiler
class YieldReturnDecompiler
{
// For a description on the code generated by the C# compiler for yield return:
// http://csharpindepth.com/Articles/Chapter6/IteratorBlockImplementation.aspx
@ -34,11 +34,8 @@ namespace ICSharpCode.Decompiler.ILAst @@ -34,11 +34,8 @@ namespace ICSharpCode.Decompiler.ILAst
// - Figure out which of the fields is the state field
// - Construct an exception table based on states. This allows us to determine, for each state, what the parent try block is.
/// <summary>
/// This exception is thrown when we find something else than we expect from the C# compiler.
/// This aborts the analysis and makes the whole transform fail.
/// </summary>
class YieldAnalysisFailedException : Exception {}
// See http://community.sharpdevelop.net/blogs/danielgrunwald/archive/2011/03/06/ilspy-yield-return.aspx
// for a description of this step.
DecompilerContext context;
TypeDefinition enumeratorType;
@ -66,7 +63,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -66,7 +63,7 @@ namespace ICSharpCode.Decompiler.ILAst
#endif
try {
yrd.Run();
} catch (YieldAnalysisFailedException) {
} catch (SymbolicAnalysisFailedException) {
return;
}
#if DEBUG
@ -211,7 +208,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -211,7 +208,7 @@ namespace ICSharpCode.Decompiler.ILAst
}
}
if (stateField == null)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
}
/// <summary>
@ -220,7 +217,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -220,7 +217,7 @@ namespace ICSharpCode.Decompiler.ILAst
ILBlock CreateILAst(MethodDefinition method)
{
if (method == null || !method.HasBody)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
ILBlock ilMethod = new ILBlock();
ILAstBuilder astBuilder = new ILAstBuilder();
@ -269,7 +266,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -269,7 +266,7 @@ namespace ICSharpCode.Decompiler.ILAst
}
}
if (currentField == null)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
}
#endregion
@ -322,337 +319,30 @@ namespace ICSharpCode.Decompiler.ILAst @@ -322,337 +319,30 @@ namespace ICSharpCode.Decompiler.ILAst
disposeMethod = enumeratorType.Methods.FirstOrDefault(m => m.Name == "System.IDisposable.Dispose");
ILBlock ilMethod = CreateILAst(disposeMethod);
finallyMethodToStateInterval = new Dictionary<MethodDefinition, Interval>();
InitStateRanges(ilMethod.Body[0]);
AssignStateRanges(ilMethod.Body, ilMethod.Body.Count, forDispose: true);
var rangeAnalysis = new StateRangeAnalysis(ilMethod.Body[0], StateRangeAnalysisMode.IteratorDispose, stateField);
rangeAnalysis.AssignStateRanges(ilMethod.Body, ilMethod.Body.Count);
finallyMethodToStateInterval = rangeAnalysis.finallyMethodToStateInterval;
// Now look at the finally blocks:
foreach (var tryFinally in ilMethod.GetSelfAndChildrenRecursive<ILTryCatchBlock>()) {
Interval interval = ranges[tryFinally.TryBlock.Body[0]].ToEnclosingInterval();
Interval interval = rangeAnalysis.ranges[tryFinally.TryBlock.Body[0]].ToEnclosingInterval();
var finallyBody = tryFinally.FinallyBlock.Body;
if (finallyBody.Count != 2)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
ILExpression call = finallyBody[0] as ILExpression;
if (call == null || call.Code != ILCode.Call || call.Arguments.Count != 1)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
if (!call.Arguments[0].MatchThis())
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
if (!finallyBody[1].Match(ILCode.Endfinally))
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
MethodDefinition mdef = GetMethodDefinition(call.Operand as MethodReference);
if (mdef == null || finallyMethodToStateInterval.ContainsKey(mdef))
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
finallyMethodToStateInterval.Add(mdef, interval);
}
ranges = null;
}
#endregion
#region Assign StateRanges / Symbolic Execution (used for analysis of Dispose() and MoveNext())
#region struct Interval / class StateRange
struct Interval
{
public readonly int Start, End;
public Interval(int start, int end)
{
Debug.Assert(start <= end || (start == 0 && end == -1));
this.Start = start;
this.End = end;
}
public override string ToString()
{
return string.Format("({0} to {1})", Start, End);
}
}
class StateRange
{
readonly List<Interval> data = new List<Interval>();
public StateRange()
{
}
public StateRange(int start, int end)
{
this.data.Add(new Interval(start, end));
}
public bool Contains(int val)
{
foreach (Interval v in data) {
if (v.Start <= val && val <= v.End)
return true;
}
return false;
}
public void UnionWith(StateRange other)
{
data.AddRange(other.data);
}
/// <summary>
/// Unions this state range with (other intersect (minVal to maxVal))
/// </summary>
public void UnionWith(StateRange other, int minVal, int maxVal)
{
foreach (Interval v in other.data) {
int start = Math.Max(v.Start, minVal);
int end = Math.Min(v.End, maxVal);
if (start <= end)
data.Add(new Interval(start, end));
}
}
/// <summary>
/// Merges overlapping interval ranges.
/// </summary>
public void Simplify()
{
if (data.Count < 2)
return;
data.Sort((a, b) => a.Start.CompareTo(b.Start));
Interval prev = data[0];
int prevIndex = 0;
for (int i = 1; i < data.Count; i++) {
Interval next = data[i];
Debug.Assert(prev.Start <= next.Start);
if (next.Start <= prev.End + 1) { // intervals overlapping or touching
prev = new Interval(prev.Start, Math.Max(prev.End, next.End));
data[prevIndex] = prev;
data[i] = new Interval(0, -1); // mark as deleted
} else {
prev = next;
prevIndex = i;
}
}
data.RemoveAll(i => i.Start > i.End); // remove all entries that were marked as deleted
}
public override string ToString()
{
return string.Join(",", data);
}
public Interval ToEnclosingInterval()
{
if (data.Count == 0)
throw new YieldAnalysisFailedException();
return new Interval(data[0].Start, data[data.Count - 1].End);
}
}
#endregion
DefaultDictionary<ILNode, StateRange> ranges;
ILVariable rangeAnalysisStateVariable;
/// <summary>
/// Initializes the state range logic:
/// Clears 'ranges' and sets 'ranges[entryPoint]' to the full range (int.MinValue to int.MaxValue)
/// </summary>
void InitStateRanges(ILNode entryPoint)
{
ranges = new DefaultDictionary<ILNode, StateRange>(n => new StateRange());
ranges[entryPoint] = new StateRange(int.MinValue, int.MaxValue);
rangeAnalysisStateVariable = null;
}
int AssignStateRanges(List<ILNode> body, int bodyLength, bool forDispose)
{
if (bodyLength == 0)
return 0;
for (int i = 0; i < bodyLength; i++) {
StateRange nodeRange = ranges[body[i]];
nodeRange.Simplify();
ILLabel label = body[i] as ILLabel;
if (label != null) {
ranges[body[i + 1]].UnionWith(nodeRange);
continue;
}
ILTryCatchBlock tryFinally = body[i] as ILTryCatchBlock;
if (tryFinally != null) {
if (!forDispose || tryFinally.CatchBlocks.Count != 0 || tryFinally.FaultBlock != null || tryFinally.FinallyBlock == null)
throw new YieldAnalysisFailedException();
ranges[tryFinally.TryBlock].UnionWith(nodeRange);
if (tryFinally.TryBlock.Body.Count != 0) {
ranges[tryFinally.TryBlock.Body[0]].UnionWith(nodeRange);
AssignStateRanges(tryFinally.TryBlock.Body, tryFinally.TryBlock.Body.Count, forDispose);
}
continue;
}
ILExpression expr = body[i] as ILExpression;
if (expr == null)
throw new YieldAnalysisFailedException();
switch (expr.Code) {
case ILCode.Switch:
{
SymbolicValue val = Eval(expr.Arguments[0]);
if (val.Type != SymbolicValueType.State)
throw new YieldAnalysisFailedException();
ILLabel[] targetLabels = (ILLabel[])expr.Operand;
for (int j = 0; j < targetLabels.Length; j++) {
int state = j - val.Constant;
ranges[targetLabels[j]].UnionWith(nodeRange, state, state);
}
StateRange nextRange = ranges[body[i + 1]];
nextRange.UnionWith(nodeRange, int.MinValue, -1 - val.Constant);
nextRange.UnionWith(nodeRange, targetLabels.Length - val.Constant, int.MaxValue);
break;
}
case ILCode.Br:
case ILCode.Leave:
ranges[(ILLabel)expr.Operand].UnionWith(nodeRange);
break;
case ILCode.Brtrue:
{
SymbolicValue val = Eval(expr.Arguments[0]);
if (val.Type == SymbolicValueType.StateEquals) {
ranges[(ILLabel)expr.Operand].UnionWith(nodeRange, val.Constant, val.Constant);
StateRange nextRange = ranges[body[i + 1]];
nextRange.UnionWith(nodeRange, int.MinValue, val.Constant - 1);
nextRange.UnionWith(nodeRange, val.Constant + 1, int.MaxValue);
} else if (val.Type == SymbolicValueType.StateInEquals) {
ranges[body[i + 1]].UnionWith(nodeRange, val.Constant, val.Constant);
StateRange targetRange = ranges[(ILLabel)expr.Operand];
targetRange.UnionWith(nodeRange, int.MinValue, val.Constant - 1);
targetRange.UnionWith(nodeRange, val.Constant + 1, int.MaxValue);
} else {
throw new YieldAnalysisFailedException();
}
break;
}
case ILCode.Nop:
ranges[body[i + 1]].UnionWith(nodeRange);
break;
case ILCode.Ret:
break;
case ILCode.Stloc:
{
SymbolicValue val = Eval(expr.Arguments[0]);
if (val.Type == SymbolicValueType.State && val.Constant == 0 && rangeAnalysisStateVariable == null)
rangeAnalysisStateVariable = (ILVariable)expr.Operand;
else
throw new YieldAnalysisFailedException();
goto case ILCode.Nop;
}
case ILCode.Call:
// in some cases (e.g. foreach over array) the C# compiler produces a finally method outside of try-finally blocks
if (forDispose) {
MethodDefinition mdef = GetMethodDefinition(expr.Operand as MethodReference);
if (mdef == null || finallyMethodToStateInterval.ContainsKey(mdef))
throw new YieldAnalysisFailedException();
finallyMethodToStateInterval.Add(mdef, nodeRange.ToEnclosingInterval());
} else {
throw new YieldAnalysisFailedException();
}
break;
default:
if (forDispose)
throw new YieldAnalysisFailedException();
else
return i;
}
}
return bodyLength;
}
enum SymbolicValueType
{
/// <summary>
/// int: Constant (result of ldc.i4)
/// </summary>
IntegerConstant,
/// <summary>
/// int: State + Constant
/// </summary>
State,
/// <summary>
/// This pointer (result of ldarg.0)
/// </summary>
This,
/// <summary>
/// bool: State == Constant
/// </summary>
StateEquals,
/// <summary>
/// bool: State != Constant
/// </summary>
StateInEquals
}
struct SymbolicValue
{
public readonly int Constant;
public readonly SymbolicValueType Type;
public SymbolicValue(SymbolicValueType type, int constant = 0)
{
this.Type = type;
this.Constant = constant;
}
public override string ToString()
{
return string.Format("[SymbolicValue {0}: {1}]", this.Type, this.Constant);
}
}
SymbolicValue Eval(ILExpression expr)
{
SymbolicValue left, right;
switch (expr.Code) {
case ILCode.Sub:
left = Eval(expr.Arguments[0]);
right = Eval(expr.Arguments[1]);
if (left.Type != SymbolicValueType.State && left.Type != SymbolicValueType.IntegerConstant)
throw new YieldAnalysisFailedException();
if (right.Type != SymbolicValueType.IntegerConstant)
throw new YieldAnalysisFailedException();
return new SymbolicValue(left.Type, unchecked ( left.Constant - right.Constant ));
case ILCode.Ldfld:
if (Eval(expr.Arguments[0]).Type != SymbolicValueType.This)
throw new YieldAnalysisFailedException();
if (GetFieldDefinition(expr.Operand as FieldReference) != stateField)
throw new YieldAnalysisFailedException();
return new SymbolicValue(SymbolicValueType.State);
case ILCode.Ldloc:
ILVariable loadedVariable = (ILVariable)expr.Operand;
if (loadedVariable == rangeAnalysisStateVariable)
return new SymbolicValue(SymbolicValueType.State);
else if (loadedVariable.IsParameter && loadedVariable.OriginalParameter.Index < 0)
return new SymbolicValue(SymbolicValueType.This);
else
throw new YieldAnalysisFailedException();
case ILCode.Ldc_I4:
return new SymbolicValue(SymbolicValueType.IntegerConstant, (int)expr.Operand);
case ILCode.Ceq:
case ILCode.Cne:
left = Eval(expr.Arguments[0]);
right = Eval(expr.Arguments[1]);
if (left.Type != SymbolicValueType.State || right.Type != SymbolicValueType.IntegerConstant)
throw new YieldAnalysisFailedException();
// bool: (state + left.Constant == right.Constant)
// bool: (state == right.Constant - left.Constant)
return new SymbolicValue(expr.Code == ILCode.Ceq ? SymbolicValueType.StateEquals : SymbolicValueType.StateInEquals, unchecked(right.Constant - left.Constant));
case ILCode.LogicNot:
SymbolicValue val = Eval(expr.Arguments[0]);
if (val.Type == SymbolicValueType.StateEquals)
return new SymbolicValue(SymbolicValueType.StateInEquals, val.Constant);
else if (val.Type == SymbolicValueType.StateInEquals)
return new SymbolicValue(SymbolicValueType.StateEquals, val.Constant);
else
throw new YieldAnalysisFailedException();
default:
throw new YieldAnalysisFailedException();
}
rangeAnalysis = null;
}
#endregion
@ -667,10 +357,10 @@ namespace ICSharpCode.Decompiler.ILAst @@ -667,10 +357,10 @@ namespace ICSharpCode.Decompiler.ILAst
ILBlock ilMethod = CreateILAst(moveNextMethod);
if (ilMethod.Body.Count == 0)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
ILExpression lastReturnArg;
if (!ilMethod.Body.Last().Match(ILCode.Ret, out lastReturnArg))
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
// There are two possibilities:
if (lastReturnArg.Code == ILCode.Ldloc) {
@ -678,14 +368,14 @@ namespace ICSharpCode.Decompiler.ILAst @@ -678,14 +368,14 @@ namespace ICSharpCode.Decompiler.ILAst
returnVariable = (ILVariable)lastReturnArg.Operand;
returnLabel = ilMethod.Body.ElementAtOrDefault(ilMethod.Body.Count - 2) as ILLabel;
if (returnLabel == null)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
} else {
// b) the compiler directly returns constants
returnVariable = null;
returnLabel = null;
// In this case, the last return must return false.
if (lastReturnArg.Code != ILCode.Ldc_I4 || (int)lastReturnArg.Operand != 0)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
}
ILTryCatchBlock tryFaultBlock = ilMethod.Body[0] as ILTryCatchBlock;
@ -694,23 +384,23 @@ namespace ICSharpCode.Decompiler.ILAst @@ -694,23 +384,23 @@ namespace ICSharpCode.Decompiler.ILAst
if (tryFaultBlock != null) {
// there are try-finally blocks
if (returnVariable == null) // in this case, we must use a return variable
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
// must be a try-fault block:
if (tryFaultBlock.CatchBlocks.Count != 0 || tryFaultBlock.FinallyBlock != null || tryFaultBlock.FaultBlock == null)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
ILBlock faultBlock = tryFaultBlock.FaultBlock;
// Ensure the fault block contains the call to Dispose().
if (faultBlock.Body.Count != 2)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
MethodReference disposeMethodRef;
ILExpression disposeArg;
if (!faultBlock.Body[0].Match(ILCode.Call, out disposeMethodRef, out disposeArg))
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
if (GetMethodDefinition(disposeMethodRef) != disposeMethod || !disposeArg.MatchThis())
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
if (!faultBlock.Body[1].Match(ILCode.Endfinally))
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
body = tryFaultBlock.TryBlock.Body;
bodyLength = body.Count;
@ -734,39 +424,22 @@ namespace ICSharpCode.Decompiler.ILAst @@ -734,39 +424,22 @@ namespace ICSharpCode.Decompiler.ILAst
bodyLength--;
ILExpression store0 = body.ElementAtOrDefault(bodyLength - 1) as ILExpression;
if (store0 == null || store0.Code != ILCode.Stloc || store0.Operand != returnVariable)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
if (store0.Arguments[0].Code != ILCode.Ldc_I4 || (int)store0.Arguments[0].Operand != 0)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
bodyLength--; // don't conside the stloc instruction to be part of the body
}
// verify that the last element in the body is a label pointing to the 'ret(false)'
returnFalseLabel = body.ElementAtOrDefault(bodyLength - 1) as ILLabel;
if (returnFalseLabel == null)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
InitStateRanges(body[0]);
int pos = AssignStateRanges(body, bodyLength, forDispose: false);
if (pos > 0 && body[pos - 1] is ILLabel) {
pos--;
} else {
// ensure that the first element at body[pos] is a label:
ILLabel newLabel = new ILLabel();
newLabel.Name = "YieldReturnEntryPoint";
ranges[newLabel] = ranges[body[pos]]; // give the label the range of the instruction at body[pos]
body.Insert(pos, newLabel);
bodyLength++;
}
List<KeyValuePair<ILLabel, StateRange>> labels = new List<KeyValuePair<ILLabel, StateRange>>();
for (int i = pos; i < bodyLength; i++) {
ILLabel label = body[i] as ILLabel;
if (label != null) {
labels.Add(new KeyValuePair<ILLabel, StateRange>(label, ranges[label]));
}
}
var rangeAnalysis = new StateRangeAnalysis(body[0], StateRangeAnalysisMode.IteratorMoveNext, stateField);
int pos = rangeAnalysis.AssignStateRanges(body, bodyLength);
rangeAnalysis.EnsureLabelAtPos(body, ref pos, ref bodyLength);
var labels = rangeAnalysis.CreateLabelRangeMapping(body, pos, bodyLength);
ConvertBody(body, pos, bodyLength, labels);
}
#endregion
@ -797,7 +470,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -797,7 +470,7 @@ namespace ICSharpCode.Decompiler.ILAst
// Handle stores to 'state' or 'current'
if (GetFieldDefinition(expr.Operand as FieldReference) == stateField) {
if (expr.Arguments[1].Code != ILCode.Ldc_I4)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
currentState = (int)expr.Arguments[1].Operand;
stateChanges.Add(new SetState(newBody.Count, currentState));
} else if (GetFieldDefinition(expr.Operand as FieldReference) == currentField) {
@ -809,18 +482,18 @@ namespace ICSharpCode.Decompiler.ILAst @@ -809,18 +482,18 @@ namespace ICSharpCode.Decompiler.ILAst
// handle store+branch to the returnVariable
ILExpression br = body.ElementAtOrDefault(++pos) as ILExpression;
if (br == null || !(br.Code == ILCode.Br || br.Code == ILCode.Leave) || br.Operand != returnLabel || expr.Arguments[0].Code != ILCode.Ldc_I4)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
int val = (int)expr.Arguments[0].Operand;
if (val == 0) {
newBody.Add(MakeGoTo(returnFalseLabel));
} else if (val == 1) {
newBody.Add(MakeGoTo(labels, currentState));
} else {
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
}
} else if (expr != null && expr.Code == ILCode.Ret) {
if (expr.Arguments.Count != 1 || expr.Arguments[0].Code != ILCode.Ldc_I4)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
// handle direct return (e.g. in release builds)
int val = (int)expr.Arguments[0].Operand;
if (val == 0) {
@ -828,24 +501,24 @@ namespace ICSharpCode.Decompiler.ILAst @@ -828,24 +501,24 @@ namespace ICSharpCode.Decompiler.ILAst
} else if (val == 1) {
newBody.Add(MakeGoTo(labels, currentState));
} else {
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
}
} else if (expr != null && expr.Code == ILCode.Call && expr.Arguments.Count == 1 && expr.Arguments[0].MatchThis()) {
MethodDefinition method = GetMethodDefinition(expr.Operand as MethodReference);
if (method == null)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
Interval interval;
if (method == disposeMethod) {
// Explicit call to dispose is used for "yield break;" within the method.
ILExpression br = body.ElementAtOrDefault(++pos) as ILExpression;
if (br == null || !(br.Code == ILCode.Br || br.Code == ILCode.Leave) || br.Operand != returnFalseLabel)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
newBody.Add(MakeGoTo(returnFalseLabel));
} else if (finallyMethodToStateInterval.TryGetValue(method, out interval)) {
// Call to Finally-method
int index = stateChanges.FindIndex(ss => ss.NewState >= interval.Start && ss.NewState <= interval.End);
if (index < 0)
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
ILLabel label = new ILLabel();
label.Name = "JumpOutOfTryFinally" + interval.Start + "_" + interval.End;
@ -883,7 +556,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -883,7 +556,7 @@ namespace ICSharpCode.Decompiler.ILAst
if (pair.Value.Contains(state))
return MakeGoTo(pair.Key);
}
throw new YieldAnalysisFailedException();
throw new SymbolicAnalysisFailedException();
}
ILBlock ConvertFinallyBlock(MethodDefinition finallyMethod)
@ -907,6 +580,11 @@ namespace ICSharpCode.Decompiler.ILAst @@ -907,6 +580,11 @@ namespace ICSharpCode.Decompiler.ILAst
#region TranslateFieldsToLocalAccess
void TranslateFieldsToLocalAccess()
{
TranslateFieldsToLocalAccess(newBody, fieldToParameterMap);
}
internal static void TranslateFieldsToLocalAccess(List<ILNode> newBody, Dictionary<FieldDefinition, ILVariable> fieldToParameterMap)
{
var fieldToLocalMap = new DefaultDictionary<FieldDefinition, ILVariable>(f => new ILVariable { Name = f.Name, Type = f.FieldType });
foreach (ILNode node in newBody) {

4
src/Libraries/ICSharpCode.Decompiler/Properties/AssemblyInfo.cs

@ -19,8 +19,8 @@ using System.Runtime.InteropServices; @@ -19,8 +19,8 @@ using System.Runtime.InteropServices;
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.0.0.1595")]
[assembly: AssemblyInformationalVersion("2.0.0.1595-5773d3d2")]
[assembly: AssemblyVersion("2.1.0.1603")]
[assembly: AssemblyInformationalVersion("2.1.0.1603-1170e2f8")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly",

144
src/Libraries/ICSharpCode.Decompiler/Tests/Async.cs

@ -0,0 +1,144 @@ @@ -0,0 +1,144 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// 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.
#pragma warning disable 1998
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
public class Async
{
public async void SimpleVoidMethod()
{
Console.WriteLine("Before");
await Task.Delay(TimeSpan.FromSeconds(1.0));
Console.WriteLine("After");
}
public async void VoidMethodWithoutAwait()
{
Console.WriteLine("No Await");
}
public async Task SimpleVoidTaskMethod()
{
Console.WriteLine("Before");
await Task.Delay(TimeSpan.FromSeconds(1.0));
Console.WriteLine("After");
}
public async Task TaskMethodWithoutAwait()
{
Console.WriteLine("No Await");
}
public async Task<bool> SimpleBoolTaskMethod()
{
Console.WriteLine("Before");
await Task.Delay(TimeSpan.FromSeconds(1.0));
Console.WriteLine("After");
return true;
}
public async void TwoAwaitsWithDifferentAwaiterTypes()
{
Console.WriteLine("Before");
if (await this.SimpleBoolTaskMethod())
{
await Task.Delay(TimeSpan.FromSeconds(1.0));
}
Console.WriteLine("After");
}
public async void StreamCopyTo(Stream destination, int bufferSize)
{
byte[] array = new byte[bufferSize];
int count;
while ((count = await destination.ReadAsync(array, 0, array.Length)) != 0)
{
await destination.WriteAsync(array, 0, count);
}
}
public async void StreamCopyToWithConfigureAwait(Stream destination, int bufferSize)
{
byte[] array = new byte[bufferSize];
int count;
while ((count = await destination.ReadAsync(array, 0, array.Length).ConfigureAwait(false)) != 0)
{
await destination.WriteAsync(array, 0, count).ConfigureAwait(false);
}
}
public async void AwaitInLoopCondition()
{
while (await this.SimpleBoolTaskMethod())
{
Console.WriteLine("Body");
}
}
public async Task<int> AwaitInForEach(IEnumerable<Task<int>> elements)
{
int num = 0;
foreach (Task<int> current in elements)
{
num += await current;
}
return num;
}
public async Task TaskMethodWithoutAwaitButWithExceptionHandling()
{
try
{
using (new StringWriter())
{
Console.WriteLine("No Await");
}
}
catch (Exception)
{
Console.WriteLine("Crash");
}
}
public async Task<int> NestedAwait(Task<Task<int>> task)
{
return await(await task);
}
public async Task AwaitWithStack(Task<int> task)
{
Console.WriteLine("A", 1, await task);
}
public async Task AwaitWithStack2(Task<int> task)
{
if (await this.SimpleBoolTaskMethod())
{
Console.WriteLine("A", 1, await task);
}
else
{
int num = 1;
Console.WriteLine("A", 1, num);
}
}
}

4
src/Libraries/ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.Decompiler.Tests</RootNamespace>
<AssemblyName>ICSharpCode.Decompiler.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<NoWarn>67,169,1058,728,1720,649</NoWarn>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
@ -62,6 +63,7 @@ @@ -62,6 +63,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Async.cs" />
<Compile Include="CallOverloadedMethod.cs" />
<Compile Include="CheckedUnchecked.cs" />
<Compile Include="ControlFlow.cs" />

2
src/Libraries/ICSharpCode.Decompiler/Tests/PropertiesAndEvents.cs

@ -24,7 +24,7 @@ public class PropertiesAndEvents @@ -24,7 +24,7 @@ public class PropertiesAndEvents
public event EventHandler AutomaticEvent;
[field: NonSerialized]
public event EventHandler AutomaticEventWithInitializer = delegate
public event EventHandler AutomaticEventWithInitializer = delegate(object sender, EventArgs e)
{
};

6
src/Libraries/ICSharpCode.Decompiler/Tests/TestRunner.cs

@ -34,6 +34,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -34,6 +34,12 @@ namespace ICSharpCode.Decompiler.Tests
[TestFixture]
public class TestRunner
{
[Test]
public void Async()
{
TestFile(@"..\..\Tests\Async.cs");
}
[Test, Ignore("disambiguating overloads is not yet implemented")]
public void CallOverloadedMethod()
{

20
src/Main/Base/Project/ICSharpCode.SharpDevelop.addin

@ -2282,8 +2282,8 @@ @@ -2282,8 +2282,8 @@
</Path>
<Path name = "/SharpDevelop/BackendBindings/TemplateCommands">
<Class id="AddDotNet35ReferencesIfTargetFrameworkIs35"
class="ICSharpCode.SharpDevelop.Project.Commands.AddDotNet35ReferencesIfTargetFrameworkIs35Command"/>
<Class id="CheckPortableLibraryInstalled"
class="ICSharpCode.SharpDevelop.Project.PortableLibrary.CheckPortableLibraryInstalled"/>
</Path>
<Path name = "/SharpDevelop/Views/ProjectBrowser/ContextSpecificProperties">
@ -2312,6 +2312,20 @@ @@ -2312,6 +2312,20 @@
</Path>
<Path name = "/SharpDevelop/Workbench/ProjectBehaviors">
<Condition name="ProjectBehaviorSupported" guid="{786C830F-07A1-408B-BD7F-6EE04809D6DB}">
<Class id="PortableLibraryBehavior" class="ICSharpCode.SharpDevelop.Project.PortableLibrary.PortableLibraryProjectBehavior" />
</Condition>
<ComplexCondition>
<And>
<Not> <!-- not already portable -->
<Condition name="ProjectBehaviorSupported" guid="{786C830F-07A1-408B-BD7F-6EE04809D6DB}" />
</Not>
<Or> <!-- and either a C# or VB project -->
<Condition name = "ProjectActive" activeproject="C#" />
<Condition name = "ProjectActive" activeproject="VBNet" />
</Or>
</And>
<Class id="ConvertToPortableLibraryBehavior" class="ICSharpCode.SharpDevelop.Project.PortableLibrary.ConvertToPortableLibraryProjectBehavior" />
</ComplexCondition>
</Path>
</AddIn>

16
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -343,6 +343,18 @@ @@ -343,6 +343,18 @@
<Compile Include="Src\Project\MSBuildEngine\WorkerProcess.cs" />
<Compile Include="Src\Project\MSBuildFileProject.cs" />
<Compile Include="Src\Project\MSBuildItemWrapper.cs" />
<Compile Include="Src\Project\PortableLibrary\CheckPortableLibraryInstalled.cs" />
<Compile Include="Src\Project\PortableLibrary\ConvertToPortableLibraryProjectBehavior.cs" />
<Compile Include="Src\Project\PortableLibrary\PickPortableTargetFramework.cs" />
<Compile Include="Src\Project\PortableLibrary\PortableLibraryProjectBehavior.cs" />
<Compile Include="Src\Project\PortableLibrary\PortableTargetFramework.cs" />
<Compile Include="Src\Project\PortableLibrary\Profile.cs" />
<Compile Include="Src\Project\PortableLibrary\ProfileList.cs" />
<Compile Include="Src\Project\PortableLibrary\SelectProfileDialog.xaml.cs">
<DependentUpon>SelectProfileDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Project\PortableLibrary\SupportedFramework.cs" />
<Compile Include="Src\Project\ProjectChangeWatcher.cs" />
<Compile Include="Src\Project\ProjectLoadInformation.cs" />
<Compile Include="Src\Project\ProjectStartException.cs" />
@ -738,9 +750,9 @@ @@ -738,9 +750,9 @@
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\AsyncDiscoveryState.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\DiscoveryNetworkCredential.cs" />
<Compile Include="Src\Services\ProjectService\ProjectLoader.cs" />
<Compile Include="Src\Util\MultiDictionary.cs" />
<Compile Include="Src\Util\DotnetDetection.cs" />
<Compile Include="Src\Util\FakeXmlViewContent.cs" />
<Compile Include="Src\Util\MultiDictionary.cs" />
<Compile Include="Src\Util\ReactiveExtensions.cs" />
<Compile Include="Src\Util\SharpDevelopServiceContainer.cs" />
<Compile Include="Src\Util\TreeNode.cs" />
@ -813,6 +825,7 @@ @@ -813,6 +825,7 @@
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\AddServiceReferenceDialog.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\AdvancedServiceDialog.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptionsPanel..xaml" />
<Page Include="Src\Project\PortableLibrary\SelectProfileDialog.xaml" />
<Page Include="themes\generic.xaml" />
<ProjectReference Include="..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>
@ -836,6 +849,7 @@ @@ -836,6 +849,7 @@
<Folder Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference" />
<Folder Include="Src\Refactoring" />
<Folder Include="Src\Project\Behaviors" />
<Folder Include="Src\Project\PortableLibrary" />
<Folder Include="themes" />
<Folder Include="Src\Bookmarks\Pad\Controls" />
<Folder Include="Src\Editor\AvalonEdit" />

7
src/Main/Base/Project/Src/Bookmarks/BookmarkManager.cs

@ -5,6 +5,7 @@ using ICSharpCode.NRefactory; @@ -5,6 +5,7 @@ using ICSharpCode.NRefactory;
using System;
using System.Collections.Generic;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
@ -96,7 +97,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -96,7 +97,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
static void OnAdded(BookmarkEventArgs e)
{
if (Added != null) {
Added(null, e);
Added(null, e);
}
}
@ -139,8 +140,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -139,8 +140,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
for(int index = bookmarks.Count - 1; index >= 0; --index){
SDBookmark bookmark = bookmarks[index];
if(match(bookmark)) {
bookmarks.RemoveAt(index);
OnRemoved(new BookmarkEventArgs(bookmark));
bookmarks.RemoveAt(index);
OnRemoved(new BookmarkEventArgs(bookmark));
}
}
}

2
src/Main/Base/Project/Src/Bookmarks/SDMarkerBookmark.cs

@ -23,7 +23,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -23,7 +23,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
protected abstract ITextMarker CreateMarker(ITextMarkerService markerService);
void SetMarker()
public void SetMarker()
{
RemoveMarker();
if (this.Document != null) {

5
src/Main/Base/Project/Src/Editor/ISyntaxHighlighter.cs

@ -20,6 +20,11 @@ namespace ICSharpCode.SharpDevelop.Editor @@ -20,6 +20,11 @@ namespace ICSharpCode.SharpDevelop.Editor
/// </summary>
IEnumerable<string> GetSpanColorNamesFromLineStart(int lineNumber);
/// <summary>
/// Retrieves the HighlightingColor with the specified name. Returns null if no color matching the name is found.
/// </summary>
HighlightingColor GetNamedColor(string name);
/// <summary>
/// Gets the highlighting definition that is being used.
/// </summary>

16
src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs

@ -132,7 +132,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -132,7 +132,7 @@ namespace ICSharpCode.SharpDevelop.Gui
#region label editing
string labelEditOldLabel;
//string labelEditOldLabel;
public void StartLabelEdit(ExtTreeNode node)
{
@ -146,10 +146,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -146,10 +146,12 @@ namespace ICSharpCode.SharpDevelop.Gui
LabelEdit = true;
node.BeforeLabelEdit();
node.BeginEdit();
// remove node's label so that it doesn't get rendered behind the label editing textbox
// (if the user deletes some characters so that the text box shrinks)
labelEditOldLabel = node.Text;
node.Text = "";
// Workaround disabled due to http://community.sharpdevelop.net/forums/t/14354.aspx
// "Rename fails if filename in Project Explorer is too long for the treeview viewport"
//// remove node's label so that it doesn't get rendered behind the label editing textbox
//// (if the user deletes some characters so that the text box shrinks)
//labelEditOldLabel = node.Text;
//node.Text = "";
}
}
@ -176,8 +178,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -176,8 +178,8 @@ namespace ICSharpCode.SharpDevelop.Gui
ExtTreeNode node = e.Node as ExtTreeNode;
if (node != null) {
node.Text = labelEditOldLabel;
labelEditOldLabel = null;
//node.Text = labelEditOldLabel;
//labelEditOldLabel = null;
if (e.Label != null) {
node.AfterLabelEdit(e.Label);
}

163
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs

@ -8,11 +8,11 @@ using System.IO; @@ -8,11 +8,11 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Parser;
using Mono.Cecil;
using ICSharpCode.Build.Tasks;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Parser;
using ICSharpCode.SharpDevelop.Project;
using Mono.Cecil;
namespace ICSharpCode.SharpDevelop.Gui
{
@ -49,7 +49,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -49,7 +49,6 @@ namespace ICSharpCode.SharpDevelop.Gui
protected ListView listView;
CheckBox chooseSpecificVersionCheckBox;
TextBox filterTextBox;
Button searchButton;
ToolTip toolTip = new ToolTip();
ToolTip filterTextboxToolTip = new ToolTip();
ISelectReferenceDialog selectDialog;
@ -92,179 +91,81 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -92,179 +91,81 @@ namespace ICSharpCode.SharpDevelop.Gui
chooseSpecificVersionCheckBox = new CheckBox();
chooseSpecificVersionCheckBox.Dock = DockStyle.Left;
chooseSpecificVersionCheckBox.AutoSize = true;
chooseSpecificVersionCheckBox.Text = StringParser.Parse("${res:Dialog.SelectReferenceDialog.GacReferencePanel.ChooseSpecificAssemblyVersion}");
chooseSpecificVersionCheckBox.CheckedChanged += delegate {
listView.Items.Clear();
if (chooseSpecificVersionCheckBox.Checked)
listView.Items.AddRange(fullItemList);
else
listView.Items.AddRange(shortItemList);
ResetList();
Search();
};
filterTextBox = new TextBox { Width = 100, Dock = DockStyle.Right };
searchButton = new Button { Dock = DockStyle.Right, Width = 50, Text = "Search" };
toolTip.SetToolTip(searchButton, searchButton.Text);
filterTextBox = new TextBox { Width = 150, Dock = DockStyle.Right };
filterTextboxToolTip.SetToolTip(filterTextBox, "Search by type name");
searchButton.Click += searchButton_Click;
filterTextBox.TextChanged += delegate { Search(); };
IButtonControl defaultButton = null;
filterTextBox.Enter += delegate { defaultButton = ((Form)selectDialog).AcceptButton; ((Form)selectDialog).AcceptButton = null; };
filterTextBox.Leave += delegate { ((Form)selectDialog).AcceptButton = defaultButton; };
upperPanel.Controls.Add(chooseSpecificVersionCheckBox);
upperPanel.Controls.Add(filterTextBox);
upperPanel.Controls.Add(searchButton);
this.Controls.Add(upperPanel);
PrintCache();
worker = new BackgroundWorker { WorkerSupportsCancellation = true, WorkerReportsProgress = true };
worker.DoWork += searchTask_DoWork;
worker.RunWorkerCompleted += searchTask_RunWorkerCompleted;
worker.ProgressChanged += searchTask_ProgressChanged;
}
#region Search by types
void searchTask_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
searchButton.Text = string.Format("{0} %", e.ProgressPercentage);
}
void searchTask_DoWork(object sender, DoWorkEventArgs e)
void ResetList()
{
e.Cancel = !SearchTypesName(
chooseSpecificVersionCheckBox.Checked ? fullItemList : shortItemList, filterTextBox.Text);
}
void searchButton_Click(object sender, EventArgs e)
{
string text;
if(!worker.IsBusy) {
filterTextBox.ReadOnly = true;
worker.RunWorkerAsync();
text = "Cancel";
}
else {
worker.CancelAsync();
text = "Search";
filterTextBox.ReadOnly = false;
}
searchButton.Text = text;
this.toolTip.SetToolTip(searchButton, text);
listView.Items.Clear();
if (chooseSpecificVersionCheckBox.Checked)
listView.Items.AddRange(fullItemList);
else
listView.Items.AddRange(shortItemList);
}
void searchTask_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
void Search()
{
if (this.IsDisposed) {
// avoid crash when dialog is closed before search is completed
ResetList();
if (string.IsNullOrWhiteSpace(filterTextBox.Text))
return;
}
searchButton.Text = "Search"; this.toolTip.SetToolTip(searchButton, searchButton.Text);
filterTextBox.ReadOnly = false;
if (resultList != null && resultList.Count > 0) {
listView.Items.Clear();
listView.Items.AddRange(resultList.ToArray());
}
SearchItems(filterTextBox.Text);
listView.Items.Clear();
listView.Items.AddRange(resultList.ToArray());
}
/// <summary>
/// Search for type name.
/// </summary>
/// <param name="list">Array of items where to search.</param>
/// <param name="filter">Filter to search.</param>
/// <returns><c>true</c>, if call succeded, <c>false</c> otherwise.</returns>
bool SearchTypesName(ListViewItem[] list, string filter)
void SearchItems(string text)
{
// return null if list is null
if (list == null) return false;
// return if filter is empty
if (string.IsNullOrEmpty(filter)) {
resultList = list.ToList();
return true;
}
// clear result
resultList.Clear();
// scan the list
for (int i = 0; i < list.Length; ++i) {
ListViewItem item = list[i];
DomAssemblyName asm = item.Tag as DomAssemblyName;
// search path
if (asm.FullName.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0)
resultList.Add(item);
else {
if (worker.CancellationPending)
return false;
// search using Mono.Cecil the class/interface/structs names
AssemblyDefinition currentAssembly;
if(!assembliesCache.ContainsKey(asm.FullName)) {
try {
currentAssembly = resolver.Resolve(asm.FullName);
}
catch {
continue;
}
assembliesCache.Add(asm.FullName, currentAssembly);
}
else
currentAssembly = assembliesCache[asm.FullName];
// search types in modules
if (currentAssembly != null) {
foreach(var module in currentAssembly.Modules)
foreach (var type in module.Types)
if (type.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0 &&
!resultList.Contains(item))
resultList.Add(item);
}
// report
worker.ReportProgress((int)(((i * 1.0) / list.Length) * 100));
}
}
return true;
var searchList = listView.Items.OfType<ListViewItem>().ToList();
searchList.RemoveWhere(item => item.Text.IndexOf(text, StringComparison.OrdinalIgnoreCase) < 0);
resultList = searchList;
}
protected override void Dispose(bool disposing)
{
if (disposing) {
// Clear all resources used.
// cancel the worker
if (worker != null && worker.IsBusy && !worker.CancellationPending)
worker.CancelAsync();
worker = null;
// clear all cached data
if (assembliesCache.Count > 0)
assembliesCache.Clear();
assembliesCache = null;
if (resultList.Count > 0)
resultList.Clear();
resultList = null;
selectDialog = null;
resolver = null;
if (fullItemList.Length > 0)
Array.Clear(fullItemList, 0, fullItemList.Length);
fullItemList = null;
// force a collection to reclam memory
GC.Collect();
}
base.Dispose(disposing);
}
#endregion
void columnClick(object sender, ColumnClickEventArgs e)
{
if(e.Column < 2) {
if (e.Column < 2) {
sorter.CurrentColumn = e.Column;
listView.Sort();
}

13
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ProjectWithServiceReferences.cs

@ -82,9 +82,16 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference @@ -82,9 +82,16 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference
void AddServiceReferencesItemToProject()
{
var projectItem = new ServiceReferencesProjectItem(project);
projectItem.Include = "Service References";
AddProjectItemToProject(projectItem);
if (IsServiceReferencesItemMissingFromProject()) {
var projectItem = new ServiceReferencesProjectItem(project);
projectItem.Include = "Service References";
AddProjectItemToProject(projectItem);
}
}
bool IsServiceReferencesItemMissingFromProject()
{
return project.GetItemsOfType(ItemType.ServiceReferences).Count() == 0;
}
void AddServiceReferenceItemToProject(ServiceReferenceFileName fileName)

3
src/Main/Base/Project/Src/Gui/Dialogs/TreeViewOptionsDialog.xaml.cs

@ -30,6 +30,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -30,6 +30,9 @@ namespace ICSharpCode.SharpDevelop.Gui
if (optionPanels == null)
throw new ArgumentNullException("optionPanels");
InitializeComponent();
ICSharpCode.SharpDevelop.Gui.FormLocationHelper.ApplyWindow(this, "TreeViewOptionsDialog.WindowBounds", true);
var list = optionPanels.Select(op => new OptionPanelNode(op, this)).ToList();
treeView.ItemsSource = list;
if (list.Count > 0) {

20
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ProjectNodeCommands.cs

@ -12,13 +12,12 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -12,13 +12,12 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
{
public override void Run()
{
AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode;
Solution solution = ProjectService.OpenSolution;
if (node == null || solution == null) {
IProject project = ProjectService.CurrentProject;
if (solution == null || project == null)
return;
}
if (node.Project.IsStartable) {
solution.Preferences.StartupProject = node.Project;
if (project.IsStartable) {
solution.Preferences.StartupProject = project;
} else {
MessageService.ShowError("${res:BackendBindings.ExecutionManager.CantExecuteDLLError}");
}
@ -34,15 +33,14 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -34,15 +33,14 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
internal static void DoRunProject(bool withDebugging = true)
{
AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode;
if (node == null) {
IProject project = ProjectService.CurrentProject;
if (project == null)
return;
}
if (node.Project.IsStartable) {
BuildProjectBeforeExecute build = new BuildProjectBeforeExecute(node.Project);
if (project.IsStartable) {
BuildProjectBeforeExecute build = new BuildProjectBeforeExecute(project);
build.BuildComplete += delegate {
if (build.LastBuildResults.ErrorCount == 0) {
node.Project.Start(withDebugging);
project.Start(withDebugging);
}
};
build.Run();

101
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ReferenceFolderNodeCommands.cs

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Web.Services.Discovery;
using System.Windows.Forms;
@ -177,54 +178,70 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -177,54 +178,70 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
}
return webReferencesNode;
}
}
}
public class ShowServiceInBrowser: AbstractMenuCommand
public class ShowServiceInBrowser : AbstractMenuCommand
{
private static string NodePath = "//system.serviceModel//client//endpoint";
static string NodePath = "//system.serviceModel//client//endpoint";
public override void Run()
{
// hack try url fvoid = LoadConfigDocument(f);
XmlDocument appConfig = LoadAppConfig();
if (appConfig != null) {
string endpointAddress = FindEndPointAddress(appConfig);
if (endpointAddress != null) {
StartInternetExplorer(endpointAddress);
} else {
MessageService.ShowError("No service found.");
}
} else {
MessageService.ShowError("No app.config file found.");
}
}
XmlDocument LoadAppConfig()
{
AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode;
var f = CompilableProject.GetAppConfigFile(node.Project,false);
if (!String.IsNullOrEmpty(f))
{
var configFile = LoadConfigDocument(f);
var endPoint = configFile.SelectSingleNode(NodePath).Attributes["address"].Value;
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Normal;
startInfo.Arguments = endPoint;
Process.Start(startInfo);
} else
{
MessageService.ShowError("No app.config File found");
FileName appConfigFileName = CompilableProject.GetAppConfigFile(node.Project, false);
if (!String.IsNullOrEmpty(appConfigFileName)) {
return LoadAppConfig(appConfigFileName);
}
return null;
}
static XmlDocument LoadAppConfig(string fileName)
{
try {
var doc = new XmlDocument();
doc.Load(fileName);
return doc;
} catch (FileNotFoundException ex) {
LoggingService.Debug("LoadConfigDocument: " + fileName + ": " + ex.Message);
}
return null;
}
static XmlDocument LoadConfigDocument(string fileName)
{
XmlDocument doc = null;
try
{
doc = new XmlDocument();
doc.Load(fileName);
return doc;
}
catch (System.IO.FileNotFoundException e)
{
throw new Exception("No configuration file found.", e);
}
}
string FindEndPointAddress(XmlDocument appConfig)
{
XmlNode endPoint = appConfig.SelectSingleNode(NodePath);
if (endPoint != null) {
XmlAttribute addressAttribute = endPoint.Attributes["address"];
if (addressAttribute != null) {
return addressAttribute.Value;
}
}
return null;
}
void StartInternetExplorer(string arguments)
{
var startInfo = new ProcessStartInfo("IExplore.exe") {
WindowStyle = ProcessWindowStyle.Normal,
Arguments = arguments
};
Process.Start(startInfo);
}
}
public class AddServiceReferenceToProject : AbstractMenuCommand
{
@ -235,7 +252,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -235,7 +252,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
if (project == null) {
return;
}
var vm = new AddServiceReferenceViewModel(project);
var dialog = new AddServiceReferenceDialog();
dialog.DataContext = vm;
@ -246,14 +263,12 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -246,14 +263,12 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
}
}
public class RefreshReference : AbstractMenuCommand
{
public override void Run()
{
ReferenceNode node = Owner as ReferenceNode;
if (node != null)
{
var node = Owner as ReferenceNode;
if (node != null) {
ReferenceProjectItem item = node.ReferenceProjectItem;
if (item != null) {
#warning Reimplement RefreshReference

4
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/AbstractProjectBrowserTreeNode.cs

@ -51,8 +51,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -51,8 +51,8 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary>
/// Returns the project in which this node belongs to. This assumes that
/// any node is child of a project. THIS DON'T WORK ON COMBINE NODES!
/// (a combine node returns null)
/// any node is child of a project. Keep in mind that Solution Folders
/// and Solution Items do not have a project assigned.
/// </summary>
public virtual IProject Project {
get {

2
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs

@ -43,6 +43,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -43,6 +43,8 @@ namespace ICSharpCode.SharpDevelop.Project
public ProjectNode(IProject project)
{
if (project == null)
throw new ArgumentNullException("project");
sortOrder = 1;
this.ContextmenuAddinTreePath = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectNode";

2
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs

@ -27,7 +27,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -27,7 +27,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
public ProjectCreateInformation(IEnumerable<IProject> projects)
{
Platform = "x86";
Platform = "AnyCPU";
createdProjects.AddRange(projects);
}

62
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

@ -42,6 +42,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -42,6 +42,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
string name;
string relativePath;
string defaultPlatform;
/// <summary>
/// The language of the project.
@ -56,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -56,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
List<ProjectItem> projectItems = new List<ProjectItem>();
List<ProjectProperty> projectProperties = new List<ProjectProperty>();
List<Action<IProject>> createActions = new List<Action<IProject>>();
List<Action<ProjectCreateInformation>> preCreateActions = new List<Action<ProjectCreateInformation>>();
/// <summary>
/// Creates a project descriptor for the project node specified by the xml element.
@ -83,6 +85,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -83,6 +85,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
if (string.IsNullOrEmpty(languageName)) {
ProjectTemplate.WarnAttributeMissing(element, "language");
}
defaultPlatform = element.GetAttribute("defaultPlatform");
LoadElementChildren(element, hintPath);
}
@ -109,6 +112,9 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -109,6 +112,9 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
case "CreateActions":
LoadCreateActions(node);
break;
case "PreCreateActions":
LoadPreCreateActions(node);
break;
case "ProjectItems":
LoadProjectItems(node);
break;
@ -151,7 +157,16 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -151,7 +157,16 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
}
}
static Action<IProject> ReadAction(XmlElement el)
void LoadPreCreateActions(XmlElement preCreateActionsElement)
{
foreach (XmlElement el in preCreateActionsElement) {
Action<ProjectCreateInformation> action = ReadAction(el);
if (action != null)
preCreateActions.Add(action);
}
}
static Action<object> ReadAction(XmlElement el)
{
switch (el.Name) {
case "RunCommand":
@ -310,6 +325,10 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -310,6 +325,10 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
projectCreateInformation.OutputProjectFileName = projectLocation;
projectCreateInformation.RootNamespace = standardNamespace.ToString();
projectCreateInformation.ProjectName = newProjectName;
if (!string.IsNullOrEmpty(defaultPlatform))
projectCreateInformation.Platform = defaultPlatform;
RunPreCreateActions(projectCreateInformation);
StringParserPropertyContainer.FileCreation["StandardNamespace"] = projectCreateInformation.RootNamespace;
@ -422,6 +441,24 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -422,6 +441,24 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
}
}
// Add properties from <PropertyGroup>
// This must be done before adding <Imports>, because the import path can refer to properties.
if (projectProperties.Count > 0) {
if (!(project is MSBuildBasedProject))
throw new Exception("<PropertyGroup> may be only used in project templates for MSBuildBasedProjects");
foreach (ProjectProperty p in projectProperties) {
((MSBuildBasedProject)project).SetProperty(
StringParser.Parse(p.Configuration),
StringParser.Parse(p.Platform),
StringParser.Parse(p.Name),
StringParser.Parse(p.Value),
p.Location,
p.ValueIsLiteral
);
}
}
// Add Imports
if (clearExistingImports || projectImports.Count > 0) {
MSBuildBasedProject msbuildProject = project as MSBuildBasedProject;
@ -450,22 +487,6 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -450,22 +487,6 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
}
}
if (projectProperties.Count > 0) {
if (!(project is MSBuildBasedProject))
throw new Exception("<PropertyGroup> may be only used in project templates for MSBuildBasedProjects");
foreach (ProjectProperty p in projectProperties) {
((MSBuildBasedProject)project).SetProperty(
StringParser.Parse(p.Configuration),
StringParser.Parse(p.Platform),
StringParser.Parse(p.Name),
StringParser.Parse(p.Value),
p.Location,
p.ValueIsLiteral
);
}
}
// Add Files
if (project is IProjectItemListProvider) {
@ -503,6 +524,13 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -503,6 +524,13 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
}
}
void RunPreCreateActions(ProjectCreateInformation projectCreateInformation)
{
foreach (var action in preCreateActions) {
action(projectCreateInformation);
}
}
void RunCreateActions(IProject project)
{
foreach (Action<IProject> action in createActions) {

1
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs

@ -317,7 +317,6 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -317,7 +317,6 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
string solutionLocation = projectCreateInformation.Solution.FileName;
if (createNewSolution) {
projectCreateInformation.Solution.AddFolder(project);
projectCreateInformation.Solution.FixSolutionConfiguration(new IProject[] {project});
projectCreateInformation.Solution.Save();
ProjectService.OnSolutionCreated(new SolutionEventArgs(projectCreateInformation.Solution));
projectCreateInformation.Solution.Dispose();

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save