Browse Source

added initial vb.net binding (very c#-ish at the moment)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@36 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Markus Palme 21 years ago
parent
commit
d7bf7939a4
  1. 31
      src/AddIns/BackendBindings/VBNetBinding/Project/Configuration/AssemblyInfo.cs
  2. 122
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/AdvancedBuildOptionsDialog.xfrm
  3. 185
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/ApplicationSettings.xfrm
  4. 86
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/BuildEvents.xfrm
  5. 189
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/BuildOptions.xfrm
  6. 114
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/DebugOptions.xfrm
  7. 250
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/Publish.xfrm
  8. 71
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/ReferencePaths.xfrm
  9. 94
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/Signing.xfrm
  10. 199
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/DocumentAccessor.cs
  11. 375
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/Indentation.cs
  12. 457
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs
  13. 95
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/ApplicationSettings.cs
  14. 55
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildEvents.cs
  15. 173
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptions.cs
  16. 87
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/DebugOptions.cs
  17. 27
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/Publish.cs
  18. 26
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/ReferencePaths.cs
  19. 82
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/Signing.cs
  20. 440
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/Parser/ExpressionFinder.cs
  21. 141
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/Parser/Parser.cs
  22. 599
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs
  23. 570
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetAmbience.cs
  24. 85
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetBindingExecutionManager.cs
  25. 90
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs
  26. 77
      src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin
  27. 111
      src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj
  28. 11
      src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj.user
  29. 20
      src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.sln
  30. BIN
      src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.suo

31
src/AddIns/BackendBindings/VBNetBinding/Project/Configuration/AssemblyInfo.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("VB.NET Binding")]
[assembly: AssemblyDescription("VB.NET language binding for #develop")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("www.icsharpcode.net")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("(c) 2005 Mike Krueger, Markus Palme")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("2.0.0.1")]
// The following attributes specify the key for the sign of your assembly. See the
// .NET Framework documentation for more information about signing.
// This is not required, if you don't want signing let these attributes like they're.
[assembly: AssemblyDelaySign(false)]

122
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/AdvancedBuildOptionsDialog.xfrm

@ -0,0 +1,122 @@ @@ -0,0 +1,122 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="XmlForm1" />
<FormBorderStyle value="FixedDialog" />
<ClientSize value="{Width=384, Height=262}" />
<DockPadding value="" />
<Text value="Advanced Build Settings" />
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: OK" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: Cancel" />
<Controls>
<System.Windows.Forms.ComboBox>
<Name value="DLLBaseAddressComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="11" />
<Location value="{X=156,Y=200}" />
<Size value="{Width=220, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label5" />
<Text value="DLL &amp;Base Address:" />
<TextAlign value="MiddleRight" />
<TabIndex value="10" />
<Size value="{Width=148, Height=23}" />
<Location value="{X=4,Y=200}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="fileAlignmentComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="9" />
<Location value="{X=156,Y=172}" />
<Size value="{Width=220, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label4" />
<Text value="&amp;File Alignment:" />
<TextAlign value="MiddleRight" />
<TabIndex value="8" />
<Size value="{Width=144, Height=23}" />
<Location value="{X=8,Y=172}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="debugInfoComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="7" />
<Location value="{X=156,Y=144}" />
<Size value="{Width=220, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label3" />
<Text value="D&amp;ebug Info:" />
<TextAlign value="MiddleRight" />
<TabIndex value="6" />
<Size value="{Width=144, Height=23}" />
<Location value="{X=8,Y=144}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.CheckBox>
<Name value="noMsCorLibReferenceCheckBox" />
<Location value="{X=8,Y=116}" />
<Size value="{Width=368, Height=20}" />
<Text value="D&amp;o not reference mscorlib.dll" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="checkOverUnderflowCheckBox" />
<Location value="{X=8,Y=92}" />
<Size value="{Width=368, Height=20}" />
<Text value="C&amp;heck for arithmetic overflow/underflow" />
<Anchor value="Top, Left, Right" />
<TabIndex value="4" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.ComboBox>
<Name value="reportCompilerErrorComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Location value="{X=8,Y=64}" />
<Size value="{Width=368, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="&amp;Report Compiler Errors:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Size value="{Width=352, Height=16}" />
<Location value="{X=8,Y=48}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="languageVersionComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=8,Y=24}" />
<Size value="{Width=368, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="&amp;Language Version:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=360, Height=16}" />
<Location value="{X=8,Y=8}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=304,Y=232}" />
<Text value="Cancel" />
<Anchor value="Bottom, Right" />
<TabIndex value="12" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="okButton" />
<Location value="{X=216,Y=232}" />
<Text value="OK" />
<Anchor value="Bottom, Right" />
<TabIndex value="12" />
<DialogResult value="OK" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.Form>
</Components>

185
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/ApplicationSettings.xfrm

@ -0,0 +1,185 @@ @@ -0,0 +1,185 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlUserControl1" />
<DockPadding value="" />
<ClientSize value="{Width=456, Height=364}" />
<Controls>
<System.Windows.Forms.Button>
<Name value="win32ResourceFileBrowseButton" />
<Location value="{X=408,Y=208}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="14" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ComboBox>
<Name value="win32ResourceFileComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="13" />
<Location value="{X=8,Y=208}" />
<Size value="{Width=392, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label9" />
<Text value="Win32 R&amp;esource File:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="12" />
<Size value="{Width=436, Height=16}" />
<Location value="{X=8,Y=192}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="applicationIconBrowseButton" />
<Location value="{X=408,Y=160}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="11" />
</System.Windows.Forms.Button>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<TabIndex value="15" />
<Location value="{X=8,Y=236}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=440, Height=112}" />
<Text value="Project Information" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="outputNameTextBox" />
<ReadOnly value="True" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
<Location value="{X=112,Y=80}" />
<Size value="{Width=320, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label8" />
<Text value="Output Name:" />
<TextAlign value="MiddleRight" />
<TabIndex value="4" />
<Location value="{X=8,Y=80}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="projectFileTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Location value="{X=112,Y=56}" />
<Size value="{Width=320, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label7" />
<Text value="Project &amp;File:" />
<TextAlign value="MiddleRight" />
<TabIndex value="2" />
<Location value="{X=8,Y=52}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="projectFolderTextBox" />
<ReadOnly value="True" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=112,Y=28}" />
<Size value="{Width=320, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label6" />
<Text value="Project Folder:" />
<TextAlign value="MiddleRight" />
<TabIndex value="0" />
<Location value="{X=8,Y=24}" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.PictureBox>
<Name value="applicationIconPictureBox" />
<Size value="{Width=48, Height=48}" />
<Location value="{X=8,Y=140}" />
<SizeMode value="StretchImage" />
</System.Windows.Forms.PictureBox>
<System.Windows.Forms.ComboBox>
<Name value="applicationIconComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="10" />
<Location value="{X=64,Y=160}" />
<Size value="{Width=336, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label5" />
<Text value="Application i&amp;con:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="9" />
<Size value="{Width=384, Height=16}" />
<Location value="{X=64,Y=144}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="startupObjectComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="7" />
<Location value="{X=160,Y=112}" />
<Size value="{Width=288, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label4" />
<Text value="&amp;Startup object:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="6" />
<Size value="{Width=288, Height=16}" />
<Location value="{X=160,Y=96}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="outputTypeComboBox" />
<TabIndex value="5" />
<Location value="{X=8,Y=112}" />
<Size value="{Width=136, Height=21}" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label3" />
<Text value="&amp;Output type:" />
<TextAlign value="BottomLeft" />
<TabIndex value="4" />
<Size value="{Width=136, Height=16}" />
<Location value="{X=8,Y=96}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="rootNamespaceTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Location value="{X=8,Y=68}" />
<Size value="{Width=440, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="&amp;Root namespace:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Size value="{Width=440, Height=16}" />
<Location value="{X=8,Y=52}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="assemblyNameTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=8,Y=24}" />
<Size value="{Width=440, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="Assembly &amp;name:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=440, Height=16}" />
<Location value="{X=8,Y=8}" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

86
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/BuildEvents.xfrm

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlUserControl1" />
<DockPadding value="" />
<ClientSize value="{Width=384, Height=256}" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=364, Height=180}" />
<Text value="Build Events" />
<Controls>
<System.Windows.Forms.ComboBox>
<Name value="runPostBuildEventComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="8" />
<Location value="{X=8,Y=153}" />
<Size value="{Width=184, Height=21}" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label3" />
<Text value="&amp;Run the post-build event:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="7" />
<Size value="{Width=352, Height=23}" />
<Location value="{X=8,Y=130}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="postBuildEventTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
<Location value="{X=8,Y=96}" />
<Size value="{Width=304, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="P&amp;ost-build event command line:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="4" />
<Size value="{Width=344, Height=23}" />
<Location value="{X=8,Y=75}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="postBuildEventBrowseButton" />
<Location value="{X=316,Y=98}" />
<Size value="{Width=40, Height=23}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="6" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="preBuildEventTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Location value="{X=8,Y=49}" />
<Size value="{Width=304, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="P&amp;re-build event command line:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Size value="{Width=344, Height=23}" />
<Location value="{X=8,Y=25}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="preBuildEventBrowseButton" />
<Location value="{X=316,Y=50}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

189
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/BuildOptions.xfrm

@ -0,0 +1,189 @@ @@ -0,0 +1,189 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlUserControl1" />
<DockPadding value="" />
<ClientSize value="{Width=432, Height=480}" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="groupBox3" />
<TabIndex value="8" />
<Location value="{X=8,Y=288}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=416, Height=168}" />
<Text value="Output" />
<Controls>
<System.Windows.Forms.Button>
<Name value="advancedOptionsButton" />
<Location value="{X=320,Y=142}" />
<Size value="{Width=84, Height=21}" />
<Text value="Ad&amp;vanced" />
<Anchor value="Top, Right" />
<TabIndex value="6" />
</System.Windows.Forms.Button>
<System.Windows.Forms.CheckBox>
<Name value="registerCOMInteropCheckBox" />
<Location value="{X=8,Y=123}" />
<Size value="{Width=308, Height=20}" />
<Text value="&amp;Register for COM Interop" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="xmlDocumentationCheckBox" />
<Location value="{X=8,Y=73}" />
<Size value="{Width=400, Height=20}" />
<Text value="&amp;XML Documentation File" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.TextBox>
<Name value="xmlDocumentationTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="4" />
<Location value="{X=24,Y=96}" />
<Size value="{Width=384, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label5" />
<Text value="Ou&amp;tput Path:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=400, Height=16}" />
<Location value="{X=8,Y=27}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="outputPathTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=8,Y=45}" />
<Size value="{Width=352, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="outputPathBrowseButton" />
<Location value="{X=368,Y=45}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox2" />
<TabIndex value="7" />
<Location value="{X=8,Y=184}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=416, Height=100}" />
<Text value="Treat Warnings as Errors" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="specificWarningsTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Location value="{X=136,Y=44}" />
<Size value="{Width=272, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.RadioButton>
<Name value="allRadioButton" />
<Location value="{X=8,Y=68}" />
<Size value="{Width=128, Height=24}" />
<Text value="A&amp;ll" />
<TabIndex value="3" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="specificWarningsRadioButton" />
<Location value="{X=8,Y=44}" />
<Size value="{Width=128, Height=24}" />
<Text value="Sp&amp;ecific Warnings:" />
<TabIndex value="1" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="noneRadioButton" />
<Location value="{X=8,Y=20}" />
<Size value="{Width=128, Height=24}" />
<Text value="&amp;None" />
<TabIndex value="0" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<TabIndex value="6" />
<Location value="{X=8,Y=96}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=416, Height=80}" />
<Text value="Errors and Warnings" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="suppressWarningsTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Location value="{X=164,Y=44}" />
<Size value="{Width=244, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label4" />
<Text value="&amp;Suppress Warnings:" />
<TextAlign value="MiddleRight" />
<TabIndex value="2" />
<Size value="{Width=160, Height=23}" />
<Location value="{X=4,Y=44}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="warningLevelComboBox" />
<TabIndex value="1" />
<Location value="{X=164,Y=20}" />
<Size value="{Width=60, Height=21}" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label3" />
<Text value="&amp;Warning Level:" />
<TextAlign value="MiddleRight" />
<TabIndex value="0" />
<Size value="{Width=160, Height=23}" />
<Location value="{X=4,Y=20}" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.CheckBox>
<Name value="optimizeCodeCheckBox" />
<Location value="{X=8,Y=48}" />
<Size value="{Width=416, Height=24}" />
<Text value="Opti&amp;mize code" />
<Anchor value="Top, Left, Right" />
<TabIndex value="4" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="allowUnsafeCodeCheckBox" />
<Location value="{X=8,Y=72}" />
<Size value="{Width=416, Height=24}" />
<Text value="Allow &amp;Unsafe code" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.TextBox>
<Name value="conditionalSymbolsTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=8,Y=24}" />
<Size value="{Width=416, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="Con&amp;ditional Compilation Symbols:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=416, Height=16}" />
<Location value="{X=8,Y=8}" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

114
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/DebugOptions.xfrm

@ -0,0 +1,114 @@ @@ -0,0 +1,114 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlUserControl1" />
<DockPadding value="" />
<ClientSize value="{Width=480, Height=312}" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=464, Height=100}" />
<Text value="Start Action" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="startBrowserInURLTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="8" />
<Location value="{X=156,Y=68}" />
<Size value="{Width=300, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="startExternalProgramBrowseButton" />
<Location value="{X=416,Y=44}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="7" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="startExternalProgramTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Location value="{X=156,Y=44}" />
<Size value="{Width=252, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.RadioButton>
<Name value="startBrowserInURLRadioButton" />
<Location value="{X=4,Y=68}" />
<Size value="{Width=152, Height=20}" />
<Text value="Start browser in &amp;URL:" />
<TabIndex value="2" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="startExternalProgramRadioButton" />
<Location value="{X=4,Y=44}" />
<Size value="{Width=152, Height=20}" />
<Text value="Start e&amp;xternal program:" />
<TabIndex value="1" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="startProjectRadioButton" />
<Location value="{X=4,Y=20}" />
<Size value="{Width=152, Height=20}" />
<Text value="&amp;Start project" />
<TabIndex value="0" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox2" />
<TabIndex value="9" />
<Location value="{X=8,Y=120}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=464, Height=80}" />
<Text value="Start Options" />
<Controls>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="&amp;Working directory:" />
<TextAlign value="MiddleRight" />
<TabIndex value="12" />
<Size value="{Width=148, Height=20}" />
<Location value="{X=4,Y=48}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="Co&amp;mmand line arguments:" />
<TextAlign value="MiddleRight" />
<TabIndex value="11" />
<Size value="{Width=148, Height=20}" />
<Location value="{X=8,Y=20}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="commandLineArgumentsTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="10" />
<Location value="{X=156,Y=20}" />
<Size value="{Width=300, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="workingDirectoryBrowseButton" />
<Location value="{X=416,Y=52}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="7" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="workingDirectoryTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Location value="{X=156,Y=52}" />
<Size value="{Width=252, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

250
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/Publish.xfrm

