Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@925 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
14 changed files with 3692 additions and 1 deletions
@ -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. |
@ -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 |
@ -0,0 +1,39 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
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("")] |
@ -0,0 +1,49 @@ |
|||||||
|
<AddIn name = "PInvoke Add-in" |
||||||
|
author = "Matt Ward" |
||||||
|
copyright = "prj:///doc/copyright.txt" |
||||||
|
description = "PInvoke.Net integration for SharpDevelop."> |
||||||
|
|
||||||
|
<Manifest> |
||||||
|
<Identity name = "ICSharpCode.PInvokeAddIn"/> |
||||||
|
</Manifest> |
||||||
|
|
||||||
|
<Runtime> |
||||||
|
<Import assembly="PInvokeAddIn.dll" /> |
||||||
|
</Runtime> |
||||||
|
|
||||||
|
<!-- Menu options --> |
||||||
|
<Path name="/SharpDevelop/Workbench/MainMenu/Tools"> |
||||||
|
<ComplexCondition action = "Disable"> |
||||||
|
<Or> |
||||||
|
<Condition name = "ActiveContentExtension" activeextension = ".vb"/> |
||||||
|
<Condition name = "ActiveContentExtension" activeextension = ".cs"/> |
||||||
|
</Or> |
||||||
|
<MenuItem id = "InsertPInvoke" |
||||||
|
insertafter = "Separator1" insertbefore = "Separator2" |
||||||
|
label = "${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesMenuLabel}" |
||||||
|
description = "Insert PInvoke signatures." |
||||||
|
class = "ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesCommand" |
||||||
|
/> |
||||||
|
</ComplexCondition> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- Right click in text editor menu option --> |
||||||
|
<Path name = "/SharpDevelop/ViewContent/DefaultTextEditor/ContextMenu"> |
||||||
|
|
||||||
|
<MenuItem id = "Separator4" |
||||||
|
type = "Separator" |
||||||
|
insertafter = "Options"/> |
||||||
|
|
||||||
|
<ComplexCondition action = "Disable"> |
||||||
|
<Or> |
||||||
|
<Condition name = "ActiveContentExtension" activeextension = ".vb"/> |
||||||
|
<Condition name = "ActiveContentExtension" activeextension = ".cs"/> |
||||||
|
</Or> |
||||||
|
<MenuItem id = "InsertPInvoke" |
||||||
|
label = "${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesMenuLabel}" |
||||||
|
insertafter = "Separator4" |
||||||
|
class ="ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesCommand" |
||||||
|
/> |
||||||
|
</ComplexCondition> |
||||||
|
</Path> |
||||||
|
</AddIn> |
@ -0,0 +1,73 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<SchemaVersion>2.0</SchemaVersion> |
||||||
|
<ProjectGuid>{5EEB99CF-EA2B-4733-80A6-CE9192D68170}</ProjectGuid> |
||||||
|
<RootNamespace>PInvokeAddIn</RootNamespace> |
||||||
|
<AssemblyName>PInvokeAddIn</AssemblyName> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<NoConfig>False</NoConfig> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||||
|
<DebugSymbols>True</DebugSymbols> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\PInvokeAddIn\</OutputPath> |
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||||
|
<DebugSymbols>False</DebugSymbols> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\PInvokeAddIn\</OutputPath> |
||||||
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Windows.Forms" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
||||||
|
<Reference Include="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||||
|
<Compile Include="Src\InsertPInvokeSignaturesCommand.cs" /> |
||||||
|
<Compile Include="Src\InsertPInvokeSignaturesForm.cs" /> |
||||||
|
<Compile Include="Src\WebReferences\PInvokeService.cs" /> |
||||||
|
<Compile Include="Src\PInvokeRepository.cs" /> |
||||||
|
<Compile Include="Src\PInvokeCodeGenerator.cs" /> |
||||||
|
<EmbeddedResource Include="Resources\InsertPInvokeSignaturesForm.xfrm" /> |
||||||
|
<None Include="signatures.xml"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="signatures.xml"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="PInvoke.addin"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||||
|
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||||
|
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||||
|
<Name>ICSharpCode.Core</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj"> |
||||||
|
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project> |
||||||
|
<Name>ICSharpCode.TextEditor</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
</Project> |
@ -0,0 +1,122 @@ |
|||||||
|
<Components version="1.0"> |
||||||
|
<System.Windows.Forms.Form> |
||||||
|
<Name value="InsertPInvokeSignaturesForm" /> |
||||||
|
<ShowInTaskbar value="False" /> |
||||||
|
<StartPosition value="CenterParent" /> |
||||||
|
<MinimumSize value="{Width=300, Height=200}" /> |
||||||
|
<ClientSize value="{Width=512, Height=294}" /> |
||||||
|
<MinimizeBox value="False" /> |
||||||
|
<DockPadding value="" /> |
||||||
|
<Text value="${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.DialogName}" /> |
||||||
|
<AcceptButton value="FindButton [System.Windows.Forms.Button], Text: ${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.FindButtonText}" /> |
||||||
|
<CancelButton value="CloseButton [System.Windows.Forms.Button], Text: ${res:Global.CloseButtonText}" /> |
||||||
|
<Controls> |
||||||
|
<System.Windows.Forms.LinkLabel> |
||||||
|
<Name value="MoreInfoLinkLabel" /> |
||||||
|
<Anchor value="Bottom, Left" /> |
||||||
|
<TabIndex value="4" /> |
||||||
|
<Location value="{X=8,Y=264}" /> |
||||||
|
<Size value="{Width=248, Height=16}" /> |
||||||
|
<Text value="${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.MoreInfoLinkLabel}" /> |
||||||
|
</System.Windows.Forms.LinkLabel> |
||||||
|
<System.Windows.Forms.Button> |
||||||
|
<Name value="InsertButton" /> |
||||||
|
<Location value="{X=368,Y=264}" /> |
||||||
|
<Size value="{Width=64, Height=24}" /> |
||||||
|
<Text value="${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.InsertButtonText}" /> |
||||||
|
<Anchor value="Bottom, Right" /> |
||||||
|
<TabIndex value="2" /> |
||||||
|
</System.Windows.Forms.Button> |
||||||
|
<System.Windows.Forms.Button> |
||||||
|
<Name value="CloseButton" /> |
||||||
|
<Location value="{X=440,Y=264}" /> |
||||||
|
<Size value="{Width=64, Height=24}" /> |
||||||
|
<Text value="${res:Global.CloseButtonText}" /> |
||||||
|
<Anchor value="Bottom, Right" /> |
||||||
|
<TabIndex value="3" /> |
||||||
|
<DialogResult value="Cancel" /> |
||||||
|
</System.Windows.Forms.Button> |
||||||
|
<System.Windows.Forms.Panel> |
||||||
|
<Name value="BottomPanel" /> |
||||||
|
<Location value="{X=0,Y=88}" /> |
||||||
|
<Size value="{Width=512, Height=168}" /> |
||||||
|
<DockPadding value="" /> |
||||||
|
<Anchor value="Top, Bottom, Left, Right" /> |
||||||
|
<TabIndex value="1" /> |
||||||
|
<Controls> |
||||||
|
<System.Windows.Forms.RichTextBox> |
||||||
|
<Name value="SignatureRichTextBox" /> |
||||||
|
<Anchor value="Top, Bottom, Left, Right" /> |
||||||
|
<Size value="{Width=496, Height=152}" /> |
||||||
|
<Location value="{X=8,Y=8}" /> |
||||||
|
<Text value="" /> |
||||||
|
<TabIndex value="0" /> |
||||||
|
</System.Windows.Forms.RichTextBox> |
||||||
|
</Controls> |
||||||
|
</System.Windows.Forms.Panel> |
||||||
|
<System.Windows.Forms.Panel> |
||||||
|
<Name value="TopPanel" /> |
||||||
|
<Location value="{X=0,Y=0}" /> |
||||||
|
<Size value="{Width=512, Height=88}" /> |
||||||
|
<DockPadding value="" /> |
||||||
|
<Anchor value="Top, Left, Right" /> |
||||||
|
<TabIndex value="0" /> |
||||||
|
<Controls> |
||||||
|
<System.Windows.Forms.ComboBox> |
||||||
|
<Name value="ModuleNameComboBox" /> |
||||||
|
<Anchor value="Top, Left, Right" /> |
||||||
|
<TabIndex value="5" /> |
||||||
|
<Location value="{X=80,Y=32}" /> |
||||||
|
<Size value="{Width=352, Height=21}" /> |
||||||
|
</System.Windows.Forms.ComboBox> |
||||||
|
<System.Windows.Forms.ComboBox> |
||||||
|
<Name value="FunctionNameComboBox" /> |
||||||
|
<Anchor value="Top, Left, Right" /> |
||||||
|
<TabIndex value="4" /> |
||||||
|
<Location value="{X=80,Y=8}" /> |
||||||
|
<Size value="{Width=352, Height=21}" /> |
||||||
|
</System.Windows.Forms.ComboBox> |
||||||
|
<System.Windows.Forms.ComboBox> |
||||||
|
<Name value="LanguageComboBox" /> |
||||||
|
<TabIndex value="6" /> |
||||||
|
<Location value="{X=80,Y=56}" /> |
||||||
|
<Size value="{Width=72, Height=21}" /> |
||||||
|
<DropDownStyle value="DropDownList" /> |
||||||
|
</System.Windows.Forms.ComboBox> |
||||||
|
<System.Windows.Forms.Label> |
||||||
|
<Name value="LanguageLabel" /> |
||||||
|
<Text value="${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.LanguageLabel}" /> |
||||||
|
<TextAlign value="MiddleLeft" /> |
||||||
|
<TabIndex value="3" /> |
||||||
|
<Size value="{Width=72, Height=16}" /> |
||||||
|
<Location value="{X=8,Y=56}" /> |
||||||
|
</System.Windows.Forms.Label> |
||||||
|
<System.Windows.Forms.Label> |
||||||
|
<Name value="ModuleNameLabel" /> |
||||||
|
<Text value="${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.ModuleNameLabel}" /> |
||||||
|
<TextAlign value="MiddleLeft" /> |
||||||
|
<TabIndex value="1" /> |
||||||
|
<Size value="{Width=72, Height=16}" /> |
||||||
|
<Location value="{X=8,Y=32}" /> |
||||||
|
</System.Windows.Forms.Label> |
||||||
|
<System.Windows.Forms.Label> |
||||||
|
<Name value="FunctionNameLabel" /> |
||||||
|
<Text value="${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.FunctionNameLabel}" /> |
||||||
|
<TextAlign value="MiddleLeft" /> |
||||||
|
<TabIndex value="0" /> |
||||||
|
<Size value="{Width=72, Height=16}" /> |
||||||
|
<Location value="{X=8,Y=8}" /> |
||||||
|
</System.Windows.Forms.Label> |
||||||
|
<System.Windows.Forms.Button> |
||||||
|
<Name value="FindButton" /> |
||||||
|
<Location value="{X=440,Y=8}" /> |
||||||
|
<Size value="{Width=64, Height=24}" /> |
||||||
|
<Text value="${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesForm.FindButtonText}" /> |
||||||
|
<Anchor value="Top, Right" /> |
||||||
|
<TabIndex value="7" /> |
||||||
|
</System.Windows.Forms.Button> |
||||||
|
</Controls> |
||||||
|
</System.Windows.Forms.Panel> |
||||||
|
</Controls> |
||||||
|
</System.Windows.Forms.Form> |
||||||
|
</Components> |
@ -0,0 +1,31 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.PInvokeAddIn |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Displays a dialog so the user can browser for PInvoke signatures and
|
||||||
|
/// insert one or more of them into the code.
|
||||||
|
/// </summary>
|
||||||
|
public class InsertPInvokeSignaturesCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Starts the command.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
// Show PInvoke dialog.
|
||||||
|
using(InsertPInvokeSignaturesForm form = new InsertPInvokeSignaturesForm()) { |
||||||
|
form.ShowDialog(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,362 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
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 |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Form that allows the user to find PInvoke signatures and insert
|
||||||
|
/// them into the code.
|
||||||
|
/// </summary>
|
||||||
|
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(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Populates the language combo box.
|
||||||
|
/// </summary>
|
||||||
|
void SetupLanguages() |
||||||
|
{ |
||||||
|
string[] supportedLanguages = PInvokeRepository.Instance.GetSupportedLanguages(); |
||||||
|
|
||||||
|
languageComboBox.Items.Add(allLanguages); |
||||||
|
|
||||||
|
foreach (string language in supportedLanguages) { |
||||||
|
languageComboBox.Items.Add(language); |
||||||
|
} |
||||||
|
|
||||||
|
languageComboBox.SelectedIndex = 0; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Populates the function name combo box.
|
||||||
|
/// </summary>
|
||||||
|
void SetupFunctionNames() |
||||||
|
{ |
||||||
|
string[] names = PInvokeRepository.Instance.GetFunctionNames(); |
||||||
|
|
||||||
|
foreach (string name in names) { |
||||||
|
functionNameComboBox.Items.Add(name); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Populates the module name combo box.
|
||||||
|
/// </summary>
|
||||||
|
void SetupModuleNames() |
||||||
|
{ |
||||||
|
string[] names = PInvokeRepository.Instance.GetModuleNames(); |
||||||
|
|
||||||
|
foreach (string name in names) { |
||||||
|
moduleNameComboBox.Items.Add(name); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void CloseButtonClick(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
Close(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Insert PInvoke signature into code.
|
||||||
|
/// </summary>
|
||||||
|
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; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replaces the "|" in the signature string with new lines.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
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; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the combo box text that has been typed in by the user
|
||||||
|
/// ignoring any autocomplete text.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comboBox">A combo box control.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// The combo box text that has been typed in by the user.
|
||||||
|
/// </returns>
|
||||||
|
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); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the displayed PInvoke signatures based on the selected
|
||||||
|
/// language.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The event source.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
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; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,88 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.TextEditor; |
||||||
|
using ICSharpCode.TextEditor.Actions; |
||||||
|
using ICSharpCode.TextEditor.Document; |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.PInvokeAddIn |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Generates PInvoke signature code in the SharpDevelop text editor.
|
||||||
|
/// </summary>
|
||||||
|
public class PInvokeCodeGenerator |
||||||
|
{ |
||||||
|
int numOperations; |
||||||
|
|
||||||
|
public PInvokeCodeGenerator() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Inserts the PInvoke signature at the current cursor position.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textArea">The text editor.</param>
|
||||||
|
/// <param name="signature">A PInvoke signature string.</param>
|
||||||
|
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)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,112 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.IO; |
||||||
|
using System.Reflection; |
||||||
|
using System.Xml; |
||||||
|
|
||||||
|
namespace ICSharpCode.PInvokeAddIn |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents the repository of pinvoke information.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
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; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the folder where this assembly was loaded from.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The folder where this assembly was loaded.</returns>
|
||||||
|
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); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,311 @@ |
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 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.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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; |
||||||
|
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[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; |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public PInvokeService() { |
||||||
|
this.Url = "http://www.pinvoke.net/pinvokeservice.asmx"; |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event GetResultsForFunctionCompletedEventHandler GetResultsForFunctionCompleted; |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event ContributeSignaturesAndTypesCompletedEventHandler ContributeSignaturesAndTypesCompleted; |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[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])); |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginGetResultsForFunction(string functionName, string moduleName, System.AsyncCallback callback, object asyncState) { |
||||||
|
return this.BeginInvoke("GetResultsForFunction", new object[] { |
||||||
|
functionName, |
||||||
|
moduleName}, callback, asyncState); |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public SignatureInfo[] EndGetResultsForFunction(System.IAsyncResult asyncResult) { |
||||||
|
object[] results = this.EndInvoke(asyncResult); |
||||||
|
return ((SignatureInfo[])(results[0])); |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void GetResultsForFunctionAsync(string functionName, string moduleName) { |
||||||
|
this.GetResultsForFunctionAsync(functionName, moduleName, null); |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
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)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[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])); |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
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); |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string EndContributeSignaturesAndTypes(System.IAsyncResult asyncResult) { |
||||||
|
object[] results = this.EndInvoke(asyncResult); |
||||||
|
return ((string)(results[0])); |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void ContributeSignaturesAndTypesAsync(string code, string language, string userName) { |
||||||
|
this.ContributeSignaturesAndTypesAsync(code, language, userName, null); |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
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)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public new void CancelAsync(object userState) { |
||||||
|
base.CancelAsync(userState); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[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; |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string Signature { |
||||||
|
get { |
||||||
|
return this.signatureField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.signatureField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string Language { |
||||||
|
get { |
||||||
|
return this.languageField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.languageField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string LastAuthor { |
||||||
|
get { |
||||||
|
return this.lastAuthorField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.lastAuthorField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.DateTime LastModified { |
||||||
|
get { |
||||||
|
return this.lastModifiedField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.lastModifiedField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string Module { |
||||||
|
get { |
||||||
|
return this.moduleField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.moduleField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string Url { |
||||||
|
get { |
||||||
|
return this.urlField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.urlField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string AlternativeManagedAPI { |
||||||
|
get { |
||||||
|
return this.alternativeManagedAPIField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.alternativeManagedAPIField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string Summary { |
||||||
|
get { |
||||||
|
return this.summaryField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.summaryField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string SignatureComments { |
||||||
|
get { |
||||||
|
return this.signatureCommentsField; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.signatureCommentsField = value; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] |
||||||
|
public delegate void GetResultsForFunctionCompletedEventHandler(object sender, GetResultsForFunctionCompletedEventArgs e); |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[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; |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public SignatureInfo[] Result { |
||||||
|
get { |
||||||
|
this.RaiseExceptionIfNecessary(); |
||||||
|
return ((SignatureInfo[])(this.results[0])); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] |
||||||
|
public delegate void ContributeSignaturesAndTypesCompletedEventHandler(object sender, ContributeSignaturesAndTypesCompletedEventArgs e); |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[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; |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string Result { |
||||||
|
get { |
||||||
|
this.RaiseExceptionIfNecessary(); |
||||||
|
return ((string)(this.results[0])); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,2 @@ |
|||||||
|
SET wsdlapp=wsdl /l:CS /n:ICSharpCode.PInvokeAddIn.WebServices /nologo |
||||||
|
%wsdlapp% http://www.pinvoke.net/pinvokeservice.asmx?WSDL |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue