From: <an...@us...> - 2008-01-24 12:42:44
|
Revision: 1305 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1305&view=rev Author: and-81 Date: 2008-01-24 04:41:12 -0800 (Thu, 24 Jan 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Commands/CommandProcessor/CommandProcessor.csproj trunk/plugins/IR Server Suite/Commands/CommandProcessor/Processor.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/GeneralCommands.csproj trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs trunk/plugins/IR Server Suite/Common/MPUtils/Forms/MPAction.cs trunk/plugins/IR Server Suite/Common/MPUtils/MPCommon.cs trunk/plugins/IR Server Suite/Common/MPUtils/MPUtils.csproj trunk/plugins/IR Server Suite/Documentation/new.html trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/MPBlastZonePlugin.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/MultiMapNameBox.Designer.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/MultiMapNameBox.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs Added Paths: ----------- trunk/plugins/IR Server Suite/Commands/CommandProcessor/Control Statements/CommandAbortMacro.cs trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.cs trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.designer.cs trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.resx trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandHibernate.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandLogOff.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandReboot.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandSendWOL.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandShutdown.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandStandBy.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.Designer.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.cs trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.resx trunk/plugins/IR Server Suite/Commands/GeneralCommands/Win32.cs trunk/plugins/IR Server Suite/Common/MPUtils/Forms/MPMessage.Designer.cs trunk/plugins/IR Server Suite/Common/MPUtils/Forms/MPMessage.cs trunk/plugins/IR Server Suite/Common/MPUtils/Forms/MPMessage.resx Modified: trunk/plugins/IR Server Suite/Commands/CommandProcessor/CommandProcessor.csproj =================================================================== --- trunk/plugins/IR Server Suite/Commands/CommandProcessor/CommandProcessor.csproj 2008-01-23 18:07:48 UTC (rev 1304) +++ trunk/plugins/IR Server Suite/Commands/CommandProcessor/CommandProcessor.csproj 2008-01-24 12:41:12 UTC (rev 1305) @@ -38,6 +38,13 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="Control Statements\CommandAbortMacro.cs" /> + <Compile Include="Forms\EditAbortMessage.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Forms\EditAbortMessage.designer.cs"> + <DependentUpon>EditAbortMessage.cs</DependentUpon> + </Compile> <Compile Include="MacroExecutionException.cs" /> <Compile Include="Maths Operations\CommandMathsSubtract.cs" /> <Compile Include="Maths Operations\CommandMathsMultiply.cs" /> @@ -145,6 +152,10 @@ </Compile> </ItemGroup> <ItemGroup> + <EmbeddedResource Include="Forms\EditAbortMessage.resx"> + <DependentUpon>EditAbortMessage.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> <EmbeddedResource Include="Forms\EditStackFile.resx"> <DependentUpon>EditStackFile.cs</DependentUpon> <SubType>Designer</SubType> Added: trunk/plugins/IR Server Suite/Commands/CommandProcessor/Control Statements/CommandAbortMacro.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/CommandProcessor/Control Statements/CommandAbortMacro.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/CommandProcessor/Control Statements/CommandAbortMacro.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace Commands +{ + + /// <summary> + /// Abort special command. + /// </summary> + public class CommandAbortMacro : Command + { + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="CommandAbortMacro"/> class. + /// </summary> + public CommandAbortMacro() { InitParameters(1); } + + /// <summary> + /// Initializes a new instance of the <see cref="CommandAbortMacro"/> class. + /// </summary> + /// <param name="parameters">The parameters.</param> + public CommandAbortMacro(string[] parameters) : base(parameters) { } + + #endregion Constructors + + #region Implementation + + /// <summary> + /// Gets the category of this command. + /// </summary> + /// <returns>The category of this command.</returns> + public override string GetCategory() { return Processor.CategoryControl; } + + /// <summary> + /// Gets the user interface text. + /// </summary> + /// <returns>User interface text.</returns> + public override string GetUserInterfaceText() { return "Abort Macro"; } + + /// <summary> + /// Gets the user display text. + /// </summary> + /// <returns>The user display text.</returns> + public override string GetUserDisplayText() + { + if (String.IsNullOrEmpty(Parameters[0])) + return GetUserInterfaceText(); + else + return String.Format("{0} \"{1}\"", GetUserInterfaceText(), Parameters[0]); + } + + /// <summary> + /// Edit this command. + /// </summary> + /// <param name="parent">The parent window.</param> + /// <returns><c>true</c> if the command was modified; otherwise <c>false</c>.</returns> + public override bool Edit(IWin32Window parent) + { + EditAbortMessage edit = new EditAbortMessage(Parameters[0]); + if (edit.ShowDialog(parent) == DialogResult.OK) + { + Parameters[0] = edit.AbortMessage; + return true; + } + + return false; + } + + /// <summary> + /// Execute this command. + /// </summary> + public override void Execute(VariableList variables) + { + if (String.IsNullOrEmpty(Parameters[0])) + throw new MacroExecutionException("Abort Macro Command"); + else + throw new MacroExecutionException("Abort Macro Command: " + Parameters[0]); + } + + #endregion Implementation + + } + +} Added: trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.IO; +using System.Text; +using System.Windows.Forms; + +namespace Commands +{ + + /// <summary> + /// Edit Abort Message form. + /// </summary> + partial class EditAbortMessage : Form + { + + #region Properties + + /// <summary> + /// Gets the abort message. + /// </summary> + /// <value>The abort message.</value> + public string AbortMessage + { + get + { + return textBoxMessage.Text.Trim(); + } + } + + #endregion Properties + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="EditAbortMessage"/> class. + /// </summary> + public EditAbortMessage() + { + InitializeComponent(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="EditAbortMessage"/> class. + /// </summary> + /// <param name="name">The existing label name.</param> + public EditAbortMessage(string name) + : this() + { + if (!String.IsNullOrEmpty(name)) + textBoxMessage.Text = name; + } + + #endregion + + #region Buttons + + private void buttonOK_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + #endregion Buttons + + } + +} Added: trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.designer.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,111 @@ +namespace Commands +{ + + partial class EditAbortMessage + { + + /// <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() + { + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonOK = new System.Windows.Forms.Button(); + this.labelMessage = new System.Windows.Forms.Label(); + this.textBoxMessage = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(320, 40); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(64, 24); + this.buttonCancel.TabIndex = 3; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_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(248, 40); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(64, 24); + this.buttonOK.TabIndex = 2; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // labelMessage + // + this.labelMessage.Location = new System.Drawing.Point(8, 8); + this.labelMessage.Name = "labelMessage"; + this.labelMessage.Size = new System.Drawing.Size(72, 20); + this.labelMessage.TabIndex = 0; + this.labelMessage.Text = "Message:"; + this.labelMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // textBoxMessage + // + this.textBoxMessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxMessage.Location = new System.Drawing.Point(80, 8); + this.textBoxMessage.Name = "textBoxMessage"; + this.textBoxMessage.Size = new System.Drawing.Size(304, 20); + this.textBoxMessage.TabIndex = 1; + // + // EditAbortMessage + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonCancel; + this.ClientSize = new System.Drawing.Size(392, 73); + this.Controls.Add(this.textBoxMessage); + this.Controls.Add(this.labelMessage); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(400, 100); + this.Name = "EditAbortMessage"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Abort Message"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Label labelMessage; + private System.Windows.Forms.TextBox textBoxMessage; + } + +} Added: trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.resx =================================================================== --- trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.resx (rev 0) +++ trunk/plugins/IR Server Suite/Commands/CommandProcessor/Forms/EditAbortMessage.resx 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,120 @@ +<?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> +</root> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Commands/CommandProcessor/Processor.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/CommandProcessor/Processor.cs 2008-01-23 18:07:48 UTC (rev 1304) +++ trunk/plugins/IR Server Suite/Commands/CommandProcessor/Processor.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -493,6 +493,7 @@ specialCommands.Add(typeof(CommandLabel)); specialCommands.Add(typeof(CommandGotoLabel)); specialCommands.Add(typeof(CommandSwitch)); + specialCommands.Add(typeof(CommandAbortMacro)); // Variable Commands ... specialCommands.Add(typeof(CommandSetVariable)); Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandHibernate.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandHibernate.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandHibernate.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace Commands.General +{ + + /// <summary> + /// Hibernate macro command. + /// </summary> + public class CommandHibernate : Command + { + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="CommandHibernate"/> class. + /// </summary> + public CommandHibernate() { InitParameters(0); } + + /// <summary> + /// Initializes a new instance of the <see cref="CommandHibernate"/> class. + /// </summary> + /// <param name="parameters">The parameters.</param> + public CommandHibernate(string[] parameters) : base(parameters) { } + + #endregion Constructors + + #region Implementation + + /// <summary> + /// Gets the category of this command. + /// </summary> + /// <returns>The category of this command.</returns> + public override string GetCategory() { return "General Commands"; } + + /// <summary> + /// Gets the user interface text. + /// </summary> + /// <returns>User interface text.</returns> + public override string GetUserInterfaceText() { return "Hibernate"; } + + /// <summary> + /// Execute this command. + /// </summary> + /// <param name="variables">The variable list of the calling code.</param> + public override void Execute(VariableList variables) + { + if (!Application.SetSuspendState(PowerState.Hibernate, false, false)) + throw new CommandExecutionException("Hibernate command refused"); + } + + #endregion Implementation + + } + +} Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandLogOff.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandLogOff.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandLogOff.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace Commands.General +{ + + /// <summary> + /// LogOff macro command. + /// </summary> + public class CommandLogOff : Command + { + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="CommandLogOff"/> class. + /// </summary> + public CommandLogOff() { InitParameters(0); } + + /// <summary> + /// Initializes a new instance of the <see cref="CommandLogOff"/> class. + /// </summary> + /// <param name="parameters">The parameters.</param> + public CommandLogOff(string[] parameters) : base(parameters) { } + + #endregion Constructors + + #region Implementation + + /// <summary> + /// Gets the category of this command. + /// </summary> + /// <returns>The category of this command.</returns> + public override string GetCategory() { return "General Commands"; } + + /// <summary> + /// Gets the user interface text. + /// </summary> + /// <returns>User interface text.</returns> + public override string GetUserInterfaceText() { return "LogOff"; } + + /// <summary> + /// Execute this command. + /// </summary> + /// <param name="variables">The variable list of the calling code.</param> + public override void Execute(VariableList variables) + { + if (!Win32.WindowsExit(Win32.ExitWindows.LogOff, Win32.ShutdownReasons.FlagUserDefined)) + throw new CommandExecutionException("LogOff command refused"); + } + + #endregion Implementation + + } + +} Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandReboot.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandReboot.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandReboot.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace Commands.General +{ + + /// <summary> + /// Reboot macro command. + /// </summary> + public class CommandReboot : Command + { + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="CommandReboot"/> class. + /// </summary> + public CommandReboot() { InitParameters(0); } + + /// <summary> + /// Initializes a new instance of the <see cref="CommandReboot"/> class. + /// </summary> + /// <param name="parameters">The parameters.</param> + public CommandReboot(string[] parameters) : base(parameters) { } + + #endregion Constructors + + #region Implementation + + /// <summary> + /// Gets the category of this command. + /// </summary> + /// <returns>The category of this command.</returns> + public override string GetCategory() { return "General Commands"; } + + /// <summary> + /// Gets the user interface text. + /// </summary> + /// <returns>User interface text.</returns> + public override string GetUserInterfaceText() { return "Reboot"; } + + /// <summary> + /// Execute this command. + /// </summary> + /// <param name="variables">The variable list of the calling code.</param> + public override void Execute(VariableList variables) + { + if (!Win32.WindowsExit(Win32.ExitWindows.Reboot, Win32.ShutdownReasons.FlagUserDefined)) + throw new CommandExecutionException("Shutdown command refused"); + } + + #endregion Implementation + + } + +} Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandSendWOL.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandSendWOL.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandSendWOL.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Windows.Forms; + +using IrssUtils; + +namespace Commands.General +{ + + /// <summary> + /// Send WakeOnLan general command. + /// </summary> + public class CommandSendWOL : Command + { + + #region Constants + + /// <summary> + /// WakeOnLan packet header. + /// </summary> + static readonly byte[] Header = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + + #endregion Constants + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="CommandSendWOL"/> class. + /// </summary> + public CommandSendWOL() { InitParameters(3); } + + /// <summary> + /// Initializes a new instance of the <see cref="CommandSendWOL"/> class. + /// </summary> + /// <param name="parameters">The parameters.</param> + public CommandSendWOL(string[] parameters) : base(parameters) { } + + #endregion Constructors + + #region Public Methods + + /// <summary> + /// Gets the category of this command. + /// </summary> + /// <returns>The category of this command.</returns> + public override string GetCategory() { return "General Commands"; } + + /// <summary> + /// Gets the user interface text. + /// </summary> + /// <returns>User interface text.</returns> + public override string GetUserInterfaceText() { return "Send WakeOnLan"; } + + /// <summary> + /// Gets the user display text. + /// </summary> + /// <returns>The user display text.</returns> + public override string GetUserDisplayText() + { + return String.Format("{0} ({1})", GetUserInterfaceText(), String.Join(", ", Parameters)); + } + + /// <summary> + /// Execute this command. + /// </summary> + /// <param name="variables">The variable list of the calling code.</param> + public override void Execute(VariableList variables) + { + string mac = Parameters[0]; + if (mac.StartsWith(VariableList.VariablePrefix, StringComparison.OrdinalIgnoreCase)) + mac = variables.VariableGet(mac); + mac = Common.ReplaceSpecial(mac); + + string port = Parameters[1]; + if (port.StartsWith(VariableList.VariablePrefix, StringComparison.OrdinalIgnoreCase)) + port = variables.VariableGet(port); + port = Common.ReplaceSpecial(port); + + string password = Parameters[2]; + if (!String.IsNullOrEmpty(password)) + { + if (password.StartsWith(VariableList.VariablePrefix, StringComparison.OrdinalIgnoreCase)) + password = variables.VariableGet(password); + password = Common.ReplaceSpecial(password); + } + + SendWOL(mac, int.Parse(port), password); + } + + /// <summary> + /// Edit this command. + /// </summary> + /// <param name="parent">The parent window.</param> + /// <returns><c>true</c> if the command was modified; otherwise <c>false</c>.</returns> + public override bool Edit(IWin32Window parent) + { + EditSendWOL edit = new EditSendWOL(Parameters); + if (edit.ShowDialog(parent) == DialogResult.OK) + { + Parameters = edit.Parameters; + return true; + } + + return false; + } + + #endregion Public Methods + + /// <summary> + /// Send a Wake On LAN packet. + /// </summary> + /// <param name="mac">The mac address.</param> + /// <param name="port">The destination port.</param> + /// <param name="password">Optional password. Must be null, 4 or 6 bytes.</param> + static void SendWOL(string mac, int port, string password) + { + // Convert mac address to byte[] + string[] macParts = mac.Split(new char[] { ':', '-', '.', ' ' }, StringSplitOptions.RemoveEmptyEntries); + if (macParts.Length != 6) + throw new ArgumentException("Not a valid mac address", "mac"); + + byte[] macAddress = new byte[macParts.Length]; + for (int index = 0; index < macAddress.Length; index++) + macAddress[index] = byte.Parse(macParts[5 - index], System.Globalization.NumberStyles.HexNumber); + + // Convert password to byte[] + byte[] pass = null; + if (!String.IsNullOrEmpty(password)) + pass = Encoding.ASCII.GetBytes(password); + + if (pass != null && pass.Length != 4 && pass.Length != 6) + throw new ArgumentException("Not a valid password (must be null, 4 or 6 bytes)", "password"); + + int packetLength = Header.Length + (16 * macAddress.Length); + if (pass != null) + packetLength += pass.Length; + + byte[] packet = new byte[packetLength]; + + // Packet Header ... + Buffer.BlockCopy(Header, 0, packet, 0, Header.Length); + + // MAC repeated 16 times ... + int offset = Header.Length; + for (int i = 0; i < 16; i++) + { + Buffer.BlockCopy(macAddress, 0, packet, offset, macAddress.Length); + offset += macAddress.Length; + } + + // Add password (optional) ... + if (pass != null) + Buffer.BlockCopy(pass, 0, packet, offset, pass.Length); + + // Create connection ... + UdpClient client = new UdpClient(); + client.Connect(IPAddress.Broadcast, port); + + // Send ... + client.Send(packet, packet.Length); + } + + } + +} Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandShutdown.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandShutdown.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandShutdown.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace Commands.General +{ + + /// <summary> + /// Shutdown macro command. + /// </summary> + public class CommandShutdown : Command + { + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="CommandShutdown"/> class. + /// </summary> + public CommandShutdown() { InitParameters(0); } + + /// <summary> + /// Initializes a new instance of the <see cref="CommandShutdown"/> class. + /// </summary> + /// <param name="parameters">The parameters.</param> + public CommandShutdown(string[] parameters) : base(parameters) { } + + #endregion Constructors + + #region Implementation + + /// <summary> + /// Gets the category of this command. + /// </summary> + /// <returns>The category of this command.</returns> + public override string GetCategory() { return "General Commands"; } + + /// <summary> + /// Gets the user interface text. + /// </summary> + /// <returns>User interface text.</returns> + public override string GetUserInterfaceText() { return "Shutdown"; } + + /// <summary> + /// Execute this command. + /// </summary> + /// <param name="variables">The variable list of the calling code.</param> + public override void Execute(VariableList variables) + { + if (!Win32.WindowsExit(Win32.ExitWindows.ShutDown, Win32.ShutdownReasons.FlagUserDefined)) + throw new CommandExecutionException("Shutdown command refused"); + } + + #endregion Implementation + + } + +} Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandStandBy.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandStandBy.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/CommandStandBy.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace Commands.General +{ + + /// <summary> + /// StandBy macro command. + /// </summary> + public class CommandStandBy : Command + { + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="CommandStandBy"/> class. + /// </summary> + public CommandStandBy() { InitParameters(0); } + + /// <summary> + /// Initializes a new instance of the <see cref="CommandStandBy"/> class. + /// </summary> + /// <param name="parameters">The parameters.</param> + public CommandStandBy(string[] parameters) : base(parameters) { } + + #endregion Constructors + + #region Implementation + + /// <summary> + /// Gets the category of this command. + /// </summary> + /// <returns>The category of this command.</returns> + public override string GetCategory() { return "General Commands"; } + + /// <summary> + /// Gets the user interface text. + /// </summary> + /// <returns>User interface text.</returns> + public override string GetUserInterfaceText() { return "StandBy"; } + + /// <summary> + /// Execute this command. + /// </summary> + /// <param name="variables">The variable list of the calling code.</param> + public override void Execute(VariableList variables) + { + if (!Application.SetSuspendState(PowerState.Suspend, false, false)) + throw new CommandExecutionException("StandBy command refused"); + } + + #endregion Implementation + + } + +} Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.Designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.Designer.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,184 @@ +namespace Commands.General +{ + + partial class EditSendWOL + { + + /// <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() + { + this.components = new System.ComponentModel.Container(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonOK = new System.Windows.Forms.Button(); + this.labelMac = new System.Windows.Forms.Label(); + this.textBoxMac = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.numericUpDownPort = new System.Windows.Forms.NumericUpDown(); + this.labelPassword = new System.Windows.Forms.Label(); + this.textBoxPassword = new System.Windows.Forms.TextBox(); + this.toolTips = new System.Windows.Forms.ToolTip(this.components); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPort)).BeginInit(); + this.SuspendLayout(); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(176, 104); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(64, 24); + this.buttonCancel.TabIndex = 3; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_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(104, 104); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(64, 24); + this.buttonOK.TabIndex = 2; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // labelMac + // + this.labelMac.Location = new System.Drawing.Point(8, 8); + this.labelMac.Name = "labelMac"; + this.labelMac.Size = new System.Drawing.Size(88, 20); + this.labelMac.TabIndex = 0; + this.labelMac.Text = "MAC Address:"; + this.labelMac.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // textBoxMac + // + this.textBoxMac.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxMac.Location = new System.Drawing.Point(96, 8); + this.textBoxMac.Name = "textBoxMac"; + this.textBoxMac.Size = new System.Drawing.Size(144, 20); + this.textBoxMac.TabIndex = 4; + this.textBoxMac.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTips.SetToolTip(this.textBoxMac, "MAC Address of machine to wake"); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 40); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(88, 20); + this.label1.TabIndex = 5; + this.label1.Text = "Port:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // numericUpDownPort + // + this.numericUpDownPort.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.numericUpDownPort.Location = new System.Drawing.Point(96, 40); + this.numericUpDownPort.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.numericUpDownPort.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownPort.Name = "numericUpDownPort"; + this.numericUpDownPort.Size = new System.Drawing.Size(144, 20); + this.numericUpDownPort.TabIndex = 6; + this.numericUpDownPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTips.SetToolTip(this.numericUpDownPort, "WakeOnLan port (default: 9)"); + this.numericUpDownPort.Value = new decimal(new int[] { + 9, + 0, + 0, + 0}); + // + // labelPassword + // + this.labelPassword.Location = new System.Drawing.Point(8, 72); + this.labelPassword.Name = "labelPassword"; + this.labelPassword.Size = new System.Drawing.Size(88, 20); + this.labelPassword.TabIndex = 7; + this.labelPassword.Text = "Password:"; + this.labelPassword.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // textBoxPassword + // + this.textBoxPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxPassword.Location = new System.Drawing.Point(96, 72); + this.textBoxPassword.Name = "textBoxPassword"; + this.textBoxPassword.Size = new System.Drawing.Size(144, 20); + this.textBoxPassword.TabIndex = 8; + this.textBoxPassword.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTips.SetToolTip(this.textBoxPassword, "Optional password (either 4 or 6 charactors)"); + // + // EditSendWOL + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonCancel; + this.ClientSize = new System.Drawing.Size(248, 137); + this.Controls.Add(this.textBoxPassword); + this.Controls.Add(this.labelPassword); + this.Controls.Add(this.numericUpDownPort); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBoxMac); + this.Controls.Add(this.labelMac); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.buttonCancel); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(256, 164); + this.Name = "EditSendWOL"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Wake On Lan Command"; + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPort)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Label labelMac; + private System.Windows.Forms.TextBox textBoxMac; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown numericUpDownPort; + private System.Windows.Forms.Label labelPassword; + private System.Windows.Forms.TextBox textBoxPassword; + private System.Windows.Forms.ToolTip toolTips; + } + +} Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using IrssUtils; + +namespace Commands.General +{ + + /// <summary> + /// Edit Send WOL Command form. + /// </summary> + partial class EditSendWOL : Form + { + + #region Properties + + /// <summary> + /// Gets the command parameters. + /// </summary> + /// <value>The command parameters.</value> + public string[] Parameters + { + get + { + return new string[] { + textBoxMac.Text.Trim(), + numericUpDownPort.Value.ToString(), + textBoxPassword.Text.Trim() + }; + } + } + + #endregion Properties + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="EditSendWOL"/> class. + /// </summary> + /// <param name="parameters">The command parameters.</param> + public EditSendWOL(string[] parameters) + { + InitializeComponent(); + + textBoxMac.Text = parameters[0]; + if (!String.IsNullOrEmpty(parameters[1])) + numericUpDownPort.Value = Decimal.Parse(parameters[1]); + textBoxPassword.Text = parameters[2]; + } + + #endregion + + #region Buttons + + private void buttonOK_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + #endregion Buttons + + } + +} Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.resx =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.resx (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/EditSendWOL.resx 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,123 @@ +<?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="toolTips.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Commands/GeneralCommands/GeneralCommands.csproj =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/GeneralCommands.csproj 2008-01-23 18:07:48 UTC (rev 1304) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/GeneralCommands.csproj 2008-01-24 12:41:12 UTC (rev 1305) @@ -38,7 +38,19 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="CommandHibernate.cs" /> <Compile Include="CommandKeystrokes.cs" /> + <Compile Include="CommandReboot.cs" /> + <Compile Include="CommandShutdown.cs" /> + <Compile Include="CommandStandBy.cs" /> + <Compile Include="CommandLogOff.cs" /> + <Compile Include="CommandSendWOL.cs" /> + <Compile Include="EditSendWOL.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="EditSendWOL.Designer.cs"> + <DependentUpon>EditSendWOL.cs</DependentUpon> + </Compile> <Compile Include="EditKeystrokes.cs"> <SubType>Form</SubType> </Compile> @@ -46,6 +58,7 @@ <DependentUpon>EditKeystrokes.cs</DependentUpon> </Compile> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Win32.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\Common\IrssUtils\IrssUtils.csproj"> @@ -65,6 +78,10 @@ </ProjectReference> </ItemGroup> <ItemGroup> + <EmbeddedResource Include="EditSendWOL.resx"> + <DependentUpon>EditSendWOL.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> <EmbeddedResource Include="EditKeystrokes.resx"> <DependentUpon>EditKeystrokes.cs</DependentUpon> <SubType>Designer</SubType> Added: trunk/plugins/IR Server Suite/Commands/GeneralCommands/Win32.cs =================================================================== --- trunk/plugins/IR Server Suite/Commands/GeneralCommands/Win32.cs (rev 0) +++ trunk/plugins/IR Server Suite/Commands/GeneralCommands/Win32.cs 2008-01-24 12:41:12 UTC (rev 1305) @@ -0,0 +1,2339 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Text; + +namespace Commands.General +{ + + /// <summary> + /// Win32 native method class. + /// </summary> + [CLSCompliant(false)] + public static class Win32 + { + + #region Constants + + /// <summary> + /// Maximum length of unmanaged Windows Path strings. + /// </summary> + const int MAX_PATH = 260; + + /// <summary> + /// Maximum length of unmanaged Typename. + /// </summary> + const int MAX_TYPE = 80; + + + const int GCL_HICON = -14; + const int GCL_HICONSM = -34; + + + const int ICON_SMALL = 0; + const int ICON_BIG = 1; + + const int WPF_RESTORETOMAXIMIZED = 2; + + const int MINIMIZE_ALL = 419; + const int MINIMIZE_ALL_UNDO = 416; + + #endregion Constants + + #region Enumerations + + [Flags] + enum SHGFI + { + /// <summary>get icon</summary> + Icon = 0x000000100, + /// <summary>get display name</summary> + DisplayName = 0x000000200, + /// <summary>get type name</summary> + TypeName = 0x000000400, + /// <summary>get attributes</summary> + Attributes = 0x000000800, + /// <summary>get icon location</summary> + IconLocation = 0x000001000, + /// <summary>return exe type</summary> + ExeType = 0x000002000, + /// <summary>get system icon index</summary> + SysIconIndex = 0x000004000, + /// <summary>put a link overlay on icon</summary> + LinkOverlay = 0x000008000, + /// <summary>show icon in selected state</summary> + Selected = 0x000010000, + /// <summary>get only specified attributes</summary> + Attr_Specified = 0x000020000, + /// <summary>get large icon</summary> + LargeIcon = 0x000000000, + /// <summary>get small icon</summary> + SmallIcon = 0x000000001, + /// <summary>get open icon</summary> + OpenIcon = 0x000000002, + /// <summary>get shell size icon</summary> + ShellIconSize = 0x000000004, + /// <summary>pszPath is a pidl</summary> + PIDL = 0x000000008, + /// <summary>use passed dwFileAttribute</summary> + UseFileAttributes = 0x000000010, + /// <summary>apply the appropriate overlays</summary> + AddOverlays = 0x000000020, + /// <summary>Get the index of the overlay in the upper 8 bits of the iIcon</summary> + OverlayIndex = 0x000000040, + } + + /// <summary> + /// Windows Message types. + /// </summary> + public enum WindowsMessage + { + /// <summary> + /// WM_ACTIVATE + /// </summary> + WM_ACTIVATE = 0x6, + /// <summary> + /// WM_ACTIVATEAPP + /// </summary> + WM_ACTIVATEAPP = 0x1C, + /// <summary> + /// WM_AFXFIRST + /// </summary> + WM_AFXFIRST = 0x360, + /// <summary> + /// WM_AFXLAST + /// </summary> + WM_AFXLAST = 0x37F, + /// <summary> + /// WM_APP + /// </summary> + WM_APP = 0x8000, + /// <summary> + /// WM_APPCOMMAND + /// </summary> + WM_APPCOMMAND = 0x319, + /// <summary> + /// WM_ASKCBFORMATNAME + /// </summary> + WM_ASKCBFORMATNAME = 0x30C, + /// <summary> + /// WM_CANCELJOURNAL + /// </summary> + WM_CANCELJOURNAL = 0x4B, + /// <summary> + /// WM_CANCELMODE + /// </summary> + WM_CANCELMODE = 0x1F, + /// <summary> + /// WM_CAPTURECHANGED + /// </summary> + WM_CAPTURECHANGED = 0x215, + /// <summary> + /// WM_CHANGECBCHAIN + /// </summary> + WM_CHANGECBCHAIN = 0x30D, + /// <summary> + /// WM_CHAR + /// </summary> + WM_CHAR = 0x102, + /// <summary> + /// + /// </summary> + WM_CHARTOITEM = 0x2F, + /// <summary> + /// + /// </summary> + WM_CHILDACTIVATE = 0x22, + /// <summary> + /// + /// </summary> + WM_CLEAR = 0x303, + /// <summary> + /// + /// </summary> + WM_CLOSE = 0x10, + /// <summary> + /// + /// </summary> + WM_COMMAND = 0x111, + /// <summary> + /// + /// </summary> + WM_COMPACTING = 0x41, + /// <summary> + /// + /// </summary> + WM_COMPAREITEM = 0x39, + /// <summary> + /// + /// </summary> + WM_CONTEXTMENU = 0x7B, + /// <summary> + /// + /// </summary> + WM_COPY = 0x301, + /// <summary> + /// + /// </summary> + WM_COPYDATA = 0x4A, + /// <summary> + /// + /// </summary> + WM_CREATE = 0x1, + /// <summary> + /// + /// </summary> + WM_CTLCOLORBTN = 0x135, + /// <summary> + /// + /// </summary> + WM_CTLCOLORDLG = 0x136, + /// <summary> + /// + /// </summary> + WM_CTLCOLOREDIT = 0x133, + /// <summary> + /// + /// </summary> + WM_CTLCOLORLISTBOX = 0x134, + /// <summary> + /// + /// </summary> + ... [truncated message content] |