@ -0,0 +1,250 @@ @@ -0,0 +1,250 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlUserControl1" />
<DockPadding value="" />
<ClientSize value="{Width=592, Height=480}" />
<Controls>
<System.Windows.Forms.Button>
<Name value="button5" />
<Location value="{X=472,Y=440}" />
<Size value="{Width=112, Height=23}" />
<Text value="Publish &amp;Now" />
<Anchor value="Top, Right" />
<TabIndex value="5" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="button3" />
<Location value="{X=352,Y=440}" />
<Size value="{Width=112, Height=23}" />
<Text value="Publish &amp;Wizard..." />
<Anchor value="Top, Right" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
<System.Windows.Forms.GroupBox>
<Name value="groupBox2" />
<TabIndex value="1" />
<Location value="{X=8,Y=192}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=576, Height=152}" />
<Text value="Install Mode and Settings" />
<Controls>
<System.Windows.Forms.Button>
<Name value="button8" />
<Location value="{X=456,Y=121}" />
<Size value="{Width=112, Height=23}" />
<Text value="O&amp;ptions..." />
<Anchor value="Top, Right" />
<TabIndex value="7" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="button7" />
<Location value="{X=456,Y=89}" />
<Size value="{Width=112, Height=23}" />
<Text value="&amp;Updates..." />
<Anchor value="Top, Right" />
<TabIndex value="6" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="button6" />
<Location value="{X=456,Y=57}" />
<Size value="{Width=112, Height=23}" />
<Text value="Pr&amp;erequisites..." />
<Anchor value="Top, Right" />
<TabIndex value="5" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="button4" />
<Location value="{X=456,Y=25}" />
<Size value="{Width=112, Height=23}" />
<Text value="Application &amp;Files..." />
<Anchor value="Top, Right" />
<TabIndex value="4" />
</System.Windows.Forms.Button>
<System.Windows.Forms.CheckBox>
<Name value="checkBox1" />
<Location value="{X=8,Y=121}" />
<Size value="{Width=440, Height=24}" />
<Text value="For &amp;CD installations, automatically start Setup when CD is inserted" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.RadioButton>
<Name value="radioButton2" />
<Location value="{X=8,Y=49}" />
<Size value="{Width=440, Height=24}" />
<Text value="The application is avaiable offline as well (launchable from Start &amp;menu)" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="radioButton1" />
<Location value="{X=8,Y=25}" />
<Size value="{Width=440, Height=24}" />
<Text value="The application is avaiable &amp;online only" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<TabIndex value="0" />
<Location value="{X=8,Y=8}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=576, Height=176}" />
<Text value="Publish Location" />
<Controls>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="Documentation and &amp;support URL:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="18" />
<Size value="{Width=560, Height=16}" />
<Location value="{X=8,Y=122}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="comboBox2" />
<Anchor value="Top, Left, Right" />
<TabIndex value="19" />
<Location value="{X=8,Y=138}" />
<Size value="{Width=512, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Button>
<Name value="button2" />
<Location value="{X=528,Y=138}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="20" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="&amp;Installation URL (if different than above):" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="15" />
<Size value="{Width=528, Height=16}" />
<Location value="{X=40,Y=74}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="comboBox1" />
<Anchor value="Top, Left, Right" />
<TabIndex value="16" />
<Location value="{X=40,Y=90}" />
<Size value="{Width=480, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Button>
<Name value="button1" />
<Location value="{X=528,Y=90}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="17" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Label>
<Name value="label5" />
<Text value="Pu&amp;blishing Location (web site, ftp server, or file path)" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="12" />
<Size value="{Width=560, Height=16}" />
<Location value="{X=8,Y=26}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="applicationIconComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="13" />
<Location value="{X=8,Y=42}" />
<Size value="{Width=512, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Button>
<Name value="applicationIconBrowseButton" />
<Location value="{X=528,Y=42}" />
<Size value="{Width=40, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="14" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="groupBox3" />
<TabIndex value="2" />
<Location value="{X=8,Y=352}" />
<Size value="{Width=328, Height=112}" />
<Text value="Publish Version" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="checkBox2" />
<Location value="{X=8,Y=82}" />
<Size value="{Width=312, Height=24}" />
<Text value="&amp;Automatically increment revision with each release" />
<Anchor value="Top, Left, Right" />
<TabIndex value="8" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.Label>
<Name value="label7" />
<Text value="Revision:" />
<TextAlign value="BottomCenter" />
<TabIndex value="7" />
<Size value="{Width=56, Height=23}" />
<Location value="{X=200,Y=24}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="textBox4" />
<TabIndex value="6" />
<Location value="{X=200,Y=48}" />
<Size value="{Width=56, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label6" />
<Text value="Build:" />
<TextAlign value="BottomCenter" />
<TabIndex value="5" />
<Size value="{Width=56, Height=23}" />
<Location value="{X=136,Y=24}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="textBox3" />
<TabIndex value="4" />
<Location value="{X=136,Y=48}" />
<Size value="{Width=56, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label4" />
<Text value="Minor:" />
<TextAlign value="BottomCenter" />
<TabIndex value="3" />
<Size value="{Width=56, Height=23}" />
<Location value="{X=72,Y=24}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="textBox2" />
<TabIndex value="2" />
<Location value="{X=72,Y=48}" />
<Size value="{Width=56, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label3" />
<Text value="Major:" />
<TextAlign value="BottomCenter" />
<TabIndex value="1" />
<Size value="{Width=56, Height=23}" />
<Location value="{X=8,Y=24}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="textBox1" />
<TabIndex value="0" />
<Location value="{X=8,Y=48}" />
<Size value="{Width=56, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

71
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/ReferencePaths.xfrm

@ -0,0 +1,71 @@ @@ -0,0 +1,71 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlUserControl1" />
<DockPadding value="" />
<ClientSize value="{Width=360, Height=256}" />
<Controls>
<System.Windows.Forms.Button>
<Name value="removeButton" />
<Location value="{X=8,Y=216}" />
<Size value="{Width=88, Height=23}" />
<Text value="&amp;Remove" />
<TabIndex value="7" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ListView>
<Name value="referencePathListView" />
<Anchor value="Top, Left, Right" />
<TabIndex value="6" />
<Location value="{X=8,Y=120}" />
<Size value="{Width=336, Height=88}" />
</System.Windows.Forms.ListView>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="Reference &amp;Path:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
<Size value="{Width=336, Height=23}" />
<Location value="{X=8,Y=96}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="updateButton" />
<Location value="{X=112,Y=64}" />
<Size value="{Width=80, Height=23}" />
<Text value="&amp;Update" />
<TabIndex value="4" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="addFolderButton" />
<Location value="{X=8,Y=64}" />
<Size value="{Width=96, Height=23}" />
<Text value="&amp;Add Folder" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="folderTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=8,Y=32}" />
<Size value="{Width=296, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="&amp;Folder:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=344, Height=23}" />
<Location value="{X=8,Y=8}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="folderBrowseButton" />
<Location value="{X=312,Y=32}" />
<Size value="{Width=40, Height=23}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

94
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/Signing.xfrm

@ -0,0 +1,94 @@ @@ -0,0 +1,94 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlUserControl1" />
<DockPadding value="" />
<ClientSize value="{Width=392, Height=312}" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<TabIndex value="1" />
<Location value="{X=8,Y=28}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=368, Height=196}" />
<Text value="Key Selection" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="delaySignOnlyCheckBox" />
<Location value="{X=4,Y=169}" />
<Size value="{Width=356, Height=24}" />
<Text value="Dela&amp;y Sign only" />
<Anchor value="Top, Left, Right" />
<TabIndex value="8" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.ComboBox>
<Name value="containerComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="7" />
<Location value="{X=108,Y=133}" />
<Size value="{Width=252, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="&amp;Container:" />
<TextAlign value="MiddleRight" />
<TabIndex value="6" />
<Location value="{X=8,Y=128}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="providerNameComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
<Location value="{X=108,Y=105}" />
<Size value="{Width=252, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="Provider &amp;name:" />
<TextAlign value="MiddleRight" />
<TabIndex value="4" />
<Location value="{X=8,Y=100}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.RadioButton>
<Name value="useKeyProviderRadioButton" />
<Location value="{X=4,Y=77}" />
<Size value="{Width=356, Height=24}" />
<Text value="Use this key &amp;provider:" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.ComboBox>
<Name value="keyFileComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=20,Y=49}" />
<Size value="{Width=184, Height=21}" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Button>
<Name value="changePasswordButton" />
<Location value="{X=212,Y=49}" />
<Size value="{Width=148, Height=21}" />
<Text value="Change Pass&amp;word..." />
<Anchor value="Top, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Button>
<System.Windows.Forms.RadioButton>
<Name value="useKeyFileRadioButton" />
<Location value="{X=4,Y=25}" />
<Size value="{Width=356, Height=24}" />
<Text value="Use a key &amp;file:" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.CheckBox>
<Name value="signAssemblyCheckBox" />
<Location value="{X=8,Y=4}" />
<Size value="{Width=376, Height=24}" />
<Text value="Sign the &amp;assembly" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.CheckBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

199
src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/DocumentAccessor.cs

@ -0,0 +1,199 @@ @@ -0,0 +1,199 @@
using System;
using System.Collections;
using System.IO;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
namespace VBNetBinding.FormattingStrategy
{
/// <summary>
/// Interface used for the indentation class to access the document.
/// </summary>
public interface IDocumentAccessor
{
/// <summary>Gets if something was changed in the document.</summary>
bool Dirty { get; }
/// <summary>Gets if the current line is read only (because it is not in the
/// selected text region)</summary>
bool ReadOnly { get; }
/// <summary>Gets the number of the current line.</summary>
int LineNumber { get; }
/// <summary>Gets/Sets the text of the current line.</summary>
string Text { get; set; }
/// <summary>Advances to the next line.</summary>
bool Next();
}
#region DocumentAccessor
public class DocumentAccessor : IDocumentAccessor
{
IDocument doc;
int minLine;
int maxLine;
int changedLines = 0;
public DocumentAccessor(IDocument document)
{
doc = document;
this.minLine = 0;
this.maxLine = doc.TotalNumberOfLines - 1;
}
public DocumentAccessor(IDocument document, int minLine, int maxLine)
{
doc = document;
this.minLine = minLine;
this.maxLine = maxLine;
}
int num = -1;
bool dirty;
string text;
LineSegment line;
public bool ReadOnly
{
get {
return num < minLine;
}
}
public bool Dirty
{
get {
return dirty;
}
}
public int LineNumber
{
get {
return num;
}
}
public int ChangedLines
{
get {
return changedLines;
}
}
bool lineDirty = false;
public string Text
{
get { return text; }
set {
if (num < minLine) return;
text = value;
dirty = true;
lineDirty = true;
}
}
public bool Next()
{
if (lineDirty) {
doc.Replace(line.Offset, line.Length, text);
lineDirty = false;
++changedLines;
}
++num;
if (num > maxLine) return false;
line = doc.GetLineSegment(num);
text = doc.GetText(line);
return true;
}
}
#endregion
#region FileAccessor
public class FileAccessor : IDisposable, IDocumentAccessor
{
public bool Dirty
{
get {
return dirty;
}
}
public bool ReadOnly
{
get {
return false;
}
}
FileStream f;
StreamReader r;
ArrayList lines = new ArrayList();
bool dirty = false;
System.Text.Encoding encoding;
string filename;
public FileAccessor(string filename)
{
this.filename = filename;
f = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None);
// TODO: Auto-detect encoding
encoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
r = new StreamReader(f, encoding);
}
int num = 0;
public int LineNumber
{
get { return num; }
}
string text = "";
public string Text
{
get {
return text;
}
set {
dirty = true;
text = value;
}
}
public bool Next()
{
if (num > 0) {
lines.Add(text);
}
text = r.ReadLine();
++num;
return text != null;
}
void IDisposable.Dispose()
{
Close();
}
public void Close()
{
r.Close();
f.Close();
if (dirty) {
f = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None);
using (StreamWriter w = new StreamWriter(f, encoding)) {
foreach (string line in lines) {
w.WriteLine(line);
}
}
f.Close();
}
}
}
#endregion
}

375
src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/Indentation.cs

