diff --git a/src/AddIns/Misc/PInvokeAddIn/Doc/readme.txt b/src/AddIns/Misc/PInvokeAddIn/Doc/readme.txt new file mode 100644 index 0000000000..c10347385e --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Doc/readme.txt @@ -0,0 +1,24 @@ +Inserts PInvoke signatures into VB.Net or C# source code. +--------------------------------------------------------- + +Features +-------- + +Search PInvoke signatures held at http://www.pinvoke.net +Insert C# or VB.Net signatures into source code. + +Menu option +----------- + +Tools->Insert PInvoke Signatures... + +Right click context menu +------------------------ + +Right click in a ".vb" or ".cs" file and select "Insert PInvoke Signatures...". + + +Limitations +----------- + +No support for connecting to http://www.pinvoke.net through a proxy. \ No newline at end of file diff --git a/src/AddIns/Misc/PInvokeAddIn/PInvokeAddIn.sln b/src/AddIns/Misc/PInvokeAddIn/PInvokeAddIn.sln new file mode 100644 index 0000000000..a176696c3b --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/PInvokeAddIn.sln @@ -0,0 +1,16 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.0.0.909 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PInvokeAddIn", "Project\PInvokeAddIn.csproj", "{5EEB99CF-EA2B-4733-80A6-CE9192D68170}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5EEB99CF-EA2B-4733-80A6-CE9192D68170}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EEB99CF-EA2B-4733-80A6-CE9192D68170}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EEB99CF-EA2B-4733-80A6-CE9192D68170}.Release|Any CPU.Build.0 = Release|Any CPU + {5EEB99CF-EA2B-4733-80A6-CE9192D68170}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/Configuration/AssemblyInfo.cs b/src/AddIns/Misc/PInvokeAddIn/Project/Configuration/AssemblyInfo.cs new file mode 100644 index 0000000000..a63666d547 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/Configuration/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// +// +// +// +// $Revision$ +// + +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("PInvokeAddIn")] +[assembly: AssemblyDescription("PInvoke AddIn for SharpDevelop")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("ic#code")] +[assembly: AssemblyProduct("SharpDevelop")] +[assembly: AssemblyCopyright("2004-2005 AlphaSierraPapa")] +[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("")] diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/PInvoke.addin b/src/AddIns/Misc/PInvokeAddIn/Project/PInvoke.addin new file mode 100644 index 0000000000..a67f5641e8 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/PInvoke.addin @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/PInvokeAddIn.csproj b/src/AddIns/Misc/PInvokeAddIn/Project/PInvokeAddIn.csproj new file mode 100644 index 0000000000..c20c9fb1c4 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/PInvokeAddIn.csproj @@ -0,0 +1,73 @@ + + + Debug + AnyCPU + 2.0 + {5EEB99CF-EA2B-4733-80A6-CE9192D68170} + PInvokeAddIn + PInvokeAddIn + Library + 4 + False + False + + + True + False + False + True + ..\..\..\..\..\AddIns\AddIns\Misc\PInvokeAddIn\ + False + + + False + True + False + False + ..\..\..\..\..\AddIns\AddIns\Misc\PInvokeAddIn\ + False + + + + + + + + + + + + + + + + + + Always + + + Always + + + Always + + + + + {2748AD25-9C63-4E12-877B-4DCE96FBED54} + ICSharpCode.SharpDevelop + False + + + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} + ICSharpCode.Core + False + + + {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} + ICSharpCode.TextEditor + False + + + + \ No newline at end of file diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/Resources/InsertPInvokeSignaturesForm.xfrm b/src/AddIns/Misc/PInvokeAddIn/Project/Resources/InsertPInvokeSignaturesForm.xfrm new file mode 100644 index 0000000000..5d63259918 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/Resources/InsertPInvokeSignaturesForm.xfrm @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesCommand.cs b/src/AddIns/Misc/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesCommand.cs new file mode 100644 index 0000000000..7355be8a35 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesCommand.cs @@ -0,0 +1,31 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Windows.Forms; +using ICSharpCode.Core; + +namespace ICSharpCode.PInvokeAddIn +{ + /// + /// Displays a dialog so the user can browser for PInvoke signatures and + /// insert one or more of them into the code. + /// + public class InsertPInvokeSignaturesCommand : AbstractMenuCommand + { + /// + /// Starts the command. + /// + public override void Run() + { + // Show PInvoke dialog. + using(InsertPInvokeSignaturesForm form = new InsertPInvokeSignaturesForm()) { + form.ShowDialog(); + } + } + } +} diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesForm.cs b/src/AddIns/Misc/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesForm.cs new file mode 100644 index 0000000000..a9a1e3404e --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesForm.cs @@ -0,0 +1,362 @@ +// +// +// +// +// $Revision$ +// + +using ICSharpCode.Core; +using ICSharpCode.PInvokeAddIn.WebServices; +using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; +using ICSharpCode.SharpDevelop.Gui; +using ICSharpCode.SharpDevelop.Gui.XmlForms; +using ICSharpCode.TextEditor; +using System; +using System.IO; +using System.Text; +using System.Windows.Forms; +using System.Diagnostics; + +namespace ICSharpCode.PInvokeAddIn +{ + /// + /// Form that allows the user to find PInvoke signatures and insert + /// them into the code. + /// + public class InsertPInvokeSignaturesForm : XmlForm + { + Button findButton; + Button insertButton; + Button closeButton; + ComboBox functionNameComboBox; + ComboBox moduleNameComboBox; + RichTextBox signatureRichTextBox; + ComboBox languageComboBox; + LinkLabel moreInfoLinkLabel; + + const char BackspaceCharacter = (char)0x08; + SignatureInfo[] signatures; + string allLanguages = StringParser.Parse("${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.AllLanguages}"); + + const string pinvokeWebSiteUrl = "http://www.pinvoke.net/"; + + string pinvokeUrl = pinvokeWebSiteUrl; + + public InsertPInvokeSignaturesForm() + { + SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("PInvokeAddIn.Resources.InsertPInvokeSignaturesForm.xfrm")); + + signatureRichTextBox = ((RichTextBox)ControlDictionary["SignatureRichTextBox"]); + + // Hook up events. + closeButton = ((Button)ControlDictionary["CloseButton"]); + closeButton.Click += new EventHandler(CloseButtonClick); + + insertButton = ((Button)ControlDictionary["InsertButton"]); + insertButton.Enabled = false; + insertButton.Click += new EventHandler(InsertButtonClick); + + findButton = ((Button)ControlDictionary["FindButton"]); + findButton.Click += new EventHandler(FindButtonClick); + + functionNameComboBox = ((ComboBox)ControlDictionary["FunctionNameComboBox"]); + functionNameComboBox.KeyPress += new KeyPressEventHandler(FunctionNameComboBoxKeyPress); + + moduleNameComboBox = ((ComboBox)ControlDictionary["ModuleNameComboBox"]); + moduleNameComboBox.KeyPress += new KeyPressEventHandler(ModuleNameComboBoxKeyPress); + + moreInfoLinkLabel = ((LinkLabel)ControlDictionary["MoreInfoLinkLabel"]); + moreInfoLinkLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(MoreInfoLinkClicked); + + languageComboBox = ((ComboBox)ControlDictionary["LanguageComboBox"]); + languageComboBox.SelectedIndexChanged += new EventHandler(LanguageComboBoxSelectedIndexChanged); + + SetupLanguages(); + SetupFunctionNames(); + SetupModuleNames(); + } + + protected override void SetupXmlLoader() + { + xmlLoader.StringValueFilter = new SharpDevelopStringValueFilter(); + xmlLoader.PropertyValueCreator = new SharpDevelopPropertyValueCreator(); + xmlLoader.ObjectCreator = new SharpDevelopObjectCreator(); + } + + /// + /// Populates the language combo box. + /// + void SetupLanguages() + { + string[] supportedLanguages = PInvokeRepository.Instance.GetSupportedLanguages(); + + languageComboBox.Items.Add(allLanguages); + + foreach (string language in supportedLanguages) { + languageComboBox.Items.Add(language); + } + + languageComboBox.SelectedIndex = 0; + } + + /// + /// Populates the function name combo box. + /// + void SetupFunctionNames() + { + string[] names = PInvokeRepository.Instance.GetFunctionNames(); + + foreach (string name in names) { + functionNameComboBox.Items.Add(name); + } + } + + /// + /// Populates the module name combo box. + /// + void SetupModuleNames() + { + string[] names = PInvokeRepository.Instance.GetModuleNames(); + + foreach (string name in names) { + moduleNameComboBox.Items.Add(name); + } + } + + void CloseButtonClick(object sender, EventArgs e) + { + Close(); + } + + /// + /// Insert PInvoke signature into code. + /// + void InsertButtonClick(object sender, EventArgs e) + { + Close(); + PInvokeCodeGenerator generator = new PInvokeCodeGenerator(); + + string language = languageComboBox.Text; + if (language == allLanguages) { + language = GetSourceFileLanguage(); + } + + string signature = GetSelectedPInvokeSignature(language); + + if (signature.Length > 0) { + TextEditorControl textEditor = GetTextEditorControl(); + if (textEditor != null) { + generator.Generate(textEditor.ActiveTextAreaControl.TextArea, signature); + } + } else { + MessageService.ShowError(String.Format(StringParser.Parse("${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.NoSignatureFoundForLanguage}"), language)); + } + } + + void FindButtonClick(object sender, EventArgs e) + { + try { + signatures = Search(functionNameComboBox.Text, moduleNameComboBox.Text); + + int signaturesAdded = DisplaySearchResults(languageComboBox.Text); + + if (signatures.Length > 0) { + pinvokeUrl = signatures[0].Url; + } + + if (signaturesAdded > 0) { + insertButton.Enabled = true; + } else { + insertButton.Enabled = false; + } + + } catch(Exception ex) { + signatures = null; + MessageService.ShowError(ex.Message); + } + } + + string GetSelectedPInvokeSignature(string language) + { + StringBuilder signatureBuilder = new StringBuilder(); + + foreach (SignatureInfo info in signatures) { + if (info.Language.ToLower() == language.ToLower()) { + signatureBuilder.Append(GetSignature(info)); + signatureBuilder.Append("\r\n"); + } + } + + return signatureBuilder.ToString(); + } + + SignatureInfo[] Search(string functionName, string moduleName) + { + PInvokeService webService = new PInvokeService(); + return webService.GetResultsForFunction(functionName, moduleName); + } + + int DisplaySearchResults(string language) + { + signatureRichTextBox.Clear(); + + if (signatures.Length > 0) { + if (signatures[0].Summary.Length > 0) { + signatureRichTextBox.Text = String.Concat(signatures[0].Summary, "\r\n\r\n"); + } + } + + int signaturesAdded = 0; + + foreach (SignatureInfo info in signatures) { + + bool languageWanted = false; + if ((language == allLanguages) || (language.ToLower() == info.Language.ToLower())) { + languageWanted = true; + } + + if (languageWanted) { + ++signaturesAdded; + + string signatureText = GetSignature(info); + if (signatureText.EndsWith("\r\n")) { + signatureRichTextBox.Text += String.Concat(signatureText, "\r\n\r\n"); + } else { + signatureRichTextBox.Text += String.Concat(signatureText, "\r\n\r\n"); + } + } + } + + if (signaturesAdded == 0) { + signatureRichTextBox.Text += StringParser.Parse("${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.NoSignaturesFound}"); + } + + return signaturesAdded; + } + + /// + /// Replaces the "|" in the signature string with new lines. + /// + /// + /// + string GetSignature(SignatureInfo info) + { + return info.Signature.Replace("|", "\r\n"); + } + + void FunctionNameComboBoxKeyPress(object sender, KeyPressEventArgs e) + { + Autocomplete(functionNameComboBox, e); + } + + void ModuleNameComboBoxKeyPress(object sender, KeyPressEventArgs e) + { + Autocomplete(moduleNameComboBox, e); + } + + void Autocomplete(ComboBox comboBox, KeyPressEventArgs e) + { + e.Handled = true; + string searchText = String.Empty; + + if (e.KeyChar == BackspaceCharacter) { + if ((comboBox.SelectionStart == 1) || (comboBox.SelectionStart == 0)) { + comboBox.Text = String.Empty; + comboBox.SelectionStart = 0; + + } else { + comboBox.Text = comboBox.Text.Substring(0, comboBox.SelectionStart - 1); + comboBox.SelectionStart = comboBox.Text.Length; + searchText = GetComboBoxText(comboBox); + } + } else { + searchText = String.Concat(GetComboBoxText(comboBox), e.KeyChar); + comboBox.Text = searchText; + comboBox.SelectionStart = comboBox.Text.Length; + } + + if (searchText.Length > 0) { + + int index = comboBox.FindString(searchText); + + if (index != -1) { + comboBox.SelectedIndex = index; + comboBox.Text = (string)comboBox.Items[index]; + comboBox.Select(searchText.Length, comboBox.Text.Length - (searchText.Length)); + } else { + comboBox.Text = searchText; + comboBox.SelectionStart = comboBox.Text.Length; + } + } + } + + /// + /// Gets the combo box text that has been typed in by the user + /// ignoring any autocomplete text. + /// + /// A combo box control. + /// + /// The combo box text that has been typed in by the user. + /// + string GetComboBoxText(ComboBox comboBox) + { + string comboBoxText = String.Empty; + + if (comboBox.SelectionStart > 0) { + comboBoxText = comboBox.Text.Substring(0, comboBox.SelectionStart); + } + return comboBoxText; + } + + string GetSourceFileLanguage() + { + TextEditorControl textEditor = GetTextEditorControl(); + if (textEditor != null) { + string fileExtension = Path.GetExtension(textEditor.ActiveTextAreaControl.TextArea.MotherTextEditorControl.FileName).ToLower(); + if (fileExtension == ".vb") { + return "VB"; + } + } + return "C#"; + } + + void MoreInfoLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + Process.Start(pinvokeUrl); + } + + /// + /// Updates the displayed PInvoke signatures based on the selected + /// language. + /// + /// The event source. + /// The event arguments. + void LanguageComboBoxSelectedIndexChanged(object sender, EventArgs e) + { + if (signatures != null) { + if (signatures.Length > 0) { + int signaturesAdded = DisplaySearchResults(languageComboBox.Text); + if (signaturesAdded > 0) { + insertButton.Enabled = true; + } else { + insertButton.Enabled = false; + } + } + } + } + + static TextEditorControl GetTextEditorControl() + { + TextEditorControl textEditorControl = null; + + IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; + + if ((window != null) && (window.ViewContent is ITextEditorControlProvider)) { + textEditorControl = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl; + } + + return textEditorControl; + } + } +} diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/Src/PInvokeCodeGenerator.cs b/src/AddIns/Misc/PInvokeAddIn/Project/Src/PInvokeCodeGenerator.cs new file mode 100644 index 0000000000..8b98495e21 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/Src/PInvokeCodeGenerator.cs @@ -0,0 +1,88 @@ +// +// +// +// +// $Revision$ +// + +using ICSharpCode.Core; +using ICSharpCode.TextEditor; +using ICSharpCode.TextEditor.Actions; +using ICSharpCode.TextEditor.Document; +using System; + +namespace ICSharpCode.PInvokeAddIn +{ + /// + /// Generates PInvoke signature code in the SharpDevelop text editor. + /// + public class PInvokeCodeGenerator + { + int numOperations; + + public PInvokeCodeGenerator() + { + } + + /// + /// Inserts the PInvoke signature at the current cursor position. + /// + /// The text editor. + /// A PInvoke signature string. + public void Generate(TextArea textArea, string signature) + { + numOperations = 0; + IndentStyle oldIndentStyle = textArea.TextEditorProperties.IndentStyle; + bool oldEnableEndConstructs = PropertyService.Get("VBBinding.TextEditor.EnableEndConstructs", true); + + try { + + textArea.BeginUpdate(); + textArea.TextEditorProperties.IndentStyle = IndentStyle.Smart; + PropertyService.Set("VBBinding.TextEditor.EnableEndConstructs", false); + + string[] lines = signature.Replace("\r\n", "\n").Split('\n'); + + for (int i = 0; i < lines.Length; ++i) { + + textArea.InsertString(lines[i]); + ++numOperations; + + // Insert new line if not the last line. + if ( i < (lines.Length - 1)) + { + Return(textArea); + } + } + + if (numOperations > 0) { + textArea.Document.UndoStack.UndoLast(numOperations); + } + + } finally { + textArea.TextEditorProperties.IndentStyle = oldIndentStyle; + PropertyService.Set("VBBinding.TextEditor.EnableEndConstructs", oldEnableEndConstructs); + textArea.EndUpdate(); + textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); + textArea.Document.CommitUpdate(); + } + } + + void Return(TextArea textArea) + { + IndentLine(textArea); + new Return().Execute(textArea); + ++numOperations; + } + + void IndentLine(TextArea textArea) + { + int delta = textArea.Document.FormattingStrategy.IndentLine(textArea, textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset)); + if (delta != 0) { + ++numOperations; + LineSegment caretLine = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset); + textArea.Caret.Position = textArea.Document.OffsetToPosition(Math.Min(textArea.Caret.Offset + delta, caretLine.Offset + caretLine.Length)); + } + } + } +} diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/Src/PInvokeRepository.cs b/src/AddIns/Misc/PInvokeAddIn/Project/Src/PInvokeRepository.cs new file mode 100644 index 0000000000..57c8121f73 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/Src/PInvokeRepository.cs @@ -0,0 +1,112 @@ +// +// +// +// +// $Revision$ +// + + +using System; +using System.Collections; +using System.IO; +using System.Reflection; +using System.Xml; + +namespace ICSharpCode.PInvokeAddIn +{ + /// + /// Represents the repository of pinvoke information. + /// + /// + /// All the main data is stored at http://www.pinvoke.net. + /// This class contains function names and module names for the drop + /// down lists read from the "signatures.xml" config file. + /// + public sealed class PInvokeRepository + { + static string[] functionNames; + static string[] moduleNames; + static PInvokeRepository repository; + + PInvokeRepository() + { + } + + public static PInvokeRepository Instance + { + get { + if (repository == null) { + repository = new PInvokeRepository(); + } + return repository; + } + } + + public string[] GetSupportedLanguages() + { + return new string[] {"C#", "VB"}; + } + + public string[] GetFunctionNames() + { + if (functionNames == null) { + ReadConfig(); + } + + return functionNames; + } + + public string[] GetModuleNames() + { + if (moduleNames == null) { + ReadConfig(); + } + + return moduleNames; + } + + /// + /// Gets the folder where this assembly was loaded from. + /// + /// The folder where this assembly was loaded. + string GetAssemblyFolder() + { + Assembly assembly = GetType().Assembly; + + string assemblyFilename = assembly.CodeBase.Replace("file:///", ""); + string folder = Path.GetDirectoryName(assemblyFilename); + + return folder; + } + + void ReadConfig() + { + string configFile = Path.Combine(GetAssemblyFolder(), "signatures.xml"); + + XmlDocument doc = new XmlDocument(); + doc.Load(configFile); + + ArrayList moduleArrayList = new ArrayList(); + ArrayList functionArrayList = new ArrayList(); + + foreach(XmlElement moduleElement in doc.DocumentElement.SelectNodes("//module")) + { + XmlAttribute moduleName = (XmlAttribute)moduleElement.SelectSingleNode("@name"); + moduleArrayList.Add(moduleName.Value); + + foreach(XmlAttribute functionName in moduleElement.SelectNodes("function/@name")) + { + functionArrayList.Add(functionName.Value); + } + } + + moduleNames = new string[moduleArrayList.Count]; + moduleArrayList.Sort(); + moduleArrayList.CopyTo(moduleNames); + + functionNames = new string[functionArrayList.Count]; + functionArrayList.Sort(); + functionArrayList.CopyTo(functionNames); + } + } +} diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/Src/WebReferences/PInvokeService.cs b/src/AddIns/Misc/PInvokeAddIn/Project/Src/WebReferences/PInvokeService.cs new file mode 100644 index 0000000000..c5ceb02aa0 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/Src/WebReferences/PInvokeService.cs @@ -0,0 +1,311 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// +// This source code was auto-generated by wsdl, Version=2.0.50727.42. +// +namespace ICSharpCode.PInvokeAddIn.WebServices { + using System.Diagnostics; + using System.Web.Services; + using System.ComponentModel; + using System.Web.Services.Protocols; + using System; + using System.Xml.Serialization; + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name="PInvokeServiceSoap", Namespace="http://www.pinvoke.net/webservices/")] + public partial class PInvokeService : System.Web.Services.Protocols.SoapHttpClientProtocol { + + private System.Threading.SendOrPostCallback GetResultsForFunctionOperationCompleted; + + private System.Threading.SendOrPostCallback ContributeSignaturesAndTypesOperationCompleted; + + /// + public PInvokeService() { + this.Url = "http://www.pinvoke.net/pinvokeservice.asmx"; + } + + /// + public event GetResultsForFunctionCompletedEventHandler GetResultsForFunctionCompleted; + + /// + public event ContributeSignaturesAndTypesCompletedEventHandler ContributeSignaturesAndTypesCompleted; + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.pinvoke.net/webservices/GetResultsForFunction", RequestNamespace="http://www.pinvoke.net/webservices/", ResponseNamespace="http://www.pinvoke.net/webservices/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlArrayItemAttribute(IsNullable=false)] + public SignatureInfo[] GetResultsForFunction(string functionName, string moduleName) { + object[] results = this.Invoke("GetResultsForFunction", new object[] { + functionName, + moduleName}); + return ((SignatureInfo[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetResultsForFunction(string functionName, string moduleName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetResultsForFunction", new object[] { + functionName, + moduleName}, callback, asyncState); + } + + /// + public SignatureInfo[] EndGetResultsForFunction(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SignatureInfo[])(results[0])); + } + + /// + public void GetResultsForFunctionAsync(string functionName, string moduleName) { + this.GetResultsForFunctionAsync(functionName, moduleName, null); + } + + /// + public void GetResultsForFunctionAsync(string functionName, string moduleName, object userState) { + if ((this.GetResultsForFunctionOperationCompleted == null)) { + this.GetResultsForFunctionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetResultsForFunctionOperationCompleted); + } + this.InvokeAsync("GetResultsForFunction", new object[] { + functionName, + moduleName}, this.GetResultsForFunctionOperationCompleted, userState); + } + + private void OnGetResultsForFunctionOperationCompleted(object arg) { + if ((this.GetResultsForFunctionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetResultsForFunctionCompleted(this, new GetResultsForFunctionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.pinvoke.net/webservices/ContributeSignaturesAndTypes", RequestNamespace="http://www.pinvoke.net/webservices/", ResponseNamespace="http://www.pinvoke.net/webservices/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string ContributeSignaturesAndTypes(string code, string language, string userName) { + object[] results = this.Invoke("ContributeSignaturesAndTypes", new object[] { + code, + language, + userName}); + return ((string)(results[0])); + } + + /// + public System.IAsyncResult BeginContributeSignaturesAndTypes(string code, string language, string userName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("ContributeSignaturesAndTypes", new object[] { + code, + language, + userName}, callback, asyncState); + } + + /// + public string EndContributeSignaturesAndTypes(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// + public void ContributeSignaturesAndTypesAsync(string code, string language, string userName) { + this.ContributeSignaturesAndTypesAsync(code, language, userName, null); + } + + /// + public void ContributeSignaturesAndTypesAsync(string code, string language, string userName, object userState) { + if ((this.ContributeSignaturesAndTypesOperationCompleted == null)) { + this.ContributeSignaturesAndTypesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnContributeSignaturesAndTypesOperationCompleted); + } + this.InvokeAsync("ContributeSignaturesAndTypes", new object[] { + code, + language, + userName}, this.ContributeSignaturesAndTypesOperationCompleted, userState); + } + + private void OnContributeSignaturesAndTypesOperationCompleted(object arg) { + if ((this.ContributeSignaturesAndTypesCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ContributeSignaturesAndTypesCompleted(this, new ContributeSignaturesAndTypesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) { + base.CancelAsync(userState); + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.pinvoke.net/webservices/")] + public partial class SignatureInfo { + + private string signatureField; + + private string languageField; + + private string lastAuthorField; + + private System.DateTime lastModifiedField; + + private string moduleField; + + private string urlField; + + private string alternativeManagedAPIField; + + private string summaryField; + + private string signatureCommentsField; + + /// + public string Signature { + get { + return this.signatureField; + } + set { + this.signatureField = value; + } + } + + /// + public string Language { + get { + return this.languageField; + } + set { + this.languageField = value; + } + } + + /// + public string LastAuthor { + get { + return this.lastAuthorField; + } + set { + this.lastAuthorField = value; + } + } + + /// + public System.DateTime LastModified { + get { + return this.lastModifiedField; + } + set { + this.lastModifiedField = value; + } + } + + /// + public string Module { + get { + return this.moduleField; + } + set { + this.moduleField = value; + } + } + + /// + public string Url { + get { + return this.urlField; + } + set { + this.urlField = value; + } + } + + /// + public string AlternativeManagedAPI { + get { + return this.alternativeManagedAPIField; + } + set { + this.alternativeManagedAPIField = value; + } + } + + /// + public string Summary { + get { + return this.summaryField; + } + set { + this.summaryField = value; + } + } + + /// + public string SignatureComments { + get { + return this.signatureCommentsField; + } + set { + this.signatureCommentsField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetResultsForFunctionCompletedEventHandler(object sender, GetResultsForFunctionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetResultsForFunctionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetResultsForFunctionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SignatureInfo[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SignatureInfo[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void ContributeSignaturesAndTypesCompletedEventHandler(object sender, ContributeSignaturesAndTypesCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ContributeSignaturesAndTypesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ContributeSignaturesAndTypesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } +} diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/Src/WebReferences/ProxyGenerator.cmd b/src/AddIns/Misc/PInvokeAddIn/Project/Src/WebReferences/ProxyGenerator.cmd new file mode 100644 index 0000000000..89bf97b664 --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/Src/WebReferences/ProxyGenerator.cmd @@ -0,0 +1,2 @@ +SET wsdlapp=wsdl /l:CS /n:ICSharpCode.PInvokeAddIn.WebServices /nologo +%wsdlapp% http://www.pinvoke.net/pinvokeservice.asmx?WSDL diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/signatures.xml b/src/AddIns/Misc/PInvokeAddIn/Project/signatures.xml new file mode 100644 index 0000000000..18a97c24cb --- /dev/null +++ b/src/AddIns/Misc/PInvokeAddIn/Project/signatures.xml @@ -0,0 +1,2455 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/SharpDevelop.sln b/src/SharpDevelop.sln index b73a676af6..26a3223270 100644 --- a/src/SharpDevelop.sln +++ b/src/SharpDevelop.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.913 +# SharpDevelop 2.0.0.909 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}" ProjectSection(SolutionItems) = postProject EndProjectSection @@ -32,6 +32,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CE5B42B7-6 ProjectSection(SolutionItems) = postProject EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PInvokeAddIn", "AddIns\Misc\PInvokeAddIn\Project\PInvokeAddIn.csproj", "{5EEB99CF-EA2B-4733-80A6-CE9192D68170}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager", "AddIns\Misc\AddInManager\Project\AddInManager.csproj", "{F93E52FD-DA66-4CE5-A0CB-BCD902811122}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAntAddIn", "AddIns\Misc\NAntAddIn\Project\NAntAddIn.csproj", "{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}" @@ -222,6 +224,10 @@ Global {F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Any CPU.Build.0 = Release|Any CPU {F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EEB99CF-EA2B-4733-80A6-CE9192D68170}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EEB99CF-EA2B-4733-80A6-CE9192D68170}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EEB99CF-EA2B-4733-80A6-CE9192D68170}.Release|Any CPU.Build.0 = Release|Any CPU + {5EEB99CF-EA2B-4733-80A6-CE9192D68170}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -248,6 +254,7 @@ Global {B1CE28A0-04E8-490D-8256-E0C4D52C93C8} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2} {1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2} {F93E52FD-DA66-4CE5-A0CB-BCD902811122} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2} + {5EEB99CF-EA2B-4733-80A6-CE9192D68170} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2} {B08385CD-F0CC-488C-B4F4-EEB34B6D2688} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D} {1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D} {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}