From: <an...@us...> - 2007-12-11 07:00:40
|
Revision: 1142 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1142&view=rev Author: and-81 Date: 2007-12-10 23:00:22 -0800 (Mon, 10 Dec 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs trunk/plugins/IR Server Suite/Applications/Translator/Program.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/SmsKeyboard.Designer.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/SmsKeyboard.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/VirtualKeyboard.Designer.cs trunk/plugins/IR Server Suite/Common/IrssUtils/IrssUtils.csproj trunk/plugins/IR Server Suite/Common/MPUtils/Forms/GoToScreen.cs trunk/plugins/IR Server Suite/Common/MPUtils/MPUtils.csproj trunk/plugins/IR Server Suite/IR Server Suite.sln 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/Forms/SetupForm.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/SetupForm.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/Forms/SetupForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2 Blaster Plugin.csproj trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/PluginSetup.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/TV3 Blaster Plugin.csproj trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/TV3BlasterPlugin.cs trunk/plugins/MCEReplacement/Forms/MacroEditor.cs trunk/plugins/MCEReplacement/Forms/SetupForm.cs trunk/plugins/MCEReplacement/MCEReplacement.cs trunk/plugins/MCEReplacement/MCEReplacement.csproj trunk/plugins/MCEReplacementTray/MCEReplacementTray.csproj Added Paths: ----------- trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/BeepCommand.Designer.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/BeepCommand.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/BeepCommand.resx trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/ trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/0.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/1.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/2.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/3.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/4.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/5.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/6.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/7.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/8.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/9.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C/OK.IR trunk/plugins/IR Server Suite/Set Top Boxes/ADB SCV-3800C.xml Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs 2007-12-10 13:54:01 UTC (rev 1141) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs 2007-12-11 07:00:22 UTC (rev 1142) @@ -63,10 +63,16 @@ comboBoxCommands.Items.Add(Common.UITextSerial); comboBoxCommands.Items.Add(Common.UITextWindowMsg); comboBoxCommands.Items.Add(Common.UITextTcpMsg); + comboBoxCommands.Items.Add(Common.UITextHttpMsg); comboBoxCommands.Items.Add(Common.UITextKeys); comboBoxCommands.Items.Add(Common.UITextMouse); comboBoxCommands.Items.Add(Common.UITextEject); comboBoxCommands.Items.Add(Common.UITextPopup); + comboBoxCommands.Items.Add(Common.UITextVirtualKB); + comboBoxCommands.Items.Add(Common.UITextSmsKB); + comboBoxCommands.Items.Add(Common.UITextBeep); + comboBoxCommands.Items.Add(Common.UITextSound); + comboBoxCommands.Items.Add(Common.UITextDisplay); comboBoxCommands.Items.Add(Common.UITextStandby); comboBoxCommands.Items.Add(Common.UITextHibernate); comboBoxCommands.Items.Add(Common.UITextReboot); @@ -92,99 +98,17 @@ using (XmlTextWriter writer = new XmlTextWriter(fileName, Encoding.UTF8)) { writer.Formatting = Formatting.Indented; - writer.Indentation = 1; - writer.IndentChar = (char)9; writer.WriteStartDocument(true); - writer.WriteStartElement("macro"); // <macro> + writer.WriteStartElement("macro"); foreach (string item in listBoxMacro.Items) { - writer.WriteStartElement("action"); - - if (item.StartsWith(Common.CmdPrefixMacro, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagMacro); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixMacro.Length)); - } - else if (item.StartsWith(Common.CmdPrefixBlast, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagBlast); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixBlast.Length)); - } - else if (item.StartsWith(Common.CmdPrefixPause, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagPause); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixPause.Length)); - } - else if (item.StartsWith(Common.CmdPrefixRun, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagRun); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixRun.Length)); - } - else if (item.StartsWith(Common.CmdPrefixSerial, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagSerial); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixSerial.Length)); - } - else if (item.StartsWith(Common.CmdPrefixWindowMsg, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagWindowMsg); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixWindowMsg.Length)); - } - else if (item.StartsWith(Common.CmdPrefixTcpMsg, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagTcpMsg); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixTcpMsg.Length)); - } - else if (item.StartsWith(Common.CmdPrefixKeys, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagKeys); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixKeys.Length)); - } - else if (item.StartsWith(Common.CmdPrefixMouse, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagMouse); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixMouse.Length)); - } - else if (item.StartsWith(Common.CmdPrefixEject, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagEject); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixEject.Length)); - } - else if (item.StartsWith(Common.CmdPrefixPopup, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagPopup); - writer.WriteAttributeString("cmdproperty", item.Substring(Common.CmdPrefixPopup.Length)); - } - else if (item.StartsWith(Common.CmdPrefixStandby, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagStandby); - writer.WriteAttributeString("cmdproperty", String.Empty); - } - else if (item.StartsWith(Common.CmdPrefixHibernate, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagHibernate); - writer.WriteAttributeString("cmdproperty", String.Empty); - } - else if (item.StartsWith(Common.CmdPrefixReboot, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagReboot); - writer.WriteAttributeString("cmdproperty", String.Empty); - } - else if (item.StartsWith(Common.CmdPrefixShutdown, StringComparison.OrdinalIgnoreCase)) - { - writer.WriteAttributeString("command", Common.XmlTagShutdown); - writer.WriteAttributeString("cmdproperty", String.Empty); - } - else - { - IrssLog.Error("Cannot write unknown macro item ({0}) to file ({1}).", item, fileName); - } - + writer.WriteStartElement("item"); + writer.WriteAttributeString("command", item); writer.WriteEndElement(); } - writer.WriteEndElement(); // </macro> + writer.WriteEndElement(); writer.WriteEndDocument(); } } @@ -205,78 +129,12 @@ XmlDocument doc = new XmlDocument(); doc.Load(fileName); + XmlNodeList commandSequence = doc.DocumentElement.SelectNodes("item"); + listBoxMacro.Items.Clear(); - XmlNodeList commandSequence = doc.DocumentElement.SelectNodes("action"); - - string commandProperty; foreach (XmlNode item in commandSequence) - { - commandProperty = item.Attributes["cmdproperty"].Value; - - switch (item.Attributes["command"].Value) - { - case Common.XmlTagMacro: - listBoxMacro.Items.Add(Common.CmdPrefixMacro + commandProperty); - break; - - case Common.XmlTagBlast: - listBoxMacro.Items.Add(Common.CmdPrefixBlast + commandProperty); - break; - - case Common.XmlTagPause: - listBoxMacro.Items.Add(Common.CmdPrefixPause + commandProperty); - break; - - case Common.XmlTagRun: - listBoxMacro.Items.Add(Common.CmdPrefixRun + commandProperty); - break; - - case Common.XmlTagSerial: - listBoxMacro.Items.Add(Common.CmdPrefixSerial + commandProperty); - break; - - case Common.XmlTagWindowMsg: - listBoxMacro.Items.Add(Common.CmdPrefixWindowMsg + commandProperty); - break; - - case Common.XmlTagTcpMsg: - listBoxMacro.Items.Add(Common.CmdPrefixTcpMsg + commandProperty); - break; - - case Common.XmlTagKeys: - listBoxMacro.Items.Add(Common.CmdPrefixKeys + commandProperty); - break; - - case Common.XmlTagMouse: - listBoxMacro.Items.Add(Common.CmdPrefixMouse + commandProperty); - break; - - case Common.XmlTagEject: - listBoxMacro.Items.Add(Common.CmdPrefixEject + commandProperty); - break; - - case Common.XmlTagPopup: - listBoxMacro.Items.Add(Common.CmdPrefixPopup + commandProperty); - break; - - case Common.XmlTagStandby: - listBoxMacro.Items.Add(Common.CmdPrefixStandby); - break; - - case Common.XmlTagHibernate: - listBoxMacro.Items.Add(Common.CmdPrefixHibernate); - break; - - case Common.XmlTagReboot: - listBoxMacro.Items.Add(Common.CmdPrefixReboot); - break; - - case Common.XmlTagShutdown: - listBoxMacro.Items.Add(Common.CmdPrefixShutdown); - break; - } - } + listBoxMacro.Items.Add(item.Attributes["command"].Value); } catch (Exception ex) { @@ -294,97 +152,146 @@ if (comboBoxCommands.SelectedIndex == -1) return; - string selected = comboBoxCommands.SelectedItem as string; - - if (selected.Equals(Common.UITextRun, StringComparison.OrdinalIgnoreCase)) + try { - ExternalProgram externalProgram = new ExternalProgram(true); - if (externalProgram.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixRun + externalProgram.CommandString); - } - else if (selected.Equals(Common.UITextPause, StringComparison.OrdinalIgnoreCase)) - { - PauseTime pauseTime = new PauseTime(); - if (pauseTime.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixPause + pauseTime.Time.ToString()); - } - else if (selected.Equals(Common.UITextSerial, StringComparison.OrdinalIgnoreCase)) - { - SerialCommand serialCommand = new SerialCommand(); - if (serialCommand.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixSerial + serialCommand.CommandString); - } - else if (selected.Equals(Common.UITextWindowMsg, StringComparison.OrdinalIgnoreCase)) - { - MessageCommand messageCommand = new MessageCommand(); - if (messageCommand.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixWindowMsg + messageCommand.CommandString); - } - else if (selected.Equals(Common.UITextTcpMsg, StringComparison.OrdinalIgnoreCase)) - { - TcpMessageCommand tcpMessageCommand = new TcpMessageCommand(); - if (tcpMessageCommand.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixTcpMsg + tcpMessageCommand.CommandString); - } - else if (selected.Equals(Common.UITextKeys, StringComparison.OrdinalIgnoreCase)) - { - KeysCommand keysCommand = new KeysCommand(); - if (keysCommand.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixKeys + keysCommand.CommandString); - } - else if (selected.Equals(Common.UITextMouse, StringComparison.OrdinalIgnoreCase)) - { - MouseCommand mouseCommand = new MouseCommand(); - if (mouseCommand.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixMouse + mouseCommand.CommandString); - } - else if (selected.Equals(Common.UITextEject, StringComparison.OrdinalIgnoreCase)) - { - EjectCommand ejectCommand = new EjectCommand(); - if (ejectCommand.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixEject + ejectCommand.CommandString); - } - else if (selected.Equals(Common.UITextPopup, StringComparison.OrdinalIgnoreCase)) - { - PopupMessage popupMessage = new PopupMessage(); - if (popupMessage.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixPopup + popupMessage.CommandString); - } - else if (selected.Equals(Common.UITextStandby, StringComparison.OrdinalIgnoreCase)) - { - listBoxMacro.Items.Add(Common.CmdPrefixStandby); - } - else if (selected.Equals(Common.UITextHibernate, StringComparison.OrdinalIgnoreCase)) - { - listBoxMacro.Items.Add(Common.CmdPrefixHibernate); - } - else if (selected.Equals(Common.UITextReboot, StringComparison.OrdinalIgnoreCase)) - { - listBoxMacro.Items.Add(Common.CmdPrefixReboot); - } - else if (selected.Equals(Common.UITextShutdown, StringComparison.OrdinalIgnoreCase)) - { - listBoxMacro.Items.Add(Common.CmdPrefixShutdown); - } - else if (selected.StartsWith(Common.CmdPrefixBlast, StringComparison.OrdinalIgnoreCase)) - { - BlastCommand blastCommand = new BlastCommand( - new BlastIrDelegate(Program.BlastIR), - Common.FolderIRCommands, - Program.TransceiverInformation.Ports, - selected.Substring(Common.CmdPrefixBlast.Length)); + string selected = comboBoxCommands.SelectedItem as string; + string newCommand = null; - if (blastCommand.ShowDialog(this) == DialogResult.OK) - listBoxMacro.Items.Add(Common.CmdPrefixBlast + blastCommand.CommandString); + if (selected.Equals(Common.UITextRun, StringComparison.OrdinalIgnoreCase)) + { + ExternalProgram externalProgram = new ExternalProgram(); + if (externalProgram.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixRun + externalProgram.CommandString; + } + else if (selected.Equals(Common.UITextPause, StringComparison.OrdinalIgnoreCase)) + { + PauseTime pauseTime = new PauseTime(); + if (pauseTime.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixPause + pauseTime.Time.ToString(); + } + else if (selected.Equals(Common.UITextSerial, StringComparison.OrdinalIgnoreCase)) + { + SerialCommand serialCommand = new SerialCommand(); + if (serialCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixSerial + serialCommand.CommandString; + } + else if (selected.Equals(Common.UITextWindowMsg, StringComparison.OrdinalIgnoreCase)) + { + MessageCommand messageCommand = new MessageCommand(); + if (messageCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixWindowMsg + messageCommand.CommandString; + } + else if (selected.Equals(Common.UITextTcpMsg, StringComparison.OrdinalIgnoreCase)) + { + TcpMessageCommand tcpMessageCommand = new TcpMessageCommand(); + if (tcpMessageCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixTcpMsg + tcpMessageCommand.CommandString; + } + else if (selected.Equals(Common.UITextHttpMsg, StringComparison.OrdinalIgnoreCase)) + { + /* + HttpMessageCommand httpMessageCommand = new HttpMessageCommand(); + if (httpMessageCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixHttpMsg + httpMessageCommand.CommandString; + */ + } + else if (selected.Equals(Common.UITextKeys, StringComparison.OrdinalIgnoreCase)) + { + KeysCommand keysCommand = new KeysCommand(); + if (keysCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixKeys + keysCommand.CommandString; + } + else if (selected.Equals(Common.UITextMouse, StringComparison.OrdinalIgnoreCase)) + { + MouseCommand mouseCommand = new MouseCommand(); + if (mouseCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixMouse + mouseCommand.CommandString; + } + else if (selected.Equals(Common.UITextEject, StringComparison.OrdinalIgnoreCase)) + { + EjectCommand ejectCommand = new EjectCommand(); + if (ejectCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixEject + ejectCommand.CommandString; + } + else if (selected.Equals(Common.UITextPopup, StringComparison.OrdinalIgnoreCase)) + { + PopupMessage popupMessage = new PopupMessage(); + if (popupMessage.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixPopup + popupMessage.CommandString; + } + else if (selected.Equals(Common.UITextVirtualKB, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixVirtualKB; + } + else if (selected.Equals(Common.UITextSmsKB, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixSmsKB; + } + else if (selected.Equals(Common.UITextBeep, StringComparison.OrdinalIgnoreCase)) + { + BeepCommand beepCommand = new BeepCommand(); + if (beepCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixBeep + beepCommand.CommandString; + } + else if (selected.Equals(Common.UITextSound, StringComparison.OrdinalIgnoreCase)) + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Filter = "Wave Files|*.WAV"; + openFileDialog.Multiselect = false; + + if (openFileDialog.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixSound + openFileDialog.FileName; + } + else if (selected.Equals(Common.UITextDisplay, StringComparison.OrdinalIgnoreCase)) + { + DisplayModeCommand displayModeCommand = new DisplayModeCommand(); + if (displayModeCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixDisplay + displayModeCommand.CommandString; + } + else if (selected.Equals(Common.UITextStandby, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixStandby; + } + else if (selected.Equals(Common.UITextHibernate, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixHibernate; + } + else if (selected.Equals(Common.UITextReboot, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixReboot; + } + else if (selected.Equals(Common.UITextShutdown, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixShutdown; + } + else if (selected.StartsWith(Common.CmdPrefixBlast, StringComparison.OrdinalIgnoreCase)) + { + BlastCommand blastCommand = new BlastCommand( + new BlastIrDelegate(Program.BlastIR), + Common.FolderIRCommands, + Program.TransceiverInformation.Ports, + selected.Substring(Common.CmdPrefixBlast.Length)); + + if (blastCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixBlast + blastCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixMacro, StringComparison.OrdinalIgnoreCase)) + { + newCommand = selected; + } + else + { + throw new ApplicationException(String.Format("Unknown command in macro command list \"{0}\"", selected)); + } + + if (!String.IsNullOrEmpty(newCommand)) + listBoxMacro.Items.Add(newCommand); } - else if (selected.StartsWith(Common.CmdPrefixMacro, StringComparison.OrdinalIgnoreCase)) + catch (Exception ex) { - listBoxMacro.Items.Add(selected); + IrssLog.Error(ex.ToString()); + MessageBox.Show(this, ex.Message, "Failed to add macro command", MessageBoxButtons.OK, MessageBoxIcon.Error); } - else - { - throw new ApplicationException(String.Format("Unknown command in macro command list \"{0}\"", selected)); - } } private void buttonMoveUp_Click(object sender, EventArgs e) @@ -434,16 +341,15 @@ return; } - string fileName = Program.FolderMacros + name + Common.FileExtensionMacro; - - WriteToFile(fileName); - try { + WriteToFile(Program.FolderMacros + name + Common.FileExtensionMacro); + Program.ProcessCommand(Common.CmdPrefixMacro + name, false); } catch (Exception ex) { + IrssLog.Error(ex.ToString()); MessageBox.Show(this, ex.Message, "Test failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -472,10 +378,16 @@ return; } - string fileName = Program.FolderMacros + name + Common.FileExtensionMacro; + try + { + WriteToFile(Program.FolderMacros + name + Common.FileExtensionMacro); + } + catch (Exception ex) + { + IrssLog.Error(ex.ToString()); + MessageBox.Show(this, ex.Message, "Failed writing macro to file", MessageBoxButtons.OK, MessageBoxIcon.Error); + } - WriteToFile(fileName); - this.DialogResult = DialogResult.OK; this.Close(); } @@ -485,132 +397,137 @@ if (listBoxMacro.SelectedIndex == -1) return; - string selected = listBoxMacro.SelectedItem as string; - - if (selected.StartsWith(Common.CmdPrefixPause, StringComparison.OrdinalIgnoreCase)) + try { - PauseTime pauseTime = new PauseTime(int.Parse(selected.Substring(Common.CmdPrefixPause.Length))); - if (pauseTime.ShowDialog(this) == DialogResult.Cancel) - return; + string selected = listBoxMacro.SelectedItem as string; + string newCommand = null; - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixPause + pauseTime.Time.ToString()); - listBoxMacro.SelectedIndex = index; - } - else if (selected.StartsWith(Common.CmdPrefixRun, StringComparison.OrdinalIgnoreCase)) - { - string[] commands = Common.SplitRunCommand(selected.Substring(Common.CmdPrefixRun.Length)); + if (selected.StartsWith(Common.CmdPrefixRun, StringComparison.OrdinalIgnoreCase)) + { + string[] commands = Common.SplitRunCommand(selected.Substring(Common.CmdPrefixRun.Length)); - ExternalProgram executeProgram = new ExternalProgram(commands, true); - if (executeProgram.ShowDialog(this) == DialogResult.Cancel) - return; + ExternalProgram executeProgram = new ExternalProgram(commands); + if (executeProgram.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixRun + executeProgram.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixPause, StringComparison.OrdinalIgnoreCase)) + { + PauseTime pauseTime = new PauseTime(int.Parse(selected.Substring(Common.CmdPrefixPause.Length))); + if (pauseTime.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixPause + pauseTime.Time.ToString(); + } + else if (selected.StartsWith(Common.CmdPrefixSerial, StringComparison.OrdinalIgnoreCase)) + { + string[] commands = Common.SplitSerialCommand(selected.Substring(Common.CmdPrefixSerial.Length)); - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixRun + executeProgram.CommandString); - listBoxMacro.SelectedIndex = index; - } - else if (selected.StartsWith(Common.CmdPrefixSerial, StringComparison.OrdinalIgnoreCase)) - { - string[] commands = Common.SplitSerialCommand(selected.Substring(Common.CmdPrefixSerial.Length)); + SerialCommand serialCommand = new SerialCommand(commands); + if (serialCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixSerial + serialCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixWindowMsg, StringComparison.OrdinalIgnoreCase)) + { + string[] commands = Common.SplitWindowMessageCommand(selected.Substring(Common.CmdPrefixWindowMsg.Length)); - SerialCommand serialCommand = new SerialCommand(commands); - if (serialCommand.ShowDialog(this) == DialogResult.Cancel) - return; + MessageCommand messageCommand = new MessageCommand(commands); + if (messageCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixWindowMsg + messageCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixTcpMsg, StringComparison.OrdinalIgnoreCase)) + { + string[] commands = Common.SplitTcpMessageCommand(selected.Substring(Common.CmdPrefixTcpMsg.Length)); - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixSerial + serialCommand.CommandString); - listBoxMacro.SelectedIndex = index; - } - else if (selected.StartsWith(Common.CmdPrefixWindowMsg, StringComparison.OrdinalIgnoreCase)) - { - string[] commands = Common.SplitWindowMessageCommand(selected.Substring(Common.CmdPrefixWindowMsg.Length)); + TcpMessageCommand tcpMessageCommand = new TcpMessageCommand(commands); + if (tcpMessageCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixTcpMsg + tcpMessageCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixHttpMsg, StringComparison.OrdinalIgnoreCase)) + { + /* + string[] commands = Common.SplitHttpMessageCommand(selected.Substring(Common.CmdPrefixHttpMsg.Length)); + + HttpMessageCommand httpMessageCommand = new HttpMessageCommand(commands); + if (httpMessageCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixHttpMsg + httpMessageCommand.CommandString; + */ + } + else if (selected.StartsWith(Common.CmdPrefixKeys, StringComparison.OrdinalIgnoreCase)) + { + KeysCommand keysCommand = new KeysCommand(selected.Substring(Common.CmdPrefixKeys.Length)); + if (keysCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixKeys + keysCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixMouse, StringComparison.OrdinalIgnoreCase)) + { + MouseCommand mouseCommand = new MouseCommand(selected.Substring(Common.CmdPrefixMouse.Length)); + if (mouseCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixMouse + mouseCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixEject, StringComparison.OrdinalIgnoreCase)) + { + EjectCommand ejectCommand = new EjectCommand(selected.Substring(Common.CmdPrefixEject.Length)); + if (ejectCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixEject + ejectCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixPopup, StringComparison.OrdinalIgnoreCase)) + { + string[] commands = Common.SplitPopupCommand(selected.Substring(Common.CmdPrefixPopup.Length)); - MessageCommand messageCommand = new MessageCommand(commands); - if (messageCommand.ShowDialog(this) == DialogResult.Cancel) - return; + PopupMessage popupMessage = new PopupMessage(commands); + if (popupMessage.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixPopup + popupMessage.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixBeep, StringComparison.OrdinalIgnoreCase)) + { + string[] commands = Common.SplitBeepCommand(selected.Substring(Common.CmdPrefixBeep.Length)); - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixWindowMsg + messageCommand.CommandString); - listBoxMacro.SelectedIndex = index; - } - else if (selected.StartsWith(Common.CmdPrefixTcpMsg, StringComparison.OrdinalIgnoreCase)) - { - string[] commands = Common.SplitTcpMessageCommand(selected.Substring(Common.CmdPrefixTcpMsg.Length)); - TcpMessageCommand tcpMessageCommand = new TcpMessageCommand(commands); - if (tcpMessageCommand.ShowDialog(this) == DialogResult.Cancel) - return; + BeepCommand beepCommand = new BeepCommand(commands); + if (beepCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixBeep + beepCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixSound, StringComparison.OrdinalIgnoreCase)) + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Filter = "Wave Files|*.WAV"; + openFileDialog.Multiselect = false; + openFileDialog.FileName = selected.Substring(Common.CmdPrefixSound.Length); - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixTcpMsg + tcpMessageCommand.CommandString); - listBoxMacro.SelectedIndex = index; - } - else if (selected.StartsWith(Common.CmdPrefixKeys, StringComparison.OrdinalIgnoreCase)) - { - KeysCommand keysCommand = new KeysCommand(selected.Substring(Common.CmdPrefixKeys.Length)); - if (keysCommand.ShowDialog(this) == DialogResult.Cancel) - return; + if (openFileDialog.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixSound + openFileDialog.FileName; + } + else if (selected.StartsWith(Common.CmdPrefixDisplay, StringComparison.OrdinalIgnoreCase)) + { + string[] commands = Common.SplitDisplayModeCommand(selected.Substring(Common.CmdPrefixDisplay.Length)); - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixKeys + keysCommand.CommandString); - listBoxMacro.SelectedIndex = index; - } - else if (selected.StartsWith(Common.CmdPrefixMouse, StringComparison.OrdinalIgnoreCase)) - { - MouseCommand mouseCommand = new MouseCommand(selected.Substring(Common.CmdPrefixMouse.Length)); - if (mouseCommand.ShowDialog(this) == DialogResult.Cancel) - return; + DisplayModeCommand displayModeCommand = new DisplayModeCommand(commands); + if (displayModeCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixDisplay + displayModeCommand.CommandString; + } + else if (selected.StartsWith(Common.CmdPrefixBlast, StringComparison.OrdinalIgnoreCase)) + { + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixMouse + mouseCommand.CommandString); - listBoxMacro.SelectedIndex = index; - } - else if (selected.StartsWith(Common.CmdPrefixEject, StringComparison.OrdinalIgnoreCase)) - { - EjectCommand ejectCommand = new EjectCommand(selected.Substring(Common.CmdPrefixEject.Length)); - if (ejectCommand.ShowDialog(this) == DialogResult.Cancel) - return; + BlastCommand blastCommand = new BlastCommand( + new BlastIrDelegate(Program.BlastIR), + Common.FolderIRCommands, + Program.TransceiverInformation.Ports, + commands); - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixEject + ejectCommand.CommandString); - listBoxMacro.SelectedIndex = index; - } - else if (selected.StartsWith(Common.CmdPrefixPopup, StringComparison.OrdinalIgnoreCase)) - { - string[] commands = Common.SplitPopupCommand(selected.Substring(Common.CmdPrefixPopup.Length)); - PopupMessage popupMessage = new PopupMessage(commands); - if (popupMessage.ShowDialog(this) == DialogResult.Cancel) - return; + if (blastCommand.ShowDialog(this) == DialogResult.OK) + newCommand = Common.CmdPrefixBlast + blastCommand.CommandString; + } - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixPopup + popupMessage.CommandString); - listBoxMacro.SelectedIndex = index; + if (!String.IsNullOrEmpty(newCommand)) + { + int index = listBoxMacro.SelectedIndex; + listBoxMacro.Items.RemoveAt(index); + listBoxMacro.Items.Insert(index, newCommand); + listBoxMacro.SelectedIndex = index; + } } - else if (selected.StartsWith(Common.CmdPrefixBlast, StringComparison.OrdinalIgnoreCase)) + catch (Exception ex) { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand( - new BlastIrDelegate(Program.BlastIR), - Common.FolderIRCommands, - Program.TransceiverInformation.Ports, - commands); - - if (blastCommand.ShowDialog(this) == DialogResult.Cancel) - return; - - int index = listBoxMacro.SelectedIndex; - listBoxMacro.Items.RemoveAt(index); - listBoxMacro.Items.Insert(index, Common.CmdPrefixBlast + blastCommand.CommandString); - listBoxMacro.SelectedIndex = index; + IrssLog.Error(ex.ToString()); + MessageBox.Show(this, ex.Message, "Failed to edit macro item", MessageBoxButtons.OK, MessageBoxIcon.Error); } } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2007-12-10 13:54:01 UTC (rev 1141) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2007-12-11 07:00:22 UTC (rev 1142) @@ -972,7 +972,7 @@ if (selected.Equals(Common.UITextRun, StringComparison.OrdinalIgnoreCase)) { - ExternalProgram externalProgram = new ExternalProgram(true); + ExternalProgram externalProgram = new ExternalProgram(); if (externalProgram.ShowDialog(this) == DialogResult.Cancel) return; @@ -1046,7 +1046,7 @@ if (command.StartsWith(Common.CmdPrefixRun, StringComparison.OrdinalIgnoreCase)) { string[] commands = Common.SplitRunCommand(command.Substring(Common.CmdPrefixRun.Length)); - ExternalProgram externalProgram = new ExternalProgram(commands, true); + ExternalProgram externalProgram = new ExternalProgram(commands); if (externalProgram.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-12-10 13:54:01 UTC (rev 1141) +++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-12-11 07:00:22 UTC (rev 1142) @@ -1072,28 +1072,63 @@ } else if (command.StartsWith(Common.CmdPrefixHibernate, StringComparison.OrdinalIgnoreCase)) { - if (!Common.Hibernate()) - IrssLog.Warn("Hibernate request was rejected by another application."); + if (_inConfiguration) + { + MessageBox.Show("Cannot Hibernate in configuration", Common.UITextHibernate, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + if (!Common.Hibernate()) + IrssLog.Warn("Hibernate request was rejected by another application."); + } } else if (command.StartsWith(Common.CmdPrefixLogOff, StringComparison.OrdinalIgnoreCase)) { - if (!Common.LogOff()) - IrssLog.Warn("LogOff request failed."); + if (_inConfiguration) + { + MessageBox.Show("Cannot Log off in configuration", Common.UITextLogOff, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + if (!Common.LogOff()) + IrssLog.Warn("LogOff request failed."); + } } else if (command.StartsWith(Common.CmdPrefixReboot, StringComparison.OrdinalIgnoreCase)) { - if (!Common.Reboot()) - IrssLog.Warn("Reboot request failed."); + if (_inConfiguration) + { + MessageBox.Show("Cannot Reboot in configuration", Common.UITextReboot, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + if (!Common.Reboot()) + IrssLog.Warn("Reboot request failed."); + } } else if (command.StartsWith(Common.CmdPrefixShutdown, StringComparison.OrdinalIgnoreCase)) { - if (!Common.ShutDown()) - IrssLog.Warn("ShutDown request failed."); + if (_inConfiguration) + { + MessageBox.Show("Cannot ShutDown in configuration", Common.UITextShutdown, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + if (!Common.ShutDown()) + IrssLog.Warn("ShutDown request failed."); + } } else if (command.StartsWith(Common.CmdPrefixStandby, StringComparison.OrdinalIgnoreCase)) { - if (!Common.Standby()) - IrssLog.Warn("Standby request was rejected by another application."); + if (_inConfiguration) + { + MessageBox.Show("Cannot enter Standby in configuration", Common.UITextStandby, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + if (!Common.Standby()) + IrssLog.Warn("Standby request was rejected by another application."); + } } else if (command.StartsWith(Common.CmdPrefixTranslator, StringComparison.OrdinalIgnoreCase)) { @@ -1103,7 +1138,7 @@ { if (_inConfiguration) { - MessageBox.Show("Cannot show Virtual Keyboard in configuration", "Virtual Keyboard", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("Cannot show Virtual Keyboard in configuration", Common.UITextVirtualKB, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { @@ -1112,6 +1147,19 @@ Keyboard.ProcessCommand(vk.TextOutput); } } + else if (command.StartsWith(Common.CmdPrefixSmsKB, StringComparison.OrdinalIgnoreCase)) + { + if (_inConfiguration) + { + MessageBox.Show("Cannot show SMS Keyboard in configuration", Common.UITextSmsKB, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + IrssUtils.Forms.SmsKeyboard sms = new IrssUtils.Forms.SmsKeyboard(); + if (sms.ShowDialog() == DialogResult.OK) + Keyboard.ProcessCommand(sms.TextOutput); + } + } else { throw new ArgumentException(String.Format("Cannot process unrecognized command \"{0}\"", command), "command"); @@ -1139,154 +1187,13 @@ XmlDocument doc = new XmlDocument(); doc.Load(fileName); - if (doc.DocumentElement.InnerText.Contains(Common.XmlTagBlast) && !_registered) + if (doc.DocumentElement.InnerText.Contains(Common.CmdPrefixBlast) && !_registered) throw new ApplicationException("Cannot process Macro with Blast commands when not registered to an active IR Server"); - XmlNodeList commandSequence = doc.DocumentElement.SelectNodes("action"); - string commandProperty; + XmlNodeList commandSequence = doc.DocumentElement.SelectNodes("item"); foreach (XmlNode item in commandSequence) - { - commandProperty = item.Attributes["cmdproperty"].Value; - - switch (item.Attributes["command"].Value) - { - case Common.XmlTagMacro: - { - ProcMacro(FolderMacros + commandProperty + Common.FileExtensionMacro); - break; - } - - case Common.XmlTagBlast: - { - string[] commands = Common.SplitBlastCommand(commandProperty); - BlastIR(Common.FolderIRCommands + commands[0] + Common.FileExtensionIR, commands[1]); - break; - } - - case Common.XmlTagPause: - { - int sleep = int.Parse(commandProperty); - Thread.Sleep(sleep); - break; - } - - case Common.XmlTagRun: - { - string[] commands = Common.SplitRunCommand(commandProperty); - Common.ProcessRunCommand(commands); - break; - } - - case Common.XmlTagSerial: - { - string[] commands = Common.SplitSerialCommand(commandProperty); - Common.ProcessSerialCommand(commands); - break; - } - - case Common.XmlTagPopup: - { - string[] commands = Common.SplitPopupCommand(commandProperty); - MessageBox.Show(commands[1], commands[0], MessageBoxButtons.OK, MessageBoxIcon.Information); - break; - } - - case Common.XmlTagWindowMsg: - { - string[] commands = Common.SplitWindowMessageCommand(commandProperty); - Common.ProcessWindowMessageCommand(commands); - break; - } - - case Common.XmlTagTcpMsg: - { - string[] commands = Common.SplitTcpMessageCommand(commandProperty); - Common.ProcessTcpMessageCommand(commands); - break; - } - - case Common.XmlTagKeys: - { - if (_inConfiguration) - MessageBox.Show(commandProperty, Common.UITextKeys, MessageBoxButtons.OK, MessageBoxIcon.Information); - else - Common.ProcessKeyCommand(commandProperty); - break; - } - - case Common.XmlTagMouse: - { - Common.ProcessMouseCommand(commandProperty); - break; - } - - case Common.XmlTagEject: - { - Common.ProcessEjectCommand(commandProperty); - break; - } - - case Common.XmlTagStandby: - { - if (_inConfiguration) - MessageBox.Show("Cannot enter Standby in configuration", Common.UITextStandby, MessageBoxButtons.OK, MessageBoxIcon.Information); - else - Common.Standby(); - break; - } - - case Common.XmlTagHibernate: - { - if (_inConfiguration) - MessageBox.Show("Cannot Hibernate in configuration", Common.UITextHibernate, MessageBoxButtons.OK, MessageBoxIcon.Information); - else - Common.Hibernate(); - break; - } - - case Common.XmlTagShutdown: - { - if (_inConfiguration) - MessageBox.Show("Cannot ShutDown in configuration", Common.UITextShutdown, MessageBoxButtons.OK, MessageBoxIcon.Information); - else - Common.ShutDown(); - break; - } - - case Common.XmlTagReboot: - { - if (_inConfiguration) - MessageBox.Show("Cannot Reboot in configuration", Common.UITextReboot, MessageBoxButtons.OK, MessageBoxIcon.Information); - else - Common.Reboot(); - break; - } - - case Common.XmlTagLogOff: - { - if (_inConfiguration) - MessageBox.Show("Cannot Log off in configuration", Common.UITextLogOff, MessageBoxButtons.OK, MessageBoxIcon.Information); - else - Common.LogOff(); - break; - } - - case Common.XmlTagBeep: - { - string[] commands = Common.SplitBeepCommand(commandProperty); - Common.ProcessBeepCommand(commands); - break; - } - - case Common.XmlTagDisplay: - { - string[] commands = Common.SplitDisplayModeCommand(commandProperty); - Common.ProcessDisplayModeCommand(commands); - break; - } - } - } + ProcCommand(item.Attributes["command"].Value); } finally { Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2007-12-10 13:54:01 UTC (rev 1141) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2007-12-11 07:00:22 UTC (rev 1142) @@ -111,10 +111,11 @@ public const string CmdPrefixEject = "Eject: "; public const string CmdPrefixSound = "Sound: "; public const string CmdPrefixBeep = "Beep: "; - public const string CmdPrefixDisplay = "Display: "; + public const string CmdPrefixDisplay = "Display Mode: "; public const string CmdPrefixTranslator = "Show Translator OSD"; public const string CmdPrefixVirtualKB = "Show Virtual Keyboard"; + public const string CmdPrefixSmsKB = "Show SMS Keyboard"; // For MediaPortal ... public const string CmdPrefixMultiMap = "Multi-Mapping: "; @@ -124,42 +125,6 @@ #endregion Command Prefixes - #region XML Tags - - public const string XmlTagMacro = "MACRO"; - public const string XmlTagBlast = "BLAST"; - public const string XmlTagPause = "PAUSE"; - public const string XmlTagRun = "RUN"; - public const string XmlTagSerial = "SERIAL"; - public const string XmlTagKeys = "KEYS"; - public const string XmlTagWindowMsg = "WINDOW_MESSAGE"; - public const string XmlTagTcpMsg = "TCP_MESSAGE"; - public const string XmlTagGoto = "GOTO"; - public const string XmlTagPopup = "POPUP"; - public const string XmlTagMultiMap = "MULTI_MAPPING"; - public const string XmlTagMouseMode = "MOUSE_MODE"; - public const string XmlTagInputLayer = "INPUT_LAYER"; -// public const string XmlTagWindowState = "WINDOW_STATE"; - public const string XmlTagFocus = "GET_FOCUS"; - public const string XmlTagExit = "EXIT"; - - public const string XmlTagStandby = "STANDBY"; - public const string XmlTagHibernate = "HIBERNATE"; - public const string XmlTagReboot = "REBOOT"; - public const string XmlTagShutdown = "SHUTDOWN"; - public const string XmlTagLogOff = "LOG_OFF"; - - public const string XmlTagMouse = "MOUSE"; - public const string XmlTagEject = "EJECT"; - public const string XmlTagSound = "SOUND"; - public const string XmlTagBeep = "BEEP"; - public const string XmlTagDisplay = "DISPLAY"; - - public const string XmlTagTranslator = "TRANSLATOR"; - public const string XmlTagVirtualKB = "VIRTUAL_KEYBOARD"; - - #endregion XML Tags - #region User Interface Text public const string UITextRun = "Run Program"; @@ -168,6 +133,7 @@ public const string UITextKeys = "Keystrokes Command"; public const string UITextWindowMsg = "Window Message"; public const string UITextTcpMsg = "TCP Message"; + public const string UITextHttpMsg = "HTTP Message"; public const string UITextGoto = "Go To Screen"; public const string UITextPopup = "Popup Message"; public const string UITextMultiMap = "Set Multi-Mapping"; @@ -187,10 +153,11 @@ public const string UITextEject = "Eject CD"; public const string UITextSound = "Play Sound"; public const string UITextBeep = "Beep"; - public const string UITextDisplay = "Display"; + public const string UITextDisplay = "Display Mode"; public const string UITextTranslator = "Show Translator OSD"; public const string UITextVirtualKB = "Show Virtual Keyboard"; + public const string UITextSmsKB = "Show SMS Keyboard"; #endregion User Interface Text @@ -882,10 +849,23 @@ { foreach (Match match in Regex.Matches(input, @"%\w+%")) { - string envVar = Environment.GetEnvironmentVariable(match.Value.Substring(1, match.Value.Length - 2)); + string varName = match.Value.Substring(1, match.Value.Length - 2); - if (envVar != null) - output = output.Replace(match.Value, envVar); + string envVar = String.Empty; + + switch (varName.ToUpperInvariant()) + { + case "$CLIPBOARD_TEXT$": + if (Clipboard.ContainsText()) + envVar = Clipboard.GetText(); + break; + + default: + envVar = Environment.GetEnvironmentVariable(varName); + break; + } + + output = output.Replace(match.Value, envVar); } } Added: trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/BeepCommand.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/BeepCommand.Designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Forms/BeepCommand.Designer.cs 2007-12-11 07:00:22 UTC (rev 1142) @@ -0,0 +1,173 @@ +namespace IrssUtils.Forms +{ + partial class BeepCommand + { + /// <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.numericUpDownFreq = new System.Windows.Forms.NumericUpDown(); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.labelFrequency = new System.Windows.Forms.Label(); + this.labelDuration = new System.Windows.Forms.Label(); + this.numericUpDownDuration = new System.Windows.Forms.NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFreq)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownDuration)).BeginInit(); + this.SuspendLayout(); + // + // numericUpDownFreq + // + this.numericUpDownFreq.Increment = new decimal(new int[] { + 50, + 0, + 0, + 0}); + this.numericUpDownFreq.Location = new System.Drawing.Point(87, 8); + this.numericUpDownFreq.Maximum = new decimal(new int[] { + 32767, + 0, + 0, + 0}); + this.numericUpDownFreq.Minimum = new decimal(new int[] { + 37, + 0, + 0, + 0}); + this.numericUpDownFreq.Name = "numericUpDownFreq"; + this.numericUpDownFreq.Size = new System.Drawing.Size(73, 20); + this.numericUpDownFreq.TabIndex = 1; + this.numericUpDownFreq.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDownFreq.Value = new decimal(new int[] { + 5000, + 0, + 0, + 0}); + // + // 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(24, 80); + 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); + // + // 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(96, 80); + 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); + // + // labelFrequency + // + this.labelFrequency.Location = new System.Drawing.Point(8, 8); + this.labelFrequency.Name = "labelFrequency"; + this.labelFrequency.Size = new System.Drawing.Size(80, 20); + this.labelFrequency.TabIndex = 4; + this.labelFrequency.Text = "Frequency:"; + this.labelFrequency.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelDuration + // + this.labelDuration.Location = new System.Drawing.Point(8, 40); + this.labelDuration.Name = "labelDuration"; + this.labelDuration.Size = new System.Drawing.Size(80, 20); + this.labelDuration.TabIndex = 5; + this.labelDuration.Text = "Duration:"; + this.labelDuration.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // numericUpDownDuration + // + this.numericUpDownDuration.Increment = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numericUpDownDuration.Location = new System.Drawing.Point(88, 40); + this.numericUpDownDuration.Maximum = new decimal(new int[] { + 100000, + 0, + 0, + 0}); + this.numericUpDownDuration.Minimum = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.numericUpDownDuration.Name = "numericUpDownDuration"; + this.numericUpDownDuration.Size = new System.Drawing.Size(73, 20); + this.numericUpDownDuration.TabIndex = 6; + this.numericUpDownDuration.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDownDuration.Value = new decimal(new int[] { + 500, + 0, + 0, + 0}); + // + // BeepCommand + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + ... [truncated message content] |