@ -0,0 +1,375 @@ @@ -0,0 +1,375 @@
using System;
using System.Collections;
using System.Text;
namespace VBNetBinding.FormattingStrategy
{
public class IndentationSettings
{
public string IndentString = "\t";
}
public class IndentationReformatter
{
public struct Block
{
public string OuterIndent;
public string InnerIndent;
public string LastWord;
public char Bracket;
public bool Continuation;
public bool OneLineBlock;
public int StartLine;
public void Indent(IndentationSettings set)
{
Indent(set, set.IndentString);
}
public void Indent(IndentationSettings set, string str)
{
OuterIndent = InnerIndent;
InnerIndent += str;
Continuation = false;
OneLineBlock = false;
LastWord = "";
}
}
StringBuilder wordBuilder;
Stack blocks; // blocks contains all blocks outside of the current
Block block; // block is the current block
bool inString = false;
bool inChar = false;
bool verbatim = false;
bool escape = false;
bool lineComment = false;
bool blockComment = false;
char lastRealChar = ' '; // last non-comment char
public void Reformat(IDocumentAccessor doc, IndentationSettings set)
{
Init();
while (doc.Next()) {
Step(doc, set);
}
}
public void Init()
{
wordBuilder = new StringBuilder();
blocks = new Stack();
block = new Block();
block.InnerIndent = "";
block.OuterIndent = "";
block.Bracket = '{';
block.Continuation = false;
block.LastWord = "";
block.OneLineBlock = false;
block.StartLine = 0;
inString = false;
inChar = false;
verbatim = false;
escape = false;
lineComment = false;
blockComment = false;
lastRealChar = ' '; // last non-comment char
}
public void Step(IDocumentAccessor doc, IndentationSettings set)
{
string line = doc.Text.TrimStart();
StringBuilder indent = new StringBuilder();
if (line.Length == 0) {
// Special threatment for empty lines:
if (blockComment || (inString && verbatim))
return;
indent.Append(block.InnerIndent);
if (block.OneLineBlock)
indent.Append(set.IndentString);
if (block.Continuation)
indent.Append(set.IndentString);
if (doc.Text != indent.ToString())
doc.Text = indent.ToString();
return;
}
if (TrimEnd(doc))
line = doc.Text.TrimStart();
Block oldBlock = block;
bool startInComment = blockComment;
bool startInString = (inString && verbatim);
#region Parse char by char
lineComment = false;
inChar = false;
escape = false;
if (!verbatim) inString = false;
lastRealChar = '\n';
char lastchar = ' ';
char c = ' ';
char nextchar = line[0];
for (int i = 0; i < line.Length; i++) {
if (lineComment) break; // cancel parsing current line
lastchar = c;
c = nextchar;
if (i + 1 < line.Length)
nextchar = line[i + 1];
else
nextchar = '\n';
if (escape) {
escape = false;
continue;
}
#region Check for comment/string chars
switch (c) {
case '/':
if (blockComment && lastchar == '*')
blockComment = false;
if (!inString && !inChar) {
if (!blockComment && nextchar == '/')
lineComment = true;
if (!lineComment && nextchar == '*')
blockComment = true;
}
break;
case '#':
if (!(inChar || blockComment || inString))
lineComment = true;
break;
case '"':
if (!(inChar || lineComment || blockComment)) {
inString = !inString;
if (!inString && verbatim) {
if (nextchar == '"') {
escape = true; // skip escaped quote
inString = true;
} else {
verbatim = false;
}
} else if (inString && lastchar == '@') {
verbatim = true;
}
}
break;
case '\'':
if (!(inString || lineComment || blockComment)) {
inChar = !inChar;
}
break;
case '\\':
if ((inString && !verbatim) || inChar)
escape = true; // skip next character
break;
}
#endregion
if (lineComment || blockComment || inString || inChar) {
if (wordBuilder.Length > 0)
block.LastWord = wordBuilder.ToString();
wordBuilder.Length = 0;
continue;
}
if (!Char.IsWhiteSpace(c) && c != '[' && c != '/') {
if (block.Bracket == '{')
block.Continuation = true;
}
if (Char.IsLetterOrDigit(c)) {
wordBuilder.Append(c);
} else {
if (wordBuilder.Length > 0)
block.LastWord = wordBuilder.ToString();
wordBuilder.Length = 0;
}
#region Push/Pop the blocks
switch (c) {
case '{':
block.OneLineBlock = false;
blocks.Push(block);
block.StartLine = doc.LineNumber;
if (block.LastWord == "switch")
block.Indent(set, set.IndentString + set.IndentString);
else
block.Indent(set);
block.Bracket = '{';
break;
case '}':
while (block.Bracket != '{') {
if (blocks.Count == 0) break;
block = (Block)blocks.Pop();
}
if (blocks.Count == 0) break;
block = (Block)blocks.Pop();
block.Continuation = false;
block.OneLineBlock = false;
break;
case '(':
case '[':
blocks.Push(block);
if (block.StartLine == doc.LineNumber)
block.InnerIndent = block.OuterIndent;
else
block.StartLine = doc.LineNumber;
block.Indent(set,
(oldBlock.OneLineBlock ? set.IndentString : "") +
(oldBlock.Continuation ? set.IndentString : "") +
new String(' ', i + 1));
block.Bracket = c;
break;
case ')':
if (blocks.Count == 0) break;
if (block.Bracket == '(') {
block = (Block)blocks.Pop();
if (IsSingleStatementKeyword(block.LastWord))
block.Continuation = false;
}
break;
case ']':
if (blocks.Count == 0) break;
if (block.Bracket == '[')
block = (Block)blocks.Pop();
break;
case ';':
case ',':
block.Continuation = false;
block.OneLineBlock = false;
break;
case ':':
if (block.LastWord == "case" || line.StartsWith("case ") || line.StartsWith(block.LastWord + ":")) {
block.Continuation = false;
block.OneLineBlock = false;
}
break;
}
if (!Char.IsWhiteSpace(c)) {
// register this char as last char
lastRealChar = c;
}
#endregion
}
#endregion
if (wordBuilder.Length > 0)
block.LastWord = wordBuilder.ToString();
wordBuilder.Length = 0;
if (startInString) return;
if (startInComment && line[0] != '*') return;
if (doc.Text.StartsWith("//\t"))
return;
if (line[0] == '}') {
indent.Append(oldBlock.OuterIndent);
oldBlock.OneLineBlock = false;
oldBlock.Continuation = false;
} else {
indent.Append(oldBlock.InnerIndent);
}
if (indent.Length > 0 && oldBlock.Bracket == '(' && line[0] == ')') {
indent.Remove(indent.Length - 1, 1);
} else if (indent.Length > 0 && oldBlock.Bracket == '[' && line[0] == ']') {
indent.Remove(indent.Length - 1, 1);
}
if (line[0] == ':') {
oldBlock.Continuation = true;
} else if (lastRealChar == ':' && indent.Length >= set.IndentString.Length) {
if (block.LastWord == "case" || line.StartsWith("case ") || line.StartsWith(block.LastWord + ":"))
indent.Remove(indent.Length - set.IndentString.Length, set.IndentString.Length);
} else if (lastRealChar == ')') {
if (IsSingleStatementKeyword(block.LastWord)) {
block.OneLineBlock = true;
}
} else if (block.LastWord == "else" && lastRealChar == 'e') {
block.OneLineBlock = true;
block.Continuation = false;
}
if (doc.ReadOnly) {
// We can't change the current line, but we should accept the existing
// indentation if possible (so if the current statement is not a multiline
// statement).
if (!oldBlock.Continuation && !oldBlock.OneLineBlock &&
oldBlock.StartLine == block.StartLine &&
block.StartLine < doc.LineNumber && lastRealChar != ':') {
// use indent StringBuilder to get the indentation of the current line
indent.Length = 0;
line = doc.Text; // get untrimmed line
for (int i = 0; i < line.Length; ++i) {
if (!Char.IsWhiteSpace(line[i]))
break;
indent.Append(line[i]);
}
block.InnerIndent = indent.ToString();
}
return;
}
if (line[0] != '{') {
if (line[0] != ')' && oldBlock.Continuation && oldBlock.Bracket == '{')
indent.Append(set.IndentString);
if (oldBlock.OneLineBlock)
indent.Append(set.IndentString);
}
// this is only for blockcomment lines starting with *,
// all others keep their old indentation
if (startInComment)
indent.Append(' ');
if (indent.Length != (doc.Text.Length - line.Length) ||
!doc.Text.StartsWith(indent.ToString()) ||
Char.IsWhiteSpace(doc.Text[indent.Length]))
{
doc.Text = indent.ToString() + line;
}
}
bool IsSingleStatementKeyword(string keyword) {
switch (keyword) {
case "if":
case "for":
case "while":
case "do":
case "foreach":
case "using":
case "lock":
return true;
default:
return false;
}
}
bool TrimEnd(IDocumentAccessor doc)
{
string line = doc.Text;
if (!Char.IsWhiteSpace(line[line.Length - 1])) return false;
// one space after an empty comment is allowed
if (line.EndsWith("// "))
return false;
doc.Text = line.TrimEnd();
return true;
}
}
}

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

@ -0,0 +1,457 @@ @@ -0,0 +1,457 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Markus Palme" email="MarkusPalme@gmx.de"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor.Actions;
using ICSharpCode.TextEditor;
using ICSharpCode.Core;
namespace VBNetBinding.FormattingStrategy
{
/// <summary>
/// This class handles the auto and smart indenting in the textbuffer while
/// you type.
/// </summary>
public class VBFormattingStrategy : DefaultFormattingStrategy
{
ArrayList statements;
StringCollection keywords;
bool doCasing;
bool doInsertion;
public VBFormattingStrategy()
{
statements = new ArrayList();
statements.Add(new VBStatement("^if.*?then$", "^end ?if$", "End If", 1));
statements.Add(new VBStatement("\\bclass \\w+$", "^end class$", "End Class", 1));
statements.Add(new VBStatement("\\bnamespace \\w+$", "^end namespace$", "End Namespace", 1));
statements.Add(new VBStatement("\\bmodule \\w+$", "^end module$", "End Module", 1));
statements.Add(new VBStatement("\\bstructure \\w+$", "^end structure$", "End Structure", 1));
statements.Add(new VBStatement("^while ", "^end while$", "End While", 1));
statements.Add(new VBStatement("^select case", "^end select$", "End Select", 2));
statements.Add(new VBStatement("(?<!\\bmustoverride )\\bsub \\w+", "^end sub$", "End Sub", 1));
statements.Add(new VBStatement("(?<!\\bmustoverride (readonly |writeonly )?)\\bproperty \\w+", "^end property$", "End Property", 1));
statements.Add(new VBStatement("(?<!\\bmustoverride )\\bfunction \\w+", "^end function$", "End Function", 1));
statements.Add(new VBStatement("\\bfor .*?$", "^next( \\w+)?$", "Next", 1));
statements.Add(new VBStatement("^synclock .*?$", "^end synclock$", "End SyncLock", 1));
statements.Add(new VBStatement("^get$", "^end get$", "End Get", 1));
statements.Add(new VBStatement("^with \\w+$", "^end with$", "End With", 1));
statements.Add(new VBStatement("^set(\\s*\\(.*?\\))?$", "^end set$", "End Set", 1));
statements.Add(new VBStatement("^try$", "^end try$", "End Try", 1));
statements.Add(new VBStatement("^do .+?$", "^loop$", "Loop", 1));
statements.Add(new VBStatement("^do$", "^loop .+?$", "Loop While ", 1));
statements.Add(new VBStatement("\\benum .*?$", "^end enum$", "End Enum", 1));
keywords = new StringCollection();
keywords.AddRange(new string[] {
"AddHandler", "AddressOf", "Alias", "And", "AndAlso", "Ansi", "As", "Assembly",
"Auto", "Boolean", "ByRef", "Byte", "ByVal", "Call", "Case", "Catch",
"CBool", "CByte", "CChar", "CDate", "CDec", "CDbl", "Char", "CInt", "Class",
"CLng", "CObj", "Const", "CShort", "CSng", "CStr", "CType",
"Date", "Decimal", "Declare", "Default", "Delegate", "Dim", "DirectCast", "Do",
"Double", "Each", "Else", "ElseIf", "End", "Enum", "Erase", "Error",
"Event", "Exit", "False", "Finally", "For", "Friend", "Function", "Get",
"GetType", "GoSub", "GoTo", "Handles", "If", "Implements", "Imports", "In",
"Inherits", "Integer", "Interface", "Is", "Let", "Lib", "Like", "Long",
"Loop", "Me", "Mod", "Module", "MustInherit", "MustOverride", "MyBase", "MyClass",
"Namespace", "New", "Next", "Not", "Nothing", "NotInheritable", "NotOverridable", "Object",
"On", "Option", "Optional", "Or", "OrElse", "Overloads", "Overridable", "Overrides",
"ParamArray", "Preserve", "Private", "Property", "Protected", "Public", "RaiseEvent", "ReadOnly",
"ReDim", "Region", "REM", "RemoveHandler", "Resume", "Return", "Select", "Set", "Shadows",
"Shared", "Short", "Single", "Static", "Step", "Stop", "String", "Structure",
"Sub", "SyncLock", "Then", "Throw", "To", "True", "Try", "TypeOf",
"Unicode", "Until", "Variant", "When", "While", "With", "WithEvents", "WriteOnly", "Xor"
});
}
/// <summary>
/// Define VB.net specific smart indenting for a line :)
/// </summary>
protected override int SmartIndentLine(TextArea textArea, int lineNr)
{
doCasing = PropertyService.Get("VBBinding.TextEditor.EnableCasing", true);
IDocument document = textArea.Document;
if (lineNr <= 0)
return AutoIndentLine(textArea, lineNr);
LineSegment lineAbove = document.GetLineSegment(lineNr - 1);
string lineAboveText = document.GetText(lineAbove.Offset, lineAbove.Length).Trim();
LineSegment curLine = document.GetLineSegment(lineNr);
string oldLineText = document.GetText(curLine.Offset, curLine.Length);
string curLineText = oldLineText.Trim();
// remove comments
string texttoreplace = Regex.Replace(lineAboveText, "'.*$", "", RegexOptions.Singleline).Trim();
// remove string content
foreach (Match match in Regex.Matches(texttoreplace, "\"[^\"]*?\"")) {
texttoreplace = texttoreplace.Remove(match.Index, match.Length).Insert(match.Index, new String('-', match.Length));
}
string curLineReplace = Regex.Replace(curLineText, "'.*$", "", RegexOptions.Singleline).Trim();
// remove string content
foreach (Match match in Regex.Matches(curLineReplace, "\"[^\"]*?\"")) {
curLineReplace = curLineReplace.Remove(match.Index, match.Length).Insert(match.Index, new String('-', match.Length));
}
StringBuilder b = new StringBuilder(GetIndentation(textArea, lineNr - 1));
string indentString = Tab.GetIndentationString(document);
if (texttoreplace.IndexOf(':') > 0)
texttoreplace = texttoreplace.Substring(0, texttoreplace.IndexOf(':')).TrimEnd();
bool matched = false;
foreach (VBStatement statement in statements) {
if (statement.IndentPlus == 0) continue;
if (Regex.IsMatch(curLineReplace, statement.EndRegex, RegexOptions.IgnoreCase)) {
for (int i = 0; i < statement.IndentPlus; ++i) {
RemoveIndent(b);
}
if (doCasing && !statement.EndStatement.EndsWith(" "))
curLineText = statement.EndStatement;
matched = true;
}
if (Regex.IsMatch(texttoreplace, statement.StartRegex, RegexOptions.IgnoreCase)) {
for (int i = 0; i < statement.IndentPlus; ++i) {
b.Append(indentString);
}
matched = true;
}
if (matched)
break;
}
if (lineNr >= 2) {
if (texttoreplace.EndsWith("_")) {
// Line continuation
char secondLastChar = ' ';
for (int i = texttoreplace.Length - 2; i >= 0; --i) {
secondLastChar = texttoreplace[i];
if (!Char.IsWhiteSpace(secondLastChar))
break;
}
if (secondLastChar != '>') {
// is not end of attribute
LineSegment line2Above = document.GetLineSegment(lineNr - 2);
string lineAboveText2 = document.GetText(line2Above.Offset, line2Above.Length).Trim();
lineAboveText2 = Regex.Replace(lineAboveText2, "'.*$", "", RegexOptions.Singleline).Trim();
if (!lineAboveText2.EndsWith("_")) {
b.Append(indentString);
}
}
} else {
LineSegment line2Above = document.GetLineSegment(lineNr - 2);
string lineAboveText2 = document.GetText(line2Above.Offset, line2Above.Length).Trim();
lineAboveText2 = StripComment(lineAboveText2);
if (lineAboveText2.EndsWith("_")) {
char secondLastChar = ' ';
for (int i = texttoreplace.Length - 2; i >= 0; --i) {
secondLastChar = texttoreplace[i];
if (!Char.IsWhiteSpace(secondLastChar))
break;
}
if (secondLastChar != '>')
RemoveIndent(b);
}
}
}
if (IsElseConstruct(curLineText))
RemoveIndent(b);
if (IsElseConstruct(lineAboveText))
b.Append(indentString);
int indentLength = b.Length;
b.Append(curLineText);
if (b.ToString() != oldLineText)
textArea.Document.Replace(curLine.Offset, curLine.Length, b.ToString());
return indentLength;
}
bool IsElseConstruct(string line)
{
string t = StripComment(line).ToLower();
if (t.StartsWith("case ")) return true;
if (t == "else" || t.StartsWith("elseif ")) return true;
if (t == "catch" || t.StartsWith("catch ")) return true;
if (t == "finally") return true;
return false;
}
string StripComment(string text)
{
return Regex.Replace(text, "'.*$", "", RegexOptions.Singleline).Trim();
}
void RemoveIndent(StringBuilder b)
{
if (b.Length == 0) return;
if (b[b.Length - 1] == '\t') {
b.Remove(b.Length - 1, 1);
} else {
for (int j = 0; j < 4; ++j) {
if (b.Length == 0) return;
if (b[b.Length - 1] != ' ')
break;
b.Remove(b.Length - 1, 1);
}
}
}
public override int FormatLine(TextArea textArea, int lineNr, int cursorOffset, char ch)
{
doCasing = PropertyService.Get("VBBinding.TextEditor.EnableCasing", true);
doInsertion = PropertyService.Get("VBBinding.TextEditor.EnableEndConstructs", true);
if (lineNr > 0) {
LineSegment curLine = textArea.Document.GetLineSegment(lineNr);
LineSegment lineAbove = lineNr > 0 ? textArea.Document.GetLineSegment(lineNr - 1) : null;
string curLineText = textArea.Document.GetText(curLine.Offset, curLine.Length);
string lineAboveText = textArea.Document.GetText(lineAbove.Offset, lineAbove.Length);
if (ch == '\n' && lineAboveText != null) {
int undoCount = 1;
// remove comments
string texttoreplace = Regex.Replace(lineAboveText, "'.*$", "", RegexOptions.Singleline);
// remove string content
MatchCollection strmatches = Regex.Matches(texttoreplace, "\"[^\"]*?\"", RegexOptions.Singleline);
foreach (Match match in strmatches) {
texttoreplace = texttoreplace.Remove(match.Index, match.Length).Insert(match.Index, new String('-', match.Length));
}
if (doCasing) {
foreach (string keyword in keywords) {
string regex = "(?:\\W|^)(" + keyword + ")(?:\\W|$)";
MatchCollection matches = Regex.Matches(texttoreplace, regex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
foreach (Match match in matches) {
textArea.Document.Replace(lineAbove.Offset + match.Groups[1].Index, match.Groups[1].Length, keyword);
++undoCount;
}
}
}
if (doInsertion) {
foreach (VBStatement statement in statements) {
if (Regex.IsMatch(texttoreplace.Trim(), statement.StartRegex, RegexOptions.IgnoreCase)) {
string indentation = GetIndentation(textArea, lineNr - 1);
if (isEndStatementNeeded(textArea, statement, lineNr)) {
textArea.Document.Insert(textArea.Caret.Offset, "\n" + indentation + statement.EndStatement);
++undoCount;
}
for (int i = 0; i < statement.IndentPlus; i++) {
indentation += Tab.GetIndentationString(textArea.Document);
}
textArea.Document.Replace(curLine.Offset, curLine.Length, indentation + curLineText.Trim());
textArea.Document.UndoStack.UndoLast(undoCount + 1);
return indentation.Length;
}
}
}
if (IsInString(lineAboveText)) {
if (IsFinishedString(curLineText)) {
textArea.Document.Insert(lineAbove.Offset + lineAbove.Length,
"\" & _");
curLine = textArea.Document.GetLineSegment(lineNr);
textArea.Document.Insert(curLine.Offset, "\"");
if (IsElseConstruct(lineAboveText))
SmartIndentLine(textArea, lineNr - 1);
int result = SmartIndentLine(textArea, lineNr) + 1;
textArea.Document.UndoStack.UndoLast(undoCount + 3);
return result;
} else {
textArea.Document.Insert(lineAbove.Offset + lineAbove.Length,
"\"");
if (IsElseConstruct(lineAboveText))
SmartIndentLine(textArea, lineNr - 1);
int result = SmartIndentLine(textArea, lineNr);
textArea.Document.UndoStack.UndoLast(undoCount + 2);
return result;
}
} else {
string indent = GetIndentation(textArea, lineNr - 1);
if (indent.Length > 0) {
string newLineText = indent + TextUtilities.GetLineAsString(textArea.Document, lineNr).Trim();
curLine = textArea.Document.GetLineSegment(lineNr);
textArea.Document.Replace(curLine.Offset, curLine.Length, newLineText);
++undoCount;
}
if (IsElseConstruct(lineAboveText))
SmartIndentLine(textArea, lineNr - 1);
textArea.Document.UndoStack.UndoLast(undoCount);
return indent.Length;
}
}
}
return 0;
}
bool IsInString(string start)
{
bool inString = false;
for (int i = 0; i < start.Length; i++) {
if (start[i] == '"')
inString = !inString;
if (!inString && start[i] == '\'')
return false;
}
return inString;
}
bool IsFinishedString(string end)
{
bool inString = true;
for (int i = 0; i < end.Length; i++) {
if (end[i] == '"')
inString = !inString;
if (!inString && end[i] == '\'')
break;
}
return !inString;
}
bool isEndStatementNeeded(TextArea textArea, VBStatement statement, int lineNr)
{
int count = 0;
for (int i = 0; i < textArea.Document.TotalNumberOfLines; i++) {
LineSegment line = textArea.Document.GetLineSegment(i);
string lineText = textArea.Document.GetText(line.Offset, line.Length).Trim();
if (lineText.StartsWith("'")) {
continue;
}
if (Regex.IsMatch(lineText, statement.StartRegex, RegexOptions.IgnoreCase)) {
count++;
} else if (Regex.IsMatch(lineText, statement.EndRegex, RegexOptions.IgnoreCase)) {
count--;
}
}
return count > 0;
}
class VBStatement
{
public string StartRegex = "";
public string EndRegex = "";
public string EndStatement = "";
public int IndentPlus = 0;
public VBStatement()
{
}
public VBStatement(string startRegex, string endRegex, string endStatement, int indentPlus)
{
StartRegex = startRegex;
EndRegex = endRegex;
EndStatement = endStatement;
IndentPlus = indentPlus;
}
}
#region SearchBracket
public override int SearchBracketBackward(IDocument document, int offset, char openBracket, char closingBracket)
{
bool inString = false;
char ch;
int brackets = -1;
for (int i = offset; i > 0; --i) {
ch = document.GetCharAt(i);
if (ch == openBracket && !inString) {
++brackets;
if (brackets == 0) return i;
} else if (ch == closingBracket && !inString) {
--brackets;
} else if (ch == '"') {
inString = !inString;
} else if (ch == '\n') {
int lineStart = ScanLineStart(document, i);
if (lineStart >= 0) { // line could have a comment
inString = false;
for (int j = lineStart; j < i; ++j) {
ch = document.GetCharAt(j);
if (ch == '"') inString = !inString;
if (ch == '\'' && !inString) {
// comment found!
// Skip searching in the comment:
i = j;
break;
}
}
}
inString = false;
}
}
return -1;
}
static int ScanLineStart(IDocument document, int offset)
{
bool hasComment = false;
for (int i = offset - 1; i > 0; --i) {
char ch = document.GetCharAt(i);
if (ch == '\n') {
if (!hasComment) return -1;
return i + 1;
} else if (ch == '\'') {
hasComment = true;
}
}
return 0;
}
public override int SearchBracketForward(IDocument document, int offset, char openBracket, char closingBracket)
{
bool inString = false;
bool inComment = false;
int brackets = 1;
for (int i = offset; i < document.TextLength; ++i) {
char ch = document.GetCharAt(i);
if (ch == '\n') {
inString = false;
inComment = false;
}
if (inComment) continue;
if (ch == '"') inString = !inString;
if (inString) continue;
if (ch == '\'') {
inComment = true;
} else if (ch == openBracket) {
++brackets;
} else if (ch == closingBracket) {
--brackets;
if (brackets == 0) return i;
}
}
return -1;
}
#endregion
}
}

95
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/ApplicationSettings.cs

@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.ExternalTool;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
namespace VBNetBinding.OptionPanels
{
public class ApplicationSettings : AbstractOptionPanel
{
VBNetProject project;
public ApplicationSettings()
{
}
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.ApplicationSettings.xfrm"));
this.project = (VBNetProject)((Properties)CustomizationObject).Get("Project");
ConnectBrowseButton("applicationIconBrowseButton", "applicationIconComboBox", "${res:SharpDevelop.FileFilter.Icons}|*.ico|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
// TODO: Suitable file filter.
ConnectBrowseButton("win32ResourceFileBrowseButton", "win32ResourceFileComboBox");
Get<TextBox>("assemblyName").Text = project.AssemblyName;
Get<TextBox>("assemblyName").TextChanged += new EventHandler(RefreshOutputNameTextBox);
Get<TextBox>("assemblyName").TextChanged += new EventHandler(Save);
Get<TextBox>("rootNamespace").Text = project.RootNamespace;
Get<TextBox>("rootNamespace").TextChanged += new EventHandler(Save);
Get<ComboBox>("outputType").Items.Add(StringParser.Parse("${res:Dialog.Options.PrjOptions.Configuration.CompileTarget.Exe}"));
Get<ComboBox>("outputType").Items.Add(StringParser.Parse("${res:Dialog.Options.PrjOptions.Configuration.CompileTarget.WinExe}"));
Get<ComboBox>("outputType").Items.Add(StringParser.Parse("${res:Dialog.Options.PrjOptions.Configuration.CompileTarget.Library}"));
Get<ComboBox>("outputType").Items.Add(StringParser.Parse("${res:Dialog.Options.PrjOptions.Configuration.CompileTarget.Module}"));
Get<ComboBox>("outputType").SelectedIndex = (int)project.OutputType;
Get<ComboBox>("outputType").SelectedIndexChanged += new EventHandler(RefreshOutputNameTextBox);
Get<ComboBox>("outputType").SelectedIndexChanged += new EventHandler(Save);
Get<ComboBox>("startupObject").Text = project.StartupObject;
Get<ComboBox>("startupObject").SelectedIndexChanged += new EventHandler(Save);
Get<ComboBox>("applicationIcon").Text = project.ApplicationIcon;
Get<ComboBox>("applicationIcon").TextChanged += new EventHandler(ApplicationIconComboBoxTextChanged);
Get<ComboBox>("applicationIcon").TextChanged += new EventHandler(Save);
Get<ComboBox>("win32ResourceFile").Text = project.Win32Resource;
Get<ComboBox>("win32ResourceFile").TextChanged += new EventHandler(Save);
Get<TextBox>("projectFolder").Text = project.Directory;
Get<TextBox>("projectFile").Text = Path.GetFileName(project.FileName);
Get<TextBox>("projectFile").TextChanged += new EventHandler(Save);
RefreshOutputNameTextBox(null, EventArgs.Empty);
}
void Save(object sender, EventArgs e)
{
StorePanelContents();
}
public override bool StorePanelContents()
{
project.AssemblyName = Get<TextBox>("assemblyName").Text;
project.RootNamespace = Get<TextBox>("rootNamespace").Text;
project.OutputType = (OutputType)Get<ComboBox>("outputType").SelectedIndex;
project.StartupObject = Get<ComboBox>("startupObject").Text;
project.ApplicationIcon = Get<ComboBox>("applicationIcon").Text;
project.Win32Resource = Get<ComboBox>("win32ResourceFile").Text;
project.Name = Path.GetFileNameWithoutExtension(Get<TextBox>("projectFile").Text);
project.Save();
return true;
}
void RefreshOutputNameTextBox(object sender, EventArgs e)
{
Get<TextBox>("outputName").Text = Get<TextBox>("assemblyName").Text + MSBuildProject.GetExtension((OutputType)Get<ComboBox>("outputType").SelectedIndex);
}
void ApplicationIconComboBoxTextChanged(object sender, EventArgs e)
{
string applicationIcon = Get<ComboBox>("applicationIcon").Text;
if (File.Exists(applicationIcon)) {
Get<PictureBox>("applicationIcon").Image = Image.FromFile(applicationIcon);
}
}
}
}

55
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildEvents.cs

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.ExternalTool;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace VBNetBinding.OptionPanels
{
public class BuildEvents : AbstractOptionPanel
{
VBNetProject project;
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.BuildEvents.xfrm"));
ConnectBrowseButton("preBuildEventBrowseButton",
"preBuildEventTextBox",
"${res:SharpDevelop.FileFilter.AllFiles}|*.*");
ConnectBrowseButton("postBuildEventBrowseButton",
"postBuildEventTextBox",
"${res:SharpDevelop.FileFilter.AllFiles}|*.*");
this.project = (VBNetProject)((Properties)CustomizationObject).Get("Project");
Get<TextBox>("preBuildEvent").Text = project.PreBuildEvent;
Get<TextBox>("preBuildEvent").TextChanged += new EventHandler(Save);
Get<TextBox>("postBuildEvent").Text = project.PostBuildEvent;
Get<TextBox>("postBuildEvent").TextChanged += new EventHandler(Save);
Get<ComboBox>("runPostBuildEvent").Items.Add("Always");
Get<ComboBox>("runPostBuildEvent").Items.Add("On successful build");
Get<ComboBox>("runPostBuildEvent").Items.Add("When the build updates the project output");
Get<ComboBox>("runPostBuildEvent").SelectedIndex = (int)project.RunPostBuildEvent;
Get<ComboBox>("runPostBuildEvent").SelectedIndexChanged += new EventHandler(Save);
}
void Save(object sender, EventArgs e)
{
StorePanelContents();
}
public override bool StorePanelContents()
{
project.PreBuildEvent = Get<TextBox>("preBuildEvent").Text;
project.PostBuildEvent = Get<TextBox>("postBuildEvent").Text;
project.RunPostBuildEvent = (RunPostBuildEvent)Get<ComboBox>("runPostBuildEvent").SelectedIndex;
project.Save();
return true;
}
}
}

173
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptions.cs

@ -0,0 +1,173 @@ @@ -0,0 +1,173 @@
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.ExternalTool;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
namespace VBNetBinding.OptionPanels
{
public class BuildOptions : AbstractOptionPanel
{
VBNetProject project;
public BuildOptions()
{
}
void ShowAdvancedOptions(object sender, EventArgs e)
{
using (AdvancedBuildOptionsDialog advancedBuildOptionsDialog = new AdvancedBuildOptionsDialog(project)) {
advancedBuildOptionsDialog.ShowDialog(WorkbenchSingleton.MainForm);
}
}
string Config = "Debug";
string Platform = "AnyCPU";
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.BuildOptions.xfrm"));
this.project = (VBNetProject)((Properties)CustomizationObject).Get("Project");
ConnectBrowseFolder("outputPathBrowseButton", "outputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}");
Get<Button>("advancedOptions").Click += new EventHandler(ShowAdvancedOptions);
Get<TextBox>("conditionalSymbols").Text = project.GetDefineConstants(Config, Platform);
Get<TextBox>("conditionalSymbols").TextChanged += new EventHandler(Save);
Get<CheckBox>("optimizeCode").Checked = project.GetOptimize(Config, Platform);
Get<CheckBox>("optimizeCode").CheckedChanged += new EventHandler(Save);
Get<CheckBox>("allowUnsafeCode").Checked = project.GetAllowUnsafeBlocks(Config, Platform);
Get<CheckBox>("allowUnsafeCode").CheckedChanged += new EventHandler(Save);
Get<ComboBox>("warningLevel").Items.AddRange( new object[] {0, 1, 2, 3, 4});
Get<ComboBox>("warningLevel").Text = project.WarningLevel.ToString();
Get<ComboBox>("warningLevel").TextChanged += new EventHandler(Save);
Get<TextBox>("suppressWarnings").Text = project.GetNoWarn(Config, Platform);
Get<TextBox>("suppressWarnings").TextChanged += new EventHandler(Save);
Get<TextBox>("specificWarnings").Text = project.GetWarningsAsErrors(Config, Platform);
Get<TextBox>("specificWarnings").TextChanged += new EventHandler(Save);
WarningsAsErrors warningsAsErrors = project.GetTreatWarningsAsErrors(Config, Platform);
Get<RadioButton>("none").Checked = warningsAsErrors == WarningsAsErrors.None;
Get<RadioButton>("none").CheckedChanged += new EventHandler(Save);
Get<RadioButton>("specificWarnings").Checked = warningsAsErrors == WarningsAsErrors.Specific;
Get<RadioButton>("specificWarnings").CheckedChanged += new EventHandler(UpdateEnabledStates);
Get<RadioButton>("specificWarnings").CheckedChanged += new EventHandler(Save);
Get<RadioButton>("all").Checked = warningsAsErrors == WarningsAsErrors.All;
Get<RadioButton>("all").CheckedChanged += new EventHandler(Save);
Get<TextBox>("outputPath").Text = project.GetOutputPath(Config, Platform);
Get<TextBox>("outputPath").TextChanged += new EventHandler(Save);
Get<TextBox>("xmlDocumentation").Text = project.GetDocumentationFile(Config, Platform);
Get<TextBox>("xmlDocumentation").TextChanged += new EventHandler(Save);
Get<CheckBox>("xmlDocumentation").Checked = Get<TextBox>("xmlDocumentation").Text.Length > 0;
Get<CheckBox>("xmlDocumentation").CheckedChanged += new EventHandler(UpdateEnabledStates);
Get<CheckBox>("registerCOMInterop").Checked = project.GetRegisterForComInterop(Config, Platform);
Get<CheckBox>("registerCOMInterop").CheckedChanged += new EventHandler(Save);
UpdateEnabledStates(this, EventArgs.Empty);
}
void Save(object sender, EventArgs e)
{
StorePanelContents();
}
void UpdateEnabledStates(object sender, EventArgs e)
{
Get<TextBox>("specificWarnings").Enabled = Get<RadioButton>("specificWarnings").Checked;
Get<TextBox>("xmlDocumentation").Enabled = Get<CheckBox>("xmlDocumentation").Checked;
}
public override bool StorePanelContents()
{
project.SetDefineConstants(Config, Platform, Get<TextBox>("conditionalSymbols").Text);
project.SetOptimize(Config, Platform, Get<CheckBox>("optimizeCode").Checked);
project.SetAllowUnsafeBlocks(Config, Platform, Get<CheckBox>("allowUnsafeCode").Checked);
project.WarningLevel = Int32.Parse(Get<ComboBox>("warningLevel").Text);
project.SetNoWarn(Config, Platform, Get<TextBox>("suppressWarnings").Text);
project.SetWarningsAsErrors(Config, Platform, Get<TextBox>("specificWarnings").Text);
if (Get<RadioButton>("none").Checked) {
project.SetTreatWarningsAsErrors(Config, Platform, WarningsAsErrors.None);
} else if (Get<RadioButton>("specificWarnings").Checked) {
project.SetTreatWarningsAsErrors(Config, Platform, WarningsAsErrors.Specific);
} else {
project.SetTreatWarningsAsErrors(Config, Platform, WarningsAsErrors.All);
}
project.SetOutputPath(Config, Platform, Get<TextBox>("outputPath").Text);
if (Get<CheckBox>("xmlDocumentation").Checked) {
project.SetDocumentationFile(Config, Platform, Get<TextBox>("xmlDocumentation").Text);
} else {
project.SetDocumentationFile(Config, Platform, "");
}
project.SetRegisterForComInterop(Config, Platform, Get<CheckBox>("registerCOMInterop").Checked);
project.Save();
return true;
}
}
public class AdvancedBuildOptionsDialog : BaseSharpDevelopForm
{
string Config = "Debug";
string Platform = "AnyCPU";
VBNetProject project;
public AdvancedBuildOptionsDialog(VBNetProject project)
{
this.project = project;
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.AdvancedBuildOptionsDialog.xfrm"));
Get<ComboBox>("languageVersion").Text = project.GetLangVersion(Config, Platform);
Get<ComboBox>("languageVersion").Items.AddRange(new string[] { "default", "ISO-1"});
Get<ComboBox>("reportCompilerError").Text = project.GetErrorReport(Config, Platform);
Get<ComboBox>("reportCompilerError").Items.AddRange(new string[] { "none", "prompt", "send"});
Get<CheckBox>("checkOverUnderflow").Checked = project.GetCheckForOverflowUnderflow(Config, Platform);
Get<CheckBox>("noMsCorLibReference").Checked = project.GetNoStdLib(Config, Platform);
Get<ComboBox>("debugInfo").Text = project.GetDebugType(Config, Platform);
Get<ComboBox>("debugInfo").Items.AddRange(new string[] { "none", "full", "pdb-only"});
Get<ComboBox>("fileAlignment").Text = project.GetFileAlignment(Config, Platform).ToString();
Get<ComboBox>("fileAlignment").Items.AddRange(new string[] { "512", "1024", "2048", "4096", "8192"});
Get<ComboBox>("DLLBaseAddress").Text = project.GetBaseAddress(Config, Platform).ToString();
Get<Button>("ok").Click += new EventHandler(OkButtonClick);
}
void OkButtonClick(object sender, EventArgs e)
{
if (Get<ComboBox>("languageVersion").Text != "default") {
project.SetLangVersion(Config, Platform, Get<ComboBox>("languageVersion").Text);
} else {
project.SetLangVersion(Config, Platform, "");
}
project.SetErrorReport(Config, Platform, Get<ComboBox>("reportCompilerError").Text);
project.SetCheckForOverflowUnderflow(Config, Platform, Get<CheckBox>("checkOverUnderflow").Checked);
project.SetNoStdLib(Config, Platform, Get<CheckBox>("noMsCorLibReference").Checked);
project.SetDebugType(Config, Platform, Get<ComboBox>("debugInfo").Text);
project.SetFileAlignment(Config, Platform, Int32.Parse(Get<ComboBox>("fileAlignment").Text));
project.SetBaseAddress(Config, Platform, Int32.Parse(Get<ComboBox>("DLLBaseAddress").Text));
}
}
}

87
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/DebugOptions.cs

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.ExternalTool;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace VBNetBinding.OptionPanels
{
public class DebugOptions : AbstractOptionPanel
{
VBNetProject project;
string Config = "Debug";
string Platform = "AnyCPU";
public DebugOptions()
{
}
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.DebugOptions.xfrm"));
ConnectBrowseButton("startExternalProgramBrowseButton", "startExternalProgramTextBox", "${res:SharpDevelop.FileFilter.AllFiles}|*.*");
ConnectBrowseFolder("workingDirectoryBrowseButton", "workingDirectoryTextBox");
this.project = (VBNetProject)((Properties)CustomizationObject).Get("Project");
StartAction startAction = project.GetStartAction(Config, Platform);
Get<RadioButton>("startProject").Checked = startAction == StartAction.Project;
Get<RadioButton>("startProject").CheckedChanged += new EventHandler(UpdateEnabledStates);
Get<RadioButton>("startProject").CheckedChanged += new EventHandler(Save);
Get<RadioButton>("startExternalProgram").Checked = startAction == StartAction.Program;
Get<RadioButton>("startExternalProgram").CheckedChanged += new EventHandler(UpdateEnabledStates);
Get<RadioButton>("startExternalProgram").CheckedChanged += new EventHandler(Save);
Get<RadioButton>("startBrowserInURL").Checked = startAction == StartAction.StartURL;
Get<RadioButton>("startBrowserInURL").CheckedChanged += new EventHandler(UpdateEnabledStates);
Get<RadioButton>("startBrowserInURL").CheckedChanged += new EventHandler(Save);
Get<TextBox>("startExternalProgram").Text = project.GetStartProgram(Config, Platform);
Get<TextBox>("startExternalProgram").TextChanged += new EventHandler(Save);
Get<TextBox>("startBrowserInURL").Text = project.GetStartURL(Config, Platform);
Get<TextBox>("startBrowserInURL").TextChanged += new EventHandler(Save);
Get<TextBox>("commandLineArguments").Text = project.GetStartArguments(Config, Platform);
Get<TextBox>("commandLineArguments").TextChanged += new EventHandler(Save);
Get<TextBox>("workingDirectory").Text = project.GetStartWorkingDirectory(Config, Platform);
Get<TextBox>("workingDirectory").TextChanged += new EventHandler(Save);
UpdateEnabledStates(this, EventArgs.Empty);
}
void Save(object sender, EventArgs e)
{
StorePanelContents();
}
void UpdateEnabledStates(object sender, EventArgs e)
{
Get<TextBox>("startExternalProgram").Enabled = Get<Button>("startExternalProgramBrowse").Enabled = Get<RadioButton>("startExternalProgram").Checked;
Get<TextBox>("startBrowserInURL").Enabled = Get<RadioButton>("startBrowserInURL").Checked;
}
public override bool StorePanelContents()
{
project.SetStartProgram(Config, Platform, Get<TextBox>("startExternalProgram").Text);
project.SetStartURL(Config, Platform, Get<TextBox>("startBrowserInURL").Text);
project.SetStartArguments(Config, Platform, Get<TextBox>("commandLineArguments").Text);
project.SetStartWorkingDirectory(Config, Platform, Get<TextBox>("workingDirectory").Text);
if (Get<RadioButton>("startProject").Checked) {
project.SetStartAction(Config, Platform, StartAction.Project);
} else if (Get<RadioButton>("startExternalProgram").Checked) {
project.SetStartAction(Config, Platform, StartAction.Program);
} else {
project.SetStartAction(Config, Platform, StartAction.StartURL);
}
project.Save();
return true;
}
}
}

27
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/Publish.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.ExternalTool;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace VBNetBinding.OptionPanels
{
public class Publish : AbstractOptionPanel
{
VBNetProject project;
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.Publish.xfrm"));
this.project = (VBNetProject)((Properties)CustomizationObject).Get("Project");
}
public override bool StorePanelContents()
{
// TODO
return true;
}
}
}

26
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/ReferencePaths.cs

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.ExternalTool;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace VBNetBinding.OptionPanels
{
public class ReferencePaths : AbstractOptionPanel
{
VBNetProject project;
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.ReferencePaths.xfrm"));
this.project = (VBNetProject)((Properties)CustomizationObject).Get("Project");
}
public override bool StorePanelContents()
{
// TODO
return true;
}
}
}

82
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/Signing.cs

@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.ExternalTool;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace VBNetBinding.OptionPanels
{
public class Signing : AbstractOptionPanel
{
VBNetProject project;
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.Signing.xfrm"));
this.project = (VBNetProject)((Properties)CustomizationObject).Get("Project");
Get<CheckBox>("signAssembly").Checked = project.SignAssembly;
Get<CheckBox>("signAssembly").CheckedChanged += new EventHandler(Save);
Get<RadioButton>("useKeyFile").Checked = project.AssemblyOriginatorKeyMode == AssemblyOriginatorKeyMode.File;
Get<RadioButton>("useKeyFile").CheckedChanged += new EventHandler(UpdateEnabledStates);
Get<RadioButton>("useKeyFile").CheckedChanged += new EventHandler(Save);
Get<RadioButton>("useKeyProvider").Checked = project.AssemblyOriginatorKeyMode == AssemblyOriginatorKeyMode.Provider;
Get<RadioButton>("useKeyProvider").CheckedChanged += new EventHandler(UpdateEnabledStates);
Get<RadioButton>("useKeyProvider").CheckedChanged += new EventHandler(Save);
Get<ComboBox>("keyFile").Text = project.AssemblyOriginatorKeyFile;
Get<ComboBox>("keyFile").TextChanged += new EventHandler(Save);
Get<ComboBox>("providerName").Text = project.AssemblyKeyProviderName;
Get<ComboBox>("providerName").Items.Add("TODO: GetKeyProviders()");
Get<ComboBox>("providerName").TextChanged += new EventHandler(Save);
Get<ComboBox>("container").Text = "TODO";
Get<ComboBox>("container").TextChanged += new EventHandler(Save);
Get<CheckBox>("delaySignOnly").Checked = project.DelaySign;
Get<CheckBox>("delaySignOnly").CheckedChanged += new EventHandler(Save);
UpdateEnabledStates(this, EventArgs.Empty);
}
void Save(object sender, EventArgs e)
{
StorePanelContents();
}
void UpdateEnabledStates(object sender, EventArgs e)
{
Get<Button>("changePassword").Enabled = false;
Get<ComboBox>("providerName").Enabled = Get<ComboBox>("container").Enabled = Get<RadioButton>("useKeyProvider").Checked;
Get<ComboBox>("keyFile").Enabled = Get<RadioButton>("useKeyFile").Checked;
Get<CheckBox>("signAssembly").Enabled = Get<RadioButton>("useKeyFile").Checked;
}
public override bool StorePanelContents()
{
project.SignAssembly = Get<CheckBox>("signAssembly").Checked;
project.DelaySign = Get<CheckBox>("delaySignOnly").Checked;
project.AssemblyOriginatorKeyFile = Get<ComboBox>("keyFile").Text;
project.AssemblyKeyProviderName = Get<ComboBox>("providerName").Text;
// TODO : Container ????
if (Get<RadioButton>("useKeyFile").Checked) {
project.AssemblyOriginatorKeyMode = AssemblyOriginatorKeyMode.File;
} else if (Get<RadioButton>("useKeyProvider").Checked) {
project.AssemblyOriginatorKeyMode = AssemblyOriginatorKeyMode.Provider;
}
project.Save();
return true;
}
}
}

440
src/AddIns/BackendBindings/VBNetBinding/Project/Src/Parser/ExpressionFinder.cs

