Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@35 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
21 changed files with 0 additions and 3136 deletions
@ -1,84 +0,0 @@
@@ -1,84 +0,0 @@
|
||||
<AddIn name = "VB.NET Binding" |
||||
author = "Markus Palme" |
||||
copyright = "GPL" |
||||
url = "http://www.icsharpcode.net" |
||||
description = "#Develop language binding for VB.NET" |
||||
version = "1.0.0"> |
||||
|
||||
<Runtime> |
||||
<Import assembly = "VBNetBinding.dll"/> |
||||
</Runtime> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/Ambiences"> |
||||
<Class id = "VBNET" |
||||
class = "ICSharpCode.SharpDevelop.Services.VBAmbience"/> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/FileFilter"> |
||||
<FileFilter id = "VBNET" |
||||
insertafter="CSharp" |
||||
insertbefore="AllFiles" |
||||
name = "${res:SharpDevelop.FileFilter.VBNetFiles}" |
||||
extensions = "*.vb"/> |
||||
</Path> |
||||
|
||||
<Path name = "/Workspace/Parser"> |
||||
<Class id = "VBNetParser" |
||||
class = "VBBinding.Parser.TParser"/> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/MainMenu/Project"> |
||||
<Condition activeproject="VBNET"> |
||||
<MenuItem id = "VB.DOC" |
||||
label = "${res:XML.MainMenu.ProjectMenu.RunVBDOC}" |
||||
description = "${res:XML.MainMenu.ProjectMenu.RunVBDOC.Description}" |
||||
class = "VBBinding.VBDOCCommand"/> |
||||
</Condition> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties"> |
||||
<Condition activeproject="VBNET"> |
||||
<DialogPanel id = "VBCodeGenerationPanel" |
||||
label = "${res:Dialog.Options.PrjOptions.CodeGenerationPanel.PanelName}" |
||||
class = "VBBinding.CodeGenerationPanel"/> |
||||
<DialogPanel id = "VBOutputOptionsPanel" |
||||
label = "${res:Dialog.Options.PrjOptions.OutputOptionsPanel.PanelName}" |
||||
class = "VBBinding.OutputOptionsPanel"/> |
||||
<DialogPanel id = "VBRuntimeCompilerPanel" |
||||
label = "Compiler" |
||||
class = "VBBinding.VBCompilerPanel"/> |
||||
<DialogPanel id = "VBDOCConfigurationPanel" |
||||
label = "VB.DOC" |
||||
class = "VBBinding.VBDOCConfigurationPanel"/> |
||||
</Condition> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Dialogs/OptionsDialog/TextEditorOptions"> |
||||
<DialogPanel id = "VBSpecificOptions" |
||||
label = "${res:Dialog.Options.IDEOptions.TextEditor.VB.PanelName}" |
||||
insertafter = "Behavior" |
||||
class = "VBBinding.TextEditorOptionsPanel"/> |
||||
</Path> |
||||
|
||||
<Path name = "/AddIns/DefaultTextEditor/Formater"> |
||||
<Condition textcontent = "VBNET"> |
||||
<Class id ="VBNetFormatter" insertbefore="DefaultFormatter" class ="VBBinding.FormattingStrategy.VBFormattingStrategy"/> |
||||
</Condition> |
||||
</Path> |
||||
|
||||
<Path name = "/Workspace/Icons"> |
||||
<!-- VB.NET --> |
||||
<Icon id = "VBPrj" |
||||
language = "VBNET" |
||||
resource = "VB.ProjectIcon"/> |
||||
<Icon id = "VBFile" |
||||
extensions = ".vb" |
||||
resource = "VB.FileIcon"/> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/LanguageBindings"> |
||||
<LanguageBinding id = "VBNET" |
||||
supportedextensions = ".vb" |
||||
class = "VBBinding.VBLanguageBinding" /> |
||||
</Path> |
||||
</AddIn> |
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
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) 2004 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)] |
||||
[assembly: AssemblyKeyFile("")] |
@ -1,457 +0,0 @@
@@ -1,457 +0,0 @@
|
||||
// <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 VBBinding.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
|
||||
} |
||||
} |
@ -1,78 +0,0 @@
@@ -1,78 +0,0 @@
|
||||
// <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.IO; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Internal.ExternalTool; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
public class CodeGenerationPanel : AbstractOptionPanel |
||||
{ |
||||
VBCompilerParameters compilerParameters = null; |
||||
|
||||
|
||||
static |
||||
|
||||
public override bool ReceiveDialogMessage(DialogMessage message) |
||||
{ |
||||
if (message == DialogMessage.OK) { |
||||
if (compilerParameters == null) { |
||||
return true; |
||||
} |
||||
|
||||
|
||||
|
||||
compilerParameters.DefineSymbols = ControlDictionary["symbolsTextBox"].Text; |
||||
compilerParameters.MainClass = ControlDictionary["mainClassTextBox"].Text; |
||||
compilerParameters.Imports = ControlDictionary["importsTextBox"].Text; |
||||
compilerParameters.RootNamespace = ControlDictionary["RootNamespaceTextBox"].Text; |
||||
|
||||
compilerParameters.Debugmode = ((CheckBox)ControlDictionary["generateDebugInformationCheckBox"]).Checked; |
||||
compilerParameters.Optimize = ((CheckBox)ControlDictionary["enableOptimizationCheckBox"]).Checked; |
||||
compilerParameters.GenerateOverflowChecks = ((CheckBox)ControlDictionary["generateOverflowChecksCheckBox"]).Checked; |
||||
compilerParameters.TreatWarningsAsErrors = ((CheckBox)ControlDictionary["warningsAsErrorsCheckBox"]).Checked; |
||||
|
||||
compilerParameters.OptionExplicit = ((CheckBox)ControlDictionary["optionExplicitCheckBox"]).Checked ; |
||||
compilerParameters.OptionStrict = ((CheckBox)ControlDictionary["optionStrictCheckBox"]).Checked; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
void SetValues(object sender, EventArgs e) |
||||
{ |
||||
this.compilerParameters = (VBCompilerParameters)((Properties)CustomizationObject).Get("Config"); |
||||
|
||||
ControlDictionary["symbolsTextBox"].Text = compilerParameters.DefineSymbols; |
||||
ControlDictionary["mainClassTextBox"].Text = compilerParameters.MainClass; |
||||
ControlDictionary["importsTextBox"].Text = compilerParameters.Imports; |
||||
ControlDictionary["RootNamespaceTextBox"].Text = compilerParameters.RootNamespace; |
||||
|
||||
|
||||
((CheckBox)ControlDictionary["generateDebugInformationCheckBox"]).Checked = compilerParameters.Debugmode; |
||||
((CheckBox)ControlDictionary["enableOptimizationCheckBox"]).Checked = compilerParameters.Optimize; |
||||
((CheckBox)ControlDictionary["generateOverflowChecksCheckBox"]).Checked = compilerParameters.GenerateOverflowChecks; |
||||
((CheckBox)ControlDictionary["warningsAsErrorsCheckBox"]).Checked = compilerParameters.TreatWarningsAsErrors; |
||||
|
||||
((CheckBox)ControlDictionary["optionExplicitCheckBox"]).Checked = compilerParameters.OptionExplicit; |
||||
((CheckBox)ControlDictionary["optionStrictCheckBox"]).Checked = compilerParameters.OptionStrict; |
||||
} |
||||
|
||||
static |
||||
public CodeGenerationPanel() : base(PropertyService.DataDirectory + @"\resources\panels\ProjectOptions\VBNetCodeGenerationPanel.xfrm") |
||||
{ |
||||
CustomizationObjectChanged += new EventHandler(SetValues); |
||||
|
||||
} |
||||
} |
||||
} |
@ -1,66 +0,0 @@
@@ -1,66 +0,0 @@
|
||||
// <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.Windows.Forms; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
[Serializable()] |
||||
class GuiMessageRecipient : IMessageRecipient |
||||
{ |
||||
class StatusForm : Form |
||||
{ |
||||
Label statusLabel; |
||||
|
||||
public StatusForm() |
||||
{ |
||||
this.Text = "VB.DOC status"; |
||||
this.ControlBox = false; |
||||
this.StartPosition = FormStartPosition.CenterScreen; |
||||
this.ShowInTaskbar = false; |
||||
|
||||
this.Size = new System.Drawing.Size(400, 50); |
||||
|
||||
statusLabel = new Label(); |
||||
statusLabel.Dock = DockStyle.Fill; |
||||
statusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; |
||||
Controls.Add(statusLabel); |
||||
} |
||||
|
||||
public void Status(string statusMessage) |
||||
{ |
||||
statusLabel.Text = statusMessage; |
||||
Application.DoEvents(); |
||||
} |
||||
} |
||||
|
||||
StatusForm messageForm; |
||||
|
||||
public GuiMessageRecipient() |
||||
{ |
||||
messageForm = new StatusForm(); |
||||
messageForm.Show(); |
||||
} |
||||
|
||||
public void Finished() |
||||
{ |
||||
messageForm.Close(); |
||||
} |
||||
|
||||
public void DisplayStatusMessage(string message) |
||||
{ |
||||
messageForm.Status(message); |
||||
} |
||||
|
||||
public void DisplayErrorMessage(string message) |
||||
{ |
||||
// message doesn't work in this app domain
|
||||
System.Windows.Forms.MessageBox.Show(message); |
||||
} |
||||
} |
||||
} |
@ -1,161 +0,0 @@
@@ -1,161 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Mike Krger" email="mike@icsharpcode.net"/>
|
||||
// <version value="$version"/>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Internal.ExternalTool; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
public class OutputOptionsPanel : AbstractOptionPanel |
||||
{ |
||||
VBCompilerParameters compilerParameters; |
||||
static |
||||
|
||||
|
||||
public override bool ReceiveDialogMessage(DialogMessage message) |
||||
{ |
||||
if (message == DialogMessage.OK) { |
||||
if (compilerParameters == null) { |
||||
return true; |
||||
} |
||||
|
||||
|
||||
if (!FileUtility.IsValidFileName(ControlDictionary["assemblyNameTextBox"].Text)) { |
||||
MessageBox.Show("Invalid assembly name specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); |
||||
return false; |
||||
} |
||||
if (!FileUtility.IsValidFileName(ControlDictionary["outputDirectoryTextBox"].Text)) { |
||||
MessageBox.Show("Invalid output directory specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); |
||||
return false; |
||||
} |
||||
|
||||
if (ControlDictionary["win32IconTextBox"].Text.Length > 0) { |
||||
if (!FileUtility.IsValidFileName(ControlDictionary["win32IconTextBox"].Text)) { |
||||
MessageBox.Show("Invalid Win32Icon specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); |
||||
return false; |
||||
} |
||||
if (!File.Exists(ControlDictionary["win32IconTextBox"].Text)) { |
||||
MessageBox.Show("Win32Icon doesn't exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
compilerParameters.CompileTarget = (CompileTarget)((ComboBox)ControlDictionary["compileTargetComboBox"]).SelectedIndex; |
||||
compilerParameters.OutputAssembly = ControlDictionary["assemblyNameTextBox"].Text; |
||||
compilerParameters.OutputDirectory = ControlDictionary["outputDirectoryTextBox"].Text; |
||||
compilerParameters.CommandLineParameters = ControlDictionary["parametersTextBox"].Text; |
||||
compilerParameters.ExecuteBeforeBuild = ControlDictionary["executeBeforeTextBox"].Text; |
||||
compilerParameters.ExecuteAfterBuild = ControlDictionary["executeAfterTextBox"].Text; |
||||
compilerParameters.ExecuteScript = ControlDictionary["executeScriptTextBox"].Text; |
||||
compilerParameters.Win32Icon = ControlDictionary["win32IconTextBox"].Text; |
||||
compilerParameters.ExecuteBeforeBuildArguments = ControlDictionary["executeBeforeArgumentsTextBox"].Text; |
||||
compilerParameters.ExecuteAfterBuildArguments = ControlDictionary["executeAfterArgumentsTextBox"].Text; |
||||
|
||||
compilerParameters.PauseConsoleOutput = ((CheckBox)ControlDictionary["pauseConsoleOutputCheckBox"]).Checked; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
void SetValues(object sender, EventArgs e) |
||||
{ |
||||
this.compilerParameters = (VBCompilerParameters)((Properties)CustomizationObject).Get("Config"); |
||||
|
||||
((ComboBox)ControlDictionary["compileTargetComboBox"]).SelectedIndex = (int)compilerParameters.CompileTarget; |
||||
ControlDictionary["win32IconTextBox"].Text = compilerParameters.Win32Icon; |
||||
ControlDictionary["assemblyNameTextBox"].Text = compilerParameters.OutputAssembly; |
||||
ControlDictionary["outputDirectoryTextBox"].Text = compilerParameters.OutputDirectory; |
||||
ControlDictionary["parametersTextBox"].Text = compilerParameters.CommandLineParameters; |
||||
ControlDictionary["executeScriptTextBox"].Text = compilerParameters.ExecuteScript; |
||||
ControlDictionary["executeBeforeTextBox"].Text = compilerParameters.ExecuteBeforeBuild; |
||||
ControlDictionary["executeAfterTextBox"].Text = compilerParameters.ExecuteAfterBuild; |
||||
ControlDictionary["executeBeforeArgumentsTextBox"].Text = compilerParameters.ExecuteBeforeBuildArguments; |
||||
ControlDictionary["executeAfterArgumentsTextBox"].Text = compilerParameters.ExecuteAfterBuildArguments; |
||||
|
||||
((CheckBox)ControlDictionary["pauseConsoleOutputCheckBox"]).Checked = compilerParameters.PauseConsoleOutput; |
||||
} |
||||
|
||||
void SelectFolder(object sender, EventArgs e) |
||||
{ |
||||
FolderDialog fdiag = new FolderDialog(); |
||||
|
||||
if (fdiag.DisplayDialog("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}") == DialogResult.OK) { |
||||
ControlDictionary["outputDirectoryTextBox"].Text = fdiag.Path; |
||||
} |
||||
} |
||||
|
||||
void SelectFile2(object sender, EventArgs e) |
||||
{ |
||||
OpenFileDialog fdiag = new OpenFileDialog(); |
||||
fdiag.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
||||
fdiag.Multiselect = false; |
||||
|
||||
if(fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { |
||||
ControlDictionary["executeBeforeTextBox"].Text = fdiag.FileName; |
||||
} |
||||
} |
||||
|
||||
void SelectFile3(object sender, EventArgs e) |
||||
{ |
||||
OpenFileDialog fdiag = new OpenFileDialog(); |
||||
fdiag.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
||||
fdiag.Multiselect = false; |
||||
|
||||
if(fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { |
||||
ControlDictionary["executeAfterTextBox"].Text = fdiag.FileName; |
||||
} |
||||
} |
||||
void SelectFile4(object sender, EventArgs e) |
||||
{ |
||||
OpenFileDialog fdiag = new OpenFileDialog(); |
||||
fdiag.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
||||
fdiag.Multiselect = false; |
||||
|
||||
if(fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { |
||||
ControlDictionary["executeScriptTextBox"].Text = fdiag.FileName; |
||||
} |
||||
} |
||||
void SelectWin32Icon(object sender, EventArgs e) |
||||
{ |
||||
using (OpenFileDialog fdiag = new OpenFileDialog()) { |
||||
fdiag.AddExtension = true; |
||||
fdiag.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.Icons}|*.ico|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
||||
fdiag.Multiselect = false; |
||||
fdiag.CheckFileExists = true; |
||||
|
||||
if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { |
||||
ControlDictionary["win32IconTextBox"].Text = fdiag.FileName; |
||||
} |
||||
} |
||||
} |
||||
|
||||
static |
||||
public OutputOptionsPanel() : base(PropertyService.DataDirectory + @"\resources\panels\ProjectOptions\OutputPanel.xfrm") |
||||
{ |
||||
CustomizationObjectChanged += new EventHandler(SetValues); |
||||
ControlDictionary["browseButton"].Click += new EventHandler(SelectFolder); |
||||
ControlDictionary["browseButton2"].Click += new EventHandler(SelectFile2); |
||||
ControlDictionary["browseButton3"].Click += new EventHandler(SelectFile3); |
||||
ControlDictionary["browseButton4"].Click += new EventHandler(SelectFile4); |
||||
ControlDictionary["browseWin32IconButton"].Click += new EventHandler(SelectWin32Icon); |
||||
|
||||
|
||||
((ComboBox)ControlDictionary["compileTargetComboBox"]).Items.Add(ResourceService.GetString("Dialog.Options.PrjOptions.Configuration.CompileTarget.Exe")); |
||||
((ComboBox)ControlDictionary["compileTargetComboBox"]).Items.Add(ResourceService.GetString("Dialog.Options.PrjOptions.Configuration.CompileTarget.WinExe")); |
||||
((ComboBox)ControlDictionary["compileTargetComboBox"]).Items.Add(ResourceService.GetString("Dialog.Options.PrjOptions.Configuration.CompileTarget.Library")); |
||||
((ComboBox)ControlDictionary["compileTargetComboBox"]).Items.Add(ResourceService.GetString("Dialog.Options.PrjOptions.Configuration.CompileTarget.Module")); |
||||
|
||||
} |
||||
} |
||||
|
||||
} |
@ -1,38 +0,0 @@
@@ -1,38 +0,0 @@
|
||||
// <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.IO; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Internal.ExternalTool; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
public class TextEditorOptionsPanel : AbstractOptionPanel |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXml(Path.Combine(PropertyService.DataDirectory, |
||||
@"resources\panels\VBSpecificTextEditorOptions.xfrm")); |
||||
((CheckBox)ControlDictionary["enableEndConstructsCheckBox"]).Checked = PropertyService.Get("VBBinding.TextEditor.EnableEndConstructs", true); |
||||
((CheckBox)ControlDictionary["enableCasingCheckBox"]).Checked = PropertyService.Get("VBBinding.TextEditor.EnableCasing", true); |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
PropertyService.Set("VBBinding.TextEditor.EnableEndConstructs", ((CheckBox)ControlDictionary["enableEndConstructsCheckBox"]).Checked); |
||||
PropertyService.Set("VBBinding.TextEditor.EnableCasing", ((CheckBox)ControlDictionary["enableCasingCheckBox"]).Checked); |
||||
|
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -1,47 +0,0 @@
@@ -1,47 +0,0 @@
|
||||
// <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.IO; |
||||
using System.Drawing; |
||||
using System.Collections; |
||||
using System.ComponentModel; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
public class VBCompilerPanel : AbstractOptionPanel |
||||
{ |
||||
VBCompilerParameters config = null; |
||||
|
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXml(Path.Combine(PropertyService.DataDirectory, |
||||
@"resources\panels\VBCompilerPanel.xfrm")); |
||||
|
||||
this.config = (VBCompilerParameters)((Properties)CustomizationObject).Get("Config"); |
||||
|
||||
|
||||
((ComboBox)ControlDictionary["compilerVersionComboBox"]).Items.Add("Standard"); |
||||
foreach (string runtime in FileUtility.GetAvaiableRuntimeVersions()) { |
||||
((ComboBox)ControlDictionary["compilerVersionComboBox"]).Items.Add(runtime); |
||||
} |
||||
|
||||
((ComboBox)ControlDictionary["compilerVersionComboBox"]).Text = config.VBCompilerVersion.Length == 0 ? "Standard" : config.VBCompilerVersion; |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
config.VBCompilerVersion = ControlDictionary["compilerVersionComboBox"].Text; |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -1,88 +0,0 @@
@@ -1,88 +0,0 @@
|
||||
// <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.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Internal.ExternalTool; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
public class VBDOCConfigurationPanel : AbstractOptionPanel |
||||
{ |
||||
VBCompilerParameters compilerParameters = null; |
||||
VBProject project = null; |
||||
|
||||
static |
||||
static |
||||
|
||||
///<summary>
|
||||
/// Returns if the filename will be parsed when running VB.DOC.
|
||||
/// </summary>
|
||||
public static bool IsFileIncluded(string filename, VBProject project) |
||||
{ |
||||
VBCompilerParameters compilerparameters = (VBCompilerParameters)project.ActiveConfiguration; |
||||
return Array.IndexOf(compilerparameters.VBDOCFiles, filename) == -1; |
||||
} |
||||
|
||||
|
||||
public VBDOCConfigurationPanel() : base(PropertyService.DataDirectory + @"\resources\panels\ProjectOptions\VBDOCConfigurationPanel.xfrm") |
||||
{ |
||||
CustomizationObjectChanged += new EventHandler(SetValues); |
||||
ControlDictionary["BrowseOutputFileButton"].Click += new EventHandler(BrowseOutputFileButton_Click); |
||||
} |
||||
|
||||
private void BrowseOutputFileButton_Click(object sender, EventArgs e) { |
||||
SaveFileDialog dialog = new SaveFileDialog(); |
||||
dialog.Filter = "XML files (*.xml)|*.xml"; |
||||
if(dialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { |
||||
((TextBox)ControlDictionary["OutputFileTextBox"]).Text = dialog.FileName; |
||||
} |
||||
} |
||||
|
||||
public override bool ReceiveDialogMessage(DialogMessage message) |
||||
{ |
||||
if (message == DialogMessage.OK) { |
||||
if (compilerParameters == null) { |
||||
return true; |
||||
} |
||||
|
||||
compilerParameters.VBDOCOutputFile = ((TextBox)ControlDictionary["OutputFileTextBox"]).Text; |
||||
compilerParameters.VBDOCCommentPrefix = ((TextBox)ControlDictionary["CommentPrefixTextBox"]).Text; |
||||
|
||||
string[] files = new string[((CheckedListBox)ControlDictionary["FileListBox"]).Items.Count - ((CheckedListBox)ControlDictionary["FileListBox"]).CheckedIndices.Count]; |
||||
int count = 0; |
||||
for(int index = 0; index < ((CheckedListBox)ControlDictionary["FileListBox"]).Items.Count; index++) { |
||||
if(((CheckedListBox)ControlDictionary["FileListBox"]).GetItemChecked(index) == false) { |
||||
files[count] = (string)((CheckedListBox)ControlDictionary["FileListBox"]).Items[index]; |
||||
count++; |
||||
} |
||||
} |
||||
compilerParameters.VBDOCFiles = files; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
void SetValues(object sender, EventArgs e) |
||||
{ |
||||
this.compilerParameters = (VBCompilerParameters)((Properties)CustomizationObject).Get("Config"); |
||||
project = (VBProject)((Properties)CustomizationObject).Get("Project"); |
||||
|
||||
((TextBox)ControlDictionary["OutputFileTextBox"]).Text = compilerParameters.VBDOCOutputFile; |
||||
((TextBox)ControlDictionary["CommentPrefixTextBox"]). Text = compilerParameters.VBDOCCommentPrefix; |
||||
|
||||
foreach(ProjectFile pfile in project.ProjectFiles) { |
||||
bool included = IsFileIncluded(pfile.Name, project); |
||||
((CheckedListBox)ControlDictionary["FileListBox"]).Items.Add(pfile.Name, included); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,371 +0,0 @@
@@ -1,371 +0,0 @@
|
||||
using System; |
||||
using System.Text; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace VBBinding.Parser |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExpressionFinder.
|
||||
/// </summary>
|
||||
public class ExpressionFinder : IExpressionFinder |
||||
{ |
||||
public string FindExpression(string inText, int offset) |
||||
{ |
||||
this.text = FilterComments(inText, ref offset); |
||||
this.text = text; |
||||
this.offset = this.lastAccept = offset; |
||||
this.state = START; |
||||
if (this.text == null) { |
||||
return null; |
||||
} |
||||
while (state != ERROR) { |
||||
ReadNextToken(); |
||||
//Console.WriteLine("cur state {0} got token {1}/{3} going to {2}", GetStateName(state), GetTokenName(curTokenType), GetStateName(stateTable[state, curTokenType]), curTokenType);
|
||||
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 (!ReadString(outText, text, ref curOffset)) { |
||||
return null; |
||||
} |
||||
break; |
||||
case '\'': |
||||
offset -= 1; |
||||
curOffset += 1; |
||||
if (!ReadToEOL(text, ref curOffset, ref offset)) { |
||||
return null; |
||||
} |
||||
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 ReadString(StringBuilder outText, string text, ref int curOffset) |
||||
{ |
||||
while (curOffset <= initialOffset) { |
||||
char ch = text[curOffset++]; |
||||
outText.Append(ch); |
||||
if (ch == '"') { |
||||
return true; |
||||
} |
||||
} |
||||
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() |
||||
{ |
||||
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; |
||||
int curTokenType; |
||||
|
||||
readonly static string[] tokenStateName = new string[] { |
||||
"Err", "Dot", "StrLit", "Ident", "New", "Bracket", "Paren", "Curly", "Using" |
||||
}; |
||||
string GetTokenName(int state) |
||||
{ |
||||
return tokenStateName[state]; |
||||
} |
||||
|
||||
void ReadNextToken() |
||||
{ |
||||
char ch = GetNext(); |
||||
|
||||
curTokenType = Err; |
||||
if (ch == '\0' || ch == '\n' || ch == '\r') { |
||||
return; |
||||
} |
||||
while (Char.IsWhiteSpace(ch)) { |
||||
ch = GetNext(); |
||||
if (ch == '\n' || ch == '\r') { |
||||
return; |
||||
} |
||||
} |
||||
|
||||
switch (ch) { |
||||
case '}': |
||||
if (ReadBracket('{', '}')) { |
||||
curTokenType = Curly; |
||||
} |
||||
break; |
||||
case ')': |
||||
if (ReadBracket('(', ')')) { |
||||
curTokenType = Parent; |
||||
} |
||||
break; |
||||
case ']': |
||||
if (ReadBracket('[', ']')) { |
||||
curTokenType = Ident; |
||||
} |
||||
break; |
||||
case '.': |
||||
curTokenType = Dot; |
||||
break; |
||||
case '\'': |
||||
case '"': |
||||
if (ReadStringLiteral(ch)) { |
||||
curTokenType = StrLit; |
||||
} |
||||
break; |
||||
default: |
||||
if (IsIdentifierPart(ch)) { |
||||
string ident = ReadIdentifier(ch); |
||||
if (ident != null) { |
||||
switch (ident.ToLower()) { |
||||
case "new": |
||||
curTokenType = New; |
||||
break; |
||||
case "imports": |
||||
curTokenType = Using; |
||||
break; |
||||
default: |
||||
curTokenType = Ident; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
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
|
||||
/*ERROR*/ { ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR}, |
||||
/*START*/ { ERROR, DOT, ACCEPT, ACCEPT, ERROR, MORE, ACCEPT2, CURLY, ACCEPTNOMORE}, |
||||
/*DOT*/ { ERROR, ERROR, ACCEPT, ACCEPT, ERROR, MORE, ACCEPT, CURLY, ERROR}, |
||||
/*MORE*/ { ERROR, ERROR, ACCEPT, ACCEPT, ERROR, MORE, ACCEPT2, CURLY, ERROR}, |
||||
/*CURLY*/ { ERROR, ERROR, ERROR, ERROR, ERROR, CURLY2, ERROR, ERROR, ERROR}, |
||||
/*CURLY2*/ { ERROR, ERROR, ERROR, CURLY3, ERROR, ERROR, ERROR, ERROR, ERROR}, |
||||
/*CURLY3*/ { ERROR, ERROR, ERROR, ERROR, ACCEPTNOMORE, ERROR, ERROR, ERROR, ERROR}, |
||||
/*ACCEPT*/ { ERROR, MORE, ERROR, ERROR, ACCEPT, ERROR, ERROR, ERROR, ACCEPTNOMORE}, |
||||
/*ACCEPTNOMORE*/ { ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR}, |
||||
/*ACCEPT2*/ { ERROR, MORE, ERROR, ACCEPT, ACCEPT, ERROR, ERROR, ERROR, ERROR}, |
||||
}; |
||||
#endregion
|
||||
} |
||||
} |
@ -1,127 +0,0 @@
@@ -1,127 +0,0 @@
|
||||
// <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.IO; |
||||
using System.Collections; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.NRefactory.Parser; |
||||
using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver; |
||||
|
||||
namespace VBBinding.Parser |
||||
{ |
||||
public class TParser : ICSharpCode.SharpDevelop.Dom.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() == ".VB"; |
||||
} |
||||
public bool CanParse(IProject project) |
||||
{ |
||||
return project.ProjectType == "VBNET"; |
||||
} |
||||
|
||||
void RetrieveRegions(ICompilationUnit cu, SpecialTracker tracker) |
||||
{ |
||||
for (int i = 0; i < tracker.CurrentSpecials.Count; ++i) { |
||||
PreProcessingDirective directive = tracker.CurrentSpecials[i] as PreProcessingDirective; |
||||
if (directive != null) { |
||||
if (directive.Cmd.ToLower() == "#region") { |
||||
int deep = 1; |
||||
for (int j = i + 1; j < tracker.CurrentSpecials.Count; ++j) { |
||||
PreProcessingDirective nextDirective = tracker.CurrentSpecials[j] as PreProcessingDirective; |
||||
if(nextDirective != null) { |
||||
switch (nextDirective.Cmd.ToLower()) { |
||||
case "#region": |
||||
++deep; |
||||
break; |
||||
case "#end": |
||||
if (nextDirective.Arg.ToLower() == "region") { |
||||
--deep; |
||||
if (deep == 0) { |
||||
cu.FoldingRegions.Add(new FoldingRegion(directive.Arg.Trim('"'), new DefaultRegion(directive.Start, nextDirective.End))); |
||||
goto end; |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
end: ; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
public ICompilationUnitBase Parse(string fileName) |
||||
{ |
||||
ICSharpCode.NRefactory.Parser.IParser p = ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser(fileName); |
||||
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.IParser p = ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser(ICSharpCode.NRefactory.Parser.SupportedLanguages.VBNet, 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.VBNet); |
||||
} |
||||
|
||||
///////// IParser Interface END
|
||||
} |
||||
} |
@ -1,279 +0,0 @@
@@ -1,279 +0,0 @@
|
||||
// <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.Xml; |
||||
using System.Diagnostics; |
||||
using System.ComponentModel; |
||||
|
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
|
||||
namespace VBBinding { |
||||
|
||||
public enum CompileTarget |
||||
{ |
||||
Exe, |
||||
WinExe, |
||||
Library, |
||||
Module |
||||
}; |
||||
|
||||
/// <summary>
|
||||
/// This class handles project specific compiler parameters
|
||||
/// </summary>
|
||||
public class VBCompilerParameters : AbstractProjectConfiguration |
||||
{ |
||||
[XmlNodeName("CodeGeneration")] |
||||
class CodeGeneration |
||||
{ |
||||
[XmlAttribute("compilerversion")] |
||||
public string vbCompilerVersion = String.Empty; |
||||
|
||||
[XmlAttribute("includedebuginformation")] |
||||
public bool debugmode = true; |
||||
|
||||
[XmlAttribute("optimize")] |
||||
public bool optimize = true; |
||||
|
||||
[XmlAttribute("generateoverflowchecks")] |
||||
public bool generateOverflowChecks = true; |
||||
|
||||
[XmlAttribute("rootnamespace")] |
||||
public string rootnamespace = String.Empty; |
||||
|
||||
[XmlAttribute("mainclass")] |
||||
public string mainclass = null; |
||||
|
||||
[XmlAttribute("target")] |
||||
public CompileTarget compiletarget = CompileTarget.Exe; |
||||
|
||||
[XmlAttribute("definesymbols")] |
||||
public string definesymbols = String.Empty; |
||||
|
||||
[XmlAttribute("optionexplicit")] |
||||
public bool optionExplicit = true; |
||||
|
||||
[XmlAttribute("optionstrict")] |
||||
public bool optionStrict = false; |
||||
|
||||
[ConvertToRelativePathAttribute()] |
||||
[XmlAttribute("win32Icon")] |
||||
public string win32Icon = String.Empty; |
||||
|
||||
[XmlAttribute("imports")] |
||||
public string imports = String.Empty; |
||||
} |
||||
|
||||
[XmlNodeName("Execution")] |
||||
class Execution |
||||
{ |
||||
[XmlAttribute("consolepause")] |
||||
public bool pauseconsoleoutput = true; |
||||
|
||||
[XmlAttribute("commandlineparameters")] |
||||
public string commandLineParameters = String.Empty; |
||||
|
||||
} |
||||
|
||||
[XmlNodeName("VBDOC")] |
||||
class VBDOC |
||||
{ |
||||
[XmlAttribute("outputfile")] |
||||
[ConvertToRelativePathAttribute()] |
||||
public string outputfile = String.Empty; |
||||
|
||||
[XmlAttribute("filestoparse")] |
||||
public string filestoparse = String.Empty; |
||||
|
||||
[XmlAttribute("commentprefix")] |
||||
public string commentprefix = "'"; |
||||
} |
||||
|
||||
CodeGeneration codeGeneration = new CodeGeneration(); |
||||
VBDOC vbdoc = new VBDOC(); |
||||
Execution execution = new Execution(); |
||||
|
||||
[Browsable(false)] |
||||
public string VBCompilerVersion |
||||
{ |
||||
get { |
||||
return codeGeneration.vbCompilerVersion; |
||||
} |
||||
set { |
||||
codeGeneration.vbCompilerVersion = value; |
||||
} |
||||
} |
||||
|
||||
public string CommandLineParameters |
||||
{ |
||||
get { |
||||
return execution.commandLineParameters; |
||||
} |
||||
set { |
||||
execution.commandLineParameters = value; |
||||
} |
||||
} |
||||
public bool GenerateOverflowChecks |
||||
{ |
||||
get { |
||||
return codeGeneration.generateOverflowChecks; |
||||
} |
||||
set { |
||||
codeGeneration.generateOverflowChecks = value; |
||||
} |
||||
} |
||||
|
||||
public string Imports |
||||
{ |
||||
get { |
||||
return codeGeneration.imports; |
||||
} |
||||
set { |
||||
codeGeneration.imports = value; |
||||
} |
||||
} |
||||
|
||||
public string Win32Icon |
||||
{ |
||||
get { |
||||
return codeGeneration.win32Icon; |
||||
} |
||||
set { |
||||
codeGeneration.win32Icon = value; |
||||
} |
||||
} |
||||
|
||||
public string RootNamespace |
||||
{ |
||||
get { |
||||
return codeGeneration.rootnamespace; |
||||
} |
||||
set { |
||||
codeGeneration.rootnamespace = value; |
||||
} |
||||
} |
||||
|
||||
public string DefineSymbols |
||||
{ |
||||
get { |
||||
return codeGeneration.definesymbols; |
||||
} |
||||
set { |
||||
codeGeneration.definesymbols = value; |
||||
} |
||||
} |
||||
|
||||
public bool PauseConsoleOutput |
||||
{ |
||||
get { |
||||
return execution.pauseconsoleoutput; |
||||
} |
||||
set { |
||||
execution.pauseconsoleoutput = value; |
||||
} |
||||
} |
||||
|
||||
public bool Debugmode |
||||
{ |
||||
get { |
||||
return codeGeneration.debugmode; |
||||
} |
||||
set { |
||||
codeGeneration.debugmode = value; |
||||
} |
||||
} |
||||
|
||||
public bool Optimize |
||||
{ |
||||
get { |
||||
return codeGeneration.optimize; |
||||
} |
||||
set { |
||||
codeGeneration.optimize = value; |
||||
} |
||||
} |
||||
|
||||
public string MainClass |
||||
{ |
||||
get { |
||||
return codeGeneration.mainclass; |
||||
} |
||||
set { |
||||
codeGeneration.mainclass = value; |
||||
} |
||||
} |
||||
|
||||
public CompileTarget CompileTarget |
||||
{ |
||||
get { |
||||
return codeGeneration.compiletarget; |
||||
} |
||||
set { |
||||
codeGeneration.compiletarget = value; |
||||
} |
||||
} |
||||
|
||||
public bool OptionExplicit |
||||
{ |
||||
get { |
||||
return codeGeneration.optionExplicit; |
||||
} |
||||
set { |
||||
codeGeneration.optionExplicit = value; |
||||
} |
||||
} |
||||
|
||||
public bool OptionStrict |
||||
{ |
||||
get { |
||||
return codeGeneration.optionStrict; |
||||
} |
||||
set { |
||||
codeGeneration.optionStrict = value; |
||||
} |
||||
} |
||||
|
||||
public string VBDOCOutputFile |
||||
{ |
||||
get { |
||||
return vbdoc.outputfile; |
||||
} |
||||
set { |
||||
vbdoc.outputfile = value; |
||||
} |
||||
} |
||||
|
||||
public string[] VBDOCFiles |
||||
{ |
||||
get { |
||||
return vbdoc.filestoparse.Split(';'); |
||||
} |
||||
set { |
||||
vbdoc.filestoparse = System.String.Join(";", value); |
||||
} |
||||
} |
||||
|
||||
public string VBDOCCommentPrefix |
||||
{ |
||||
get { |
||||
return vbdoc.commentprefix; |
||||
} |
||||
set { |
||||
vbdoc.commentprefix = value; |
||||
} |
||||
} |
||||
|
||||
public VBCompilerParameters() |
||||
{ |
||||
} |
||||
|
||||
public VBCompilerParameters(string name) |
||||
{ |
||||
this.name = name; |
||||
} |
||||
} |
||||
} |
@ -1,74 +0,0 @@
@@ -1,74 +0,0 @@
|
||||
// <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.IO; |
||||
using System.Collections; |
||||
using System.Diagnostics; |
||||
using System.ComponentModel; |
||||
using System.Xml; |
||||
|
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
/// <summary>
|
||||
/// This class describes a VB.NET project and it compilation options.
|
||||
/// </summary>
|
||||
public class VBProject : AbstractProject |
||||
{ |
||||
public override string ProjectType { |
||||
get { |
||||
return VBLanguageBinding.LanguageName; |
||||
} |
||||
} |
||||
|
||||
public override IConfiguration CreateConfiguration() |
||||
{ |
||||
return new VBCompilerParameters(); |
||||
} |
||||
|
||||
public VBProject() |
||||
{ |
||||
} |
||||
|
||||
public VBProject(ProjectCreateInformation info, XmlElement projectOptions) |
||||
{ |
||||
if (info != null) { |
||||
Name = info.ProjectName; |
||||
|
||||
VBCompilerParameters debug = (VBCompilerParameters)CreateConfiguration("Debug"); |
||||
debug.Optimize = false; |
||||
Configurations.Add(debug); |
||||
|
||||
VBCompilerParameters release = (VBCompilerParameters)CreateConfiguration("Release"); |
||||
debug.Optimize = true; |
||||
release.Debugmode = false; |
||||
release.GenerateOverflowChecks = false; |
||||
release.TreatWarningsAsErrors = false; |
||||
Configurations.Add(release); |
||||
|
||||
XmlElement el = projectOptions; |
||||
|
||||
foreach (VBCompilerParameters parameter in Configurations) { |
||||
parameter.OutputDirectory = info.BinPath + Path.DirectorySeparatorChar + parameter.Name; |
||||
parameter.OutputAssembly = Name; |
||||
|
||||
if (el != null) { |
||||
if (el.Attributes["Target"] != null) { |
||||
parameter.CompileTarget = (CompileTarget)Enum.Parse(typeof(CompileTarget), el.Attributes["Target"].InnerText); |
||||
} |
||||
if (el.Attributes["PauseConsoleOutput"] != null) { |
||||
parameter.PauseConsoleOutput = Boolean.Parse(el.Attributes["PauseConsoleOutput"].InnerText); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,570 +0,0 @@
@@ -1,570 +0,0 @@
|
||||
// <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 ICSharpCode.Core |
||||
{ |
||||
public class VBAmbience : 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 VBAmbience() |
||||
{ |
||||
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(" "); |
||||
|
||||
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(" "); |
||||
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(" "); |
||||
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(" "); |
||||
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; |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,308 +0,0 @@
@@ -1,308 +0,0 @@
|
||||
// <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.Text; |
||||
using System.Collections; |
||||
using System.IO; |
||||
using System.Diagnostics; |
||||
using System.CodeDom.Compiler; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace VBBinding { |
||||
|
||||
/// <summary>
|
||||
/// This class controls the compilation of VB.net files and VB.net projects
|
||||
/// </summary>
|
||||
public class VBBindingCompilerServices |
||||
{ |
||||
|
||||
PropertyService PropertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); |
||||
|
||||
public string GetCompiledOutputName(string fileName) |
||||
{ |
||||
return Path.ChangeExtension(fileName, ".exe"); |
||||
} |
||||
|
||||
public string GetCompiledOutputName(IProject project) |
||||
{ |
||||
VBProject p = (VBProject)project; |
||||
VBCompilerParameters compilerparameters = (VBCompilerParameters)p.ActiveConfiguration; |
||||
return FileUtility.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + (compilerparameters.CompileTarget == CompileTarget.Library ? ".dll" : ".exe"); |
||||
} |
||||
|
||||
public bool CanCompile(string fileName) |
||||
{ |
||||
return Path.GetExtension(fileName) == ".vb"; |
||||
} |
||||
|
||||
string GetCompilerName(string compilerVersion) |
||||
{ |
||||
string runtimeDirectory = Path.Combine(FileUtility.NETFrameworkInstallRoot, compilerVersion); |
||||
if (compilerVersion.Length == 0 || compilerVersion == "Standard" || !Directory.Exists(runtimeDirectory)) { |
||||
runtimeDirectory = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(); |
||||
} |
||||
return '"' + Path.Combine(runtimeDirectory, "vbc.exe") + '"'; |
||||
} |
||||
|
||||
string GenerateOptions(VBCompilerParameters compilerparameters, string outputFileName) |
||||
{ |
||||
StringBuilder sb = new StringBuilder(); |
||||
|
||||
sb.Append("\"/out:");sb.Append(outputFileName);sb.Append('"');sb.Append(Environment.NewLine); |
||||
|
||||
sb.Append("/nologo");sb.Append(Environment.NewLine); |
||||
sb.Append("/utf8output");sb.Append(Environment.NewLine); |
||||
|
||||
if (compilerparameters.Debugmode) { |
||||
sb.Append("/debug+");sb.Append(Environment.NewLine); |
||||
sb.Append("/debug:full");sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
if (compilerparameters.Optimize) { |
||||
sb.Append("/optimize");sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
if (compilerparameters.OptionStrict) { |
||||
sb.Append("/optionstrict+");sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
if (compilerparameters.OptionExplicit) { |
||||
sb.Append("/optionexplicit+");sb.Append(Environment.NewLine); |
||||
} else { |
||||
sb.Append("/optionexplicit-");sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
if (compilerparameters.Win32Icon != null && compilerparameters.Win32Icon.Length > 0 && File.Exists(compilerparameters.Win32Icon)) { |
||||
sb.Append("/win32icon:");sb.Append('"');sb.Append(compilerparameters.Win32Icon);sb.Append('"');sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
if (compilerparameters.RootNamespace!= null && compilerparameters.RootNamespace.Length > 0) { |
||||
sb.Append("/rootnamespace:");sb.Append('"');sb.Append(compilerparameters.RootNamespace);sb.Append('"');sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
if (compilerparameters.DefineSymbols.Length > 0) { |
||||
sb.Append("/define:");sb.Append('"');sb.Append(compilerparameters.DefineSymbols);sb.Append('"');sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
if (compilerparameters.MainClass != null && compilerparameters.MainClass.Length > 0) { |
||||
sb.Append("/main:");sb.Append(compilerparameters.MainClass);sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
if(compilerparameters.Imports.Length > 0) { |
||||
sb.Append("/imports:");sb.Append(compilerparameters.Imports);sb.Append(Environment.NewLine); |
||||
} |
||||
|
||||
switch (compilerparameters.CompileTarget) { |
||||
case CompileTarget.Exe: |
||||
sb.Append("/target:exe"); |
||||
break; |
||||
case CompileTarget.WinExe: |
||||
sb.Append("/target:winexe"); |
||||
break; |
||||
case CompileTarget.Library: |
||||
sb.Append("/target:library"); |
||||
break; |
||||
case CompileTarget.Module: |
||||
sb.Append("/target:module"); |
||||
break; |
||||
default: |
||||
throw new NotSupportedException("unknwon compile target:" + compilerparameters.CompileTarget); |
||||
} |
||||
sb.Append(Environment.NewLine); |
||||
return sb.ToString(); |
||||
} |
||||
|
||||
public ICompilerResult CompileFile(string filename) |
||||
{ |
||||
string output = ""; |
||||
string error = ""; |
||||
string exe = Path.ChangeExtension(filename, ".exe"); |
||||
VBCompilerParameters compilerparameters = new VBCompilerParameters(); |
||||
string stdResponseFileName = PropertyService.DataDirectory + Path.DirectorySeparatorChar + "vb.rsp"; |
||||
|
||||
string responseFileName = Path.GetTempFileName(); |
||||
|
||||
StreamWriter writer = new StreamWriter(responseFileName); |
||||
writer.WriteLine(GenerateOptions(compilerparameters, exe)); |
||||
writer.WriteLine('"' + filename + '"'); |
||||
writer.Close(); |
||||
|
||||
string compilerName = GetCompilerName(compilerparameters.VBCompilerVersion); |
||||
string outstr = compilerName + " \"@" + responseFileName + "\" \"@" + stdResponseFileName + "\""; |
||||
|
||||
TempFileCollection tf = new TempFileCollection (); |
||||
Executor.ExecWaitWithCapture(outstr, tf, ref output, ref error); |
||||
|
||||
ICompilerResult result = ParseOutput(tf, output); |
||||
|
||||
File.Delete(responseFileName); |
||||
File.Delete(output); |
||||
File.Delete(error); |
||||
WriteManifestFile(exe); |
||||
return result; |
||||
} |
||||
|
||||
public ICompilerResult CompileProject(IProject project) |
||||
{ |
||||
VBProject p = (VBProject)project; |
||||
VBCompilerParameters compilerparameters = (VBCompilerParameters)p.ActiveConfiguration; |
||||
string exe = FileUtility.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + (compilerparameters.CompileTarget == CompileTarget.Library ? ".dll" : ".exe"); |
||||
string responseFileName = Path.GetTempFileName(); |
||||
string stdResponseFileName = PropertyService.DataDirectory + Path.DirectorySeparatorChar + "vb.rsp"; |
||||
|
||||
foreach (ProjectFile finfo in project.ProjectFiles) { |
||||
if (Path.GetFileName(finfo.Name).ToLower() == "app.config") { |
||||
try { |
||||
File.Copy(finfo.Name, exe + ".config", true); |
||||
} catch (Exception ex) { |
||||
|
||||
MessageService.ShowError(ex); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
StreamWriter writer = new StreamWriter(responseFileName); |
||||
writer.WriteLine(GenerateOptions(compilerparameters, exe)); |
||||
|
||||
foreach (ProjectReference lib in p.ProjectReferences) { |
||||
string fileName = lib.GetReferencedFileName(p); |
||||
writer.WriteLine("\"/r:" + fileName + "\""); |
||||
} |
||||
|
||||
// write source files and embedded resources
|
||||
foreach (ProjectFile finfo in p.ProjectFiles) { |
||||
if (finfo.Subtype != Subtype.Directory) { |
||||
switch (finfo.BuildAction) { |
||||
case BuildAction.Compile: |
||||
writer.WriteLine('"' + finfo.Name + '"'); |
||||
break; |
||||
|
||||
case BuildAction.EmbedAsResource: |
||||
writer.WriteLine("\"/res:" + finfo.Name + "\""); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
TempFileCollection tf = new TempFileCollection (); |
||||
writer.Close(); |
||||
|
||||
string output = ""; |
||||
string error = ""; |
||||
string compilerName = GetCompilerName(compilerparameters.VBCompilerVersion); |
||||
string outstr = compilerName + " \"@" + responseFileName + "\" \"@" + stdResponseFileName + "\""; |
||||
|
||||
Executor.ExecWaitWithCapture(outstr, tf, ref output, ref error); |
||||
ICompilerResult result = ParseOutput(tf, output); |
||||
project.CopyReferencesToOutputPath(false); |
||||
|
||||
File.Delete(responseFileName); |
||||
File.Delete(output); |
||||
File.Delete(error); |
||||
if (compilerparameters.CompileTarget != CompileTarget.Library) { |
||||
WriteManifestFile(exe); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
// code duplication: see C# backend : CSharpBindingCompilerManager
|
||||
void WriteManifestFile(string fileName) |
||||
{ |
||||
string manifestFile = fileName + ".manifest"; |
||||
if (File.Exists(manifestFile)) { |
||||
return; |
||||
} |
||||
StreamWriter sw = new StreamWriter(manifestFile); |
||||
sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"); |
||||
sw.WriteLine(""); |
||||
sw.WriteLine("<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"); |
||||
sw.WriteLine(" <dependency>"); |
||||
sw.WriteLine(" <dependentAssembly>"); |
||||
sw.WriteLine(" <assemblyIdentity"); |
||||
sw.WriteLine(" type=\"win32\""); |
||||
sw.WriteLine(" name=\"Microsoft.Windows.Common-Controls\""); |
||||
sw.WriteLine(" version=\"6.0.0.0\""); |
||||
sw.WriteLine(" processorArchitecture=\"X86\""); |
||||
sw.WriteLine(" publicKeyToken=\"6595b64144ccf1df\""); |
||||
sw.WriteLine(" language=\"*\""); |
||||
sw.WriteLine(" />"); |
||||
sw.WriteLine(" </dependentAssembly>"); |
||||
sw.WriteLine(" </dependency>"); |
||||
sw.WriteLine("</assembly>"); |
||||
sw.Close(); |
||||
} |
||||
|
||||
ICompilerResult ParseOutput(TempFileCollection tf, string file) |
||||
{ |
||||
StringBuilder compilerOutput = new StringBuilder(); |
||||
|
||||
StreamReader sr = File.OpenText(file); |
||||
|
||||
// skip fist whitespace line
|
||||
sr.ReadLine(); |
||||
|
||||
CompilerResults cr = new CompilerResults(tf); |
||||
|
||||
while (true) { |
||||
string next = sr.ReadLine(); |
||||
compilerOutput.Append(next);compilerOutput.Append(Environment.NewLine); |
||||
if (next == null) { |
||||
break; |
||||
} |
||||
CompilerError error = new CompilerError(); |
||||
|
||||
int index = next.IndexOf(": "); |
||||
if (index < 0) { |
||||
continue; |
||||
} |
||||
|
||||
string description = null; |
||||
string errorwarning = null; |
||||
string location = null; |
||||
|
||||
string s1 = next.Substring(0, index); |
||||
string s2 = next.Substring(index + 2); |
||||
index = s2.IndexOf(": "); |
||||
|
||||
if (index == -1) { |
||||
errorwarning = s1; |
||||
description = s2; |
||||
} else { |
||||
location = s1; |
||||
s1 = s2.Substring(0, index); |
||||
s2 = s2.Substring(index + 2); |
||||
errorwarning = s1; |
||||
description = s2; |
||||
} |
||||
|
||||
if (location != null) { |
||||
int idx1 = location.LastIndexOf('('); |
||||
int idx2 = location.LastIndexOf(')'); |
||||
if (idx1 >= 0 && idx2 >= 0) { |
||||
string filename = location.Substring(0, idx1); |
||||
error.Line = Int32.Parse(location.Substring(idx1 + 1, idx2 - idx1 - 1)); |
||||
error.FileName = Path.GetFullPath(filename.Trim()); // + "\\" + Path.GetFileName(filename);
|
||||
} |
||||
} |
||||
|
||||
string[] what = errorwarning.Split(' '); |
||||
error.IsWarning = what[0] == "warning"; |
||||
error.ErrorNumber = what[what.Length - 1]; |
||||
|
||||
error.ErrorText = description; |
||||
|
||||
cr.Errors.Add(error); |
||||
} |
||||
sr.Close(); |
||||
return new DefaultCompilerResult(cr, compilerOutput.ToString()); |
||||
} |
||||
} |
||||
} |
@ -1,81 +0,0 @@
@@ -1,81 +0,0 @@
|
||||
// <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.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.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
/// <summary>
|
||||
/// This class controls the compilation of C Sharp files and C Sharp projects
|
||||
/// </summary>
|
||||
public class VBBindingExecutionServices |
||||
{ |
||||
|
||||
public void Execute(string filename, bool debug) |
||||
{ |
||||
string exe = Path.ChangeExtension(filename, ".exe"); |
||||
DebuggerService DebuggerService = (DebuggerService)ServiceManager.Services.GetService(typeof(DebuggerService)); |
||||
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); |
||||
} |
||||
} |
||||
|
||||
public void Execute(IProject project, bool debug) |
||||
{ |
||||
VBCompilerParameters parameters = (VBCompilerParameters)project.ActiveConfiguration; |
||||
|
||||
|
||||
string directory = FileUtility.GetDirectoryNameWithSeparator(parameters.OutputDirectory); |
||||
string exe = parameters.OutputAssembly + ".exe"; |
||||
string args = parameters.CommandLineParameters; |
||||
|
||||
ProcessStartInfo psi; |
||||
// bool customStartup = false;
|
||||
if (parameters.CompileTarget != CompileTarget.WinExe && parameters.PauseConsoleOutput && !debug) { |
||||
// customStartup = true;
|
||||
psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c \"" + directory + exe + "\" " + args + " & pause"); |
||||
} else { |
||||
if (parameters.CompileTarget == CompileTarget.Library) { |
||||
|
||||
MessageService.ShowError("${res:BackendBindings.ExecutionManager.CantExecuteDLLError}"); |
||||
return; |
||||
} |
||||
|
||||
psi = new ProcessStartInfo(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); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,98 +0,0 @@
@@ -1,98 +0,0 @@
|
||||
// <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.IO; |
||||
using System.Collections; |
||||
using System.Collections.Specialized; |
||||
using System.Windows.Forms; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
////<summary>
|
||||
/// Provides functions to run VB.DOC and to read the configuration of VB.DOC.
|
||||
/// </summary>
|
||||
public class VBDOCCommand : AbstractMenuCommand |
||||
{ |
||||
///<summary>
|
||||
/// Runs VB.DOC for the given project
|
||||
/// </summary>
|
||||
public override void Run() |
||||
{ |
||||
IProjectService projectService = (IProjectService)ICSharpCode.Core.ServiceManager.Services.GetService(typeof(IProjectService)); |
||||
VBProject project = (VBProject)projectService.CurrentSelectedProject; |
||||
VBCompilerParameters compilerParameters = (VBCompilerParameters)project.ActiveConfiguration; |
||||
|
||||
Options options = new Options(); |
||||
string extension = compilerParameters.CompileTarget == CompileTarget.Exe ? ".dll" : ".exe"; |
||||
options.AssemblyFile = Path.Combine(compilerParameters.OutputDirectory, compilerParameters.OutputAssembly) + extension; |
||||
|
||||
ArrayList files = new ArrayList(); |
||||
foreach(ProjectFile file in project.ProjectFiles) { |
||||
if(VBDOCConfigurationPanel.IsFileIncluded(file.Name, project)) { |
||||
files.Add(file.Name); |
||||
} |
||||
} |
||||
|
||||
options.Files = (string[])files.ToArray(typeof(string)); |
||||
options.GlobalImports = compilerParameters.Imports.Split(','); |
||||
options.OutputXML = compilerParameters.VBDOCOutputFile; |
||||
options.Prefix = compilerParameters.VBDOCCommentPrefix; |
||||
options.RootNamespace = compilerParameters.RootNamespace; |
||||
|
||||
ArrayList referenceDirs = new ArrayList(); |
||||
string mainDirectory = Path.GetDirectoryName(options.AssemblyFile); |
||||
|
||||
foreach(ProjectReference projectFile in project.ProjectReferences) { |
||||
if(projectFile.ReferenceType == ReferenceType.Assembly) { |
||||
string referenceDir = Path.GetDirectoryName(projectFile.Reference); |
||||
if(referenceDir.ToLower() != mainDirectory.ToLower() && referenceDirs.Contains(referenceDir) == false) { |
||||
referenceDirs.Add(referenceDir); |
||||
} |
||||
} |
||||
} |
||||
|
||||
StringCollection errors = options.Validate(); |
||||
|
||||
if(errors.Count > 0) { |
||||
string message = ""; |
||||
foreach(string description in errors) { |
||||
message += description + "\n"; |
||||
} |
||||
MessageBox.Show(message, "Invalid VB.DOC options", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
||||
return; |
||||
} |
||||
|
||||
VBDOCRunner runner = new VBDOCRunner(); |
||||
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(resolve); |
||||
GuiMessageRecipient messageRecipient = new GuiMessageRecipient(); |
||||
|
||||
try { |
||||
runner.RunVBDOC(options, messageRecipient); |
||||
} catch(Exception ex) { |
||||
MessageBox.Show("Documentation generation failed:\n" + ex.Message); |
||||
} finally { |
||||
messageRecipient.Finished(); |
||||
AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(resolve); |
||||
} |
||||
|
||||
} |
||||
|
||||
Assembly resolve(object sender, ResolveEventArgs e) |
||||
{ |
||||
if(e.Name.StartsWith("CommentExtractor")) { |
||||
return Assembly.GetAssembly(typeof(VBDOCRunner)); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
} |
@ -1,86 +0,0 @@
@@ -1,86 +0,0 @@
|
||||
// <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.IO; |
||||
using System.Collections; |
||||
using System.Diagnostics; |
||||
using System.Windows.Forms; |
||||
using System.Xml; |
||||
|
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Internal.Project; |
||||
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||
|
||||
namespace VBBinding |
||||
{ |
||||
public class VBLanguageBinding : ILanguageBinding |
||||
{ |
||||
public const string LanguageName = "VBNET"; |
||||
|
||||
VBBindingCompilerServices compilerServices = new VBBindingCompilerServices(); |
||||
VBBindingExecutionServices executionServices = new VBBindingExecutionServices(); |
||||
|
||||
public string Language { |
||||
get { |
||||
return LanguageName; |
||||
} |
||||
} |
||||
|
||||
public void Execute(string filename, bool debug) |
||||
{ |
||||
Debug.Assert(executionServices != null); |
||||
executionServices.Execute(filename, debug); |
||||
} |
||||
|
||||
public void Execute(IProject project, bool debug) |
||||
{ |
||||
Debug.Assert(executionServices != null); |
||||
executionServices.Execute(project, debug); |
||||
} |
||||
|
||||
public string GetCompiledOutputName(string fileName) |
||||
{ |
||||
Debug.Assert(compilerServices != null); |
||||
return compilerServices.GetCompiledOutputName(fileName); |
||||
} |
||||
|
||||
public string GetCompiledOutputName(IProject project) |
||||
{ |
||||
Debug.Assert(compilerServices != null); |
||||
return compilerServices.GetCompiledOutputName(project); |
||||
} |
||||
|
||||
public bool CanCompile(string fileName) |
||||
{ |
||||
Debug.Assert(compilerServices != null); |
||||
return compilerServices.CanCompile(fileName); |
||||
} |
||||
|
||||
public ICompilerResult CompileFile(string fileName) |
||||
{ |
||||
Debug.Assert(compilerServices != null); |
||||
return compilerServices.CompileFile(fileName); |
||||
} |
||||
|
||||
public ICompilerResult CompileProject(IProject project) |
||||
{ |
||||
Debug.Assert(compilerServices != null); |
||||
return compilerServices.CompileProject(project); |
||||
} |
||||
|
||||
public ICompilerResult RecompileProject(IProject project) |
||||
{ |
||||
return CompileProject(project); |
||||
} |
||||
|
||||
public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions) |
||||
{ |
||||
return new VBProject(info, projectOptions); |
||||
} |
||||
} |
||||
} |
@ -1,83 +0,0 @@
@@ -1,83 +0,0 @@
|
||||
<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.40607</ProductVersion> |
||||
<SchemaVersion>2.0</SchemaVersion> |
||||
<ProjectGuid>{6b2fd2d9-5550-49f9-ad75-bbc1cd2ae698}</ProjectGuid> |
||||
<RootNamespace>NewProject</RootNamespace> |
||||
<AssemblyName>VBNetBinding</AssemblyName> |
||||
<OutputTarget>Library</OutputTarget> |
||||
<WarningLevel>4</WarningLevel> |
||||
<NoStdLib>False</NoStdLib> |
||||
<NoConfig>False</NoConfig> |
||||
<RunPostBuildEvent>OnSuccessfulBuild</RunPostBuildEvent> |
||||
</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>False</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.Data" /> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="ICSharpCode.Core.dll"> |
||||
<HintPath>..\..\..\..\..\bin\ICSharpCode.Core.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.TextEditor.dll"> |
||||
<HintPath>..\..\..\..\..\bin\ICSharpCode.TextEditor.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.XmlForms.dll"> |
||||
<HintPath>..\..\..\..\..\bin\ICSharpCode.XmlForms.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="SharpDevelop.Base.dll"> |
||||
<HintPath>..\..\..\..\..\bin\SharpDevelop.Base.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.NRefactory.dll"> |
||||
<HintPath>..\..\..\..\..\bin\ICSharpCode.NRefactory.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="CommentExtractor.dll"> |
||||
<HintPath>..\..\..\..\..\AddIns\AddIns\BackendBindings\VBNetBinding\CommentExtractor.dll</HintPath> |
||||
<Private>True</Private> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="VBBindingCompilerServices.cs" /> |
||||
<Compile Include="VBLanguageBinding.cs" /> |
||||
<Compile Include="Project\VBProject.cs" /> |
||||
<Compile Include="Project\VBCompilerParameters.cs" /> |
||||
<Compile Include="VBBindingExecutionServices.cs" /> |
||||
<Compile Include="FormattingStrategy\VBFormattingStrategy.cs" /> |
||||
<Compile Include="Gui\OutputOptionsPanel.cs" /> |
||||
<Compile Include="Gui\CodeGenerationPanel.cs" /> |
||||
<Compile Include="Gui\VBDocConfigurationPanel.cs" /> |
||||
<Compile Include="Parser\Parser.cs" /> |
||||
<Compile Include="VBAmbience.cs" /> |
||||
<Compile Include="Parser\ExpressionFinder.cs" /> |
||||
<Compile Include="Gui\VBCompilerPanel.cs" /> |
||||
<Compile Include="VBDOCCommand.cs" /> |
||||
<Compile Include="Gui\GuiMessageRecipient.cs" /> |
||||
<Compile Include="AssemblyInfo.cs" /> |
||||
<Compile Include="Gui\TextEditorOptionsPanel.cs" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> |
||||
</Project> |
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
<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' "> |
||||
<StartProgram>..\..\..\..\bin\SharpDevelop.exe</StartProgram> |
||||
</PropertyGroup> |
||||
</Project> |
Binary file not shown.
Loading…
Reference in new issue