From: <an...@us...> - 2007-11-30 04:07:03
|
Revision: 1106 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1106&view=rev Author: and-81 Date: 2007-11-29 20:06:38 -0800 (Thu, 29 Nov 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs trunk/plugins/IR Server Suite/Applications/IR Server/IR Server.csproj trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj trunk/plugins/IR Server Suite/Documentation/new.html trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Girder Plugin.cs trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Girder Plugin.csproj trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/IR Server Plugin Interface/IConfigure.cs trunk/plugins/IR Server Suite/IR Server Plugins/IR Server Plugin Interface/IR Server Plugin Interface.csproj trunk/plugins/IR Server Suite/IR Server Plugins/IRMan Receiver/IRMan Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/IRTrans Transceiver/IRTransTransceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/IgorPlug Receiver/IgorPlug Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/IgorPlug Receiver/IgorPlug Receiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Microsoft MCE Transceiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Serial IR Blaster/Serial IR Blaster.cs trunk/plugins/IR Server Suite/IR Server Plugins/USB-UIRT Transceiver/UirtTransceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Transceiver/WinLirc Transceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Windows Message Receiver/Windows Message Receiver.cs trunk/plugins/IR Server Suite/IR Server Suite.sln trunk/plugins/IR Server Suite/Input Service/Input Service Configuration/Config.cs trunk/plugins/MCEReplacement/Forms/SetupForm.cs Added Paths: ----------- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.Designer.cs trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.cs trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.resx trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Icon.ico Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs 2007-11-29 01:08:38 UTC (rev 1105) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.Designer.cs 2007-11-30 04:06:38 UTC (rev 1106) @@ -40,10 +40,10 @@ this.textBoxPronto = new System.Windows.Forms.TextBox(); this.labelCarrier = new System.Windows.Forms.Label(); this.toolTips = new System.Windows.Forms.ToolTip(this.components); - this.textBoxCarrier = new System.Windows.Forms.TextBox(); this.buttonSetCarrier = new System.Windows.Forms.Button(); this.checkBoxStoreBinary = new System.Windows.Forms.CheckBox(); this.buttonAttemptDecode = new System.Windows.Forms.Button(); + this.textBoxCarrier = new System.Windows.Forms.TextBox(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.menuStrip.SuspendLayout(); @@ -135,14 +135,6 @@ this.labelCarrier.Text = "Carrier:"; this.labelCarrier.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // textBoxCarrier - // - this.textBoxCarrier.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.textBoxCarrier.Location = new System.Drawing.Point(64, 176); - this.textBoxCarrier.Name = "textBoxCarrier"; - this.textBoxCarrier.Size = new System.Drawing.Size(64, 20); - this.textBoxCarrier.TabIndex = 3; - // // buttonSetCarrier // this.buttonSetCarrier.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -176,8 +168,17 @@ this.buttonAttemptDecode.Text = "Attempt decode"; this.toolTips.SetToolTip(this.buttonAttemptDecode, "Try to decode the IR signal into a recognised format"); this.buttonAttemptDecode.UseVisualStyleBackColor = true; + this.buttonAttemptDecode.Visible = false; this.buttonAttemptDecode.Click += new System.EventHandler(this.buttonAttemptDecode_Click); // + // textBoxCarrier + // + this.textBoxCarrier.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.textBoxCarrier.Location = new System.Drawing.Point(64, 176); + this.textBoxCarrier.Name = "textBoxCarrier"; + this.textBoxCarrier.Size = new System.Drawing.Size(64, 20); + this.textBoxCarrier.TabIndex = 3; + // // openFileDialog // this.openFileDialog.DefaultExt = "IR"; Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs 2007-11-29 01:08:38 UTC (rev 1105) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Config.cs 2007-11-30 04:06:38 UTC (rev 1106) @@ -266,7 +266,7 @@ foreach (IRServerPluginBase transceiver in _transceivers) if (transceiver.Name.Equals(plugin, StringComparison.OrdinalIgnoreCase)) - (transceiver as IConfigure).Configure(); + (transceiver as IConfigure).Configure(this); } /* private void ReceiveChanged(object sender, EventArgs e) Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IR Server.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/IR Server.csproj 2007-11-29 01:08:38 UTC (rev 1105) +++ trunk/plugins/IR Server Suite/Applications/IR Server/IR Server.csproj 2007-11-30 04:06:38 UTC (rev 1106) @@ -38,7 +38,7 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <UseVSHostingProcess>true</UseVSHostingProcess> + <UseVSHostingProcess>false</UseVSHostingProcess> <DocumentationFile> </DocumentationFile> </PropertyGroup> Modified: trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2007-11-29 01:08:38 UTC (rev 1105) +++ trunk/plugins/IR Server Suite/Applications/Translator/Translator.csproj 2007-11-30 04:06:38 UTC (rev 1106) @@ -162,6 +162,7 @@ <None Include="Icon16Connecting.ico" /> </ItemGroup> <ItemGroup> + <Content Include="Default Settings\Default.xml" /> <Content Include="Graphics\ClickLeft.png" /> <Content Include="Graphics\ClickMiddle.png" /> <Content Include="Graphics\ClickRight.png" /> @@ -178,9 +179,6 @@ <Content Include="Graphics\ScrollUp.png" /> <Content Include="Graphics\WinLogo.png" /> </ItemGroup> - <ItemGroup> - <Folder Include="Default Settings\" /> - </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Modified: trunk/plugins/IR Server Suite/Documentation/new.html =================================================================== --- trunk/plugins/IR Server Suite/Documentation/new.html 2007-11-29 01:08:38 UTC (rev 1105) +++ trunk/plugins/IR Server Suite/Documentation/new.html 2007-11-30 04:06:38 UTC (rev 1106) @@ -21,7 +21,8 @@ <LI>Looks like 64-bit support wasn't working, so I've had another try.</LI> <LI>Added a Translator OSD that can task swap, run macros and some other useful things.</LI> <LI>Added some new macro commands (HTTP requests, beep sound, wave file playback).</LI> -<LI>Commands (including macros) now execute on separate threads. In the past calling a macro for example would block the caller until it finished, now the caller can continue while the macro executes independantly. Note that this will cause a subtle change in flow control.</LI> +<LI>Commands (including macros) now execute on separate threads. In the past calling a macro for example would block the caller until it finished, now the caller can continue while the macro executes independantly. Note that this will cause a subtle change in flow control, but shouldn't effect anyone.</LI> +<LI>Added support for Girder 3.x plugins, still experimental at this stage. Expect to see improvements in this area, like multiple Girder plugins active at the same time.</LI> </UL></P> <BR> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs 2007-11-29 01:08:38 UTC (rev 1105) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs 2007-11-30 04:06:38 UTC (rev 1106) @@ -67,7 +67,6 @@ LoadSettings(); _receiverWindow = new ReceiverWindow("Custom HID Receiver"); - _receiverWindow.ProcMsg += new ProcessMessage(ProcMessage); } #endregion Constructor @@ -111,6 +110,8 @@ /// <returns>true if successful, otherwise false.</returns> public override bool Start() { + _receiverWindow.ProcMsg += new ProcessMessage(ProcMessage); + _device.dwFlags = RawInput.RawInputDeviceFlags.InputSink; _device.hwndTarget = _receiverWindow.Handle; @@ -137,15 +138,18 @@ { _device.dwFlags |= RawInput.RawInputDeviceFlags.Remove; RegisterForRawInput(_device); + + _receiverWindow.ProcMsg -= new ProcessMessage(ProcMessage); } /// <summary> /// Configure the IR Server plugin. /// </summary> - public void Configure() + public void Configure(IWin32Window owner) { DeviceSelect deviceSelect = new DeviceSelect(); - if (deviceSelect.ShowDialog() == DialogResult.OK) + + if (deviceSelect.ShowDialog(owner) == DialogResult.OK) { _device = deviceSelect.SelectedDevice; SaveSettings(); Added: trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.Designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.Designer.cs 2007-11-30 04:06:38 UTC (rev 1106) @@ -0,0 +1,117 @@ +namespace GirderPlugin +{ + partial class Config + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Config)); + this.buttonConfigureGirderPlugin = new System.Windows.Forms.Button(); + this.textBoxPluginFile = new System.Windows.Forms.TextBox(); + this.buttonFind = new System.Windows.Forms.Button(); + this.buttonOK = new System.Windows.Forms.Button(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.SuspendLayout(); + // + // buttonConfigureGirderPlugin + // + this.buttonConfigureGirderPlugin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonConfigureGirderPlugin.Location = new System.Drawing.Point(8, 40); + this.buttonConfigureGirderPlugin.Name = "buttonConfigureGirderPlugin"; + this.buttonConfigureGirderPlugin.Size = new System.Drawing.Size(72, 24); + this.buttonConfigureGirderPlugin.TabIndex = 2; + this.buttonConfigureGirderPlugin.Text = "Configure"; + this.buttonConfigureGirderPlugin.UseVisualStyleBackColor = true; + this.buttonConfigureGirderPlugin.Click += new System.EventHandler(this.buttonConfigureGirderPlugin_Click); + // + // textBoxPluginFile + // + this.textBoxPluginFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxPluginFile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBoxPluginFile.Location = new System.Drawing.Point(8, 8); + this.textBoxPluginFile.Name = "textBoxPluginFile"; + this.textBoxPluginFile.ReadOnly = true; + this.textBoxPluginFile.Size = new System.Drawing.Size(312, 20); + this.textBoxPluginFile.TabIndex = 0; + // + // buttonFind + // + this.buttonFind.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonFind.Location = new System.Drawing.Point(328, 8); + this.buttonFind.Name = "buttonFind"; + this.buttonFind.Size = new System.Drawing.Size(24, 20); + this.buttonFind.TabIndex = 1; + this.buttonFind.Text = "..."; + this.buttonFind.UseVisualStyleBackColor = true; + this.buttonFind.Click += new System.EventHandler(this.buttonFind_Click); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.Location = new System.Drawing.Point(288, 40); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(64, 24); + this.buttonOK.TabIndex = 3; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // openFileDialog + // + this.openFileDialog.Title = "Select Girder plugin to use"; + // + // Config + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(360, 72); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.buttonFind); + this.Controls.Add(this.textBoxPluginFile); + this.Controls.Add(this.buttonConfigureGirderPlugin); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(368, 99); + this.Name = "Config"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Girder Plugin Configuration"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonConfigureGirderPlugin; + private System.Windows.Forms.TextBox textBoxPluginFile; + private System.Windows.Forms.Button buttonFind; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.OpenFileDialog openFileDialog; + } +} \ No newline at end of file Added: trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.cs 2007-11-30 04:06:38 UTC (rev 1106) @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace GirderPlugin +{ + + /// <summary> + /// Config form for selecting and configuring a Girder plugin. + /// </summary> + public partial class Config : Form + { + + /// <summary> + /// Gets or sets the name of the Girder plugin file in use. + /// </summary> + /// <value>The name of the Girder plugin file.</value> + public string FileName + { + get { return textBoxPluginFile.Text; } + set { textBoxPluginFile.Text = value; } + } + + /// <summary> + /// Initializes a new instance of the <see cref="Config"/> class. + /// </summary> + public Config() + { + InitializeComponent(); + } + + private void buttonConfigureGirderPlugin_Click(object sender, EventArgs e) + { + GirderPluginWrapper pluginWrapper = new GirderPluginWrapper(textBoxPluginFile.Text); + + pluginWrapper.GirOpen(); + + if (!pluginWrapper.CanConfigure) + { + MessageBox.Show(this, "No configuration available", "Girder Plugin Configuration", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + pluginWrapper.GirCommandGui(); + + MessageBox.Show(this, "Press OK after the Girder plugin configuration is complete", "Girder Plugin Configuration", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + pluginWrapper.GirClose(); + + pluginWrapper.Dispose(); + } + + private void buttonFind_Click(object sender, EventArgs e) + { + openFileDialog.FileName = textBoxPluginFile.Text; + + if (openFileDialog.ShowDialog(this) == DialogResult.OK) + { + GirderPluginWrapper pluginWrapper = new GirderPluginWrapper(openFileDialog.FileName); + + pluginWrapper.GirOpen(); + + string message = String.Format("{0}\n{1}\n\nUse this plugin?", pluginWrapper.GirName, pluginWrapper.GirDescription); + + if (MessageBox.Show(this, message, openFileDialog.FileName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + textBoxPluginFile.Text = openFileDialog.FileName; + + pluginWrapper.GirClose(); + + pluginWrapper.Dispose(); + } + } + + private void buttonOK_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + + } + +} Added: trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.resx =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.resx (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Config.resx 2007-11-30 04:06:38 UTC (rev 1106) @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + AAABAAIAICAAAAEAIACoEAAAJgAAABAQAAABACAAaAQAAM4QAAAoAAAAIAAAAEAAAAABACAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAMj/AADI/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAA/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AP8AAAD/AAAAAAAAAAAAAAAAAAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAA/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAP8AAAD/AAAA/wAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAA/wAAAP8AAAD/AAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/+5xB//mcQQAAnEH/+ZxB8DucQcePnEHPz5xBn8+cQZwP + nEGf/5xBn/+cQZ+fnEHPn5xBxx+cQfB/nEH//5xB +</value> + </data> +</root> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Girder Plugin.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Girder Plugin.cs 2007-11-29 01:08:38 UTC (rev 1105) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Girder Plugin.cs 2007-11-30 04:06:38 UTC (rev 1106) @@ -2,149 +2,141 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; -using System.Runtime.InteropServices; +using System.Windows.Forms; +using System.Xml; -using Microsoft.Win32.SafeHandles; - using IRServerPluginInterface; namespace GirderPlugin { - public class GirderPlugin : IRServerPluginBase, IRemoteReceiver, ITransmitIR, ILearnIR, IConfigure + /// <summary> + /// IR Server Plugin for using Girder 3.x plugins. + /// </summary> + public class GirderPlugin : IRServerPluginBase, IRemoteReceiver, IConfigure { #region Constants + static readonly string ConfigurationFile = + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + + "\\IR Server Suite\\IR Server\\Girder Plugin.xml"; + static readonly string[] Ports = new string[] { "None" }; + const int GIRINFO_POWERBROADCAST = 2; + const int PBT_APMSUSPEND = 4; + const int PBT_APMRESUMEAUTOMATIC = 18; + #endregion Constants #region Variables + string _pluginFile; + RemoteHandler _remoteButtonHandler = null; - IntPtr _pluginDll; + GirderPluginWrapper _pluginWrapper; #endregion Variables - #region Interop - - [DllImport("kernel32")] - extern static IntPtr LoadLibrary( - string dllFileName); - - [DllImport("kernel32.dll")] - static extern IntPtr GetProcAddress( - IntPtr module, - string functionName); - - [DllImport("kernel32")] - extern static Int32 FreeLibrary( - IntPtr handle); - - #endregion Interop - - #region Girder Plugin Delegates - - /* -void WINAPI gir_version (char *data, int size); -void WINAPI gir_name (char *data, int size); -void WINAPI gir_description (char *data, int size); -int WINAPI gir_devicenum (); -int WINAPI gir_requested_api (int max_api); - -int WINAPI gir_open (int gir_major_ver, int gir_minor_ver, int gir_micro_ver, p_functions api_functions ); -int WINAPI gir_close (); -int WINAPI gir_learn_event(char *old, char *newevent, int len); -int WINAPI gir_info (int message, int wparam, int lparam); - -int WINAPI gir_start (); -int WINAPI gir_stop (); - -int WINAPI gir_event(p_command command, char *eventstring, void *payload, int len, char * status, int statuslen); -void WINAPI gir_command_gui(); -void WINAPI gir_command_changed(p_command command); - */ - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - delegate void gir_version(string data, int size); - gir_version _girVersion; - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - delegate void gir_name(string data, int size); - gir_name _girName; - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - delegate void gir_description(string data, int size); - gir_description _girDescription; - - /* - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - delegate int gir_devicenum(); - gir_devicenum _girDevicenum; - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - delegate int gir_requested_api(); - gir_requested_api _girRequestedApi; - */ - - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - delegate int gir_start(); - gir_start _girStart; - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - delegate int gir_stop(); - gir_stop _girStop; - - - - #endregion Girder Plugin Delegates - - #region IRServerPluginBase Members + /// <summary> + /// Name of the IR Server plugin. + /// </summary> + /// <value>The name.</value> public override string Name { get { return "Girder Plugin"; } } - public override string Version { get { return "1.0.3.4"; } } + /// <summary> + /// IR Server plugin version. + /// </summary> + /// <value>The version.</value> + public override string Version { get { return "1.0.3.5"; } } + /// <summary> + /// The IR Server plugin's author. + /// </summary> + /// <value>The author.</value> public override string Author { get { return "and-81"; } } - public override string Description { get { return "Supports using Girder plugins"; } } + /// <summary> + /// A description of the IR Server plugin. + /// </summary> + /// <value>The description.</value> + public override string Description { get { return "Supports using Girder 3.x plugins with IR Server"; } } + /// <summary> + /// Detect the presence of this device. Devices that cannot be detected will always return false. + /// </summary> + /// <returns> + /// true if the device is present, otherwise false. + /// </returns> public override bool Detect() { return false; } + /// <summary> + /// Start the IR Server plugin. + /// </summary> + /// <returns>true if successful, otherwise false.</returns> public override bool Start() - { - LoadGirderPlugin("MceIr.dll"); - - _girStart(); + { + LoadSettings(); - return true; + _pluginWrapper = new GirderPluginWrapper(_pluginFile); + + _pluginWrapper.EventCallback += new GirderPluginWrapper.PluginEventCallback(PluginCallback); + + bool open = _pluginWrapper.GirOpen(); + if (open) + _pluginWrapper.GirStart(); + + return open; } + /// <summary> + /// Suspend the IR Server plugin when computer enters standby. + /// </summary> public override void Suspend() { + if (_pluginWrapper == null) + return; + _pluginWrapper.GirInfo(GIRINFO_POWERBROADCAST, PBT_APMSUSPEND, 0); } + /// <summary> + /// Resume the IR Server plugin when the computer returns from standby. + /// </summary> public override void Resume() { + if (_pluginWrapper == null) + return; + _pluginWrapper.GirInfo(GIRINFO_POWERBROADCAST, PBT_APMRESUMEAUTOMATIC, 0); } + /// <summary> + /// Stop the IR Server plugin. + /// </summary> public override void Stop() { - if (_pluginDll == IntPtr.Zero) + if (_pluginWrapper == null) return; - _girStop(); + _pluginWrapper.GirStop(); - FreeLibrary(_pluginDll); + _pluginWrapper.GirClose(); + + _pluginWrapper.Dispose(); + + _pluginWrapper = null; } #endregion IRServerPluginBase Members #region IRemoteReceiver Members + /// <summary> + /// Callback for remote button presses. + /// </summary> + /// <value>The remote callback.</value> public RemoteHandler RemoteCallback { get { return _remoteButtonHandler; } @@ -155,11 +147,21 @@ #region ITransmitIR Members + /// <summary> + /// Lists the available blaster ports. + /// </summary> + /// <value>The available ports.</value> public string[] AvailablePorts { get { return Ports; } } + /// <summary> + /// Transmit an infrared command. + /// </summary> + /// <param name="port">Port to transmit on.</param> + /// <param name="data">Data to transmit.</param> + /// <returns>true if successful, otherwise false.</returns> public bool Transmit(string port, byte[] data) { throw new Exception("The method or operation is not implemented."); @@ -167,60 +169,76 @@ #endregion ITransmitIR Members - #region ILearnIR Members + #region IConfigure Members - public LearnStatus Learn(out byte[] data) + /// <summary> + /// Configure the IR Server plugin. + /// </summary> + public void Configure(IWin32Window owner) { - throw new Exception("The method or operation is not implemented."); - } + LoadSettings(); - #endregion ILearnIR Members + Config config = new Config(); + config.FileName = _pluginFile; - #region IConfigure Members + if (config.ShowDialog(owner) == DialogResult.OK) + { + _pluginFile = config.FileName; - public void Configure() - { + SaveSettings(); + } } #endregion IConfigure Members #region Implementation - void LoadGirderPlugin(string girderPluginFile) + void PluginCallback(string eventstring, IntPtr payload, int len, int device) { - IntPtr function; + if (_remoteButtonHandler != null) + _remoteButtonHandler(eventstring); + } - _pluginDll = LoadLibrary(girderPluginFile); - if (_pluginDll == IntPtr.Zero) - throw new ApplicationException(String.Format("Failed to load girder plugin ({0})", girderPluginFile)); - + void LoadSettings() + { + XmlDocument doc = new XmlDocument(); + + try { doc.Load(ConfigurationFile); } + catch { return; } + + try { _pluginFile = doc.DocumentElement.Attributes["PluginFile"].Value; } + catch { } + } + void SaveSettings() + { try { - function = GetProcAddress(_pluginDll, "gir_version"); - _girVersion = (gir_version)Marshal.GetDelegateForFunctionPointer(function, typeof(gir_version)); + using (XmlTextWriter writer = new XmlTextWriter(ConfigurationFile, System.Text.Encoding.UTF8)) + { + writer.Formatting = Formatting.Indented; + writer.Indentation = 1; + writer.IndentChar = (char)9; + writer.WriteStartDocument(true); + writer.WriteStartElement("settings"); // <settings> - function = GetProcAddress(_pluginDll, "gir_name"); - _girName = (gir_name)Marshal.GetDelegateForFunctionPointer(function, typeof(gir_name)); + writer.WriteAttributeString("PluginFile", _pluginFile); - function = GetProcAddress(_pluginDll, "gir_description"); - _girDescription = (gir_description)Marshal.GetDelegateForFunctionPointer(function, typeof(gir_description)); - - - - function = GetProcAddress(_pluginDll, "gir_start"); - _girStart = (gir_start)Marshal.GetDelegateForFunctionPointer(function, typeof(gir_start)); - - function = GetProcAddress(_pluginDll, "gir_stop"); - _girStop = (gir_stop)Marshal.GetDelegateForFunctionPointer(function, typeof(gir_stop)); + writer.WriteEndElement(); // </settings> + writer.WriteEndDocument(); + } } +#if TRACE + catch (Exception ex) + { + Trace.WriteLine(ex.ToString()); + } +#else catch { - FreeLibrary(_pluginDll); - throw; } +#endif + } - } - #endregion Implementation } Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Girder Plugin.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Girder Plugin.csproj 2007-11-29 01:08:38 UTC (rev 1105) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/Girder Plugin.csproj 2007-11-30 04:06:38 UTC (rev 1106) @@ -10,6 +10,8 @@ <RootNamespace>GirderPlugin</RootNamespace> <AssemblyName>Girder Plugin</AssemblyName> <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent> + <ApplicationIcon> + </ApplicationIcon> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -20,17 +22,22 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <PlatformTarget>x86</PlatformTarget> + <PlatformTarget>AnyCPU</PlatformTarget> <UseVSHostingProcess>false</UseVSHostingProcess> + <AllowUnsafeBlocks>false</AllowUnsafeBlocks> + <DocumentationFile>bin\Debug\Girder Plugin.XML</DocumentationFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> + <DefineConstants> + </DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>AnyCPU</PlatformTarget> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <DebugSymbols>true</DebugSymbols> @@ -38,7 +45,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <DebugType>full</DebugType> - <PlatformTarget>x86</PlatformTarget> + <PlatformTarget>AnyCPU</PlatformTarget> <UseVSHostingProcess>false</UseVSHostingProcess> <ErrorReport>prompt</ErrorReport> </PropertyGroup> @@ -53,10 +60,19 @@ <ItemGroup> <Reference Include="System" /> <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="Config.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Config.Designer.cs"> + <DependentUpon>Config.cs</DependentUpon> + </Compile> <Compile Include="Girder Plugin.cs" /> + <Compile Include="GirderPluginWrapper.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> @@ -66,6 +82,15 @@ <Private>False</Private> </ProjectReference> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Config.resx"> + <SubType>Designer</SubType> + <DependentUpon>Config.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <Content Include="Icon.ico" /> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. @@ -75,6 +100,7 @@ </Target> --> <PropertyGroup> - <PostBuildEvent>copy "$(TargetName).*" "\MediaPortal Development\Plugin Releases\IR Server Suite\IR Server Plugins\"</PostBuildEvent> + <PostBuildEvent> + </PostBuildEvent> </PropertyGroup> </Project> \ No newline at end of file Added: trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Girder Plugin/GirderPluginWrapper.cs 2007-11-30 04:06:38 UTC (rev 1106) @@ -0,0 +1,931 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; + +#if TRACE +using System.Diagnostics; +#endif + +namespace GirderPlugin +{ + + /// <summary> + /// Wrapper class to work with Girder 3.x plugins. + /// </summary> + public class GirderPluginWrapper : IDisposable + { + + #region Constants + + /// <summary> + /// Simulated Girder application version (Major). + /// </summary> + public const int GirVerMajor = 3; + /// <summary> + /// Simulated Girder application version (Minor). + /// </summary> + public const int GirVerMinor = 3; + /// <summary> + /// Simulated Girder application version (Micro). + /// </summary> + public const int GirVerMicro = 0; + + /// <summary> + /// Maximum Girder API version this wrapper can handle. + /// </summary> + public const int GirMaxApi = 2; + + const int MaxStringLength = 256; + + #endregion Constants + + #region Interop + + [DllImport("kernel32")] + extern static IntPtr LoadLibrary( + string dllFileName); + + [DllImport("kernel32")] + static extern IntPtr GetProcAddress( + IntPtr module, + string functionName); + + [DllImport("kernel32")] + [return: MarshalAs(UnmanagedType.Bool)] + extern static bool FreeLibrary( + IntPtr handle); + + #endregion Interop + + #region Girder Plugin Delegates + + #region Girder Funtions + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_event_cb(string event_string, int device, IntPtr payload, int len); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_parse_girder_reg(string orig, IntPtr szstore, int size); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_get_link_name(int lvalue, IntPtr szstore, int size); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void t_set_command(GirCommand command); // GirCommand Ptr? + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void t_target_enum(int id, t_target_callback callback); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void t_target_callback(IntPtr hw, GirCommand command); // GirCommand Ptr? + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void t_realloc_pchar(IntPtr old, byte newchar); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void t_show_osd(int timer); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void t_hide_osd(); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_start_osd_draw(IntPtr hw, IntPtr h, int user); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void t_stop_osd_draw(IntPtr h); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_treepicker_show(IntPtr window, int id); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_register_cb(int actionplugin, t_event_cb callback, string prefix, int device); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_i18n_translate(string orig, IntPtr szstore, int size); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate int t_get_osd_settings(int setting); // (return int == dword) + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_get_osd_fontname(IntPtr szstore, int size); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate IntPtr t_gir_malloc(int size); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void t_gir_free(IntPtr data); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate int t_get_int_var(string name); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate double t_get_double_var(string name); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_get_string_var(string name, IntPtr szstore, int size); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_set_int_var(string name, int value); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_set_double_var(string name, double value); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_set_string_var(string name, string value); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_delete_var(string name); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_run_parser(string str, IntPtr error_value); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_send_event(string eventstring, IntPtr payload, int len, int device); + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + delegate bool t_trigger_command(int command_id); + + #endregion Girder Funtions + +/* +typedef void (WINAPI *t_target_callback) (HWND hw, p_command command); +typedef void (WINAPI *t_set_command) (p_command command); +typedef void (WINAPI *t_target_enum) (int id, t_target_callback callback); +typedef void (WINAPI *t_realloc_pchar) (PCHAR * old, PCHAR newchar); +typedef void (WINAPI *t_show_osd) (int timer); +typedef void (WINAPI *t_hide_osd) (); +typedef int (WINAPI *t_start_osd_draw) (HWND *hw, HDC *h, int user); +typedef void (WINAPI *t_stop_osd_draw) (HDC h); +typedef int (WINAPI *t_treepicker_show) (HWND window, int id); +typedef int (WINAPI *t_event_cb) (PCHAR event_string, int device, void *payload, int len); +typedef int (WINAPI *t_register_cb) (int actionplugin, t_event_cb callback, PCHAR prefix, int device); +typedef int (WINAPI *t_get_link_name) (int lvalue, PCHAR szstore, int size); +typedef int (WINAPI *t_parse_girder_reg) (PCHAR orig, PCHAR szstore, int size); +typedef int (WINAPI *t_i18n_translate) (PCHAR orig, PCHAR szstore, int size); +typedef DWORD (WINAPI *t_get_osd_settings) (int setting); +typedef int (WINAPI *t_get_osd_fontname) (PCHAR szstore, int size); +typedef int (WINAPI *t_run_parser) (PCHAR str, int *error_value); +typedef int (WINAPI *t_get_int_var) (PCHAR name); +typedef double (WINAPI *t_get_double_var) (PCHAR name); +typedef int (WINAPI *t_get_string_var) (PCHAR name, PCHAR szstore, int size); +typedef int (WINAPI *t_set_int_var) (PCHAR name, int value); +typedef int (WINAPI *t_set_double_var) (PCHAR name, double value); +typedef int (WINAPI *t_set_string_var) (PCHAR name, PCHAR value); +typedef int (WINAPI *t_delete_var) (PCHAR name); +typedef void * (WINAPI *t_gir_malloc) (int size); +typedef void (WINAPI *t_gir_free) (void *data); +typedef int (WINAPI *t_send_event) (const char * eventstring, void *payload, int len, int device); +typedef int (WINAPI *t_trigger_command) (int command_id); + + +typedef void (WINAPI *t_target_callback_ex) (HWND hw, p_command command, void * data); +typedef void (WINAPI *t_target_enum_ex) (int id, t_target_callback_ex callback, void *data); // added user data +typedef PCHAR (WINAPI *t_open_script_editor) (HWND window, PCHAR script); // call from its own thread. free return pchar with gir_free. +typedef int (WINAPI *t_get_variable_type) (PCHAR name); // 1 = int, 2 = double, 3= string, -1 = does not exists. +typedef int (WINAPI *t_open_list_variables) ( ); // call to list all vars. +typedef int (WINAPI *t_get_first_variable) ( ); // move to the beginning of the list +typedef int (WINAPI *t_close_list_variables) ( ); // close the list var MUST DO! +typedef int (WINAPI *t_get_next_int_variable) (PCHAR name, int len, int value ); +typedef int (WINAPI *t_get_next_double_variable) (PCHAR name, int len, double value ); +typedef int (WINAPI *t_get_next_string_variable) (PCHAR name, int len, PCHAR value, int size ); +typedef int (WINAPI *t_set_variable_window) (HWND window, UINT msg, int add); // call this to be notified of variable changes. +typedef void * (WINAPI *t_get_script_state) (); // call this to get the lua/script state, CHECK IF RETURN VALUE IS NOT NULL!! +*/ + [StructLayout(LayoutKind.Sequential)] + struct GirApiFunctions + { + public int size; + public t_parse_girder_reg parse_reg_string; + public t_get_link_name get_link_name; + public t_set_command set_command; + public t_target_enum target_enum; + public t_realloc_pchar realloc_pchar; + public t_show_osd show_osd; + public t_hide_osd hide_osd; + public t_start_osd_draw start_osd_draw; + public t_stop_osd_draw stop_osd_draw; + public t_treepicker_show treepicker_show; + public t_register_cb register_cb; + public t_i18n_translate i18n_translate; + public t_get_osd_settings get_osd_settings; + public t_get_osd_fontname get_osd_font_name; + public t_gir_malloc gir_malloc; + public t_gir_free gir_free; + public t_get_int_var get_int_var; + public t_get_double_var get_double_var; + public t_get_string_var get_string_var; + public t_set_int_var set_int_var; + public t_set_double_var set_double_var; + public t_set_string_var set_string_var; + public t_delete_var delete_var; + public t_run_parser run_parser; + public t_send_event send_event; + public t_trigger_command trigger_command; + public IntPtr parent_hwnd; + + } + + [StructLayout(LayoutKind.Sequential)] + struct GirCommand + { + public Mutex critical_section; + public string name; + public int actiontype; + public int actionsubtype; + public string svalue1; + public string svalue2; + public string svalue3; + public int bvalue1; + public int bvalue2; + public int bvalue3; + public int ivalue1; + public int ivalue2; + public int ivalue3; + public int lvalue1; + public int lvalue2; + public int lvalue3; + public IntPtr binary; + public int size; + } + + #region Plugin functions + + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + delegate void gir_version([In, Out] StringBuilder version, int size); + + [UnmanagedFunctionPointer(CallingConventi... [truncated message content] |