@ -0,0 +1,440 @@ @@ -0,0 +1,440 @@
using System;
using System.Text;
using ICSharpCode.SharpDevelop.Dom;
namespace VBNetBinding.Parser
{
/// <summary>
/// Description of ExpressionFinder.
/// </summary>
public class ExpressionFinder : IExpressionFinder
{
public string FindExpression(string inText, int offset)
{
this.text = FilterComments(inText, ref offset);
this.offset = this.lastAccept = offset;
this.state = START;
if (this.text == null) {
return null;
}
while (state != ERROR) {
ReadNextToken();
state = stateTable[state, curTokenType];
if (state == ACCEPT || state == ACCEPT2) {
lastAccept = this.offset;
}
if (state == ACCEPTNOMORE) {
return this.text.Substring(this.offset + 1, offset - this.offset);
}
}
return this.text.Substring(this.lastAccept + 1, offset - this.lastAccept);
}
#region Comment Filter and 'inside string watcher'
int initialOffset;
public string FilterComments(string text, ref int offset)
{
this.initialOffset = offset;
StringBuilder outText = new StringBuilder();
int curOffset = 0;
while (curOffset <= initialOffset) {
char ch = text[curOffset];
switch (ch) {
case '@':
if (curOffset + 1 < text.Length && text[curOffset + 1] == '"') {
outText.Append(text[curOffset++]); // @
outText.Append(text[curOffset++]); // "
if (!ReadVerbatimString(outText, text, ref curOffset)) {
return null;
}
}else{
outText.Append(ch);
++curOffset;
}
break;
case '\'':
outText.Append(ch);
curOffset++;
if(! ReadChar(outText, text, ref curOffset)) {
return null;
}
break;
case '"':
outText.Append(ch);
curOffset++;
if (!ReadString(outText, text, ref curOffset)) {
return null;
}
break;
case '/':
if (curOffset + 1 < text.Length && text[curOffset + 1] == '/') {
offset -= 2;
curOffset += 2;
if (!ReadToEOL(text, ref curOffset, ref offset)) {
return null;
}
} else if (curOffset + 1 < text.Length && text[curOffset + 1] == '*') {
offset -= 2;
curOffset += 2;
if (!ReadMultiLineComment(text, ref curOffset, ref offset)) {
return null;
}
} else {
goto default;
}
break;
default:
outText.Append(ch);
++curOffset;
break;
}
}
return outText.ToString();
}
bool ReadToEOL(string text, ref int curOffset, ref int offset)
{
while (curOffset <= initialOffset) {
char ch = text[curOffset++];
--offset;
if (ch == '\n') {
return true;
}
}
return false;
}
bool ReadChar(StringBuilder outText, string text, ref int curOffset)
{
char first = text[curOffset];
if (curOffset <= initialOffset) {
outText.Append(text[curOffset++]);
}
if (curOffset <= initialOffset) {
outText.Append(text[curOffset++]);
}
// special case: '\''
if(first == '\\' && curOffset <= initialOffset) {
outText.Append(text[curOffset++]);
}
return text[curOffset - 1] == '\'';
}
bool ReadString(StringBuilder outText, string text, ref int curOffset)
{
while (curOffset <= initialOffset) {
char ch = text[curOffset++];
outText.Append(ch);
if (ch == '"') {
return true;
} else if (ch == '\\') {
outText.Append(text[curOffset++]);
}
}
return false;
}
bool ReadVerbatimString(StringBuilder outText, string text, ref int curOffset)
{
while (curOffset <= initialOffset) {
char ch = text[curOffset++];
outText.Append(ch);
if (ch == '"') {
if (curOffset < text.Length && text[curOffset] == '"') {
outText.Append(text[curOffset++]);
} else {
return true;
}
}
}
return false;
}
bool ReadMultiLineComment(string text, ref int curOffset, ref int offset)
{
while (curOffset <= initialOffset) {
char ch = text[curOffset++];
--offset;
if (ch == '*') {
if (curOffset < text.Length && text[curOffset] == '/') {
++curOffset;
--offset;
return true;
}
}
}
return false;
}
#endregion
#region mini backward lexer
string text;
int offset;
char GetNext()
{
if (offset >= 0) {
return text[offset--];
}
return '\0';
}
char Peek(int n)
{
if (offset - n >= 0) {
return text[offset - n];
}
return '\0';
}
char Peek()
{
if (offset >= 0) {
return text[offset];
}
return '\0';
}
void UnGet()
{
++offset;
}
// tokens for our lexer
static int Err = 0;
static int Dot = 1;
static int StrLit = 2;
static int Ident = 3;
static int New = 4;
static int Bracket = 5;
static int Parent = 6;
static int Curly = 7;
static int Using = 8;
static int Digit = 9;
int curTokenType;
readonly static string[] tokenStateName = new string[] {
"Err", "Dot", "StrLit", "Ident", "New", "Bracket", "Paren", "Curly", "Using", "Digit"
};
string GetTokenName(int state)
{
return tokenStateName[state];
}
void ReadNextToken()
{
char ch = GetNext();
curTokenType = Err;
if (ch == '\0') {
return;
}
while (Char.IsWhiteSpace(ch)) {
ch = GetNext();
}
switch (ch) {
case '}':
if (ReadBracket('{', '}')) {
curTokenType = Curly;
}
break;
case ')':
if (ReadBracket('(', ')')) {
curTokenType = Parent;
}
break;
case ']':
if (ReadBracket('[', ']')) {
curTokenType = Bracket;
}
break;
case '.':
curTokenType = Dot;
break;
case '\'':
case '"':
if (ReadStringLiteral(ch)) {
curTokenType = StrLit;
}
break;
default:
if (IsDigit()) {
string digit = ReadDigit(ch);
curTokenType = Digit;
} else if (IsIdentifierPart(ch)) {
string ident = ReadIdentifier(ch);
if (ident != null) {
switch (ident) {
case "new":
curTokenType = New;
break;
case "using":
curTokenType = Using;
break;
default:
curTokenType = Ident;
break;
}
}
}
break;
}
}
bool IsDigit()
{
int n = 0;
while (true) {
char ch = Peek(n);
if (Char.IsDigit(ch)) {
n++;
continue;
}
return n > 0 && !Char.IsLetter(ch);
}
}
bool ReadStringLiteral(char litStart)
{
while (true) {
char ch = GetNext();
if (ch == '\0') {
return false;
}
if (ch == litStart) {
if (Peek() == '@' && litStart == '"') {
GetNext();
}
return true;
}
}
}
bool ReadBracket(char openBracket, char closingBracket)
{
int curlyBraceLevel = 0;
int squareBracketLevel = 0;
int parenthesisLevel = 0;
switch (openBracket) {
case '(':
parenthesisLevel++;
break;
case '[':
squareBracketLevel++;
break;
case '{':
curlyBraceLevel++;
break;
}
while (parenthesisLevel != 0 || squareBracketLevel != 0 || curlyBraceLevel != 0) {
char ch = GetNext();
if (ch == '\0') {
return false;
}
switch (ch) {
case '(':
parenthesisLevel--;
break;
case '[':
squareBracketLevel--;
break;
case '{':
curlyBraceLevel--;
break;
case ')':
parenthesisLevel++;
break;
case ']':
squareBracketLevel++;
break;
case '}':
curlyBraceLevel++;
break;
}
}
return true;
}
string ReadIdentifier(char ch)
{
string identifier = ch.ToString();
while (IsIdentifierPart(Peek())) {
identifier = GetNext() + identifier;
}
return identifier;
}
string ReadDigit(char ch)
{
string digit = ch.ToString();
while (Char.IsDigit(Peek()) || Peek() == '.') {
digit = GetNext() + digit;
}
return digit;
}
bool IsIdentifierPart(char ch)
{
return Char.IsLetterOrDigit(ch) || ch == '_';
}
#endregion
#region finite state machine
readonly static int ERROR = 0;
readonly static int START = 1;
readonly static int DOT = 2;
readonly static int MORE = 3;
readonly static int CURLY = 4;
readonly static int CURLY2 = 5;
readonly static int CURLY3 = 6;
readonly static int ACCEPT = 7;
readonly static int ACCEPTNOMORE = 8;
readonly static int ACCEPT2 = 9;
readonly static string[] stateName = new string[] {
"ERROR",
"START",
"DOT",
"MORE",
"CURLY",
"CURLY2",
"CURLY3",
"ACCEPT",
"ACCEPTNOMORE",
"ACCEPT2"
};
string GetStateName(int state)
{
return stateName[state];
}
int state = 0;
int lastAccept = 0;
static int[,] stateTable = new int[,] {
// Err, Dot, Str, ID, New, Brk, Par, Cur, Using, digit
/*ERROR*/ { ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR},
/*START*/ { ERROR, DOT, ACCEPT, ACCEPT, ERROR, MORE, ACCEPT2, CURLY, ACCEPTNOMORE, ERROR},
/*DOT*/ { ERROR, ERROR, ACCEPT, ACCEPT, ERROR, MORE, ACCEPT, CURLY, ERROR, ACCEPT},
/*MORE*/ { ERROR, ERROR, ACCEPT, ACCEPT, ERROR, MORE, ACCEPT2, CURLY, ERROR, ACCEPT},
/*CURLY*/ { ERROR, ERROR, ERROR, ERROR, ERROR, CURLY2, ERROR, ERROR, ERROR, ERROR},
/*CURLY2*/ { ERROR, ERROR, ERROR, CURLY3, ERROR, ERROR, ERROR, ERROR, ERROR, CURLY3},
/*CURLY3*/ { ERROR, ERROR, ERROR, ERROR, ACCEPTNOMORE, ERROR, ERROR, ERROR, ERROR, ERROR},
/*ACCEPT*/ { ERROR, MORE, ERROR, ERROR, ACCEPT, ERROR, ERROR, ERROR, ACCEPTNOMORE, ERROR},
/*ACCEPTNOMORE*/ { ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR},
/*ACCEPT2*/ { ERROR, MORE, ERROR, ACCEPT, ACCEPT, ERROR, ERROR, ERROR, ERROR, ACCEPT},
};
#endregion
}
}

141
src/AddIns/BackendBindings/VBNetBinding/Project/Src/Parser/Parser.cs

@ -0,0 +1,141 @@ @@ -0,0 +1,141 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Andrea Paatz" email="andrea@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Text;
using System.IO;
using System.Drawing;
using System.Collections;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver;
//using ICSharpCode.NRefactory.Parser;
namespace VBNetBinding.Parser
{
public class TParser : IParser
{
///<summary>IParser Interface</summary>
string[] lexerTags;
public string[] LexerTags {
get {
return lexerTags;
}
set {
lexerTags = value;
}
}
public IExpressionFinder ExpressionFinder {
get {
return new ExpressionFinder();
}
}
public bool CanParse(string fileName)
{
return Path.GetExtension(fileName).ToUpper() == ".CS";
}
public bool CanParse(IProject project)
{
return project.Language == "C#";
}
void RetrieveRegions(ICompilationUnit cu, ICSharpCode.NRefactory.Parser.SpecialTracker tracker)
{
for (int i = 0; i < tracker.CurrentSpecials.Count; ++i) {
ICSharpCode.NRefactory.Parser.PreProcessingDirective directive = tracker.CurrentSpecials[i] as ICSharpCode.NRefactory.Parser.PreProcessingDirective;
if (directive != null) {
if (directive.Cmd == "#region") {
int deep = 1;
for (int j = i + 1; j < tracker.CurrentSpecials.Count; ++j) {
ICSharpCode.NRefactory.Parser.PreProcessingDirective nextDirective = tracker.CurrentSpecials[j] as ICSharpCode.NRefactory.Parser.PreProcessingDirective;
if (nextDirective != null) {
switch (nextDirective.Cmd) {
case "#region":
++deep;
break;
case "#endregion":
--deep;
if (deep == 0) {
cu.FoldingRegions.Add(new FoldingRegion(directive.Arg.Trim(), new DefaultRegion(directive.Start, new Point(nextDirective.End.X, nextDirective.End.Y))));
goto end;
}
break;
}
}
}
end: ;
}
}
}
}
public ICompilationUnitBase Parse(string fileName)
{
// ICSharpCode.NRefactory.Parser.Parser p = new ICSharpCode.NRefactory.Parser.Parser();
//
// Lexer lexer = new Lexer(new FileReader(fileName));
// lexer.SpecialCommentTags = lexerTags;
// p.Parse(lexer);
Properties textEditorProperties = ((Properties)PropertyService.Get("ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new Properties()));
ICSharpCode.NRefactory.Parser.IParser p = ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser(fileName, Encoding.GetEncoding(textEditorProperties.Get("Encoding", 1252)));
p.Lexer.SpecialCommentTags = lexerTags;
p.Parse();
NRefactoryASTConvertVisitor visitor = new NRefactoryASTConvertVisitor();
visitor.Visit(p.CompilationUnit, null);
visitor.Cu.FileName = fileName;
visitor.Cu.ErrorsDuringCompile = p.Errors.count > 0;
RetrieveRegions(visitor.Cu, p.Lexer.SpecialTracker);
AddCommentTags(visitor.Cu, p.Lexer.TagComments);
return visitor.Cu;
}
public ICompilationUnitBase Parse(string fileName, string fileContent)
{
// ICSharpCode.NRefactory.Parser.Parser p = new ICSharpCode.NRefactory.Parser.Parser();
//
// Lexer lexer = new Lexer(new StringReader(fileContent));
// lexer.SpecialCommentTags = lexerTags;
// p.Parse(lexer);
ICSharpCode.NRefactory.Parser.IParser p = ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser(ICSharpCode.NRefactory.Parser.SupportedLanguages.CSharp, new StringReader(fileContent));
p.Lexer.SpecialCommentTags = lexerTags;
p.Parse();
NRefactoryASTConvertVisitor visitor = new NRefactoryASTConvertVisitor();
visitor.Visit(p.CompilationUnit, null);
visitor.Cu.FileName = fileName;
visitor.Cu.ErrorsDuringCompile = p.Errors.count > 0;
visitor.Cu.Tag = p.CompilationUnit;
RetrieveRegions(visitor.Cu, p.Lexer.SpecialTracker);
AddCommentTags(visitor.Cu, p.Lexer.TagComments);
return visitor.Cu;
}
void AddCommentTags(ICompilationUnit cu, ArrayList tagComments)
{
foreach (ICSharpCode.NRefactory.Parser.TagComment tagComment in tagComments) {
DefaultRegion tagRegion = new DefaultRegion(tagComment.StartPosition.Y, tagComment.StartPosition.X);
ICSharpCode.SharpDevelop.Dom.Tag tag = new ICSharpCode.SharpDevelop.Dom.Tag(tagComment.Tag, tagRegion);
tag.CommentString = tagComment.CommentText;
cu.TagComments.Add(tag);
}
}
public IResolver CreateResolver()
{
return new ICSharpCode.SharpDevelop.Dom.NRefactoryResolver.NRefactoryResolver(ICSharpCode.NRefactory.Parser.SupportedLanguages.CSharp);
}
///////// IParser Interface END
}
}

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

@ -0,0 +1,599 @@ @@ -0,0 +1,599 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Resources;
using System.Windows.Forms;
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
namespace VBNetBinding
{
public enum WarningsAsErrors
{
None,
Specific,
All
}
public enum AssemblyOriginatorKeyMode
{
None,
File,
Provider
}
public enum RunPostBuildEvent
{
Always,
OnSuccessfulBuild,
OnOutputUpdated
}
public enum StartAction
{
Project,
Program,
StartURL
}
/// <summary>
/// Description of CSharpProject.
/// </summary>
public class VBNetProject : MSBuildProject
{
[Browsable(false)]
public int WarningLevel
{
get {
return BaseConfiguration.Get("WarningLevel", 4);
}
set {
BaseConfiguration.Set("WarningLevel", 4, value);
}
}
[Browsable(false)]
public string ApplicationIcon
{
get {
return BaseConfiguration["ApplicationIcon"];
}
set {
BaseConfiguration.Set("ApplicationIcon", value);
}
}
#region Signing
[Browsable(false)]
public bool SignAssembly {
get {
return BaseConfiguration.Get("SignAssembly", false);
}
set {
BaseConfiguration.Set("SignAssembly", false, value);
}
}
[Browsable(false)]
public bool DelaySign {
get {
return BaseConfiguration.Get("DelaySign", false);
}
set {
BaseConfiguration.Set("DelaySign", false, value);
}
}
[Browsable(false)]
public string AssemblyOriginatorKeyFile {
get {
return BaseConfiguration["AssemblyOriginatorKeyFile"];
}
set {
BaseConfiguration.Set("AssemblyOriginatorKeyFile", value);
}
}
[Browsable(false)]
public string AssemblyKeyProviderName {
get {
return BaseConfiguration["AssemblyKeyProviderName"];
}
set {
BaseConfiguration.Set("AssemblyKeyProviderName", value);
}
}
[Browsable(false)]
public AssemblyOriginatorKeyMode AssemblyOriginatorKeyMode {
get {
return BaseConfiguration.Get("AssemblyOriginatorKeyMode", AssemblyOriginatorKeyMode.None);
}
set {
BaseConfiguration.Set("AssemblyOriginatorKeyMode", AssemblyOriginatorKeyMode.None, value);
}
}
#endregion
[Browsable(false)]
public string StartupObject
{
get {
return BaseConfiguration["StartupObject"];
}
set {
BaseConfiguration.Set("StartupObject", value);
}
}
[Browsable(false)]
public string Win32Resource
{
get {
return BaseConfiguration["Win32Resource"];
}
set {
BaseConfiguration.Set("Win32Resource", value);
}
}
#region Build events
[Browsable(false)]
public RunPostBuildEvent RunPostBuildEvent {
get {
return BaseConfiguration.Get("RunPostBuildEvent", RunPostBuildEvent.OnSuccessfulBuild);
}
set {
BaseConfiguration.Set("RunPostBuildEvent", RunPostBuildEvent.OnSuccessfulBuild, value);
}
}
[Browsable(false)]
public string PreBuildEvent {
get {
return BaseConfiguration["PreBuildEvent"];
}
set {
BaseConfiguration.Set("PreBuildEvent", value);
}
}
[Browsable(false)]
public string PostBuildEvent {
get {
return BaseConfiguration["PostBuildEvent"];
}
set {
BaseConfiguration.Set("PostBuildEvent", value);
}
}
#endregion
[Browsable(false)]
public string PublishUrl
{
get {
return BaseConfiguration["PublishUrl"];
}
set {
BaseConfiguration.Set("PublishUrl", value);
}
}
[Browsable(false)]
public bool Install
{
get {
return BaseConfiguration.Get("Install", false);
}
set {
BaseConfiguration.Set("Install", false, value);
}
}
[Browsable(false)]
public bool UpdateEnabled
{
get {
return BaseConfiguration.Get("UpdateEnabled", false);
}
set {
BaseConfiguration.Set("UpdateEnabled", false, value);
}
}
[Browsable(false)]
public bool UpdatePeriodically
{
get {
return BaseConfiguration.Get("UpdatePeriodically", false);
}
set {
BaseConfiguration.Set("UpdatePeriodically", false, value);
}
}
[Browsable(false)]
public bool UpdateRequired
{
get {
return BaseConfiguration.Get("UpdateRequired", false);
}
set {
BaseConfiguration.Set("UpdateRequired", false, value);
}
}
[Browsable(false)]
public bool UpdateUrlEnabled
{
get {
return BaseConfiguration.Get("UpdateUrlEnabled", false);
}
set {
BaseConfiguration.Set("UpdateUrlEnabled", value);
}
}
[Browsable(false)]
public bool BootstrapperEnabled
{
get {
return BaseConfiguration.Get("BootstrapperEnabled", false);
}
set {
BaseConfiguration.Set("BootstrapperEnabled", false, value);
}
}
[Browsable(false)]
public string InstallFrom
{
get {
return BaseConfiguration["InstallFrom"];
}
set {
BaseConfiguration.Set("InstallFrom", value);
}
}
[Browsable(false)]
public string FallbackCulture
{
get {
return BaseConfiguration["FallbackCulture"];
}
set {
BaseConfiguration.Set("FallbackCulture", value);
}
}
[Browsable(false)]
public string UpdateMode
{
get {
return BaseConfiguration["UpdateMode"];
}
set {
BaseConfiguration.Set("UpdateMode", value);
}
}
[Browsable(false)]
public string UpdateIntervalUnits
{
get {
return BaseConfiguration["UpdateIntervalUnits"];
}
set {
BaseConfiguration.Set("UpdateIntervalUnits", value);
}
}
[Browsable(false)]
public string ApplicationVersion
{
get {
return BaseConfiguration["ApplicationVersion"];
}
set {
BaseConfiguration.Set("ApplicationVersion", value);
}
}
[Browsable(false)]
public int UpdateInterval
{
get {
return BaseConfiguration.Get("UpdateInterval", 0);
}
set {
BaseConfiguration.Set("UpdateInterval", 0, value);
}
}
[Browsable(false)]
public int ApplicationRevision
{
get {
return BaseConfiguration.Get("ApplicationRevision", 0);
}
set {
BaseConfiguration.Set("ApplicationRevision", 0, value);
}
}
public bool GetDebugSymbols(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform).Get("DebugSymbols", false);
}
public void SetDebugSymbols(string configurationName, string platform, bool val)
{
GetConfiguration(configurationName, platform).Set("DebugSymbols", val);
}
public bool GetOptimize(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform).Get("Optimize", false);
}
public void SetOptimize(string configurationName, string platform, bool val)
{
GetConfiguration(configurationName, platform).Set("Optimize", false, val);
}
public bool GetAllowUnsafeBlocks(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform).Get("AllowUnsafeBlocks", false);
}
public void SetAllowUnsafeBlocks(string configurationName, string platform, bool val)
{
GetConfiguration(configurationName, platform).Set("AllowUnsafeBlocks", false, val);
}
public WarningsAsErrors GetTreatWarningsAsErrors(string configurationName, string platform)
{
PropertyGroup properties = GetConfiguration(configurationName, platform);
if (!properties.IsSet("TreatWarningsAsErrors")) {
return WarningsAsErrors.Specific;
}
bool warningAsErrors = properties.Get("TreatWarningsAsErrors", false);
return warningAsErrors ? WarningsAsErrors.All : WarningsAsErrors.None;
}
public void SetTreatWarningsAsErrors(string configurationName, string platform, WarningsAsErrors warningsAsErrors)
{
PropertyGroup properties = GetConfiguration(configurationName, platform);
switch (warningsAsErrors) {
case WarningsAsErrors.None:
properties.Set("TreatWarningsAsErrors", false, false);
break;
case WarningsAsErrors.Specific:
properties.Remove("TreatWarningsAsErrors");
break;
case WarningsAsErrors.All:
properties.Set("TreatWarningsAsErrors", false, true);
break;
}
}
public bool GetRegisterForComInterop(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform).Get("RegisterForComInterop", false);
}
public void SetRegisterForComInterop(string configurationName, string platform, bool val)
{
GetConfiguration(configurationName, platform).Set("RegisterForComInterop", false, val);
}
public string GetDefineConstants(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform)["DefineConstants"];
}
public void SetDefineConstants(string configurationName, string platform, string val)
{
GetConfiguration(configurationName, platform)["DefineConstants"] = val;
}
public string GetNoWarn(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform)["NoWarn"];
}
public void SetNoWarn(string configurationName, string platform, string val)
{
GetConfiguration(configurationName, platform)["NoWarn"] = val;
}
public string GetWarningsAsErrors(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform)["WarningsAsErrors"];
}
public void SetWarningsAsErrors(string configurationName, string platform, string val)
{
GetConfiguration(configurationName, platform)["WarningsAsErrors"] = val;
}
public string GetDocumentationFile(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform)["DocumentationFile"];
}
public void SetDocumentationFile(string configurationName, string platform, string val)
{
GetConfiguration(configurationName, platform)["DocumentationFile"] = val;
}
public string GetLangVersion(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform)["LangVersion"];
}
public void SetLangVersion(string configurationName, string platform, string val)
{
GetConfiguration(configurationName, platform)["LangVersion"] = val;
}
public string GetErrorReport(string configurationName, string platform)
{ // none, prompt, send
return GetConfiguration(configurationName, platform)["ErrorReport"];
}
public void SetErrorReport(string configurationName, string platform, string val)
{
GetConfiguration(configurationName, platform)["ErrorReport"] = val;
}
public int GetBaseAddress(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform).Get<int>("BaseAddress", 4194304);
}
public void SetBaseAddress(string configurationName, string platform, int val)
{
GetConfiguration(configurationName, platform).Set("BaseAddress", 4194304, val);
}
public int GetFileAlignment(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform).Get<int>("FileAlignment", 4096);
}
public void SetFileAlignment(string configurationName, string platform, int val)
{
GetConfiguration(configurationName, platform).Set("FileAlignment", 4096, val);
}
public string GetDebugType(string configurationName, string platform)
{ // none, full, pdbonly
return GetConfiguration(configurationName, platform)["DebugType"];
}
public void SetDebugType(string configurationName, string platform, string val)
{
GetConfiguration(configurationName, platform)["DebugType"] = val;
}
public bool GetCheckForOverflowUnderflow(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform).Get("CheckForOverflowUnderflow", false);
}
public void SetCheckForOverflowUnderflow(string configurationName, string platform, bool val)
{
GetConfiguration(configurationName, platform).Set("CheckForOverflowUnderflow", false, val);
}
public bool GetNoStdLib(string configurationName, string platform)
{
return GetConfiguration(configurationName, platform).Get("NoStdLib", false);
}
public void SetNoStdLib(string configurationName, string platform, bool val)
{
GetConfiguration(configurationName, platform).Set("NoStdLib", false, val);
}
#region Debug Options
public string GetStartProgram(string configurationName, string platform)
{
return GetUserConfiguration(configurationName, platform)["StartProgram"];
}
public void SetStartProgram(string configurationName, string platform, string val)
{
GetUserConfiguration(configurationName, platform)["StartProgram"] = val;
}
public string GetStartURL(string configurationName, string platform)
{
return GetUserConfiguration(configurationName, platform)["StartURL"];
}
public void SetStartURL(string configurationName, string platform, string val)
{
GetUserConfiguration(configurationName, platform)["StartURL"] = val;
}
public StartAction GetStartAction(string configurationName, string platform)
{
return GetUserConfiguration(configurationName, platform).Get("StartAction", StartAction.Project);
}
public void SetStartAction(string configurationName, string platform, StartAction val)
{
GetUserConfiguration(configurationName, platform).Set("StartAction", StartAction.Project, val);
}
public string GetStartArguments(string configurationName, string platform)
{
return GetUserConfiguration(configurationName, platform)["StartArguments"];
}
public void SetStartArguments(string configurationName, string platform, string val)
{
GetUserConfiguration(configurationName, platform)["StartArguments"] = val;
}
public string GetStartWorkingDirectory(string configurationName, string platform)
{
return GetUserConfiguration(configurationName, platform)["StartWorkingDirectory"];
}
public void SetStartWorkingDirectory(string configurationName, string platform, string val)
{
GetUserConfiguration(configurationName, platform)["StartWorkingDirectory"] = val;
}
public bool GetRemoteDebugEnabled(string configurationName, string platform)
{
return GetUserConfiguration(configurationName, platform).Get("RemoteDebugEnabled", false);
}
public void SetRemoteDebugEnabled(string configurationName, string platform, bool val)
{
GetUserConfiguration(configurationName, platform).Set("RemoteDebugEnabled", false, val);
}
public string GetRemoteDebugMachine(string configurationName, string platform)
{
return GetUserConfiguration(configurationName, platform)["RemoteDebugMachine"];
}
public void SetRemoteDebugMachine(string configurationName, string platform, string val)
{
GetUserConfiguration(configurationName, platform)["RemoteDebugMachine"] = val;
}
#endregion
public VBNetProject(string fileName, string projectName)
{
this.Name = projectName;
Language = "VB.NET";
SetupProject(fileName);
IdGuid = BaseConfiguration["ProjectGuid"];
}
public VBNetProject(ProjectCreateInformation info)
{
Language = "VB.NET";
Create(info);
}
}
}

