From: <an...@us...> - 2007-02-13 02:16:25
|
Revision: 114 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=114&view=rev Author: and-81 Date: 2007-02-12 18:16:23 -0800 (Mon, 12 Feb 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/MCEReplacement/Forms/LearnIR.cs trunk/plugins/MCEReplacement/Forms/MacroEditor.cs trunk/plugins/MCEReplacement/Forms/StbSetup.cs trunk/plugins/MCEReplacement/MCEReplacement.cs trunk/plugins/TV3ExtChannelChanger/Forms/PluginSetup.cs trunk/plugins/TV3ExtChannelChanger/TV3ExtChannelChanger.cs trunk/plugins/TV3MceBlaster/Forms/LearnIR.cs trunk/plugins/TV3MceBlaster/Forms/MacroEditor.cs trunk/plugins/TV3MceBlaster/Forms/PluginSetup.cs trunk/plugins/TV3MceBlaster/Forms/StbSetup.cs trunk/plugins/TV3MceBlaster/TV3MceBlaster.cs Modified: trunk/plugins/MCEReplacement/Forms/LearnIR.cs =================================================================== --- trunk/plugins/MCEReplacement/Forms/LearnIR.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/MCEReplacement/Forms/LearnIR.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -57,7 +57,7 @@ textBoxName.Text = command; - if (!command.StartsWith(MCEReplacement.IRFolder)) + if (!command.StartsWith(MCEReplacement.IRFolder, StringComparison.InvariantCultureIgnoreCase)) command = MCEReplacement.IRFolder + command; bool resetTextBoxNameEnabled = textBoxName.Enabled; @@ -109,7 +109,7 @@ if (command.Length == 0) return; - if (!command.StartsWith(MCEReplacement.IRFolder)) + if (!command.StartsWith(MCEReplacement.IRFolder, StringComparison.InvariantCultureIgnoreCase)) command = MCEReplacement.IRFolder + command; MCEReplacement.ProcessCommand(command, _blastPort, _blastSpeed); Modified: trunk/plugins/MCEReplacement/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/MCEReplacement/Forms/MacroEditor.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/MCEReplacement/Forms/MacroEditor.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -346,8 +346,8 @@ MessageBox.Show(this, "You must supply a name for this macro", "Name missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } - - if (!fileName.StartsWith(MCEReplacement.MacroFolder)) + + if (!fileName.StartsWith(MCEReplacement.MacroFolder, StringComparison.InvariantCultureIgnoreCase)) fileName = MCEReplacement.MacroFolder + fileName; WriteToFile(fileName); @@ -372,7 +372,7 @@ return; } - if (!fileName.StartsWith(MCEReplacement.MacroFolder)) + if (!fileName.StartsWith(MCEReplacement.MacroFolder, StringComparison.InvariantCultureIgnoreCase)) fileName = MCEReplacement.MacroFolder + fileName; WriteToFile(fileName); @@ -443,7 +443,7 @@ if (commands == null) { - MessageBox.Show(this, "The current Message command is corrupted, please re-set this command", "Corrupt serial command", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, "The current Message command is corrupted, please re-set this command", "Corrupt message command", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Modified: trunk/plugins/MCEReplacement/Forms/StbSetup.cs =================================================================== --- trunk/plugins/MCEReplacement/Forms/StbSetup.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/MCEReplacement/Forms/StbSetup.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -230,19 +230,19 @@ for (int i = 0; i < 10; i++) { temp = Util.GetXmlString(nodeList, String.Format("Digit{0}", i), ""); - if (temp.EndsWith(MCEReplacement.IRExtension)) + if (temp.EndsWith(MCEReplacement.IRExtension, StringComparison.InvariantCultureIgnoreCase)) temp = MCEReplacement.STBFolder + temp; listViewExternalCommands.Items[i].SubItems[1].Text = temp; } temp = Util.GetXmlString(nodeList, "SelectCommand", ""); - if (temp.EndsWith(MCEReplacement.IRExtension)) + if (temp.EndsWith(MCEReplacement.IRExtension, StringComparison.InvariantCultureIgnoreCase)) temp = MCEReplacement.STBFolder + temp; listViewExternalCommands.Items[10].SubItems[1].Text = temp; temp = Util.GetXmlString(nodeList, "PreChangeCommand", ""); - if (temp.EndsWith(MCEReplacement.IRExtension)) + if (temp.EndsWith(MCEReplacement.IRExtension, StringComparison.InvariantCultureIgnoreCase)) temp = MCEReplacement.STBFolder + temp; listViewExternalCommands.Items[11].SubItems[1].Text = temp; Modified: trunk/plugins/MCEReplacement/MCEReplacement.cs =================================================================== --- trunk/plugins/MCEReplacement/MCEReplacement.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/MCEReplacement/MCEReplacement.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -1789,7 +1789,7 @@ return false; } - if (command.StartsWith(MacroFolder)) // Macro + if (command.StartsWith(MacroFolder, StringComparison.InvariantCultureIgnoreCase)) // Macro { string fileName = AppDataFolder + command + MacroExtension; if (File.Exists(fileName)) @@ -1802,7 +1802,7 @@ return false; } } - else if (command.StartsWith(IRFolder)) // IR Code + else if (command.StartsWith(IRFolder, StringComparison.InvariantCultureIgnoreCase)) // IR Code { string fileName = AppDataFolder + command + IRExtension; if (File.Exists(fileName)) @@ -1815,14 +1815,14 @@ return false; } } - else if (command.StartsWith(STBFolder)) // STB Command + else if (command.StartsWith(STBFolder, StringComparison.InvariantCultureIgnoreCase)) // STB Command { string fileName = AppDataFolder + command; if (File.Exists(fileName)) { - if (fileName.EndsWith(IRExtension)) // IR Command + if (fileName.EndsWith(IRExtension, StringComparison.InvariantCultureIgnoreCase)) // IR Command return BlastIR(fileName, port, speed); - else if (fileName.EndsWith(MacroExtension)) // Macro + else if (fileName.EndsWith(MacroExtension, StringComparison.InvariantCultureIgnoreCase)) // Macro return ProcessMacro(fileName, port, speed); else { Modified: trunk/plugins/TV3ExtChannelChanger/Forms/PluginSetup.cs =================================================================== --- trunk/plugins/TV3ExtChannelChanger/Forms/PluginSetup.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/TV3ExtChannelChanger/Forms/PluginSetup.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -21,6 +21,8 @@ public partial class PluginSetup : SetupTv.SectionSettings { + #region Constructor + public PluginSetup() { InitializeComponent(); @@ -29,20 +31,39 @@ TV3ExtChannelChanger.LogVerbose = checkBoxLogVerbose.Checked = Convert.ToBoolean(layer.GetSetting("TV3ExtChannelChangerLogVerbose", "False").Value); } + #endregion Constructor + + #region SetupTv.SectionSettings + public override void OnSectionDeActivated() { + Log.Info("TV3ExtChannelChanger: Configuration deactivated"); + TvBusinessLayer layer = new TvBusinessLayer(); - Setting setting = layer.GetSetting("TV3ExtChannelChangerLogVerbose"); - setting.Value = checkBoxLogVerbose.Checked.ToString(); + Setting setting; + + TV3ExtChannelChanger.LogVerbose = checkBoxLogVerbose.Checked; + + setting = layer.GetSetting("TV3ExtChannelChangerLogVerbose"); + setting.Value = TV3ExtChannelChanger.LogVerbose.ToString(); setting.Persist(); + TV3ExtChannelChanger.LoadExternalConfigs(); + base.OnSectionDeActivated(); } public override void OnSectionActivated() { + Log.Info("TV3ExtChannelChanger: Configuration activated"); + + if (TV3ExtChannelChanger.ExternalChannelConfigs == null) + TV3ExtChannelChanger.LoadExternalConfigs(); + base.OnSectionActivated(); } + #endregion SetupTv.SectionSettings + private void buttonSTB_Click(object sender, EventArgs e) { ExternalChannels externalChannels = new ExternalChannels(); Modified: trunk/plugins/TV3ExtChannelChanger/TV3ExtChannelChanger.cs =================================================================== --- trunk/plugins/TV3ExtChannelChanger/TV3ExtChannelChanger.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/TV3ExtChannelChanger/TV3ExtChannelChanger.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -147,19 +147,6 @@ } } - static void LoadExternalConfigs() - { - int cardCount = TvDatabase.Card.ListAll().Count; - - if (cardCount == 0) - cardCount = 1; - - _externalChannelConfigs = new ExternalChannelConfig[cardCount]; - - for (int index = 0; index < cardCount; index++) - ExternalChannelConfigs[index] = new ExternalChannelConfig(AppDataFolder + "ExternalChannelConfig" + (index + 1).ToString() + ".xml"); - } - static bool ProcessExternalChannel(string externalChannel, int card) { bool returnCode = true; @@ -371,6 +358,22 @@ #region Public Methods /// <summary> + /// Load external channel configurations. + /// </summary> + public static void LoadExternalConfigs() + { + int cardCount = TvDatabase.Card.ListAll().Count; + + if (cardCount == 0) + cardCount = 1; + + _externalChannelConfigs = new ExternalChannelConfig[cardCount]; + + for (int index = 0; index < cardCount; index++) + ExternalChannelConfigs[index] = new ExternalChannelConfig(AppDataFolder + "ExternalChannelConfig" + (index + 1).ToString() + ".xml"); + } + + /// <summary> /// Splits a Run command into it's component parts. /// </summary> /// <param name="runCommand">The command to be split</param> Modified: trunk/plugins/TV3MceBlaster/Forms/LearnIR.cs =================================================================== --- trunk/plugins/TV3MceBlaster/Forms/LearnIR.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/TV3MceBlaster/Forms/LearnIR.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -57,7 +57,7 @@ textBoxName.Text = command; - if (!command.StartsWith(TV3MceBlaster.IRFolder)) + if (!command.StartsWith(TV3MceBlaster.IRFolder, StringComparison.InvariantCultureIgnoreCase)) command = TV3MceBlaster.IRFolder + command; bool resetTextBoxNameEnabled = textBoxName.Enabled; @@ -109,7 +109,7 @@ if (command.Length == 0) return; - if (!command.StartsWith(TV3MceBlaster.IRFolder)) + if (!command.StartsWith(TV3MceBlaster.IRFolder, StringComparison.InvariantCultureIgnoreCase)) command = TV3MceBlaster.IRFolder + command; TV3MceBlaster.ProcessCommand(command, _blastPort, _blastSpeed); Modified: trunk/plugins/TV3MceBlaster/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/TV3MceBlaster/Forms/MacroEditor.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/TV3MceBlaster/Forms/MacroEditor.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -309,8 +309,8 @@ MessageBox.Show(this, "You must supply a name for this macro", "Name missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } - - if (!fileName.StartsWith(TV3MceBlaster.MacroFolder)) + + if (!fileName.StartsWith(TV3MceBlaster.MacroFolder, StringComparison.InvariantCultureIgnoreCase)) fileName = TV3MceBlaster.MacroFolder + fileName; WriteToFile(fileName); @@ -335,7 +335,7 @@ return; } - if (!fileName.StartsWith(TV3MceBlaster.MacroFolder)) + if (!fileName.StartsWith(TV3MceBlaster.MacroFolder, StringComparison.InvariantCultureIgnoreCase)) fileName = TV3MceBlaster.MacroFolder + fileName; WriteToFile(fileName); @@ -406,7 +406,7 @@ if (commands == null) { - MessageBox.Show(this, "The current Message command is corrupted, please re-set this command", "Corrupt serial command", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(this, "The current Message command is corrupted, please re-set this command", "Corrupt message command", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Modified: trunk/plugins/TV3MceBlaster/Forms/PluginSetup.cs =================================================================== --- trunk/plugins/TV3MceBlaster/Forms/PluginSetup.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/TV3MceBlaster/Forms/PluginSetup.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -67,21 +67,36 @@ public override void OnSectionDeActivated() { + Log.Info("TV3MceBlaster: Configuration deactivated"); + TvBusinessLayer layer = new TvBusinessLayer(); Setting setting; + TV3MceBlaster.LogVerbose = checkBoxLogVerbose.Checked; + setting = layer.GetSetting("TV3MceBlasterLogVerbose"); - setting.Value = checkBoxLogVerbose.Checked.ToString(); + setting.Value = TV3MceBlaster.LogVerbose.ToString(); setting.Persist(); setting = layer.GetSetting("TV3MceBlasterBlastType"); setting.Value = Enum.GetName(typeof(MceIrApi.BlasterType), TV3MceBlaster.BlastType); setting.Persist(); + TV3MceBlaster.LoadExternalConfigs(); + + TV3MceBlaster.InConfiguration = false; + base.OnSectionDeActivated(); } public override void OnSectionActivated() { + Log.Info("TV3MceBlaster: Configuration activated"); + + TV3MceBlaster.InConfiguration = true; + + if (TV3MceBlaster.ExternalChannelConfigs == null) + TV3MceBlaster.LoadExternalConfigs(); + base.OnSectionActivated(); } Modified: trunk/plugins/TV3MceBlaster/Forms/StbSetup.cs =================================================================== --- trunk/plugins/TV3MceBlaster/Forms/StbSetup.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/TV3MceBlaster/Forms/StbSetup.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -229,19 +229,19 @@ for (int i = 0; i < 10; i++) { temp = Util.GetXmlString(nodeList, String.Format("Digit{0}", i), ""); - if (temp.EndsWith(TV3MceBlaster.IRExtension)) + if (temp.EndsWith(TV3MceBlaster.IRExtension, StringComparison.InvariantCultureIgnoreCase)) temp = TV3MceBlaster.STBFolder + temp; listViewExternalCommands.Items[i].SubItems[1].Text = temp; } temp = Util.GetXmlString(nodeList, "SelectCommand", ""); - if (temp.EndsWith(TV3MceBlaster.IRExtension)) + if (temp.EndsWith(TV3MceBlaster.IRExtension, StringComparison.InvariantCultureIgnoreCase)) temp = TV3MceBlaster.STBFolder + temp; listViewExternalCommands.Items[10].SubItems[1].Text = temp; temp = Util.GetXmlString(nodeList, "PreChangeCommand", ""); - if (temp.EndsWith(TV3MceBlaster.IRExtension)) + if (temp.EndsWith(TV3MceBlaster.IRExtension, StringComparison.InvariantCultureIgnoreCase)) temp = TV3MceBlaster.STBFolder + temp; listViewExternalCommands.Items[11].SubItems[1].Text = temp; Modified: trunk/plugins/TV3MceBlaster/TV3MceBlaster.cs =================================================================== --- trunk/plugins/TV3MceBlaster/TV3MceBlaster.cs 2007-02-12 20:11:45 UTC (rev 113) +++ trunk/plugins/TV3MceBlaster/TV3MceBlaster.cs 2007-02-13 02:16:23 UTC (rev 114) @@ -110,6 +110,12 @@ get { return _externalChannelConfigs; } } + public static bool InConfiguration + { + get { return _inConfiguration; } + set { _inConfiguration = value; } + } + #endregion Properties #region Plugin methods @@ -143,14 +149,7 @@ [CLSCompliant(false)] public SetupTv.SectionSettings Setup { - get - { - _inConfiguration = true; - - LoadExternalConfigs(); - - return new SetupTv.Sections.PluginSetup(); - } + get { return new SetupTv.Sections.PluginSetup(); } } #endregion Plugin methods @@ -174,19 +173,6 @@ } } - static void LoadExternalConfigs() - { - int cardCount = TvDatabase.Card.ListAll().Count; - - if (cardCount == 0) - cardCount = 1; - - _externalChannelConfigs = new ExternalChannelConfig[cardCount]; - - for (int index = 0; index < cardCount; index++) - ExternalChannelConfigs[index] = new ExternalChannelConfig(AppDataFolder + "ExternalChannelConfig" + (index + 1).ToString() + ".xml"); - } - static bool ProcessExternalChannel(string externalChannel, int card) { bool returnCode = true; @@ -549,6 +535,22 @@ #region Public Methods /// <summary> + /// Load external channel configurations. + /// </summary> + public static void LoadExternalConfigs() + { + int cardCount = TvDatabase.Card.ListAll().Count; + + if (cardCount == 0) + cardCount = 1; + + _externalChannelConfigs = new ExternalChannelConfig[cardCount]; + + for (int index = 0; index < cardCount; index++) + ExternalChannelConfigs[index] = new ExternalChannelConfig(AppDataFolder + "ExternalChannelConfig" + (index + 1).ToString() + ".xml"); + } + + /// <summary> /// Splits a Run command into it's component parts. /// </summary> /// <param name="runCommand">The command to be split</param> @@ -707,7 +709,7 @@ return false; } - if (command.StartsWith(MacroFolder)) // Macro + if (command.StartsWith(MacroFolder, StringComparison.InvariantCultureIgnoreCase)) // Macro { string fileName = AppDataFolder + command + MacroExtension; if (File.Exists(fileName)) @@ -720,7 +722,7 @@ return false; } } - else if (command.StartsWith(IRFolder)) // IR Code + else if (command.StartsWith(IRFolder, StringComparison.InvariantCultureIgnoreCase)) // IR Code { string fileName = AppDataFolder + command + IRExtension; if (File.Exists(fileName)) @@ -733,14 +735,14 @@ return false; } } - else if (command.StartsWith(STBFolder)) // STB Command + else if (command.StartsWith(STBFolder, StringComparison.InvariantCultureIgnoreCase)) // STB Command { string fileName = AppDataFolder + command; if (File.Exists(fileName)) { - if (fileName.EndsWith(IRExtension)) // IR Command + if (fileName.EndsWith(IRExtension, StringComparison.InvariantCultureIgnoreCase)) // IR Command return BlastIR(fileName, port, speed); - else if (fileName.EndsWith(MacroExtension)) // Macro + else if (fileName.EndsWith(MacroExtension, StringComparison.InvariantCultureIgnoreCase)) // Macro return ProcessMacro(fileName, port, speed); else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |