From: <an...@us...> - 2008-03-25 06:25:03
|
Revision: 1509 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1509&view=rev Author: and-81 Date: 2008-03-24 23:25:01 -0700 (Mon, 24 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs trunk/plugins/MCEReplacement/MCEReplacement.cs Added Paths: ----------- trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/ExternalChannelConfig.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.designer.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.resx trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.Designer.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.resx trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/SetupForm.Designer.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/SetupForm.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/SetupForm.resx trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/StbSetup.Designer.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/StbSetup.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/StbSetup.resx trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Icon.ico trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Icon16.ico trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Icon16Connecting.ico trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Icon32.ico trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Media Center Connection.csproj trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/MediaState.reg trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Program.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Properties/ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Properties/Resources.Designer.cs trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Properties/Resources.resx trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/References/ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/References/MSASState.dll trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/References/MSASState.dll.config trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/References/MediaState.dll trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/References/MemMapFile.dll trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Tray.cs Property Changed: ---------------- trunk/plugins/IR Server Suite/Applications/LogTimeCodeExtractor/ Property changes on: trunk/plugins/IR Server Suite/Applications/LogTimeCodeExtractor ___________________________________________________________________ Name: svn:ignore + bin obj Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs 2008-03-24 14:12:56 UTC (rev 1508) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs 2008-03-25 06:25:01 UTC (rev 1509) @@ -186,6 +186,7 @@ #if DEBUG DebugOpen("MicrosoftMceTransceiver_DriverReplacement.log"); DebugWriteLine("Start()"); + DebugWriteLine("Device Type: {0}", Enum.GetName(typeof(DeviceType), _deviceType)); #endif _notifyWindow = new NotifyWindow(); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2008-03-24 14:12:56 UTC (rev 1508) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2008-03-25 06:25:01 UTC (rev 1509) @@ -133,7 +133,7 @@ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - //static readonly byte[] ResetPacket = { 0xFF, 0xEE }; + //static readonly byte[] ResetPacket = { 0xFF, 0xFE }; // Misc Packets static readonly byte[] SetCarrierFreqPacket = { 0x9F, 0x06, 0x01, 0x80 }; @@ -185,6 +185,7 @@ #if DEBUG DebugOpen("MicrosoftMceTransceiver_DriverXP.log"); DebugWriteLine("Start()"); + DebugWriteLine("Device Type: {0}", Enum.GetName(typeof(DeviceType), _deviceType)); #endif _notifyWindow = new NotifyWindow(); @@ -437,7 +438,7 @@ WriteSync(new byte[] { 0x9F, 0x05 }); WriteSync(new byte[] { 0x9F, 0x0D }); WriteSync(new byte[] { 0x9F, 0x13 }); - + Thread.Sleep(4 * PacketTimeout); SetTimeout(PacketTimeout); Property changes on: trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection ___________________________________________________________________ Name: svn:ignore + bin obj Added: trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/ExternalChannelConfig.cs =================================================================== --- trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/ExternalChannelConfig.cs (rev 0) +++ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/ExternalChannelConfig.cs 2008-03-25 06:25:01 UTC (rev 1509) @@ -0,0 +1,302 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; + +namespace MediaCenterConnection +{ + + /// <summary> + /// External Channel Changing configuration file for tuning Set Top Boxes in MediaPortal. + /// </summary> + public class ExternalChannelConfig + { + + #region Constants + + const int DefaultCardID = 0; + + const int DefaultPauseTime = 250; + const bool DefaultSendSelect = false; + const bool DefaultDoubleChannelSelect = false; + const int DefaultRepeatChannelCommands = 0; + const int DefaultChannelDigits = 0; + const int DefaultRepeatPauseTime = 1000; + const bool DefaultUsePreChangeCommand = false; + + #endregion Constants + + #region Variables + + string _fileName; + + int _cardID; + + int _pauseTime; + bool _sendSelect; + bool _doubleChannelSelect; + int _repeatChannelCommands; + int _channelDigits; + int _repeatPauseTime; + bool _usePreChangeCommand; + + string _selectCommand; + string _preChangeCommand; + string[] _digits; + + #endregion Variables + + #region Properties + + /// <summary> + /// Gets the name of the file used to store this configuration. + /// </summary> + /// <value>The name of the file.</value> + public string FileName + { + get { return _fileName; } + } + + /// <summary> + /// Gets or sets the card id. + /// </summary> + /// <value>The card id.</value> + public int CardId + { + get { return _cardID; } + set { _cardID = value; } + } + + /// <summary> + /// Gets or sets the pause time. + /// </summary> + /// <value>The pause time.</value> + public int PauseTime + { + get { return _pauseTime; } + set { _pauseTime = value; } + } + /// <summary> + /// Gets or sets a value indicating whether to send a select command. + /// </summary> + /// <value><c>true</c> if send select; otherwise, <c>false</c>.</value> + public bool SendSelect + { + get { return _sendSelect; } + set { _sendSelect = value; } + } + /// <summary> + /// Gets or sets a value indicating whether to send the select command twice. + /// </summary> + /// <value><c>true</c> if sending channel select twice; otherwise, <c>false</c>.</value> + public bool DoubleChannelSelect + { + get { return _doubleChannelSelect; } + set { _doubleChannelSelect = value; } + } + /// <summary> + /// Gets or sets the flag to repeat channel commands. + /// </summary> + /// <value>The flag to repeat channel commands.</value> + public int RepeatChannelCommands + { + get { return _repeatChannelCommands; } + set { _repeatChannelCommands = value; } + } + /// <summary> + /// Gets or sets the channel digit count. + /// </summary> + /// <value>The number of channel digits.</value> + public int ChannelDigits + { + get { return _channelDigits; } + set { _channelDigits = value; } + } + /// <summary> + /// Gets or sets the pause time between repeats. + /// </summary> + /// <value>The repeat pause time.</value> + public int RepeatPauseTime + { + get { return _repeatPauseTime; } + set { _repeatPauseTime = value; } + } + /// <summary> + /// Gets or sets a value indicating whether to use a pre-change command. + /// </summary> + /// <value> + /// <c>true</c> if using a pre-change command; otherwise, <c>false</c>. + /// </value> + public bool UsePreChangeCommand + { + get { return _usePreChangeCommand; } + set { _usePreChangeCommand = value; } + } + + /// <summary> + /// Gets or sets the digit commands. + /// </summary> + /// <value>The digit commands.</value> + public string[] Digits + { + get { return _digits; } + set { _digits = value; } + } + /// <summary> + /// Gets or sets the select command. + /// </summary> + /// <value>The select command.</value> + public string SelectCommand + { + get { return _selectCommand; } + set { _selectCommand = value; } + } + /// <summary> + /// Gets or sets the pre-change command. + /// </summary> + /// <value>The pre-change command.</value> + public string PreChangeCommand + { + get { return _preChangeCommand; } + set { _preChangeCommand = value; } + } + + #endregion Properties + + #region Constructor + + /// <summary> + /// Initializes a new instance of the <see cref="ExternalChannelConfig"/> class. + /// </summary> + /// <param name="fileName">Name of the configuration file.</param> + public ExternalChannelConfig(string fileName) + { + _fileName = fileName; + + _cardID = DefaultCardID; + + _pauseTime = DefaultPauseTime; + _sendSelect = DefaultSendSelect; + _doubleChannelSelect = DefaultDoubleChannelSelect; + _repeatChannelCommands = DefaultRepeatChannelCommands; + _channelDigits = DefaultChannelDigits; + _repeatPauseTime = DefaultRepeatPauseTime; + _usePreChangeCommand = DefaultUsePreChangeCommand; + + _selectCommand = String.Empty; + _preChangeCommand = String.Empty; + _digits = new string[10]; + + for (int i = 0; i < 10; i++) + _digits[i] = String.Empty; + } + + #endregion Constructor + + /// <summary> + /// Saves this instance to its configuration file. + /// </summary> + public void Save() + { + using (XmlTextWriter writer = new XmlTextWriter(_fileName, Encoding.UTF8)) + { + writer.Formatting = Formatting.Indented; + writer.Indentation = 1; + writer.IndentChar = (char)9; + writer.WriteStartDocument(true); + writer.WriteStartElement("config"); // <config> + + writer.WriteElementString("PauseTime", PauseTime.ToString()); + writer.WriteElementString("UsePreChangeCommand", UsePreChangeCommand.ToString()); + writer.WriteElementString("SendSelect", SendSelect.ToString()); + writer.WriteElementString("DoubleChannelSelect", DoubleChannelSelect.ToString()); + writer.WriteElementString("ChannelDigits", ChannelDigits.ToString()); + writer.WriteElementString("RepeatChannelCommands", RepeatChannelCommands.ToString()); + writer.WriteElementString("RepeatDelay", RepeatPauseTime.ToString()); + + writer.WriteElementString("SelectCommand", SelectCommand); + writer.WriteElementString("PreChangeCommand", PreChangeCommand); + + for (int i = 0; i < 10; i++) + writer.WriteElementString("Digit" + i.ToString(), Digits[i]); + + writer.WriteEndElement(); // </config> + writer.WriteEndDocument(); + } + } + + static string GetString(XmlDocument doc, string element, string defaultValue) + { + if (String.IsNullOrEmpty(element)) + return defaultValue; + + XmlNode node = doc.DocumentElement.SelectSingleNode(element); + if (node == null) + return defaultValue; + + return node.InnerText; + } + static int GetInt(XmlDocument doc, string element, int defaultValue) + { + if (String.IsNullOrEmpty(element)) + return defaultValue; + + XmlNode node = doc.DocumentElement.SelectSingleNode(element); + if (node == null) + return defaultValue; + + int returnValue; + if (int.TryParse(node.InnerText, out returnValue)) + return returnValue; + + return defaultValue; + } + static bool GetBool(XmlDocument doc, string element, bool defaultValue) + { + if (String.IsNullOrEmpty(element)) + return defaultValue; + + XmlNode node = doc.DocumentElement.SelectSingleNode(element); + if (node == null) + return defaultValue; + + bool returnValue; + if (bool.TryParse(node.InnerText, out returnValue)) + return returnValue; + + return defaultValue; + } + + /// <summary> + /// Loads the specified file into a new instance of <see cref="ExternalChannelConfig"/> class. + /// </summary> + /// <param name="fileName">Name of the file to load.</param> + /// <returns>A new <see cref="ExternalChannelConfig"/> class instance.</returns> + public static ExternalChannelConfig Load(string fileName) + { + ExternalChannelConfig newECC = new ExternalChannelConfig(fileName); + + XmlDocument doc = new XmlDocument(); + doc.Load(fileName); + + newECC.PauseTime = GetInt(doc, "PauseTime", DefaultPauseTime); + newECC.UsePreChangeCommand = GetBool(doc, "UsePreChangeCommand", DefaultUsePreChangeCommand); + newECC.SendSelect = GetBool(doc, "SendSelect", DefaultSendSelect); + newECC.DoubleChannelSelect = GetBool(doc, "DoubleChannelSelect", DefaultDoubleChannelSelect); + newECC.RepeatChannelCommands = GetInt(doc, "RepeatChannelCommands", DefaultRepeatChannelCommands); + newECC.ChannelDigits = GetInt(doc, "ChannelDigits", DefaultChannelDigits); + newECC.RepeatPauseTime = GetInt(doc, "RepeatDelay", DefaultRepeatPauseTime); + + newECC.SelectCommand = GetString(doc, "SelectCommand", String.Empty); + newECC.PreChangeCommand = GetString(doc, "PreChangeCommand", String.Empty); + + for (int index = 0; index < 10; index++) + newECC.Digits[index] = GetString(doc, "Digit" + index.ToString(), String.Empty); + + return newECC; + } + + } + +} Added: trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.cs =================================================================== --- trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.cs (rev 0) +++ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.cs 2008-03-25 06:25:01 UTC (rev 1509) @@ -0,0 +1,200 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +#if TRACE +using System.Diagnostics; +#endif +using System.Drawing; +using System.IO; +using System.Text; +using System.Threading; +using System.Windows.Forms; +using System.Xml; + +using IrssUtils; + +namespace MediaCenterConnection +{ + + partial class ExternalChannels : Form + { + + #region Variables + + TabPage _tvCardTab; + StbSetup _tvCardStbSetup; + + #endregion Variables + + #region Constructor + + public ExternalChannels() + { + InitializeComponent(); + } + + #endregion Constructor + + private void ExternalChannels_Load(object sender, EventArgs e) + { + _tvCardStbSetup = new StbSetup(0); + _tvCardStbSetup.Name = "StbSetup"; + _tvCardStbSetup.Dock = DockStyle.Fill; + + _tvCardTab = new TabPage("STB"); + _tvCardTab.Controls.Add(_tvCardStbSetup); + + this.tabControlTVCards.TabPages.Add(_tvCardTab); + + // Setup quick setup combo box + string[] quickSetupFiles = Directory.GetFiles(Common.FolderSTB, "*.xml", SearchOption.TopDirectoryOnly); + foreach (string file in quickSetupFiles) + comboBoxQuickSetup.Items.Add(Path.GetFileNameWithoutExtension(file)); + + comboBoxQuickSetup.Items.Add("Clear all"); + } + + static void ProcessExternalChannelProgram(string runCommand, int currentChannelDigit, string fullChannelString) + { + string[] commands = Common.SplitRunCommand(runCommand); + + commands[2] = commands[2].Replace("%1", currentChannelDigit.ToString()); + commands[2] = commands[2].Replace("%2", fullChannelString); + + Common.ProcessRunCommand(commands); + } + + static void ProcessSerialCommand(string serialCommand, int currentChannelDigit, string fullChannelString) + { + string[] commands = Common.SplitSerialCommand(serialCommand); + + commands[0] = commands[0].Replace("%1", currentChannelDigit.ToString()); + commands[0] = commands[0].Replace("%2", fullChannelString); + + Common.ProcessSerialCommand(commands); + } + + #region Buttons + + private void buttonOK_Click(object sender, EventArgs e) + { + try + { + _tvCardStbSetup.Save(); + Tray.ExtChannelConfig.Save(); + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString(), "Failed to save external channel setup", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void buttonTest_Click(object sender, EventArgs e) + { + try + { + StbSetup setup = _tvCardStbSetup; + + int channelTest = Decimal.ToInt32(numericUpDownTest.Value); + string channel; + switch (setup.ChannelDigits) + { + case 2: + channel = channelTest.ToString("00"); + break; + + case 3: + channel = channelTest.ToString("000"); + break; + + case 4: + channel = channelTest.ToString("0000"); + break; + + default: + channel = channelTest.ToString(); + break; + } + + int charVal; + string command; + + for (int repeatCount = 0; repeatCount <= setup.RepeatChannelCommands; repeatCount++) + { + if (repeatCount > 0 && setup.RepeatPauseTime > 0) + Thread.Sleep(setup.RepeatPauseTime); + + if (setup.UsePreChangeCommand && !String.IsNullOrEmpty(setup.PreChangeCommand)) + { + Tray.ProcessExternalCommand(setup.PreChangeCommand, -1, channel); + + if (setup.PauseTime > 0) + Thread.Sleep(setup.PauseTime); + } + + foreach (char digit in channel) + { + charVal = digit - 48; + + command = setup.Digits[charVal]; + if (!String.IsNullOrEmpty(command)) + { + Tray.ProcessExternalCommand(command, charVal, channel); + + if (setup.PauseTime > 0) + Thread.Sleep(setup.PauseTime); + } + } + + if (setup.SendSelect && !String.IsNullOrEmpty(setup.SelectCommand)) + { + Tray.ProcessExternalCommand(setup.SelectCommand, -1, channel); + + if (setup.DoubleChannelSelect) + { + if (setup.PauseTime > 0) + Thread.Sleep(setup.PauseTime); + + Tray.ProcessExternalCommand(setup.SelectCommand, -1, channel); + } + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString(), "Failed to test external channel", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonQuickSet_Click(object sender, EventArgs e) + { + string quickSetup = comboBoxQuickSetup.Text; + + if (String.IsNullOrEmpty(quickSetup)) + return; + + try + { + _tvCardStbSetup.SetToXml(quickSetup); + } + catch (Exception ex) + { + MessageBox.Show(ex.ToString(), "Failed to quick-set external channel setup", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + #endregion Buttons + + } + +} Added: trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.designer.cs 2008-03-25 06:25:01 UTC (rev 1509) @@ -0,0 +1,206 @@ +namespace MediaCenterConnection +{ + partial class ExternalChannels + { + /// <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.buttonOK = new System.Windows.Forms.Button(); + this.groupBoxQuickSetup = new System.Windows.Forms.GroupBox(); + this.buttonQuickSet = new System.Windows.Forms.Button(); + this.comboBoxQuickSetup = new System.Windows.Forms.ComboBox(); + this.groupBoxTest = new System.Windows.Forms.GroupBox(); + this.labelCh = new System.Windows.Forms.Label(); + this.buttonTest = new System.Windows.Forms.Button(); + this.numericUpDownTest = new System.Windows.Forms.NumericUpDown(); + this.tabControlTVCards = new System.Windows.Forms.TabControl(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.groupBoxQuickSetup.SuspendLayout(); + this.groupBoxTest.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTest)).BeginInit(); + this.SuspendLayout(); + // + // 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(400, 408); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(56, 24); + this.buttonOK.TabIndex = 3; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // groupBoxQuickSetup + // + this.groupBoxQuickSetup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxQuickSetup.Controls.Add(this.buttonQuickSet); + this.groupBoxQuickSetup.Controls.Add(this.comboBoxQuickSetup); + this.groupBoxQuickSetup.Location = new System.Drawing.Point(8, 352); + this.groupBoxQuickSetup.Name = "groupBoxQuickSetup"; + this.groupBoxQuickSetup.Size = new System.Drawing.Size(288, 48); + this.groupBoxQuickSetup.TabIndex = 1; + this.groupBoxQuickSetup.TabStop = false; + this.groupBoxQuickSetup.Text = "Quick Setup"; + // + // buttonQuickSet + // + this.buttonQuickSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonQuickSet.Location = new System.Drawing.Point(232, 16); + this.buttonQuickSet.Name = "buttonQuickSet"; + this.buttonQuickSet.Size = new System.Drawing.Size(48, 21); + this.buttonQuickSet.TabIndex = 1; + this.buttonQuickSet.Text = "Set"; + this.buttonQuickSet.UseVisualStyleBackColor = true; + this.buttonQuickSet.Click += new System.EventHandler(this.buttonQuickSet_Click); + // + // comboBoxQuickSetup + // + this.comboBoxQuickSetup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxQuickSetup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxQuickSetup.FormattingEnabled = true; + this.comboBoxQuickSetup.Location = new System.Drawing.Point(8, 16); + this.comboBoxQuickSetup.Name = "comboBoxQuickSetup"; + this.comboBoxQuickSetup.Size = new System.Drawing.Size(216, 21); + this.comboBoxQuickSetup.TabIndex = 0; + // + // groupBoxTest + // + this.groupBoxTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxTest.Controls.Add(this.labelCh); + this.groupBoxTest.Controls.Add(this.buttonTest); + this.groupBoxTest.Controls.Add(this.numericUpDownTest); + this.groupBoxTest.Location = new System.Drawing.Point(304, 352); + this.groupBoxTest.Name = "groupBoxTest"; + this.groupBoxTest.Size = new System.Drawing.Size(216, 48); + this.groupBoxTest.TabIndex = 2; + this.groupBoxTest.TabStop = false; + this.groupBoxTest.Text = "Test"; + // + // labelCh + // + this.labelCh.Location = new System.Drawing.Point(8, 16); + this.labelCh.Name = "labelCh"; + this.labelCh.Size = new System.Drawing.Size(64, 20); + this.labelCh.TabIndex = 0; + this.labelCh.Text = "Channel:"; + this.labelCh.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // buttonTest + // + this.buttonTest.Location = new System.Drawing.Point(152, 16); + this.buttonTest.Name = "buttonTest"; + this.buttonTest.Size = new System.Drawing.Size(56, 20); + this.buttonTest.TabIndex = 2; + this.buttonTest.Text = "Test"; + this.buttonTest.UseVisualStyleBackColor = true; + this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click); + // + // numericUpDownTest + // + this.numericUpDownTest.Location = new System.Drawing.Point(72, 16); + this.numericUpDownTest.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.numericUpDownTest.Name = "numericUpDownTest"; + this.numericUpDownTest.Size = new System.Drawing.Size(72, 20); + this.numericUpDownTest.TabIndex = 1; + this.numericUpDownTest.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDownTest.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // tabControlTVCards + // + this.tabControlTVCards.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControlTVCards.Location = new System.Drawing.Point(8, 8); + this.tabControlTVCards.Name = "tabControlTVCards"; + this.tabControlTVCards.SelectedIndex = 0; + this.tabControlTVCards.Size = new System.Drawing.Size(512, 336); + this.tabControlTVCards.TabIndex = 0; + // + // 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(464, 408); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(56, 24); + this.buttonCancel.TabIndex = 4; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // ExternalChannels + // + 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(528, 439); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.tabControlTVCards); + this.Controls.Add(this.groupBoxTest); + this.Controls.Add(this.groupBoxQuickSetup); + this.Controls.Add(this.buttonOK); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(536, 466); + this.Name = "ExternalChannels"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "External Channel Changing"; + this.Load += new System.EventHandler(this.ExternalChannels_Load); + this.groupBoxQuickSetup.ResumeLayout(false); + this.groupBoxTest.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTest)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.GroupBox groupBoxQuickSetup; + private System.Windows.Forms.ComboBox comboBoxQuickSetup; + private System.Windows.Forms.GroupBox groupBoxTest; + private System.Windows.Forms.NumericUpDown numericUpDownTest; + private System.Windows.Forms.Button buttonTest; + private System.Windows.Forms.Button buttonQuickSet; + private System.Windows.Forms.Label labelCh; + private System.Windows.Forms.TabControl tabControlTVCards; + private System.Windows.Forms.Button buttonCancel; + + } +} \ No newline at end of file Added: trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.resx =================================================================== --- trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.resx (rev 0) +++ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/ExternalChannels.resx 2008-03-25 06:25:01 UTC (rev 1509) @@ -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 Added: trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.Designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.Designer.cs 2008-03-25 06:25:01 UTC (rev 1509) @@ -0,0 +1,242 @@ +namespace MediaCenterConnection +{ + partial class MacroEditor + { + /// <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.labelName = new System.Windows.Forms.Label(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.groupBoxCommandSequence = new System.Windows.Forms.GroupBox(); + this.buttonRemove = new System.Windows.Forms.Button(); + this.buttonMoveDown = new System.Windows.Forms.Button(); + this.buttonMoveUp = new System.Windows.Forms.Button(); + this.listBoxMacro = new System.Windows.Forms.ListBox(); + this.comboBoxCommands = new System.Windows.Forms.ComboBox(); + this.buttonAddCommand = new System.Windows.Forms.Button(); + this.groupBoxCommands = new System.Windows.Forms.GroupBox(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonTest = new System.Windows.Forms.Button(); + this.buttonOK = new System.Windows.Forms.Button(); + this.groupBoxCommandSequence.SuspendLayout(); + this.groupBoxCommands.SuspendLayout(); + this.SuspendLayout(); + // + // labelName + // + this.labelName.Location = new System.Drawing.Point(8, 8); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(48, 20); + this.labelName.TabIndex = 0; + this.labelName.Text = "Name:"; + this.labelName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // textBoxName + // + this.textBoxName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxName.Location = new System.Drawing.Point(64, 8); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(240, 20); + this.textBoxName.TabIndex = 1; + // + // groupBoxCommandSequence + // + this.groupBoxCommandSequence.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxCommandSequence.Controls.Add(this.buttonRemove); + this.groupBoxCommandSequence.Controls.Add(this.buttonMoveDown); + this.groupBoxCommandSequence.Controls.Add(this.buttonMoveUp); + this.groupBoxCommandSequence.Controls.Add(this.listBoxMacro); + this.groupBoxCommandSequence.Location = new System.Drawing.Point(8, 40); + this.groupBoxCommandSequence.Name = "groupBoxCommandSequence"; + this.groupBoxCommandSequence.Size = new System.Drawing.Size(296, 192); + this.groupBoxCommandSequence.TabIndex = 2; + this.groupBoxCommandSequence.TabStop = false; + this.groupBoxCommandSequence.Text = "Macro"; + // + // buttonRemove + // + this.buttonRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRemove.Location = new System.Drawing.Point(232, 160); + this.buttonRemove.Name = "buttonRemove"; + this.buttonRemove.Size = new System.Drawing.Size(56, 24); + this.buttonRemove.TabIndex = 3; + this.buttonRemove.Text = "Remove"; + this.buttonRemove.UseVisualStyleBackColor = true; + this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click); + // + // buttonMoveDown + // + this.buttonMoveDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonMoveDown.Location = new System.Drawing.Point(64, 160); + this.buttonMoveDown.Name = "buttonMoveDown"; + this.buttonMoveDown.Size = new System.Drawing.Size(48, 24); + this.buttonMoveDown.TabIndex = 2; + this.buttonMoveDown.Text = "Down"; + this.buttonMoveDown.UseVisualStyleBackColor = true; + this.buttonMoveDown.Click += new System.EventHandler(this.buttonMoveDown_Click); + // + // buttonMoveUp + // + this.buttonMoveUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonMoveUp.Location = new System.Drawing.Point(8, 160); + this.buttonMoveUp.Name = "buttonMoveUp"; + this.buttonMoveUp.Size = new System.Drawing.Size(48, 24); + this.buttonMoveUp.TabIndex = 1; + this.buttonMoveUp.Text = "Up"; + this.buttonMoveUp.UseVisualStyleBackColor = true; + this.buttonMoveUp.Click += new System.EventHandler(this.buttonMoveUp_Click); + // + // listBoxMacro + // + this.listBoxMacro.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listBoxMacro.FormattingEnabled = true; + this.listBoxMacro.IntegralHeight = false; + this.listBoxMacro.Location = new System.Drawing.Point(8, 16); + this.listBoxMacro.Name = "listBoxMacro"; + this.listBoxMacro.Size = new System.Drawing.Size(280, 136); + this.listBoxMacro.TabIndex = 0; + this.listBoxMacro.DoubleClick += new System.EventHandler(this.listBoxCommandSequence_DoubleClick); + // + // comboBoxCommands + // + this.comboBoxCommands.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxCommands.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxCommands.FormattingEnabled = true; + this.comboBoxCommands.Location = new System.Drawing.Point(8, 16); + this.comboBoxCommands.Name = "comboBoxCommands"; + this.comboBoxCommands.Size = new System.Drawing.Size(232, 21); + this.comboBoxCommands.TabIndex = 0; + // + // buttonAddCommand + // + this.buttonAddCommand.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonAddCommand.Location = new System.Drawing.Point(248, 16); + this.buttonAddCommand.Name = "buttonAddCommand"; + this.buttonAddCommand.Size = new System.Drawing.Size(40, 21); + this.buttonAddCommand.TabIndex = 1; + this.buttonAddCommand.Text = "Add"; + this.buttonAddCommand.UseVisualStyleBackColor = true; + this.buttonAddCommand.Click += new System.EventHandler(this.buttonAddCommand_Click); + // + // groupBoxCommands + // + this.groupBoxCommands.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxCommands.Controls.Add(this.buttonAddCommand); + this.groupBoxCommands.Controls.Add(this.comboBoxCommands); + this.groupBoxCommands.Location = new System.Drawing.Point(8, 240); + this.groupBoxCommands.Name = "groupBoxCommands"; + this.groupBoxCommands.Size = new System.Drawing.Size(296, 48); + this.groupBoxCommands.TabIndex = 3; + this.groupBoxCommands.TabStop = false; + this.groupBoxCommands.Text = "Commands"; + // + // 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(256, 296); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(48, 24); + this.buttonCancel.TabIndex = 6; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // buttonTest + // + this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonTest.Location = new System.Drawing.Point(8, 296); + this.buttonTest.Name = "buttonTest"; + this.buttonTest.Size = new System.Drawing.Size(48, 24); + this.buttonTest.TabIndex = 4; + this.buttonTest.Text = "Test"; + this.buttonTest.UseVisualStyleBackColor = true; + this.buttonTest.Click += new System.EventHandler(this.buttonTest_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(200, 296); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(48, 24); + this.buttonOK.TabIndex = 5; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // MacroEditor + // + 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(312, 329); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.buttonTest); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.groupBoxCommands); + this.Controls.Add(this.groupBoxCommandSequence); + this.Controls.Add(this.labelName); + this.Controls.Add(this.textBoxName); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(320, 356); + this.Name = "MacroEditor"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Macro Editor"; + this.Load += new System.EventHandler(this.MacroEditor_Load); + this.groupBoxCommandSequence.ResumeLayout(false); + this.groupBoxCommands.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelName; + private System.Windows.Forms.TextBox textBoxName; + private System.Windows.Forms.GroupBox groupBoxCommandSequence; + private System.Windows.Forms.Button buttonRemove; + private System.Windows.Forms.Button buttonMoveDown; + private System.Windows.Forms.Button buttonMoveUp; + private System.Windows.Forms.ListBox listBoxMacro; + private System.Windows.Forms.ComboBox comboBoxCommands; + private System.Windows.Forms.Button buttonAddCommand; + private System.Windows.Forms.GroupBox groupBoxCommands; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonTest; + private System.Windows.Forms.Button buttonOK; + } +} \ No newline at end of file Added: trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.cs (rev 0) +++ trunk/plugins/IR Server Suite/Media Center Plugins/Media Center Connection/Forms/MacroEditor.cs 2008-03-25 06:25:01 UTC (rev 1509) @@ -0,0 +1,492 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +#if TRACE +using System.Diagnostics; +#endif +using System.Drawing; +using System.IO; +using System.Text; +using System.Windows.Forms; +using System.Xml; + +using IrssUtils; +using IrssUtils.Forms; + +namespace MediaCenterConnection +{ + + partial class MacroEditor : Form + { + + #region Constructor + + /// <summary> + /// Creates a Macro Editor windows form. + /// </summary> + public MacroEditor() + { + InitializeComponent(); + + textBoxName.Text = "New"; + textBoxName.Enabled = true; + } + + /// <summary> + /// Creates a Macro Editor windows form. + /// </summary> + /// <param name="name">The name of an existing macro.</param> + public MacroEditor(string name) + : this() + { + if (String.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); + + textBoxName.Text = name; + textBoxName.Enabled = false; + + string fileName = Path.Combine(Tray.FolderMacros, name + Common.FileExtensionMacro); + ReadFromFile(fileName); + } + + #endregion Constructor + + #region Implementation + + void RefreshCommandList() + { + comboBoxCommands.Items.Clear(); + + comboBoxCommands.Items.Add(Common.UITextRun); + comboBoxCommands.Items.Add(Common.UITextPause); + 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.UITextGotoScreen); + comboBoxCommands.Items.Add(Common.UITextInputLayer); + //comboBoxCommands.Items.Add(Common.UITextWindowState); + comboBoxCommands.Items.Add(Common.UITextFocus); + comboBoxCommands.Items.Add(Common.UITextExit); + comboBoxCommands.Items.Add(Common.UITextSendMPAction); + comboBoxCommands.Items.Add(Common.UITextSendMPMsg); + comboBoxCommands.Items.Add(Common.UITextStandby); + comboBoxCommands.Items.Add(Common.UITextHibernate); + comboBoxCommands.Items.Add(Common.UITextReboot); + comboBoxCommands.Items.Add(Common.UITextShutdown); + + string[] fileList = Tray.GetFileList(true); + if (fileList != null && fileList.Length > 0) + comboBoxCommands.Items.AddRange(fileList); + } + + /// <summary> + /// Write the macro in the listBox to a macro name provided. + /// </summary> + /// <param name="fileName">Name of Macro to write (macro name, not file path).</param> + void WriteToFile(string fileName) + { + try + { + using (XmlTextWriter writer = new XmlTextWriter(fileName, Encoding.UTF8)) + { + writer.Formatting = Formatting.Indented; + writer.WriteStartDocument(true); + writer.WriteStartElement("macro"); + + foreach (string item in listBoxMacro.Items) + { + writer.WriteStartElement("item"); + writer.WriteAttributeString("command", item); + writer.WriteEndElement(); + } + + writer.WriteEndElement(); + writer.WriteEndDocument(); + } + } + catch (Exception ex) + { + IrssLog.Error(ex); + } + } + + /// <summary> + /// Read a macro into the listBox from the macro name provided. + /// </summary> + /// <param name="fileName">Name of Macro to read (macro name, not file path).</param> + void ReadFromFile(string fileName) + { + try + { + XmlDocument doc = new XmlDocument(); + doc.Load(fileName); + + XmlNodeList commandSequence = doc.DocumentElement.SelectNodes("item"); + + listBoxMacro.Items.Clear(); + + foreach (XmlNode item in commandSequence) + listBoxMacro.Items.Add(item.Attributes["command"].Value); + } + catch (Exception ex) + { + IrssLog.Error(ex); + } + } + + private void MacroEditor_Load(object sender, EventArgs e) + { + RefreshCommandList(); + } + + private void buttonAddCommand_Click(object sender, EventArgs e) + { + if (comboBoxCommands.SelectedIndex == -1) + return; + + try + { + string selected = comboBoxCommands.SelectedItem as string; + string newCommand = null; + + 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.UITextWindowState, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixWindowState; + } + */ + else if (selected.Equals(Common.UITextFocus, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixFocus; + } + else if (selected.Equals(Common.UITextExit, StringComparison.OrdinalIgnoreCase)) + { + newCommand = Common.CmdPrefixExit; + } + 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; + } + ... [truncated message content] |