570
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetAmbience.cs

@ -0,0 +1,570 @@ @@ -0,0 +1,570 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Text;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.Core;
namespace VBNetBinding
{
public class VBNetAmbience : AbstractAmbience
{
static string[,] typeConversionList = new string[,] {
{"System.String", "String"},
{"System.Single", "Single"},
{"System.Int16", "Short"},
{"System.Void", "Void"},
{"System.Object", "Object"},
{"System.Int64", "Long"},
{"System.Int32", "Integer"},
{"System.Double", "Double"},
{"System.Char", "Char"},
{"System.Boolean", "Boolean"},
{"System.Byte", "Byte"},
{"System.Decimal", "Decimal"},
{"System.DateTime", "Date"},
};
static Hashtable typeConversionTable = new Hashtable();
static VBNetAmbience()
{
for (int i = 0; i < typeConversionList.GetLength(0); ++i) {
typeConversionTable[typeConversionList[i, 0]] = typeConversionList[i, 1];
}
}
string GetModifier(IDecoration decoration)
{
StringBuilder builder = new StringBuilder();
if (IncludeHTMLMarkup) {
builder.Append("<i>");
}
if (decoration.IsStatic) {
builder.Append("Shared ");
}
if (decoration.IsAbstract) {
builder.Append("MustOverride ");
} else if (decoration.IsFinal) {
builder.Append("NotOverridable ");
} else if (decoration.IsVirtual) {
builder.Append("Overridable ");
} else if (decoration.IsOverride) {
builder.Append("Overrides ");
} else if (decoration.IsNew) {
builder.Append("Shadows ");
}
if (IncludeHTMLMarkup) {
builder.Append("</i>");
}
return builder.ToString();
}
public override string Convert(ModifierEnum modifier)
{
StringBuilder builder = new StringBuilder();
if (ShowAccessibility) {
if ((modifier & ModifierEnum.Public) == ModifierEnum.Public) {
builder.Append("Public");
} else if ((modifier & ModifierEnum.Private) == ModifierEnum.Private) {
builder.Append("Private");
} else if ((modifier & (ModifierEnum.Protected | ModifierEnum.Internal)) == (ModifierEnum.Protected | ModifierEnum.Internal)) {
builder.Append("Protected Friend");
} else if ((modifier & ModifierEnum.ProtectedOrInternal) == ModifierEnum.ProtectedOrInternal) {
builder.Append("Protected Friend");
} else if ((modifier & ModifierEnum.Internal) == ModifierEnum.Internal) {
builder.Append("Friend");
} else if ((modifier & ModifierEnum.Protected) == ModifierEnum.Protected) {
builder.Append("Protected");
}
builder.Append(' ');
}
return builder.ToString();
}
public override string Convert(IClass c)
{
StringBuilder builder = new StringBuilder();
builder.Append(Convert(c.Modifiers));
if (IncludeHTMLMarkup) {
builder.Append("<i>");
}
if (ShowModifiers) {
if (c.IsSealed) {
if (c.ClassType == ClassType.Class) {
builder.Append("NotInheritable ");
}
} else if (c.IsAbstract && c.ClassType != ClassType.Interface) {
builder.Append("MustInherit ");
}
}
if (IncludeHTMLMarkup) {
builder.Append("</i>");
}
switch (c.ClassType) {
case ClassType.Delegate:
builder.Append("Delegate ");
if (ShowReturnType) {
foreach (IMethod m in c.Methods) {
if (m.Name != "Invoke") {
continue;
}
if (m.ReturnType == null || m.ReturnType.FullyQualifiedName == "System.Void") {
builder.Append("Sub");
} else {
builder.Append("Function");
}
}
}
break;
case ClassType.Class:
builder.Append("Class");
break;
case ClassType.Struct:
builder.Append("Structure");
break;
case ClassType.Interface:
builder.Append("Interface");
break;
case ClassType.Enum:
builder.Append("Enum");
break;
}
builder.Append(' ');
if (IncludeHTMLMarkup) {
builder.Append("<b>");
}
if (UseFullyQualifiedMemberNames) {
builder.Append(c.FullyQualifiedName);
} else {
builder.Append(c.Name);
}
if (IncludeHTMLMarkup) {
builder.Append("</b>");
}
if (c.ClassType == ClassType.Delegate) {
builder.Append("(");
if (IncludeHTMLMarkup) builder.Append("<br>");
foreach (IMethod m in c.Methods) {
if (m.Name != "Invoke") continue;
for (int i = 0; i < m.Parameters.Count; ++i) {
if (IncludeHTMLMarkup) builder.Append("&nbsp;&nbsp;&nbsp;");
builder.Append(Convert(m.Parameters[i]));
if (i + 1 < m.Parameters.Count) builder.Append(", ");
if (IncludeHTMLMarkup) builder.Append("<br>");
}
}
builder.Append(")");
foreach (IMethod m in c.Methods) {
if (m.Name != "Invoke") continue;
if (m.ReturnType == null || m.ReturnType.FullyQualifiedName == "System.Void") {
} else {
if (ShowReturnType) {
builder.Append(" As ");
builder.Append(Convert(m.ReturnType));
}
}
}
} else if (ShowInheritanceList) {
if (c.BaseTypes.Count > 0) {
builder.Append(" Inherits ");
for (int i = 0; i < c.BaseTypes.Count; ++i) {
builder.Append(c.BaseTypes[i]);
if (i + 1 < c.BaseTypes.Count) {
builder.Append(", ");
}
}
}
}
return builder.ToString();
}
public override string ConvertEnd(IClass c)
{
StringBuilder builder = new StringBuilder();
builder.Append("End ");
switch (c.ClassType) {
case ClassType.Delegate:
builder.Append("Delegate");
break;
case ClassType.Class:
builder.Append("Class");
break;
case ClassType.Struct:
builder.Append("Structure");
break;
case ClassType.Interface:
builder.Append("Interface");
break;
case ClassType.Enum:
builder.Append("Enum");
break;
}
return builder.ToString();
}
public override string Convert(IField field)
{
StringBuilder builder = new StringBuilder();
builder.Append(Convert(field.Modifiers));
if (IncludeHTMLMarkup) {
builder.Append("<i>");
}
if (ShowModifiers) {
if (field.IsStatic && field.IsLiteral) {
builder.Append("Const ");
} else if (field.IsStatic) {
builder.Append("Shared ");
}
}
if (IncludeHTMLMarkup) {
builder.Append("</i>");
builder.Append("<b>");
}
if (UseFullyQualifiedMemberNames) {
builder.Append(field.FullyQualifiedName);
} else {
builder.Append(field.Name);
}
if (IncludeHTMLMarkup) {
builder.Append("</b>");
}
if (field.ReturnType != null && ShowReturnType) {
builder.Append(" As ");
builder.Append(Convert(field.ReturnType));
}
return builder.ToString();
}
public override string Convert(IProperty property)
{
StringBuilder builder = new StringBuilder();
builder.Append(Convert(property.Modifiers));
if (ShowModifiers) {
builder.Append(GetModifier(property));
}
if (property.CanGet && !property.CanSet) {
builder.Append("ReadOnly ");
}
if (property.CanSet && !property.CanGet) {
builder.Append("WriteOnly ");
}
if (IncludeHTMLMarkup) {
builder.Append("<b>");
}
if (UseFullyQualifiedMemberNames) {
builder.Append(property.FullyQualifiedName);
} else {
builder.Append(property.Name);
}
if (IncludeHTMLMarkup) {
builder.Append("</b>");
}
if (property.Parameters.Count > 0) {
builder.Append("(");
if (IncludeHTMLMarkup) builder.Append("<br>");
for (int i = 0; i < property.Parameters.Count; ++i) {
if (IncludeHTMLMarkup) builder.Append("&nbsp;&nbsp;&nbsp;");
builder.Append(Convert(property.Parameters[i]));
if (i + 1 < property.Parameters.Count) {
builder.Append(", ");
}
if (IncludeHTMLMarkup) builder.Append("<br>");
}
builder.Append(')');
}
if (property.ReturnType != null && ShowReturnType) {
builder.Append(" As ");
builder.Append(Convert(property.ReturnType));
}
return builder.ToString();
}
public override string Convert(IEvent e)
{
StringBuilder builder = new StringBuilder();
builder.Append(Convert(e.Modifiers));
if (ShowModifiers) {
builder.Append(GetModifier(e));
}
if (IncludeHTMLMarkup) {
builder.Append("<b>");
}
if (UseFullyQualifiedMemberNames) {
builder.Append(e.FullyQualifiedName);
} else {
builder.Append(e.Name);
}
if (IncludeHTMLMarkup) {
builder.Append("</b>");
}
if (e.ReturnType != null && ShowReturnType) {
builder.Append(" As ");
builder.Append(Convert(e.ReturnType));
}
return builder.ToString();
}
public override string Convert(IIndexer m)
{
StringBuilder builder = new StringBuilder();
builder.Append(Convert(m.Modifiers));
if (ShowModifiers) {
if (m.IsStatic) {
builder.Append("Shared ");
}
}
if (IncludeHTMLMarkup) {
builder.Append("<b>");
}
if (UseFullyQualifiedMemberNames) {
builder.Append(m.FullyQualifiedName);
} else {
builder.Append(m.Name);
}
if (IncludeHTMLMarkup) {
builder.Append("</b>");
}
builder.Append("Item(");
if (IncludeHTMLMarkup) builder.Append("<br>");
for (int i = 0; i < m.Parameters.Count; ++i) {
if (IncludeHTMLMarkup) builder.Append("&nbsp;&nbsp;&nbsp;");
builder.Append(Convert(m.Parameters[i]));
if (i + 1 < m.Parameters.Count) {
builder.Append(", ");
}
if (IncludeHTMLMarkup) builder.Append("<br>");
}
builder.Append(")");
if (m.ReturnType != null && ShowReturnType) {
builder.Append(" As ");
builder.Append(Convert(m.ReturnType));
}
return builder.ToString();
}
public override string Convert(IMethod m)
{
StringBuilder builder = new StringBuilder();
builder.Append(Convert(m.Modifiers));
if (ShowModifiers) {
builder.Append(GetModifier(m));
}
if (ShowReturnType) {
if (m.ReturnType == null || m.ReturnType.FullyQualifiedName == "System.Void") {
builder.Append("Sub ");
} else {
builder.Append("Function ");
}
}
string dispName = UseFullyQualifiedMemberNames ? m.FullyQualifiedName : m.Name;
if (m.Name == "ctor" || m.Name == "cctor" || m.Name == "#ctor" || m.Name == "#cctor" || m.IsConstructor) {
dispName = "New";
}
if (IncludeHTMLMarkup) {
builder.Append("<b>");
}
builder.Append(dispName);
if (IncludeHTMLMarkup) {
builder.Append("</b>");
}
builder.Append("(");
if (IncludeHTMLMarkup) builder.Append("<br>");
for (int i = 0; i < m.Parameters.Count; ++i) {
if (IncludeHTMLMarkup) builder.Append("&nbsp;&nbsp;&nbsp;");
builder.Append(Convert(m.Parameters[i]));
if (i + 1 < m.Parameters.Count) {
builder.Append(", ");
}
if (IncludeHTMLMarkup) builder.Append("<br>");
}
builder.Append(')');
if (ShowReturnType && m.ReturnType != null && m.ReturnType.FullyQualifiedName != "System.Void") {
builder.Append(" As ");
builder.Append(Convert(m.ReturnType));
}
return builder.ToString();
}
public override string ConvertEnd(IMethod m)
{
if (m.ReturnType == null || m.ReturnType.FullyQualifiedName == "System.Void") {
return "End Sub";
} else {
return "End Function";
}
}
public override string Convert(IReturnType returnType)
{
if (returnType == null) {
return String.Empty;
}
StringBuilder builder = new StringBuilder();
bool linkSet = false;
// TODO: #Assembly dependance:
// if (UseLinkArrayList) {
// SharpAssemblyReturnType ret = returnType as SharpAssemblyReturnType;
// if (ret != null) {
// if (ret.UnderlyingClass != null) {
// builder.Append("<a href='as://" + linkArrayList.Add(ret.UnderlyingClass) + "'>");
// linkSet = true;
// }
// }
// }
if (returnType.FullyQualifiedName != null && typeConversionTable[returnType.FullyQualifiedName] != null) {
builder.Append(typeConversionTable[returnType.FullyQualifiedName].ToString());
} else {
builder.Append(UseFullyQualifiedNames ? returnType.FullyQualifiedName : returnType.Name);
}
if (linkSet) {
builder.Append("</a>");
}
for (int i = 0; i < returnType.PointerNestingLevel; ++i) {
builder.Append('*');
}
for (int i = 0; i < returnType.ArrayCount; ++i) {
builder.Append('(');
for (int j = 1; j < returnType.ArrayDimensions[i]; ++j) {
builder.Append(',');
}
builder.Append(')');
}
return builder.ToString();
}
public override string Convert(IParameter param)
{
StringBuilder builder = new StringBuilder();
if (ShowParameterNames) {
if (IncludeHTMLMarkup) {
builder.Append("<i>");
}
if (param.IsRef || param.IsOut) {
builder.Append("ByRef ");
} else if (param.IsParams) {
builder.Append("ByVal ParamArray ");
} else {
builder.Append("ByVal ");
}
if (IncludeHTMLMarkup) {
builder.Append("</i>");
}
builder.Append(param.Name);
builder.Append(" As ");
}
builder.Append(Convert(param.ReturnType));
return builder.ToString();
}
public override string WrapAttribute(string attribute)
{
return "<" + attribute + ">";
}
public override string WrapComment(string comment)
{
return "' " + comment;
}
public override string GetIntrinsicTypeName(string dotNetTypeName)
{
if (typeConversionTable[dotNetTypeName] != null) {
return (string)typeConversionTable[dotNetTypeName];
}
return dotNetTypeName;
}
}
}

85
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetBindingExecutionManager.cs

@ -0,0 +1,85 @@ @@ -0,0 +1,85 @@
//// <file>
//// <copyright see="prj:///doc/copyright.txt"/>
//// <license see="prj:///doc/license.txt"/>
//// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
//// <version value="$version"/>
//// </file>
//
//using System;
//using System.IO;
//using System.Diagnostics;
//using System.Collections;
//using System.Reflection;
//using System.Resources;
//using System.Windows.Forms;
//using System.Xml;
//using System.CodeDom.Compiler;
//using System.Threading;
//
//using ICSharpCode.SharpDevelop.Project;
//using ICSharpCode.SharpDevelop.Gui;
//using ICSharpCode.Core;
//
//namespace CSharpBinding
//{
// /// <summary>
// /// This class describes the main functionalaty of a language codon
// /// </summary>
// public class CSharpBindingExecutionManager
// {
// public void Execute(string filename, bool debug)
// {
// }
//
// public void Execute(IProject project, bool debug)
// {
// CSharpCompilerParameters parameters = (CSharpCompilerParameters)project.ActiveConfiguration;
//
//
// string directory = FileUtility.GetDirectoryNameWithSeparator(((CSharpCompilerParameters)project.ActiveConfiguration).OutputDirectory);
// string exe = ((CSharpCompilerParameters)project.ActiveConfiguration).OutputAssembly + ".exe";
// string args = ((CSharpCompilerParameters)project.ActiveConfiguration).CommandLineParameters;
//
//
// bool customStartup = false;
// ProcessStartInfo psi;
// if (parameters.ExecuteScript != null && parameters.ExecuteScript.Length > 0) {
// customStartup = true;
// psi = new ProcessStartInfo("\"" + parameters.ExecuteScript + "\"", args);
// } else {
// if (parameters.CompileTarget == CompileTarget.Library) {
//
// MessageService.ShowError("${res:BackendBindings.ExecutionManager.CantExecuteDLLError}");
// return;
// }
//
// string runtimeStarter = String.Empty;
//
// switch (parameters.NetRuntime) {
// case NetRuntime.Mono:
// runtimeStarter = "mono ";
// break;
// case NetRuntime.MonoInterpreter:
// runtimeStarter = "mint ";
// break;
// }
//
// if (parameters.CompileTarget != CompileTarget.WinExe && parameters.PauseConsoleOutput) {
// psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c " + runtimeStarter + "\"" + directory + exe + "\" " + args + " & pause");
// } else {
// psi = new ProcessStartInfo(runtimeStarter + "\"" + directory + exe + "\"");
// psi.Arguments = args;
// }
// }
//
// psi.WorkingDirectory = Path.GetDirectoryName(directory);
// psi.UseShellExecute = false;
// DebuggerService DebuggerService = (DebuggerService)ServiceManager.Services.GetService(typeof(DebuggerService));
// if (debug && !customStartup) {
// DebuggerService.Start(Path.Combine(directory, exe), directory, args);
// } else {
// DebuggerService.StartWithoutDebugging(psi);
// }
// }
// }
//}

90
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs

@ -0,0 +1,90 @@ @@ -0,0 +1,90 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Resources;
using System.Windows.Forms;
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
namespace VBNetBinding
{
public class VBNetLanguageBinding : ILanguageBinding
{
public const string LanguageName = "C#";
public string Language {
get {
return LanguageName;
}
}
#region routines for single file compilation
public bool CanCompile(string fileName)
{
Debug.Assert(fileName != null);
string ext = Path.GetExtension(fileName);
if (ext == null) {
return false;
}
return ext.ToUpper() == ".CS";
}
public string GetCompiledOutputName(string fileName)
{
Debug.Assert(CanCompile(fileName));
return Path.ChangeExtension(fileName, ".exe");
}
public CompilerResults CompileFile(string fileName)
{
Debug.Assert(CanCompile(fileName));
// TODO: Implement me!
return null;
}
public void Execute(string fileName, bool debug)
{
string exe = GetCompiledOutputName(fileName);
if (debug) {
DebuggerService.Start(exe, Path.GetDirectoryName(exe), "");
} else {
ProcessStartInfo psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c " + "\"" + exe + "\"" + " & pause");
psi.WorkingDirectory = Path.GetDirectoryName(exe);
psi.UseShellExecute = false;
DebuggerService.StartWithoutDebugging(psi);
}
}
#endregion
public IProject LoadProject(string fileName, string projectName)
{
return new VBNetProject(fileName, projectName);
}
public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
{
return new VBNetProject(info);
}
}
}

77
src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
<AddIn name = "SharpDevelop Bindings"
author = "Mike Krueger, Markus Palme"
copyright = "GPL"
url = "http://www.icsharpcode.net"
description = "SharpDevelop VB.NET language binding"
version = "1.0.0">
<Runtime>
<Import assembly = "VBNetBinding.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/Ambiences">
<Class id = "VBNet"
class = "VBNetBinding.VBNetAmbience"/>
</Path>
<Path name = "/SharpDevelop/Workbench/FileFilter">
<FileFilter id = "VBNet"
insertbefore="AllFiles"
name = "${res:SharpDevelop.FileFilter.VBNetFiles}"
extensions = "*.vb"/>
</Path>
<Path name = "/Workspace/Parser">
<Parser id = "VBNet"
supportedextensions = ".vb"
projectfileextension = ".vbproj"
class = "VBNetBinding.Parser.TParser"/>
</Path>
<Path path = "/SharpDevelop/BackendBindings/ProjectOptions/VBNet">
<DialogPanel id = "Application"
label = "Application"
class = "VBNetBinding.OptionPanels.ApplicationSettings"/>
<DialogPanel id = "ReferencePaths"
label = "Reference Paths"
class = "VBNetBinding.OptionPanels.ReferencePaths"/>
<DialogPanel id = "Signing"
label = "Signing"
class = "VBNetBinding.OptionPanels.Signing"/>
<DialogPanel id = "BuildEvents"
label = "Build Events"
class = "VBNetBinding.OptionPanels.BuildEvents"/>
<DialogPanel id = "BuildOptions"
label = "Build"
class = "VBNetBinding.OptionPanels.BuildOptions"/>
<DialogPanel id = "DebugOptions"
label = "Debug"
class = "VBNetBinding.OptionPanels.DebugOptions"/>
<DialogPanel id = "Publish"
label = "Publish"
class = "VBNetBinding.OptionPanels.Publish"/>
</Path>
<Path name = "/AddIns/DefaultTextEditor/Formatter/VBNet">
<Class id ="VBNetFormatter" insertbefore="DefaultFormatter" class = "CSharpBinding.FormattingStrategy.VBNetFormattingStrategy"/>
</Path>
<Path name = "/Workspace/Icons">
<!-- C# -->
<Icon id = "VBNetPrj"
language = "VBNet"
resource = "VBNet.ProjectIcon"/>
<Icon id = "VBNetFile"
extensions = ".vb"
resource = "VBNet.FileIcon"/>
</Path>
<Path path = "/SharpDevelop/Workbench/LanguageBindings">
<LanguageBinding id = "VBNet"
guid = "{634FA0F9-5C09-48ec-9E9E-29428AE97251}"
supportedextensions = ".vb"
projectfileextension = ".vbproj"
class = "VBNetBinding.VBNetLanguageBinding" />
</Path>
</AddIn>

111
src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.41115</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}</ProjectGuid>
<AssemblyName>VBNetBinding</AssemblyName>
<OutputTarget>Library</OutputTarget>
<WarningLevel>4</WarningLevel>
<NoStdLib>False</NoStdLib>
<NoConfig>False</NoConfig>
<RunPostBuildEvent>OnSuccessfulBuild</RunPostBuildEvent>
<OutputType>Library</OutputType>
<AssemblyOriginatorKeyFile />
<AssemblyKeyProviderName />
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\..\AddIns\AddIns\BackendBindings\VBNetBinding\</OutputPath>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\..\AddIns\AddIns\BackendBindings\VBNetBinding\</OutputPath>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration\AssemblyInfo.cs" />
<EmbeddedResource Include="Resources\AdvancedBuildOptionsDialog.xfrm" />
<EmbeddedResource Include="Resources\ApplicationSettings.xfrm" />
<EmbeddedResource Include="Resources\BuildEvents.xfrm" />
<EmbeddedResource Include="Resources\BuildOptions.xfrm" />
<EmbeddedResource Include="Resources\DebugOptions.xfrm" />
<EmbeddedResource Include="Resources\Publish.xfrm" />
<EmbeddedResource Include="Resources\ReferencePaths.xfrm" />
<EmbeddedResource Include="Resources\Signing.xfrm" />
<Compile Include="Src\VBNetAmbience.cs" />
<Compile Include="Src\VBNetBindingExecutionManager.cs" />
<Compile Include="Src\VBNetLanguageBinding.cs" />
<Compile Include="Src\FormattingStrategy\VBNetFormattingStrategy.cs" />
<Compile Include="Src\FormattingStrategy\DocumentAccessor.cs" />
<Compile Include="Src\FormattingStrategy\Indentation.cs" />
<Compile Include="Src\OptionPanels\ApplicationSettings.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\OptionPanels\BuildEvents.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\OptionPanels\BuildOptions.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\OptionPanels\DebugOptions.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\OptionPanels\Publish.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\OptionPanels\ReferencePaths.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\OptionPanels\Signing.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Parser\ExpressionFinder.cs" />
<Compile Include="Src\Parser\Parser.cs" />
<Compile Include="Src\Project\VBNetProject.cs" />
<None Include="VBNetBinding.addin">
<CopyToOutputDirectory>True</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
<Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
<Name>NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Src\PrettyPrinter\Gui\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

11
src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj.user

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<StartProgram>..\..\..\..\..\bin\SharpDevelop.exe</StartProgram>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<PropertyGroup>
<LastOpenVersion>8.0.41115</LastOpenVersion>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
</PropertyGroup>
</Project>

20
src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.sln

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VBNetBinding", "VBNetBinding.csproj", "{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.suo

Binary file not shown.
Loading…
Cancel
Save