You can subscribe to this list here.
2007 |
Jan
(36) |
Feb
(79) |
Mar
(123) |
Apr
(95) |
May
(119) |
Jun
(172) |
Jul
(124) |
Aug
(100) |
Sep
(83) |
Oct
(52) |
Nov
(97) |
Dec
(87) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(131) |
Feb
(80) |
Mar
(163) |
Apr
(178) |
May
(73) |
Jun
(54) |
Jul
(106) |
Aug
(118) |
Sep
(50) |
Oct
(125) |
Nov
(100) |
Dec
(99) |
2009 |
Jan
(104) |
Feb
(99) |
Mar
(68) |
Apr
(81) |
May
(52) |
Jun
(87) |
Jul
(67) |
Aug
(33) |
Sep
(27) |
Oct
(37) |
Nov
(60) |
Dec
(116) |
2010 |
Jan
(82) |
Feb
(79) |
Mar
(38) |
Apr
(50) |
May
(45) |
Jun
(53) |
Jul
(23) |
Aug
(86) |
Sep
(22) |
Oct
(96) |
Nov
(97) |
Dec
(73) |
2011 |
Jan
(24) |
Feb
(45) |
Mar
(28) |
Apr
(31) |
May
(42) |
Jun
(25) |
Jul
|
Aug
(12) |
Sep
(28) |
Oct
(13) |
Nov
(43) |
Dec
(13) |
2012 |
Jan
(62) |
Feb
(28) |
Mar
(6) |
Apr
(16) |
May
(7) |
Jun
|
Jul
(16) |
Aug
(2) |
Sep
(1) |
Oct
(4) |
Nov
(1) |
Dec
(3) |
2013 |
Jan
(5) |
Feb
|
Mar
(34) |
Apr
(9) |
May
(6) |
Jun
(10) |
Jul
(32) |
Aug
(8) |
Sep
(11) |
Oct
(35) |
Nov
(24) |
Dec
(22) |
2014 |
Jan
(44) |
Feb
(9) |
Mar
(9) |
Apr
(15) |
May
(25) |
Jun
(34) |
Jul
(16) |
Aug
(11) |
Sep
(7) |
Oct
(6) |
Nov
(1) |
Dec
(12) |
2015 |
Jan
(33) |
Feb
(19) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(5) |
From: <che...@us...> - 2007-06-09 17:57:10
|
Revision: 498 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=498&view=rev Author: chef_koch Date: 2007-06-09 10:57:08 -0700 (Sat, 09 Jun 2007) Log Message: ----------- changed View enumerator, like we have in music/videos Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-06-09 17:38:49 UTC (rev 497) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-06-09 17:57:08 UTC (rev 498) @@ -221,17 +221,17 @@ { switch ((View)ViewAs) { - case View.VIEW_AS_LIST: - ViewAs = (int)View.VIEW_AS_ICONS; + case View.List: + ViewAs = (int)View.Icons; break; - case View.VIEW_AS_ICONS: - ViewAs = (int)View.VIEW_AS_LARGEICONS; + case View.Icons: + ViewAs = (int)View.LargeIcons; break; - case View.VIEW_AS_LARGEICONS: - ViewAs = (int)View.VIEW_AS_FILMSTRIP; + case View.LargeIcons: + ViewAs = (int)View.FilmStrip; break; - case View.VIEW_AS_FILMSTRIP: - ViewAs = (int)View.VIEW_AS_LIST; + case View.FilmStrip: + ViewAs = (int)View.List; break; } } @@ -241,16 +241,16 @@ string result = ""; switch ((View)ViewAs) { - case View.VIEW_AS_LIST: + case View.List: result = GUILocalizeStrings.Get(101); break; - case View.VIEW_AS_ICONS: + case View.Icons: result = GUILocalizeStrings.Get(100); break; - case View.VIEW_AS_LARGEICONS: + case View.LargeIcons: result = GUILocalizeStrings.Get(417); break; - case View.VIEW_AS_FILMSTRIP: + case View.FilmStrip: result = GUILocalizeStrings.Get(733); break; } @@ -265,16 +265,16 @@ { switch ((View)mapSettings.ViewAs) { - case View.VIEW_AS_LIST: + case View.List: xmlwriter.SetValue("myprograms", "viewby", "list"); break; - case View.VIEW_AS_ICONS: + case View.Icons: xmlwriter.SetValue("myprograms", "viewby", "icons"); break; - case View.VIEW_AS_LARGEICONS: + case View.LargeIcons: xmlwriter.SetValue("myprograms", "viewby", "largeicons"); break; - case View.VIEW_AS_FILMSTRIP: + case View.FilmStrip: xmlwriter.SetValue("myprograms", "viewby", "filmstrip"); break; } @@ -321,13 +321,13 @@ if (curText != null) { if (curText == "list") - mapSettings.ViewAs = (int)View.VIEW_AS_LIST; + mapSettings.ViewAs = (int)View.List; else if (curText == "icons") - mapSettings.ViewAs = (int)View.VIEW_AS_ICONS; + mapSettings.ViewAs = (int)View.Icons; else if (curText == "largeicons") - mapSettings.ViewAs = (int)View.VIEW_AS_LARGEICONS; + mapSettings.ViewAs = (int)View.LargeIcons; else if (curText == "filmstrip") - mapSettings.ViewAs = (int)View.VIEW_AS_FILMSTRIP; + mapSettings.ViewAs = (int)View.FilmStrip; } mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); @@ -397,13 +397,12 @@ enum View { - VIEW_AS_LIST = 0, - VIEW_AS_ICONS = 1, - VIEW_AS_LARGEICONS = 2, - VIEW_AS_FILMSTRIP = 3, + List = 0, + Icons = 1, + LargeIcons = 2, + FilmStrip = 3, } - // Buttons [SkinControl(2)] protected GUIButtonControl btnViewAs = null; @@ -544,7 +543,6 @@ } } - public int StartWindow { get { return startWindow; } @@ -938,22 +936,22 @@ { int itemIndex = facadeView.SelectedListItemIndex; - if (mapSettings.ViewAs == (int)View.VIEW_AS_LIST) + if (mapSettings.ViewAs == (int)View.List) { facadeView.View = GUIFacadeControl.ViewMode.List; screenShotImage.Visible = true; } - else if (mapSettings.ViewAs == (int)View.VIEW_AS_ICONS) + else if (mapSettings.ViewAs == (int)View.Icons) { facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; screenShotImage.Visible = false; } - else if (mapSettings.ViewAs == (int)View.VIEW_AS_LARGEICONS) + else if (mapSettings.ViewAs == (int)View.LargeIcons) { facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; screenShotImage.Visible = false; } - else if (mapSettings.ViewAs == (int)View.VIEW_AS_FILMSTRIP) + else if (mapSettings.ViewAs == (int)View.FilmStrip) { facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; screenShotImage.Visible = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-09 17:38:54
|
Revision: 497 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=497&view=rev Author: chef_koch Date: 2007-06-09 10:38:49 -0700 (Sat, 09 Jun 2007) Log Message: ----------- just some very minor formatting changes Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs 2007-06-09 16:50:16 UTC (rev 496) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs 2007-06-09 17:38:49 UTC (rev 497) @@ -24,13 +24,14 @@ #endregion using System; +using Microsoft.DirectX.Direct3D; + using MediaPortal.Dialogs; -using Microsoft.DirectX.Direct3D; using MediaPortal.GUI.Library; using MediaPortal.Util; +using GUIPrograms.ApplicationItems; using GUIPrograms.Database; -using GUIPrograms.ApplicationItems; using GUIPrograms.FileItems; namespace GUIPrograms @@ -550,4 +551,4 @@ } #endregion } -} +} \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-06-09 16:50:16 UTC (rev 496) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-06-09 17:38:49 UTC (rev 497) @@ -24,27 +24,27 @@ #endregion using System; +using System.Drawing; using System.IO; +using System.Threading; using System.Xml.Serialization; +using Microsoft.DirectX; +using Microsoft.DirectX.Direct3D; +using Direct3D = Microsoft.DirectX.Direct3D; + +using MediaPortal.Configuration; using MediaPortal.Database; using MediaPortal.Dialogs; using MediaPortal.GUI.Library; using MediaPortal.GUI.View; using MediaPortal.Profile; using MediaPortal.Util; -using MediaPortal.Configuration; -using Microsoft.DirectX.Direct3D; -using Microsoft.DirectX; -using System.Drawing; -using System.Threading; -using Direct3D = Microsoft.DirectX.Direct3D; +using GUIPrograms.ApplicationItems; using GUIPrograms.Database; using GUIPrograms.Design; using GUIPrograms.FileItems; -using GUIPrograms.ApplicationItems; - namespace GUIPrograms { /// <summary> @@ -137,7 +137,6 @@ #endregion defaultOverrides - #region Serialisation [Serializable] @@ -560,8 +559,6 @@ #endregion - - #region Overrides public override bool Init() @@ -1367,8 +1364,5 @@ } #endregion - - - } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-06-09 16:50:16 UTC (rev 496) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-06-09 17:38:49 UTC (rev 497) @@ -24,12 +24,9 @@ #endregion using System; +using System.Collections; using System.Collections.Generic; -using System.Collections; using System.Diagnostics; -using MediaPortal.GUI.Library; -using MediaPortal.Util; -using SQLite.NET; using System.Drawing; using System.Drawing.Imaging; @@ -44,47 +41,57 @@ using System.Runtime.InteropServices; using System.Xml; using System.Windows.Forms; +using SQLite.NET; +using MediaPortal.GUI.Library; +using MediaPortal.Util; + namespace GUIPrograms { + #region enums - - public enum ApplicationType { - //Directory (Browse-Mode) - //Directory (DBCache-Mode) - //my-Files (myGames my-File output / kino.de scraper output, etc.) - //MyGames Meedio output - //Mame direct input - //File-Editor based launcher - //Item-Grouper - //Gamebase - UNKNOWN = 0, DIRBROWSE = 1, DIRCACHE = 2, MYFILEINI = 3, MYFILEMEEDIO = 4, MAMEDIRECT = 5, FILELAUNCHER = 6, GROUPER = 7, GAMEBASE = 8 - }; + UNKNOWN = 0, + DIRBROWSE = 1, //Directory (Browse-Mode) + DIRCACHE = 2, //Directory (DBCache-Mode) + MYFILEINI = 3, //my-Files (myGames my-File output / kino.de scraper output, etc.) + MYFILEMEEDIO = 4, //MyGames Meedio output + MAMEDIRECT = 5, //Mame direct input + FILELAUNCHER = 6, //File-Editor based launcher + GROUPER = 7, //Item-Grouper + GAMEBASE = 8, //Gamebase + } public enum ScraperType { - UNKNOWN = 0, ALLGAME = 1 + UNKNOWN = 0, + ALLGAME = 1, // VGMUSEUM / AMAZON etc. etc. etc. :) } public enum ScraperSaveType { - Data = 0, Images = 1, DataAndImages = 2 + Data = 0, + Images = 1, + DataAndImages = 2, } public enum ProgramInfoAction { - None = 0, LookupFileInfo = 1 + None = 0, + LookupFileInfo = 1, } + #endregion /// <summary> /// Summary description for ProgramUtils. /// </summary> public class ProgramUtils { + #region Variables + public delegate void UtilEventHandler(Process proc, bool waitForExit); static public event UtilEventHandler OnStartExternal = null; // Event: Start external process / waeberd & mPod static public event UtilEventHandler OnStopExternal = null; @@ -93,7 +100,6 @@ public const int ProgramInfoID = 1206; // some magic number, sync with DialogAppInfo.xml public const string cBackLabel = ".."; - public const string cMAMEDIRECT = "MAME_DIRECT"; public const string cDIRCACHE = "DIR_CACHE"; public const string cGROUPER = "GROUPER"; @@ -105,11 +111,16 @@ public const string cGENRE_PATCH = "GENREPATCH"; public const string cPREPOST_PATCH = "PREPOSTPATCH"; + #endregion Variables + + #region Constructor + // singleton. Dont allow any instance of this class private ProgramUtils() { } - static ProgramUtils() { } + #endregion Constructor + static public string Encode(string strValue) { return strValue.Replace("'", "''"); @@ -181,7 +192,6 @@ return nResult; } - static public DateTime StrToDateDef(string strVal, DateTime dteDefValue) { DateTime dteResult = dteDefValue; @@ -196,7 +206,6 @@ return dteResult; } - static public DateTime GetDateDef(SQLiteResultSet results, int iRecord, string strColumn, DateTime dteDefValue) { DateTime dteResult = dteDefValue; @@ -208,7 +217,6 @@ return dteResult; } - static public bool GetBool(SQLiteResultSet results, int iRecord, string strColumn) { return (Get(results, iRecord, strColumn) == "T"); @@ -245,7 +253,6 @@ return res; } - static public ProcessWindowStyle StringToWindowStyle(string strValue) { if (strValue.ToLower().Trim() == "hidden") @@ -288,7 +295,6 @@ return res; } - static public ApplicationType StringToSourceType(string strValue) { @@ -314,7 +320,6 @@ return ApplicationType.UNKNOWN; } - //ck static public void RemoveInvalidChars(ref string strTxt) { @@ -429,8 +434,6 @@ GUIPrograms.ThumbnailPath = ""; } - - static public string GetAvailableExtensions(string curDirectory) { char separator = ';'; @@ -497,7 +500,5 @@ } return strRes; } - - } -} +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <an...@us...> - 2007-06-09 16:50:18
|
Revision: 496 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=496&view=rev Author: and-81 Date: 2007-06-09 09:50:16 -0700 (Sat, 09 Jun 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Translator/Forms/BlastCommand.cs 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/MediaPortal Plugins/MP Blast Zone Plugin/Forms/BlastCommand.cs 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 Control Plugin/Forms/BlastCommand.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/MP Control Plugin/Properties/AssemblyInfo.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/StbSetup.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/StbSetup.cs Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/BlastCommand.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/BlastCommand.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/BlastCommand.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -29,32 +29,45 @@ #endregion Properties - #region Constructor + #region Constructors + public BlastCommand(string file) + { + InitializeComponent(); + + SetupPortsAndSpeeds(); + + labelIRCommandFile.Text = file; + } public BlastCommand(string[] commands) { InitializeComponent(); + SetupPortsAndSpeeds(); + if (commands == null) return; labelIRCommandFile.Text = commands[0]; - comboBoxPort.Items.AddRange(Program.TransceiverInformation.Ports); if (comboBoxPort.Items.Contains(commands[1])) comboBoxPort.SelectedItem = commands[1]; - else - comboBoxPort.SelectedIndex = 0; - comboBoxSpeed.Items.AddRange(Program.TransceiverInformation.Speeds); if (comboBoxSpeed.Items.Contains(commands[2])) comboBoxSpeed.SelectedItem = commands[2]; - else - comboBoxSpeed.SelectedIndex = 0; } - #endregion Constructor + #endregion Constructors + void SetupPortsAndSpeeds() + { + comboBoxPort.Items.AddRange(Program.TransceiverInformation.Ports); + comboBoxPort.SelectedIndex = 0; + + comboBoxSpeed.Items.AddRange(Program.TransceiverInformation.Speeds); + comboBoxSpeed.SelectedIndex = 0; + } + #region Buttons private void buttonOK_Click(object sender, EventArgs e) Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -242,9 +242,7 @@ } else { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(commands); + BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -705,9 +705,7 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(commands); + BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/BlastCommand.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/BlastCommand.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/BlastCommand.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -29,32 +29,45 @@ #endregion Properties - #region Constructor + #region Constructors + public BlastCommand(string file) + { + InitializeComponent(); + + SetupPortsAndSpeeds(); + + labelIRCommandFile.Text = file; + } public BlastCommand(string[] commands) { InitializeComponent(); + SetupPortsAndSpeeds(); + if (commands == null) return; labelIRCommandFile.Text = commands[0]; - comboBoxPort.Items.AddRange(MPBlastZonePlugin.TransceiverInformation.Ports); if (comboBoxPort.Items.Contains(commands[1])) comboBoxPort.SelectedItem = commands[1]; - else - comboBoxPort.SelectedIndex = 0; - comboBoxSpeed.Items.AddRange(MPBlastZonePlugin.TransceiverInformation.Speeds); if (comboBoxSpeed.Items.Contains(commands[2])) comboBoxSpeed.SelectedItem = commands[2]; - else - comboBoxSpeed.SelectedIndex = 0; } - #endregion Constructor + #endregion Constructors + void SetupPortsAndSpeeds() + { + comboBoxPort.Items.AddRange(MPBlastZonePlugin.TransceiverInformation.Ports); + comboBoxPort.SelectedIndex = 0; + + comboBoxSpeed.Items.AddRange(MPBlastZonePlugin.TransceiverInformation.Speeds); + comboBoxSpeed.SelectedIndex = 0; + } + #region Buttons private void buttonOK_Click(object sender, EventArgs e) Modified: 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/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/MacroEditor.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -324,9 +324,7 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(commands); + BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.OK) listBoxMacro.Items.Add(Common.CmdPrefixBlast + blastCommand.CommandString); } Modified: 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/Forms/SetupForm.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/SetupForm.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -265,9 +265,7 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(commands); + BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/BlastCommand.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/BlastCommand.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/BlastCommand.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -29,32 +29,45 @@ #endregion Properties - #region Constructor + #region Constructors + public BlastCommand(string file) + { + InitializeComponent(); + + SetupPortsAndSpeeds(); + + labelIRCommandFile.Text = file; + } public BlastCommand(string[] commands) { InitializeComponent(); + SetupPortsAndSpeeds(); + if (commands == null) return; labelIRCommandFile.Text = commands[0]; - - comboBoxPort.Items.AddRange(MPControlPlugin.TransceiverInformation.Ports); + if (comboBoxPort.Items.Contains(commands[1])) comboBoxPort.SelectedItem = commands[1]; - else - comboBoxPort.SelectedIndex = 0; - comboBoxSpeed.Items.AddRange(MPControlPlugin.TransceiverInformation.Speeds); if (comboBoxSpeed.Items.Contains(commands[2])) comboBoxSpeed.SelectedItem = commands[2]; - else - comboBoxSpeed.SelectedIndex = 0; } #endregion Constructor + void SetupPortsAndSpeeds() + { + comboBoxPort.Items.AddRange(MPControlPlugin.TransceiverInformation.Ports); + comboBoxPort.SelectedIndex = 0; + + comboBoxSpeed.Items.AddRange(MPControlPlugin.TransceiverInformation.Speeds); + comboBoxSpeed.SelectedIndex = 0; + } + #region Buttons private void buttonOK_Click(object sender, EventArgs e) Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -537,9 +537,7 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(commands); + BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -39,7 +39,7 @@ #region Constants - internal const string PluginVersion = "MP Control Plugin 1.0.3.1 for IR Server"; + internal const string PluginVersion = "MP Control Plugin 1.0.3.2 for IR Server"; internal static readonly string CustomInputDevice = Config.GetFolder(Config.Dir.CustomInputDevice) + "\\"; internal static readonly string CustomInputDefault = Config.GetFolder(Config.Dir.CustomInputDefault) + "\\"; @@ -975,7 +975,7 @@ ServerHost = xmlreader.GetValueAsString("MPControlPlugin", "ServerHost", String.Empty); LogVerbose = xmlreader.GetValueAsBool("MPControlPlugin", "LogVerbose", false); - RequireFocus = xmlreader.GetValueAsBool("MPControlPlugin", "RequireFocus", false); + RequireFocus = xmlreader.GetValueAsBool("MPControlPlugin", "RequireFocus", true); MultiMappingEnabled = xmlreader.GetValueAsBool("MPControlPlugin", "MultiMappingEnabled", false); MultiMappingButton = (RemoteButton)xmlreader.GetValueAsInt("MPControlPlugin", "MultiMappingButton", (int)RemoteButton.Start); EventMapperEnabled = xmlreader.GetValueAsBool("MPControlPlugin", "EventMapperEnabled", false); Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Properties/AssemblyInfo.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Properties/AssemblyInfo.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -34,8 +34,8 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.3.1")] -[assembly: AssemblyFileVersionAttribute("1.0.3.1")] +[assembly: AssemblyVersion("1.0.3.2")] +[assembly: AssemblyFileVersionAttribute("1.0.3.2")] // // In order to sign your assembly you must specify a key to use. Refer to the Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -233,9 +233,7 @@ } else { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, commands); + BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/StbSetup.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/StbSetup.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/StbSetup.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -366,9 +366,7 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, commands); + BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/MacroEditor.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -213,9 +213,7 @@ } else { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, commands); + BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/StbSetup.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/StbSetup.cs 2007-06-09 11:11:13 UTC (rev 495) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/StbSetup.cs 2007-06-09 16:50:16 UTC (rev 496) @@ -390,9 +390,7 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); - - BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, commands); + BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <an...@us...> - 2007-06-09 11:11:15
|
Revision: 495 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=495&view=rev Author: and-81 Date: 2007-06-09 04:11:13 -0700 (Sat, 09 Jun 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/Translator/Forms/BlastCommand.cs 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/MediaPortal Plugins/MP Blast Zone Plugin/Forms/BlastCommand.cs 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 Control Plugin/Forms/BlastCommand.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/TV2 Blaster Plugin/Forms/MacroEditor.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/StbSetup.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/StbSetup.cs Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/BlastCommand.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/BlastCommand.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/BlastCommand.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -29,20 +29,8 @@ #endregion Properties - #region Constructors + #region Constructor - public BlastCommand(string file) - { - InitializeComponent(); - - labelIRCommandFile.Text = file; - - comboBoxPort.Items.AddRange(Program.TransceiverInformation.Ports); - comboBoxPort.SelectedIndex = 0; - - comboBoxSpeed.Items.AddRange(Program.TransceiverInformation.Speeds); - comboBoxSpeed.SelectedIndex = 0; - } public BlastCommand(string[] commands) { InitializeComponent(); @@ -65,7 +53,7 @@ comboBoxSpeed.SelectedIndex = 0; } - #endregion Constructors + #endregion Constructor #region Buttons Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -242,7 +242,9 @@ } else { - BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/Applications/Translator/Forms/MainForm.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -705,7 +705,9 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/BlastCommand.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/BlastCommand.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/BlastCommand.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -29,20 +29,8 @@ #endregion Properties - #region Constructors + #region Constructor - public BlastCommand(string file) - { - InitializeComponent(); - - labelIRCommandFile.Text = file; - - comboBoxPort.Items.AddRange(MPBlastZonePlugin.TransceiverInformation.Ports); - comboBoxPort.SelectedIndex = 0; - - comboBoxSpeed.Items.AddRange(MPBlastZonePlugin.TransceiverInformation.Speeds); - comboBoxSpeed.SelectedIndex = 0; - } public BlastCommand(string[] commands) { InitializeComponent(); @@ -65,7 +53,7 @@ comboBoxSpeed.SelectedIndex = 0; } - #endregion Constructors + #endregion Constructor #region Buttons Modified: 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/MacroEditor.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -324,7 +324,9 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(commands); if (blastCommand.ShowDialog(this) == DialogResult.OK) listBoxMacro.Items.Add(Common.CmdPrefixBlast + blastCommand.CommandString); } Modified: 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/Forms/SetupForm.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Blast Zone Plugin/Forms/SetupForm.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -265,7 +265,9 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/BlastCommand.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/BlastCommand.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/BlastCommand.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -29,20 +29,8 @@ #endregion Properties - #region Constructors + #region Constructor - public BlastCommand(string file) - { - InitializeComponent(); - - labelIRCommandFile.Text = file; - - comboBoxPort.Items.AddRange(MPControlPlugin.TransceiverInformation.Ports); - comboBoxPort.SelectedIndex = 0; - - comboBoxSpeed.Items.AddRange(MPControlPlugin.TransceiverInformation.Speeds); - comboBoxSpeed.SelectedIndex = 0; - } public BlastCommand(string[] commands) { InitializeComponent(); @@ -65,7 +53,7 @@ comboBoxSpeed.SelectedIndex = 0; } - #endregion Constructors + #endregion Constructor #region Buttons Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/MacroEditor.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -404,7 +404,9 @@ } else { - BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/Forms/SetupForm.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -537,7 +537,9 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - BlastCommand blastCommand = new BlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; @@ -746,7 +748,9 @@ } else if (command.StartsWith(Common.CmdPrefixBlast)) { - BlastCommand blastCommand = new BlastCommand(command.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(command.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -233,7 +233,9 @@ } else { - BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/StbSetup.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/StbSetup.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/Forms/StbSetup.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -366,7 +366,9 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/MacroEditor.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/MacroEditor.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -213,7 +213,9 @@ } else { - BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/StbSetup.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/StbSetup.cs 2007-06-09 08:11:46 UTC (rev 494) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV3 Blaster Plugin/Forms/StbSetup.cs 2007-06-09 11:11:13 UTC (rev 495) @@ -390,7 +390,9 @@ } else if (selected.StartsWith(Common.CmdPrefixBlast)) { - BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, selected.Substring(Common.CmdPrefixBlast.Length)); + string[] commands = Common.SplitBlastCommand(selected.Substring(Common.CmdPrefixBlast.Length)); + + BlastCommand blastCommand = new BlastCommand(Common.FolderIRCommands, commands); if (blastCommand.ShowDialog(this) == DialogResult.Cancel) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-06-09 08:11:48
|
Revision: 494 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=494&view=rev Author: northern_sky Date: 2007-06-09 01:11:46 -0700 (Sat, 09 Jun 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSettings.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramFilterItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs 2007-06-08 17:14:57 UTC (rev 493) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs 2007-06-09 08:11:46 UTC (rev 494) @@ -40,1244 +40,1244 @@ namespace GUIPrograms.ApplicationItems { - /// <summary> - /// Summary description for Application. - /// </summary> - public class ApplicationItem + /// <summary> + /// Summary description for Application. + /// </summary> + public class ApplicationItem + { + protected static SQLiteClient sqlDB = null; + private DatabaseSorter dbPc = new DatabaseSorter(); + + public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + + public event FilelinkLaunchEventHandler OnLaunchFilelink = null; + + int appID; + int fatherID; + string title; + string shortTitle; + string filename; + string arguments; + ProcessWindowStyle windowStyle; + Process proc; + string startupDir; + bool useShellExecute; + bool useQuotes; + ApplicationType sourceType; + string sourceFile; + string imageFile; + string imageDirectories; // in one string for sqlite db field + public string[] imageDirs; // imageDirectories splitted + string fileDirectory; + string validExtensions; + bool importValidImagesOnly; + int appPosition; + bool enabled; + bool enableGUIRefresh; + int pincode; + int contentID; + string systemDefault; + bool waitForExit; + string preLaunch; + string postLaunch; + bool importMamePlaychoice10 = false; + + public bool ImportMamePlaychoice10 { - protected static SQLiteClient sqlDB = null; - private DatabaseSorter dbPc = new DatabaseSorter(); + get { return importMamePlaychoice10; } + set { importMamePlaychoice10 = value; } + } + bool importMameMahjong = false; - public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + public bool ImportMameMahjong + { + get { return importMameMahjong; } + set { importMameMahjong = value; } + } - public event FilelinkLaunchEventHandler OnLaunchFilelink = null; - int appID; - int fatherID; - string title; - string shortTitle; - string filename; - string arguments; - ProcessWindowStyle windowStyle; - Process proc; - string startupDir; - bool useShellExecute; - bool useQuotes; - ApplicationType sourceType; - string sourceFile; - string imageFile; - string imageDirectories; // in one string for sqlite db field - public string[] imageDirs; // imageDirectories splitted - string fileDirectory; - string validExtensions; - bool importValidImagesOnly; - int appPosition; - bool enabled; - bool enableGUIRefresh; - int pincode; - int contentID; - string systemDefault; - bool waitForExit; - string preLaunch; - string postLaunch; - bool importMamePlaychoice10 = false; + string launchErrorMsg; - public bool ImportMamePlaychoice10 - { - get { return importMamePlaychoice10; } - set { importMamePlaychoice10 = value; } - } - bool importMameMahjong = false; - public bool ImportMameMahjong - { - get { return importMameMahjong; } - set { importMameMahjong = value; } - } + // two magic image-slideshow counters + int thumbIndex = 0; + int thumbFolderIndex = -1; + string lastFilepath = ""; // cached path - string launchErrorMsg; + public bool filesAreLoaded = false; // load on demand.... + protected FileItemList fileList = null; + public bool linksAreLoaded = false; + protected FilelinkItemList fileLinks = null; - // two magic image-slideshow counters - int thumbIndex = 0; - int thumbFolderIndex = -1; + // event: read new file + public delegate void RefreshInfoEventHandler(string informationMessage, int progressBarProgess); - string lastFilepath = ""; // cached path + public event RefreshInfoEventHandler OnRefreshInfo = null; - public bool filesAreLoaded = false; // load on demand.... - protected FileItemList fileList = null; + protected void SendRefreshInfo(string informationMessage, int progressBarCtr) + { + if (OnRefreshInfo != null) + { + OnRefreshInfo(informationMessage, progressBarCtr); + } + } - public bool linksAreLoaded = false; - protected FilelinkItemList fileLinks = null; + protected int GetID = ProgramUtils.GetID; - // event: read new file - public delegate void RefreshInfoEventHandler(string informationMessage, int progressBarProgess); + public ApplicationItem(SQLiteClient initSqlDB) + { - public event RefreshInfoEventHandler OnRefreshInfo = null; + // constructor: save SQLiteDB object + sqlDB = initSqlDB; + // .. init member variables ... + appID = -1; + fatherID = -1; + title = ""; + shortTitle = ""; + filename = ""; + arguments = ""; + windowStyle = ProcessWindowStyle.Normal; + startupDir = "%FILEDIR%"; + useShellExecute = false; + useQuotes = true; + enabled = true; + sourceType = ApplicationType.UNKNOWN; + sourceFile = ""; + imageFile = ""; + fileDirectory = ""; + imageDirectories = ""; + validExtensions = ""; + appPosition = 0; + importValidImagesOnly = false; + enableGUIRefresh = false; + pincode = -1; + contentID = 100; + systemDefault = ""; + waitForExit = true; + filesAreLoaded = false; + preLaunch = ""; + postLaunch = ""; - protected void SendRefreshInfo(string informationMessage, int progressBarCtr) - { - if (OnRefreshInfo != null) - { - OnRefreshInfo(informationMessage, progressBarCtr); - } - } + } - protected int GetID = ProgramUtils.GetID; + public SQLiteClient db + { + get { return sqlDB; } + } - public ApplicationItem(SQLiteClient initSqlDB) - { + public int CurrentSortIndex + { + get { return GetCurrentSortIndex(); } + set { SetCurrentSortIndex(value); } + } - // constructor: save SQLiteDB object - sqlDB = initSqlDB; - // .. init member variables ... - appID = -1; - fatherID = -1; - title = ""; - shortTitle = ""; - filename = ""; - arguments = ""; - windowStyle = ProcessWindowStyle.Normal; - startupDir = "%FILEDIR%"; - useShellExecute = false; - useQuotes = true; - enabled = true; - sourceType = ApplicationType.UNKNOWN; - sourceFile = ""; - imageFile = ""; - fileDirectory = ""; - imageDirectories = ""; - validExtensions = ""; - appPosition = 0; - importValidImagesOnly = false; - enableGUIRefresh = false; - pincode = -1; - contentID = 100; - systemDefault = ""; - waitForExit = true; - filesAreLoaded = false; - preLaunch = ""; - postLaunch = ""; + public bool CurrentSortIsAscending + { + get { return GetCurrentSortIsAscending(); } + set { SetCurrentSortIsAscending(value); } + } - } - public SQLiteClient db + public FileItem PrevFile(FileItem curFile) + { + if (Files == null) + { + return null; + } + if (Files.Count == 0) + { + return null; + } + int index = this.Files.IndexOf(curFile); + index = index - 1; + if (index < 0) + index = Files.Count - 1; + return (FileItem)Files[index]; + } + + public FileItem NextFile(FileItem curFile) + { + if (Files == null) + { + return null; + } + if (Files.Count == 0) + { + return null; + } + int index = this.Files.IndexOf(curFile); + index = index + 1; + if (index > Files.Count - 1) + index = 0; + return (FileItem)Files[index]; + } + + + public virtual void LaunchFile(FileItem curFile, bool mpGuiMode) + { + string curFilename = curFile.Filename; + if (curFilename == "") + { + return; + } + + // Launch File by item + if (mpGuiMode) + { + curFile.UpdateLaunchInfo(); + } + ProcessStartInfo procStart = new ProcessStartInfo(); + + if (Filename != "") + { + // use the APPLICATION launcher and add current file information + procStart.FileName = Filename; // filename of the application + // set the arguments: one of the arguments is the fileitem-filename + procStart.Arguments = " " + this.Arguments + " "; + if (UseQuotes) { - get { return sqlDB; } + // avoid double quotes around the filename-argument..... + curFilename = "\"" + (curFile.Filename.TrimStart('\"')).TrimEnd('\"') + "\""; } - public int CurrentSortIndex + if (procStart.Arguments.IndexOf("%FILEnoPATHnoEXT%") >= 0) { - get { return GetCurrentSortIndex(); } - set { SetCurrentSortIndex(value); } + // ex. kawaks: + // winkawaks.exe alpham2 + // => filename without path and extension is necessary! + string filenameNoPathNoExt = curFile.ExtractFileName(); + filenameNoPathNoExt = (filenameNoPathNoExt.TrimStart('\"')).TrimEnd('\"'); + filenameNoPathNoExt = Path.GetFileNameWithoutExtension(filenameNoPathNoExt); + procStart.Arguments = procStart.Arguments.Replace("%FILEnoPATHnoEXT%", filenameNoPathNoExt); } - - public bool CurrentSortIsAscending + else { - get { return GetCurrentSortIsAscending(); } - set { SetCurrentSortIsAscending(value); } + // the fileitem-argument can be positioned anywhere in the argument string... + if (procStart.Arguments.IndexOf("%FILE%") == -1) + { + // no placeholder found => default handling: add the fileitem as the last argument + procStart.Arguments = procStart.Arguments + curFilename; + } + else + { + // placeholder found => replace the placeholder by the correct filename + procStart.Arguments = procStart.Arguments.Replace("%FILE%", curFilename); + } } - - - public FileItem PrevFile(FileItem curFile) + procStart.WorkingDirectory = Startupdir; + if (procStart.WorkingDirectory.IndexOf("%FILEDIR%") != -1) { - if (Files == null) - { - return null; - } - if (Files.Count == 0) - { - return null; - } - int index = this.Files.IndexOf(curFile); - index = index - 1; - if (index < 0) - index = Files.Count - 1; - return (FileItem)Files[index]; + procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); } + procStart.UseShellExecute = UseShellExecute; + } + else + { + // application has no launch-file + // => try to make a correct launch using the current FILE object + procStart.FileName = curFile.Filename; + procStart.WorkingDirectory = Path.GetFullPath(curFile.Filename); - public FileItem NextFile(FileItem curFile) + + if (Startupdir != "") { - if (Files == null) - { - return null; - } - if (Files.Count == 0) - { - return null; - } - int index = this.Files.IndexOf(curFile); - index = index + 1; - if (index > Files.Count - 1) - index = 0; - return (FileItem)Files[index]; + if (Startupdir.Contains("%FILEDIR%")) + { + procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); + } + else + { + procStart.WorkingDirectory = Startupdir; + } } + procStart.UseShellExecute = UseShellExecute; + } + procStart.WindowStyle = this.WindowStyle; - public virtual void LaunchFile(FileItem curFile, bool mpGuiMode) + this.LaunchErrorMsg = ""; + try + { + DoPreLaunch(); + + + if (mpGuiMode) { - string curFilename = curFile.Filename; - if (curFilename == "") - { - return; - } + AutoPlay.StopListening(); + if (g_Player.Playing) + { + g_Player.Stop(); + } + } - // Launch File by item - if (mpGuiMode) - { - curFile.UpdateLaunchInfo(); - } - ProcessStartInfo procStart = new ProcessStartInfo(); + proc = new Process(); + proc.EnableRaisingEvents = true; + proc.Exited += new EventHandler(proc_Exited); - if (Filename != "") - { - // use the APPLICATION launcher and add current file information - procStart.FileName = Filename; // filename of the application - // set the arguments: one of the arguments is the fileitem-filename - procStart.Arguments = " " + this.Arguments + " "; - if (UseQuotes) - { - // avoid double quotes around the filename-argument..... - curFilename = "\"" + (curFile.Filename.TrimStart('\"')).TrimEnd('\"') + "\""; - } + proc.StartInfo = procStart; + ProgramUtils.StartProcess(proc, WaitForExit); - if (procStart.Arguments.IndexOf("%FILEnoPATHnoEXT%") >= 0) - { - // ex. kawaks: - // winkawaks.exe alpham2 - // => filename without path and extension is necessary! - string filenameNoPathNoExt = curFile.ExtractFileName(); - filenameNoPathNoExt = (filenameNoPathNoExt.TrimStart('\"')).TrimEnd('\"'); - filenameNoPathNoExt = Path.GetFileNameWithoutExtension(filenameNoPathNoExt); - procStart.Arguments = procStart.Arguments.Replace("%FILEnoPATHnoEXT%", filenameNoPathNoExt); - } - else - { - // the fileitem-argument can be positioned anywhere in the argument string... - if (procStart.Arguments.IndexOf("%FILE%") == -1) - { - // no placeholder found => default handling: add the fileitem as the last argument - procStart.Arguments = procStart.Arguments + curFilename; - } - else - { - // placeholder found => replace the placeholder by the correct filename - procStart.Arguments = procStart.Arguments.Replace("%FILE%", curFilename); - } - } - procStart.WorkingDirectory = Startupdir; - if (procStart.WorkingDirectory.IndexOf("%FILEDIR%") != -1) - { - procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); - } - procStart.UseShellExecute = UseShellExecute; - } - else - { - // application has no launch-file - // => try to make a correct launch using the current FILE object - procStart.FileName = curFile.Filename; - procStart.WorkingDirectory = Path.GetFullPath(curFile.Filename); - - - if (Startupdir != "") - { - if (Startupdir.Contains("%FILEDIR%")) - { - procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); - } - else - { - procStart.WorkingDirectory = Startupdir; - } - } - procStart.UseShellExecute = UseShellExecute; - } - procStart.WindowStyle = this.WindowStyle; + if (mpGuiMode) + { + //GUIGraphicsContext.DX9Device.Reset(GUIGraphicsContext.DX9Device.PresentationParameters); + AutoPlay.StartListening(); + } - this.LaunchErrorMsg = ""; - try - { - DoPreLaunch(); + } + catch (Exception ex) + { + string ErrorString = String.Format("myPrograms: error launching program\n filename: {0}\n arguments: {1}\n WorkingDirectory: {2}\n stack: {3} {4} {5}", + procStart.FileName, + procStart.Arguments, + procStart.WorkingDirectory, + ex.Message, + ex.Source, + ex.StackTrace); + Log.Info(ErrorString); + this.LaunchErrorMsg = ErrorString; + } + finally + { + DoPostLaunch(); + } + } + void proc_Exited(object sender, EventArgs e) + { - if (mpGuiMode) - { - AutoPlay.StopListening(); - if (g_Player.Playing) - { - g_Player.Stop(); - } - } + if (proc != null) + { + proc.Dispose(); + proc = null; + } + } - proc = new Process(); - proc.EnableRaisingEvents = true; - proc.Exited += new EventHandler(proc_Exited); + protected void DoPreLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(preLaunch); + } + } - proc.StartInfo = procStart; - ProgramUtils.StartProcess(proc, WaitForExit); + protected void DoPostLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(postLaunch); + } + } + protected void LaunchCmd(string commands) + { + string results = ""; + string errors = ""; + string[] script; + string curLine; + Process p = new Process(); + StreamWriter sw; + StreamReader sr; + StreamReader err; - if (mpGuiMode) - { - //GUIGraphicsContext.DX9Device.Reset(GUIGraphicsContext.DX9Device.PresentationParameters); - AutoPlay.StartListening(); - } + script = commands.Split(';'); + if (script.Length > 0) + { + ProcessStartInfo psI = new ProcessStartInfo("cmd"); + psI.UseShellExecute = false; + psI.RedirectStandardInput = true; + psI.RedirectStandardOutput = true; + psI.RedirectStandardError = true; + psI.CreateNoWindow = true; + p.StartInfo = psI; - } - catch (Exception ex) - { - string ErrorString = String.Format("myPrograms: error launching program\n filename: {0}\n arguments: {1}\n WorkingDirectory: {2}\n stack: {3} {4} {5}", - procStart.FileName, - procStart.Arguments, - procStart.WorkingDirectory, - ex.Message, - ex.Source, - ex.StackTrace); - Log.Info(ErrorString); - this.LaunchErrorMsg = ErrorString; - } - finally - { - DoPostLaunch(); - } - } + p.Start(); + sw = p.StandardInput; + sr = p.StandardOutput; + err = p.StandardError; - void proc_Exited(object sender, EventArgs e) - { + sw.AutoFlush = true; - if (proc != null) - { - proc.Dispose(); - proc = null; - } - } - - protected void DoPreLaunch() + for (int i = 0; i < script.Length; i++) { - if (waitForExit && (preLaunch != "")) - { - LaunchCmd(preLaunch); - } + curLine = script[i].Trim(); + curLine = curLine.TrimStart('\n'); + if (curLine != "") + sw.WriteLine(curLine); } + sw.Close(); - protected void DoPostLaunch() + results += sr.ReadToEnd(); + errors += err.ReadToEnd(); + + if (errors.Trim() != "") { - if (waitForExit && (preLaunch != "")) - { - LaunchCmd(postLaunch); - } + Log.Info("Application PrePost errors: {0}", errors); } + } + } - protected void LaunchCmd(string commands) - { - string results = ""; - string errors = ""; - string[] script; - string curLine; - Process p = new Process(); - StreamWriter sw; - StreamReader sr; - StreamReader err; + public virtual void LaunchFile(GUIListItem item) + { + // Launch File by GUILISTITEM + // => look for FileItem and launch it using the found object + if (item.MusicTag == null) + { + return; + } + FileItem curFile = (FileItem)item.MusicTag; - script = commands.Split(';'); - if (script.Length > 0) - { - ProcessStartInfo psI = new ProcessStartInfo("cmd"); - psI.UseShellExecute = false; - psI.RedirectStandardInput = true; - psI.RedirectStandardOutput = true; - psI.RedirectStandardError = true; - psI.CreateNoWindow = true; - p.StartInfo = psI; + if (curFile == null) + { + return; + } + this.LaunchFile(curFile, true); + } - p.Start(); - sw = p.StandardInput; - sr = p.StandardOutput; - err = p.StandardError; + protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + { + this.OnLaunchFilelink(curLink, MPGUIMode); + } - sw.AutoFlush = true; + public virtual string DefaultFilepath() + { + return ""; // override this if the appitem can have subfolders + } - for (int i = 0; i < script.Length; i++) - { - curLine = script[i].Trim(); - curLine = curLine.TrimStart('\n'); - if (curLine != "") - sw.WriteLine(curLine); - } - sw.Close(); + public virtual int DisplayFiles(string filePath, GUIFacadeControl facadeView) + { + int totalItems = 0; + if (filePath != lastFilepath) + { + Files.Load(AppID, filePath); + Filelinks.Load(AppID, filePath); + } + totalItems = totalItems + DisplayArrayList(filePath, this.Files, facadeView); + totalItems = totalItems + DisplayArrayList(filePath, this.Filelinks, facadeView); + lastFilepath = filePath; + return totalItems; + } - results += sr.ReadToEnd(); - errors += err.ReadToEnd(); - - if (errors.Trim() != "") - { - Log.Info("Application PrePost errors: {0}", errors); - } - } + protected int DisplayArrayList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) + { + int totalItems = 0; + //foreach (FileItem currentFileItem in dbItems) + foreach (object obj in dbItems) + { + totalItems = totalItems + 1; + if (obj is FileItem) + { + FileItem curFile = obj as FileItem; + GUIListItem gli = new GUIListItem(curFile.Title); + gli.Label2 = curFile.Title2; + gli.MusicTag = curFile; + gli.IsFolder = curFile.IsFolder; + gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(gli); } - - public virtual void LaunchFile(GUIListItem item) + else if (obj is ProgramFilterItem) { - // Launch File by GUILISTITEM - // => look for FileItem and launch it using the found object - if (item.MusicTag == null) - { - return; - } - FileItem curFile = (FileItem)item.MusicTag; + ProgramFilterItem curFilter = obj as ProgramFilterItem; + GUIListItem gli = new GUIListItem(curFilter.Title); + gli.Label2 = curFilter.Title2; // some filters may have more than one text + gli.MusicTag = curFilter; + gli.IsFolder = true; + //ck + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - if (curFile == null) - { - return; - } - this.LaunchFile(curFile, true); + + facadeView.Add(gli); + } + } + return totalItems; + } - protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + + void OnRetrieveCoverArt(GUIListItem gli) + { + if ((gli.MusicTag != null) && (gli.MusicTag is FileItem)) + { + FileItem curFile = (FileItem)gli.MusicTag; + if (curFile.Imagefile != "") { - this.OnLaunchFilelink(curLink, MPGUIMode); + gli.ThumbnailImage = curFile.Imagefile; + gli.IconImageBig = curFile.Imagefile; + gli.IconImage = curFile.Imagefile; } - - public virtual string DefaultFilepath() + else { - return ""; // override this if the appitem can have subfolders + gli.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + gli.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + gli.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; } + } + } - public virtual int DisplayFiles(string filePath, GUIFacadeControl facadeView) - { - int totalItems = 0; - if (filePath != lastFilepath) + /* private void OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; + if (filmstrip == null) return; + if (item == null) return; + if ((item.MusicTag != null) && (item.MusicTag is FileItem) && (!item.IsFolder)) + { + filmstrip.InfoImageFileName = item.ThumbnailImage; + } + else + { + filmstrip.InfoImageFileName = ""; + } + }*/ + private void OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIPrograms.ThumbnailPath = ""; + if (item.ThumbnailImage != "" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" + ) + { + // only show big thumb if there is really one.... + GUIPrograms.ThumbnailPath = item.ThumbnailImage; + } + } + + public virtual void OnSort(GUIFacadeControl view, bool doSwitchState) + { + /* + * if (!filesAreLoaded) { - Files.Load(AppID, filePath); - Filelinks.Load(AppID, filePath); + LoadFiles(); } - totalItems = totalItems + DisplayArrayList(filePath, this.Files, facadeView); - totalItems = totalItems + DisplayArrayList(filePath, this.Filelinks, facadeView); - lastFilepath = filePath; - return totalItems; - } - protected int DisplayArrayList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) - { - int totalItems = 0; - //foreach (FileItem currentFileItem in dbItems) - foreach (object obj in dbItems) + if (doSwitchState) { - totalItems = totalItems + 1; - if (obj is FileItem) - { - FileItem curFile = obj as FileItem; - GUIListItem gli = new GUIListItem(curFile.Title); - gli.Label2 = curFile.Title2; - gli.MusicTag = curFile; - gli.IsFolder = curFile.IsFolder; - gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(gli); - } - else if (obj is ProgramFilterItem) - { - ProgramFilterItem curFilter = obj as ProgramFilterItem; - GUIListItem gli = new GUIListItem(curFilter.Title); - gli.Label2 = curFilter.Title2; // some filters may have more than one text - gli.MusicTag = curFilter; - gli.IsFolder = true; - //ck - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + dbPc.UpdateState(); + } + view.Sort(dbPc); + */ + } + public virtual void OnSortToggle(GUIFacadeControl view) + { + dbPc.sortAscending = (!dbPc.sortAscending); + view.Sort(dbPc); + } - facadeView.Add(gli); + public virtual int GetCurrentSortIndex() + { + return dbPc.CurrentSortMethodIndex; + } - } - } - return totalItems; - } + public virtual void SetCurrentSortIndex(int newValue) + { + dbPc.CurrentSortMethodIndex = newValue; + } + public virtual string CurrentSortTitle() + { + return dbPc.CurrentSortMethodAsText; + } - void OnRetrieveCoverArt(GUIListItem gli) - { - if ((gli.MusicTag != null) && (gli.MusicTag is FileItem)) - { - FileItem curFile = (FileItem)gli.MusicTag; - if (curFile.Imagefile != "") - { - gli.ThumbnailImage = curFile.Imagefile; - gli.IconImageBig = curFile.Imagefile; - gli.IconImage = curFile.Imagefile; - } - else - { - gli.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - gli.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - gli.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; - } - } - } + public virtual bool GetCurrentSortIsAscending() + { + return dbPc.sortAscending; + } - /* private void OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; - if (filmstrip == null) return; - if (item == null) return; - if ((item.MusicTag != null) && (item.MusicTag is FileItem) && (!item.IsFolder)) - { - filmstrip.InfoImageFileName = item.ThumbnailImage; - } - else - { - filmstrip.InfoImageFileName = ""; - } - }*/ - private void OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIPrograms.ThumbnailPath = ""; - if (item.ThumbnailImage != "" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" - ) - { - // only show big thumb if there is really one.... - GUIPrograms.ThumbnailPath = item.ThumbnailImage; - } - } + public virtual void SetCurrentSortIsAscending(bool newValue) + { + dbPc.sortAscending = newValue; + } - public virtual void OnSort(GUIFacadeControl view, bool doSwitchState) - { - /* - * if (!filesAreLoaded) - { - LoadFiles(); - } + public virtual bool RefreshButtonVisible() + { + return false; // otherwise, override this in child class + } - if (doSwitchState) - { - dbPc.UpdateState(); - } - view.Sort(dbPc); - */ - } + public virtual bool FileEditorAllowed() + { + return true; // otherwise, override this in child class + } - public virtual void OnSortToggle(GUIFacadeControl view) - { - dbPc.sortAscending = (!dbPc.sortAscending); - view.Sort(dbPc); - } + public virtual bool FileAddAllowed() + { + return true; // otherwise, override this in child class + } - public virtual int GetCurrentSortIndex() - { - return dbPc.CurrentSortMethodIndex; - } + public virtual bool FilesCanBeFavourites() + { + return true; // otherwise, override this in child class + } - public virtual void SetCurrentSortIndex(int newValue) - { - dbPc.CurrentSortMethodIndex = newValue; - } + public virtual bool FileBrowseAllowed() + { + // set this to true, if SUBDIRECTORIES are allowed + // (example: possible for DIRECTORY-CACHE) + return false; // otherwise, override this in child class + } - public virtual string CurrentSortTitle() - { - return dbPc.CurrentSortMethodAsText; - } + public virtual bool SubItemsAllowed() + { + return false; + } - public virtual bool GetCurrentSortIsAscending() - { - return dbPc.sortAscending; - } + public virtual bool ProfileLoadingAllowed() + { + return false; + } - public virtual void SetCurrentSortIsAscending(bool newValue) - { - dbPc.sortAscending = newValue; - } + public virtual void Refresh(bool mpGuiMode) + { + // descendant classes do that! + } - public virtual bool RefreshButtonVisible() - { - return false; // otherwise, override this in child class - } - public virtual bool FileEditorAllowed() + public virtual void OnInfo(GUIListItem item, ref bool isOverviewVisible, ref ProgramInfoAction modalResult, ref int selectedFileID) + { + GUIFileInfo fileInfoDialog = (GUIFileInfo)GUIWindowManager.GetWindow(ProgramUtils.ProgramInfoID); + if (null != fileInfoDialog) + { + if (item.MusicTag == null) { - return true; // otherwise, override this in child class + return; } + FileItem curFile = (FileItem)item.MusicTag; + fileInfoDialog.App = this; + fileInfoDialog.File = curFile; + fileInfoDialog.IsOverviewVisible = isOverviewVisible; + fileInfoDialog.DoModal(GetID); + isOverviewVisible = fileInfoDialog.IsOverviewVisible; + modalResult = fileInfoDialog.ModalResult; + selectedFileID = fileInfoDialog.SelectedFileID; + return; + } + } - public virtual bool FileAddAllowed() - { - return true; // otherwise, override this in child class - } + public int AppID + { + get { return appID; } + set { appID = value; } + } - public virtual bool FilesCanBeFavourites() - { - return true; // otherwise, override this in child class - } + public int FatherID + { + get { return fatherID; } + set { fatherID = value; } + } - public virtual bool FileBrowseAllowed() - { - // set this to true, if SUBDIRECTORIES are allowed - // (example: possible for DIRECTORY-CACHE) - return false; // otherwise, override this in child class - } + public string Title + { + get { return title; } + set { title = value; } + } - public virtual bool SubItemsAllowed() - { - return false; - } + public string ShortTitle + { + get { return shortTitle; } + set { shortTitle = value; } + } - public virtual bool ProfileLoadingAllowed() - { - return false; - } + public string Filename + { + get { return filename; } + set { filename = value; } + } - public virtual void Refresh(bool mpGuiMode) - { - // descendant classes do that! - } + public string Arguments + { + get { return arguments; } + set { arguments = value; } + } + public bool UseQuotes + { + get { return useQuotes; } + set { useQuotes = value; } + } - public virtual void OnInfo(GUIListItem item, ref bool isOverviewVisible, ref ProgramInfoAction modalResult, ref int selectedFileID) - { - GUIFileInfo fileInfoDialog = (GUIFileInfo)GUIWindowManager.GetWindow(ProgramUtils.ProgramInfoID); - if (null != fileInfoDialog) - { - if (item.MusicTag == null) - { - return; - } - FileItem curFile = (FileItem)item.MusicTag; - fileInfoDialog.App = this; - fileInfoDialog.File = curFile; - fileInfoDialog.IsOverviewVisible = isOverviewVisible; - fileInfoDialog.DoModal(GetID); - isOverviewVisible = fileInfoDialog.IsOverviewVisible; - modalResult = fileInfoDialog.ModalResult; - selectedFileID = fileInfoDialog.SelectedFileID; - return; - } - } + public bool UseShellExecute + { + get { return useShellExecute; } + set { useShellExecute = value; } + } - public int AppID - { - get { return appID; } - set { appID = value; } - } + public bool Enabled + { + get { return enabled; } + set { enabled = value; } + } - public int FatherID - { - get { return fatherID; } - set { fatherID = value; } - } + public ProcessWindowStyle WindowStyle + { + get { return windowStyle; } + set { windowStyle = value; } + } - public string Title - { - get { return title; } - set { title = value; } - } + public string Startupdir + { + get { return startupDir; } + set { startupDir = value; } + } - public string ShortTitle - { - get { return shortTitle; } - set { shortTitle = value; } - } + public string FileDirectory + { + get { return fileDirectory; } + set { fileDirectory = value; } + } - public string Filename - { - get { return filename; } - set { filename = value; } - } + public string ImageDirectory + { + get { return imageDirectories; } + set { SetImageDirectory(value); } + } - public string Arguments - { - get { return arguments; } - set { arguments = value; } - } + private void SetImageDirectory(string value) + { + imageDirectories = value; + imageDirs = imageDirectories.Split(';'); + for (int i = 0; i < imageDirs.Length; i++) + { + imageDirs[i] = imageDirs[i].Trim(); + // hack the \n away.... + // imageDirs[i] = imageDirs[i].TrimStart('\n'); + // hack trailing backslashes away + imageDirs[i] = imageDirs[i].TrimEnd('\\'); + } + } - public bool UseQuotes - { - get { return useQuotes; } - set { useQuotes = value; } - } + public string Imagefile + { + get { return imageFile; } + set { imageFile = value; } + } - public bool UseShellExecute - { - get { return useShellExecute; } - set { useShellExecute = value; } - } + public string Source + { + get { return sourceFile; } + set { sourceFile = value; } + } - public bool Enabled - { - get { return enabled; } - set { enabled = value; } - } + public ApplicationType SourceType + { + get { return sourceType; } + set { sourceType = value; } + } - public ProcessWindowStyle WindowStyle - { - get { return windowStyle; } - set { windowStyle = value; } - } + public string ValidExtensions + { + get { return validExtensions; } + set { validExtensions = value; } + } - public string Startupdir - { - get { return startupDir; } - set { startupDir = value; } - } + public bool ImportValidImagesOnly + { + get { return importValidImagesOnly; } + set { importValidImagesOnly = value; } + } - public string FileDirectory - { - get { return fileDirectory; } - set { fileDirectory = value; } - } + public int Position + { + get { return appPosition; } + set { appPosition = value; } + } - public string ImageDirectory - { - get { return imageDirectories; } - set { SetImageDirectory(value); } - } + public int ContentID + { + get { return contentID; } + set { contentID = value; } + } - private void SetImageDirectory(string value) - { - imageDirectories = value; - imageDirs = imageDirectories.Split(';'); - for (int i = 0; i < imageDirs.Length; i++) - { - imageDirs[i] = imageDirs[i].Trim(); - // hack the \n away.... - // imageDirs[i] = imageDirs[i].TrimStart('\n'); - // hack trailing backslashes away - imageDirs[i] = imageDirs[i].TrimEnd('\\'); - } - } + public string SystemDefault + { + get { return systemDefault; } + set { systemDefault = value; } + } - public string Imagefile - { - get { return imageFile; } - set { imageFile = value; } - } + public bool WaitForExit + { + get { return waitForExit; } + set { waitForExit = value; } + } - public string Source - { - get { return sourceFile; } - set { sourceFile = value; } - } - public ApplicationType SourceType - { - get { return sourceType; } - set { sourceType = value; } - } + public bool GUIRefreshPossible + { + get { return RefreshButtonVisible(); } + } - public string ValidExtensions - { - get { return validExtensions; } - set { validExtensions = value; } - } + public bool EnableGUIRefresh + { + get { return enableGUIRefresh; } + set { enableGUIRefresh = value; } + } - public bool ImportValidImagesOnly - { - get { return importValidImagesOnly; } - set { importValidImagesOnly = value; } - } + public string LaunchErrorMsg + { + get { return launchErrorMsg; } + set { launchErrorMsg = value; } + } - public int Position + public string PreLaunch + { + get { return preLaunch; } + set { preLaunch = value; } + } + + public string PostLaunch + { + get { return postLaunch; } + set { postLaunch = value; } + } + + + public FileItemList Files + { + // load on demand.... + get + { + if (!filesAreLoaded) { - get { return appPosition; } - set { appPosition = value; } + LoadFiles(); } + return fileList; + } + } - public int ContentID + + public FilelinkItemList Filelinks + { + // load on demand.... + get + { + if (!linksAreLoaded) { - get { return contentID; } - set { contentID = value; } + LoadFileLinks(); } + return fileLinks; + } + } - public string SystemDefault + + private int GetNewAppID() + { + // get an unused SQL application KEY-number + if (sqlDB != null) + { + // won't work in multiuser environment :) + SQLiteResultSet results; + int res = 0; + results = sqlDB.Execute("SELECT MAX(APPID) FROM application"); + SQLiteResultSet.Row arr = results.Rows[0]; + if (arr.fields[0] != null) { - get { return systemDefault; } - set { systemDefault = value; } + if (arr.fields[0] != "") + { + res = Int32.Parse(arr.fields[0]); + } } + return res + 1; + } + else return -1; + } - public bool WaitForExit + private void Insert() + { + if (sqlDB != null) + { + try { - get { return waitForExit; } - set { waitForExit = value; } + if (ContentID <= 0) + { + ContentID = 100; + } + //to remove + string Pincode = ""; + AppID = GetNewAppID(); // important to avoid subsequent inserts! + string sql = String.Format("insert into application (appid, fatherID, title, shorttitle, filename, arguments, windowstyle, startupdir, useshellexecute, usequotes, source_type, source, imagefile, filedirectory, imagedirectory, validextensions, importvalidimagesonly, iposition, enabled, enableGUIRefresh, GUIRefreshPossible, pincode, contentID, systemDefault, WaitForExit, preLaunch, postLaunch) values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}')", + AppID, FatherID, ProgramUtils.Encode(Title), ProgramUtils.Encode(ShortTitle), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Arguments), + ProgramUtils.WindowStyleToStr(WindowStyle), ProgramUtils.Encode(Startupdir), ProgramUtils.BooleanToStr(UseShellExecute), + ProgramUtils.BooleanToStr(UseQuotes), ProgramUtils.ApplicationTypeToString(SourceType), ProgramUtils.Encode(Source), ProgramUtils.Encode(Imagefile), + ProgramUtils.Encode(FileDirectory), ProgramUtils.Encode(ImageDirectory), ProgramUtils.Encode(ValidExtensions), ProgramUtils.BooleanToStr(importValidImagesOnly), Position, + ProgramUtils.BooleanToStr(Enabled), ProgramUtils.BooleanToStr(EnableGUIRefresh), ProgramUtils.BooleanToStr(GUIRefreshPossible), Pincode, + ContentID, ProgramUtils.Encode(SystemDefault), ProgramUtils.BooleanToStr(WaitForExit), ProgramUtils.Encode(PreLaunch), ProgramUtils.Encode(PostLaunch) + ); + sqlDB.Execute(sql); } - - - public bool GUIRefreshPossible + catch (SQLiteException ex) { - get { return RefreshButtonVisible(); } + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } + } + } - public bool EnableGUIRefresh + private void Update() + { + string sql = ""; + //to remove + string Pincode = ""; + if ((AppID >= 0) && (sqlDB != null)) + { + if (ContentID <= 0) { - get { return enableGUIRefresh; } - set { enableGUIRefresh = value; } + ContentID = 100; } - - public string LaunchErrorMsg + try { - get { return launchErrorMsg; } - set { launchErrorMsg = value; } + sql = String.Format("update application set title = '{0}', shorttitle = '{1}', filename = '{2}', arguments = '{3}', windowstyle = '{4}', startupdir = '{5}', useshellexecute = '{6}', usequotes = '{7}', source_type = '{8}', source = '{9}', imagefile = '{10}',filedirectory = '{11}',imagedirectory = '{12}',validextensions = '{13}',importvalidimagesonly = '{14}',iposition = {15}, enabled = '{16}', fatherID = '{17}', enableGUIRefresh = '{18}', GUIRefreshPossible = '{19}', pincode = '{20}', contentID = '{21}', systemDefault = '{22}', WaitForExit = '{23}', preLaunch = '{24}', postLaunch = '{25}' where appID = {26}", + ProgramUtils.Encode(Title), ProgramUtils.Encode(ShortTitle), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Arguments), + ProgramUtils.WindowStyleToStr(WindowStyle), ProgramUtils.Encode(Startupdir), ProgramUtils.BooleanToStr(UseShellExecute), + ProgramUtils.BooleanToStr(UseQuotes), ProgramUtils.ApplicationTypeToString(SourceType), ProgramUtils.Encode(Source), ProgramUtils.Encode(Imagefile), + ProgramUtils.Encode(FileDirectory), ProgramUtils.Encode(ImageDirectory), ProgramUtils.Encode(ValidExtensions), ProgramUtils.BooleanToStr(importValidImagesOnly), Position, + ProgramUtils.BooleanToStr(Enabled), FatherID, ProgramUtils.BooleanToStr(EnableGUIRefresh), ProgramUtils.BooleanToStr(GUIRefreshPossible), + Pincode, ContentID, ProgramUtils.Encode(SystemDefault), ProgramUtils.BooleanToStr(WaitForExit), ProgramUtils.Encode(PreLaunch), ProgramUtils.Encode(PostLaunch), + AppID); + sqlDB.Execute(sql); } - - public string PreLaunch + catch (SQLiteException ex) { - get { return preLaunch; } - set { preLaunch = value; } + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + Log.Info("sql \n{0}", sql); } + } + } - public string PostLaunch + public void Delete() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try { - get { return postLaunch; } - set { postLaunch = value; } + DeleteFiles(); + DeleteFileLinks(); + sqlDB.Execute(String.Format("delete from application where appid = {0}", AppID)); } - - - public FileItemList Files + catch (SQLiteException ex) { - // load on demand.... - get - { - if (!filesAreLoaded) - { - LoadFiles(); - } - return fileList; - } + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } + } + } - public FilelinkItemList Filelinks - { - // load on demand.... - get - { - if (!linksAreLoaded) - { - LoadFileLinks(); - } - return fileLinks; - } - } - private int GetNewAppID() + protected void DeleteFiles() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try { - // get an unused SQL application KEY-number - if (sqlDB != null) - { - // won't work in multiuser environment :) - SQLiteResultSet results; - int res = 0; - results = sqlDB.Execute("SELECT MAX(APPID) FROM application"); - SQLiteResultSet.Row arr = results.Rows[0]; - if (arr.fields[0] != null) - { - if (arr.fields[0] != "") - { - res = Int32.Parse(arr.fields[0]); - } - } - return res + 1; - } - else return -1; + sqlDB.Execute(String.Format("delete from tblfile where appid = {0}", AppID)); } - - private void Insert() + catch (SQLiteException ex) { - if (sqlDB != null) - { - try - { - if (ContentID <= 0) - { - ContentID = 100; - } - //to remove - string Pincode = ""; - AppID = GetNewAppID(); // important to avoid subsequent inserts! - string sql = String.Format("insert into application (appid, fatherID, title, shorttitle, filename, arguments, windowstyle, startupdir, useshellexecute, usequotes, source_type, source, imagefile, filedirectory, imagedirectory, validextensions, importvalidimagesonly, iposition, enabled, enableGUIRefresh, GUIRefreshPossible, pincode, contentID, systemDefault, WaitForExit, preLaunch, postLaunch) values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}')", - AppID, FatherID, ProgramUtils.Encode(Title), ProgramUtils.Encode(ShortTitle), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Arguments), - ProgramUtils.WindowStyleToStr(WindowStyle), ProgramUtils.Encode(Startupdir), ProgramUtils.BooleanToStr(UseShellExecute), - ProgramUtils.BooleanToStr(UseQuotes), ProgramUtils.ApplicationTypeToString(SourceType), ProgramUtils.Encode(Source), ProgramUtils.Encode(Imagefile), - ProgramUtils.Encode(FileDirectory), ProgramUtils.Encode(ImageDirectory), ProgramUtils.Encode(ValidExtensions), ProgramUtils.BooleanToStr(importValidImagesOnly), Position, - ProgramUtils.BooleanToStr(Enabled), ProgramUtils.BooleanToStr(EnableGUIRefresh), ProgramUtils.BooleanToStr(GUIRefreshPossible),Pincode , - ContentID, ProgramUtils.Encode(SystemDefault), ProgramUtils.BooleanToStr(WaitForExit), ProgramUtils.Encode(PreLaunch), ProgramUtils.Encode(PostLaunch) - ); - sqlDB.Execute(sql); - } - catch (SQLiteException ex) - { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); - } - } + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } + } + } - private void Update() + protected void DeleteFileLinks() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try { - string sql = ""; - //to remove - string Pincode = ""; - if ((AppID >= 0) && (sqlDB != null)) - { - if (ContentID <= 0) - { - ContentID = 100; - } - try - { - sql = String.Format("update application set title = '{0}', shorttitle = '{1}', filename = '{2}', arguments = '{3}', windowstyle = '{4}', startupdir = '{5}', useshellexecute = '{6}', usequotes = '{7}', source_type = '{8}', source = '{9}', imagefile = '{10}',filedirectory = '{11}',imagedirectory = '{12}',validextensions = '{13}',importvalidimagesonly = '{14}',iposition = {15}, enabled = '{16}', fatherID = '{17}', enableGUIRefresh = '{18}', GUIRefreshPossible = '{19}', pincode = '{20}', contentID = '{21}', systemDefault = '{22}', WaitForExit = '{23}', preLaunc... [truncated message content] |
From: <ze...@us...> - 2007-06-08 17:15:00
|
Revision: 493 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=493&view=rev Author: zebons Date: 2007-06-08 10:14:57 -0700 (Fri, 08 Jun 2007) Log Message: ----------- Add a setup to configure Key Skin reload Modified Paths: -------------- trunk/plugins/My Refresh/MyRefresh.cs Added Paths: ----------- trunk/plugins/My Refresh/MyRefreshSetup.Designer.cs trunk/plugins/My Refresh/MyRefreshSetup.cs trunk/plugins/My Refresh/MyRefreshSetup.resx Modified: trunk/plugins/My Refresh/MyRefresh.cs =================================================================== --- trunk/plugins/My Refresh/MyRefresh.cs 2007-06-08 13:33:09 UTC (rev 492) +++ trunk/plugins/My Refresh/MyRefresh.cs 2007-06-08 17:14:57 UTC (rev 493) @@ -1,20 +1,26 @@ +using MediaPortal.GUI.Library; +using MediaPortal.Configuration; +using System; +using System.IO; +using System.Windows.Forms; + namespace MediaPortal.Plugins { - using MediaPortal.GUI.Library; - using MediaPortal.Configuration; - using System; - using System.IO; - using System.Windows.Forms; public class MyRefresh : IPluginReceiver, IPlugin, ISetupForm { private string _language = string.Empty; - private string _refreshHotkeys = "Rr"; + private string _refreshHotkeys; public string Author() { return "Smirnoff"; } + public void ShowPlugin() + { + System.Windows.Forms.Form setup = new MyRefreshSetup(); + setup.ShowDialog(); + } public bool CanEnable() { @@ -33,7 +39,7 @@ public bool GetHome(out string buttonText, out string buttonImage, out string buttonImageFocused, out string hoverImage) { - string text; + string text; hoverImage = text = ""; buttonImageFocused = text; buttonText = buttonImage = text; @@ -47,12 +53,12 @@ public bool HasSetup() { - return false; + return true; } private void OnAction(Action action) { - if ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (this._refreshHotkeys.IndexOf((char)action.m_key.KeyChar, 0) != -1)) + if ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (this._refreshHotkeys.IndexOf((char)action.m_key.KeyChar, 0) != -1)) { this.Refresh(false); } @@ -103,17 +109,15 @@ } } - public void ShowPlugin() - { - } - public void Start() { Log.Info("MyRefresh: Plugin started", new object[0]); using (MediaPortal.Profile.Settings settings = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { this._language = settings.GetValueAsString("skin", "language", string.Empty); + _refreshHotkeys = settings.GetValueAsString("MyRefresh", "HotKeys", "Ee%"); } + Log.Info("MyRefresh: _refreshHotkeys", _refreshHotkeys); if (this._language == string.Empty) { this._language = "English"; Added: trunk/plugins/My Refresh/MyRefreshSetup.Designer.cs =================================================================== --- trunk/plugins/My Refresh/MyRefreshSetup.Designer.cs (rev 0) +++ trunk/plugins/My Refresh/MyRefreshSetup.Designer.cs 2007-06-08 17:14:57 UTC (rev 493) @@ -0,0 +1,72 @@ +namespace MediaPortal.Plugins +{ + partial class MyRefreshSetup + { + /// <summary> + /// Variable nécessaire au concepteur. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Nettoyage des ressources utilisées. + /// </summary> + /// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Code généré par le Concepteur Windows Form + + /// <summary> + /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas + /// le contenu de cette méthode avec l'éditeur de code. + /// </summary> + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.KeyList = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(29, 44); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(99, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Keys for skin reload"; + // + // KeyList + // + this.KeyList.Location = new System.Drawing.Point(148, 41); + this.KeyList.Name = "KeyList"; + this.KeyList.Size = new System.Drawing.Size(68, 20); + this.KeyList.TabIndex = 2; + // + // MyRefreshSetup + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(363, 130); + this.Controls.Add(this.KeyList); + this.Controls.Add(this.label1); + this.Name = "MyRefreshSetup"; + this.Text = "MyRefreshSetup"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MyRefreshSetup_FormClosing); + this.Load += new System.EventHandler(this.MyRefreshSetup_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox KeyList; + } +} \ No newline at end of file Added: trunk/plugins/My Refresh/MyRefreshSetup.cs =================================================================== --- trunk/plugins/My Refresh/MyRefreshSetup.cs (rev 0) +++ trunk/plugins/My Refresh/MyRefreshSetup.cs 2007-06-08 17:14:57 UTC (rev 493) @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using MediaPortal.Util; +using MediaPortal.Configuration; + +namespace MediaPortal.Plugins +{ + public partial class MyRefreshSetup : Form + { + public MyRefreshSetup() + { + InitializeComponent(); + } + + private void MyRefreshSetup_Load(object sender, EventArgs e) + { + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + KeyList.Text = xmlreader.GetValueAsString("MyRefresh", "HotKeys", "Ee%"); + } + } + private void MyRefreshSetup_FormClosing(object sender, FormClosingEventArgs e) + { + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlwriter.SetValue("MyRefresh", "HotKeys", KeyList.Text); + } + + } + } +} \ No newline at end of file Added: trunk/plugins/My Refresh/MyRefreshSetup.resx =================================================================== --- trunk/plugins/My Refresh/MyRefreshSetup.resx (rev 0) +++ trunk/plugins/My Refresh/MyRefreshSetup.resx 2007-06-08 17:14:57 UTC (rev 493) @@ -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <an...@us...> - 2007-06-08 13:33:16
|
Revision: 492 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=492&view=rev Author: and-81 Date: 2007-06-08 06:33:09 -0700 (Fri, 08 Jun 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2007-06-06 23:20:39 UTC (rev 491) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2007-06-08 13:33:09 UTC (rev 492) @@ -387,7 +387,7 @@ ServiceController[] services = ServiceController.GetServices(); foreach (ServiceController service in services) { - if (service.ServiceName == "ehRecvr") + if (service.ServiceName.Equals("ehRecvr", StringComparison.InvariantCultureIgnoreCase)) { if (service.Status != ServiceControllerStatus.Stopped && service.Status != ServiceControllerStatus.StopPending) { @@ -395,13 +395,21 @@ } } - if (service.ServiceName == "ehSched") + if (service.ServiceName.Equals("ehSched", StringComparison.InvariantCultureIgnoreCase)) { if (service.Status != ServiceControllerStatus.Stopped && service.Status != ServiceControllerStatus.StopPending) { service.Stop(); } } + + if (service.ServiceName.Equals("mcrdsvc", StringComparison.InvariantCultureIgnoreCase)) + { + if (service.Status != ServiceControllerStatus.Stopped && service.Status != ServiceControllerStatus.StopPending) + { + service.Stop(); + } + } } } catch (Exception ex) Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs 2007-06-06 23:20:39 UTC (rev 491) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/InputMapper/InputMappingForm.cs 2007-06-08 13:33:09 UTC (rev 492) @@ -291,8 +291,9 @@ // treeMapping // this.treeMapping.AllowDrop = true; - this.treeMapping.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); + this.treeMapping.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.treeMapping.FullRowSelect = true; this.treeMapping.HideSelection = false; this.treeMapping.Location = new System.Drawing.Point(16, 56); @@ -303,6 +304,7 @@ // // labelExpand // + this.labelExpand.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.labelExpand.AutoSize = true; this.labelExpand.Location = new System.Drawing.Point(328, 374); this.labelExpand.Name = "labelExpand"; @@ -313,7 +315,7 @@ // // buttonDefault // - this.buttonDefault.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonDefault.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonDefault.Location = new System.Drawing.Point(268, 442); this.buttonDefault.Name = "buttonDefault"; this.buttonDefault.Size = new System.Drawing.Size(75, 23); @@ -732,6 +734,7 @@ this.Controls.Add(this.groupBoxCondition); this.Controls.Add(this.groupBoxLayer); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MinimumSize = new System.Drawing.Size(598, 509); this.Name = "InputMappingForm"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs 2007-06-06 23:20:39 UTC (rev 491) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/MP Control Plugin/MPControlPlugin.cs 2007-06-08 13:33:09 UTC (rev 492) @@ -1400,22 +1400,22 @@ break; } /* - case Common.XmlTagWindowState: - { - if (InConfiguration) - { - MessageBox.Show("Command to toggle the window state cannot be processed in configuration.", "Window State Toggle Command", MessageBoxButtons.OK, MessageBoxIcon.Information); - break; - } + case Common.XmlTagWindowState: + { + if (InConfiguration) + { + MessageBox.Show("Command to toggle the window state cannot be processed in configuration.", "Window State Toggle Command", MessageBoxButtons.OK, MessageBoxIcon.Information); + break; + } - GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SWITCH_FULL_WINDOWED, 0, 0, 0, 0, 0, null); + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SWITCH_FULL_WINDOWED, 0, 0, 0, 0, 0, null); - if (GUIGraphicsContext.DX9Device.PresentationParameters.Windowed) - msg.Param1 = 1; + if (GUIGraphicsContext.DX9Device.PresentationParameters.Windowed) + msg.Param1 = 1; - GUIWindowManager.SendMessage(msg); - break; - } + GUIWindowManager.SendMessage(msg); + break; + } */ case Common.XmlTagFocus: { @@ -1539,34 +1539,34 @@ if (String.IsNullOrEmpty(command)) throw new ArgumentException("Null or empty argument", "command"); - if (command.StartsWith(Common.CmdPrefixMacro)) // Macro + if (command.StartsWith(Common.CmdPrefixMacro, StringComparison.InvariantCultureIgnoreCase)) // Macro { string fileName = FolderMacros + command.Substring(Common.CmdPrefixMacro.Length) + Common.FileExtensionMacro; ProcessMacro(fileName); } - else if (command.StartsWith(Common.CmdPrefixBlast)) // IR Code + else if (command.StartsWith(Common.CmdPrefixBlast, StringComparison.InvariantCultureIgnoreCase)) // IR Code { string[] commands = Common.SplitBlastCommand(command.Substring(Common.CmdPrefixBlast.Length)); string fileName = Common.FolderIRCommands + commands[0] + Common.FileExtensionIR; BlastIR(fileName, commands[1], commands[2]); } - else if (command.StartsWith(Common.CmdPrefixRun)) // External Program + else if (command.StartsWith(Common.CmdPrefixRun, StringComparison.InvariantCultureIgnoreCase)) // External Program { string[] commands = Common.SplitRunCommand(command.Substring(Common.CmdPrefixRun.Length)); Common.ProcessRunCommand(commands); } - else if (command.StartsWith(Common.CmdPrefixSerial)) // Serial Port Command + else if (command.StartsWith(Common.CmdPrefixSerial, StringComparison.InvariantCultureIgnoreCase)) // Serial Port Command { string[] commands = Common.SplitSerialCommand(command.Substring(Common.CmdPrefixSerial.Length)); Common.ProcessSerialCommand(commands); } - else if (command.StartsWith(Common.CmdPrefixMessage)) // Message Command + else if (command.StartsWith(Common.CmdPrefixMessage, StringComparison.InvariantCultureIgnoreCase)) // Message Command { string[] commands = Common.SplitMessageCommand(command.Substring(Common.CmdPrefixMessage.Length)); Common.ProcessMessageCommand(commands); } - else if (command.StartsWith(Common.CmdPrefixKeys)) // Keystroke Command + else if (command.StartsWith(Common.CmdPrefixKeys, StringComparison.InvariantCultureIgnoreCase)) // Keystroke Command { string keyCommand = command.Substring(Common.CmdPrefixKeys.Length); if (InConfiguration) @@ -1574,7 +1574,7 @@ else Common.ProcessKeyCommand(keyCommand); } - else if (command.StartsWith(Common.CmdPrefixGoto)) // Go To Screen + else if (command.StartsWith(Common.CmdPrefixGoto, StringComparison.InvariantCultureIgnoreCase)) // Go To Screen { MPCommands.ProcessGoTo(command.Substring(Common.CmdPrefixGoto.Length), MP_BasicHome); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <moi...@us...> - 2007-06-06 23:20:42
|
Revision: 491 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=491&view=rev Author: moiristo Date: 2007-06-06 16:20:39 -0700 (Wed, 06 Jun 2007) Log Message: ----------- Update of the RTLGemist section Modified Paths: -------------- trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs Added Paths: ----------- trunk/plugins/UitzendingGemist/Readme.txt Removed Paths: ------------- trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/RtlGemist.xml.bak trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemist.xml.bak trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemist2.xml.bak trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemistMain.xml.bak Added: trunk/plugins/UitzendingGemist/Readme.txt =================================================================== --- trunk/plugins/UitzendingGemist/Readme.txt (rev 0) +++ trunk/plugins/UitzendingGemist/Readme.txt 2007-06-06 23:20:39 UTC (rev 491) @@ -0,0 +1,64 @@ +MediaPortal UitzendingGemist plugin +by Moiristo + + +This plugin for MediaPortal makes it possible to browse and watch the +internet streams provided by uitzendinggemist.nl and www.rtl.nl. + +This plugin is a frontend to the website and allows the user watch these streams from within Mediaportal. + + +installation: + +- Unpack +- Use Dukus's MPInstaller utility (available in the plugins/utilities download section) to install the plugin. Be sure to use the 0.2.2_SVN MPI when you are using the latest MP snapshot. + +bugs needed to be fixed +- After an emission finishes, MP isn't notified and will not go back to the menu. +(you have to stop the playback manually) + + +thanks: + +A big thanks to ZipperZip for letting me use his Uitzending_Gemist Plugin code. + +0.8 +- Fixed the TopTen screen of RTLGemist +- Recompiled against the latest SVN + +0.7 +- Changed the plugin name to 'TV Gemist' (A lot of plugins disliked the long name) +- NLGemist now shows all available emissions, not the last five +- Fixed wrong url regex for emission logo, now it properly shows the logo that belongs to the emission +- Fixed NLGemist not going in fullscreen when clicking an emission +- Added a widescreen skin file (nothing fancy yet though) +- No progression on the Tien plugin however :) + +0.6 +- Fixed NLGemist section not working because of changed website (Now everything can be found in XML documents o/) +- Started with the Tien plugin (no functionality yet) + +0.5 +- Fixed NLGemist section not working because of changed website (It requires a cookie) +- Fixed stream regexes +- Improved skin files + +TODO: + +- Support for Tien (I contacted them for this, not much support yet though) +- Mepo Skin (I like mepo :)) + +0.4 +- Created custom skin files for Project Mayhem 3 + +0.3 +- Added a frontend to RTLGemist +- Added an UitGemist-MP-puppet +- Added a frontend to UitzendingGemist and RTLGemist +- Improvement: Focus the facadeview after loading new entries + +0.2 +- Fixed some bugs in the original code + +0.1 +- Initial version from ZipperZip \ No newline at end of file Modified: trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs =================================================================== --- trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs 2007-06-06 21:53:56 UTC (rev 490) +++ trunk/plugins/UitzendingGemist/UitGemist/RTLGemist.cs 2007-06-06 23:20:39 UTC (rev 491) @@ -449,46 +449,38 @@ string url = host + @"/experience/media/context/index.xml"; string result = wc.GetXML(url); - try - { - XPathDocument document = new XPathDocument(new System.IO.StringReader(result)); - XPathNavigator navigator = document.CreateNavigator(); - XPathExpression programs = XPathExpression.Compile("//li/a"); //returns nodeset - XPathNodeIterator nodes = navigator.Select(programs); + //StreamWriter sw = new StreamWriter("d:/test.log"); + //sw.Write(result); + //sw.Close(); - int i = 0; - while (nodes.MoveNext()) - { - //Log.Info("UitGemist: Found node '" + nodes.Current.ToString() + "'"); + int i = 0; + MatchCollection mc = Regex.Matches(result, @"target=._parent.*?href=.(?<url>.*?.xml).*?>(?<name>.*?)</a>"); + if (mc.Count == 0) Log.Info("UitGemist: No emissions found"); + foreach (Match m1 in mc) + { + Log.Info("UitGemist: Found program '" + m1.Groups["name"].Value + "'"); - Names.Add(@nodes.Current.ToString()); - Names[i] = MakeFirstUpper(ConvertString(Names[i])); - Urls.Add(@nodes.Current.GetAttribute("href", "").ToString()); - Urls[i] = ConvertString(Urls[i]); - i++; - } + Names.Add(@m1.Groups["name"].Value); + Names[i] = MakeFirstUpper(ConvertString(Names[i])); + Urls.Add(@m1.Groups["url"].Value); + Urls[i] = ConvertString(Urls[i]); + i++; + } - // Show the results! + // Show the results! - facadeview.View = GUIFacadeControl.ViewMode.List; - facadeview.Clear(); + facadeview.View = GUIFacadeControl.ViewMode.List; + facadeview.Clear(); - for (i = 0; i < Names.Count; i++) - { - string label = Names[i]; - GUIListItem item = new GUIListItem(); - item.Label = label; - item.IsFolder = false; - Util.Utils.SetDefaultIcons(item); - facadeview.Add(item); - } - } - catch (XmlException e) + for (i = 0; i < Names.Count; i++) { - Log.Info("UitGemist: Invalid xml document '" + url + "'. Details follow."); - Log.Info("UitGemist: Line number: " + e.LineNumber + ":"); - Log.Info(e.StackTrace); + string label = Names[i]; + GUIListItem item = new GUIListItem(); + item.Label = label; + item.IsFolder = false; + Util.Utils.SetDefaultIcons(item); + facadeview.Add(item); } } Deleted: trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/RtlGemist.xml.bak =================================================================== --- trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/RtlGemist.xml.bak 2007-06-06 21:53:56 UTC (rev 490) +++ trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/RtlGemist.xml.bak 2007-06-06 23:20:39 UTC (rev 491) @@ -1,52 +0,0 @@ -<window> - <id>6802</id> - <defaultcontrol>50</defaultcontrol> - <allowoverlay>yes</allowoverlay> - <define>#header.label:RTLGemist</define> -<controls> - <import>common.window.xml</import> - <control> - <type>image</type> - <description>BackGround</description> - <id>1</id> - <posX>0</posX> - <posY>0</posY> - <width>720</width> - <height>576</height> - <texture>background3.png</texture> - </control> - <control> - <type>group</type> - <description>group element</description> - <animation>FlyInFromLeft</animation> - <layout>StackLayout</layout> - <posX>5</posX> - <posY>125</posY> - <control> - <description>Favorieten</description> - <type>button</type> - <id>2</id> - <label>Favorieten</label> - <onup>17</onup> - <ondown>3</ondown> - </control> - <control> - <description>Top Tien</description> - <type>button</type> - <id>3</id> - <label>Top Tien</label> - <onup>2</onup> - <ondown>4</ondown> - </control> - <control> - <description>Programma's</description> - <type>button</type> - <id>4</id> - <label>Programma's</label> - <onup>3</onup> - <ondown>2</ondown> - </control> - </control> - <import>common.facade.xml</import> -</controls> -</window> \ No newline at end of file Deleted: trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemist.xml.bak =================================================================== --- trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemist.xml.bak 2007-06-06 21:53:56 UTC (rev 490) +++ trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemist.xml.bak 2007-06-06 23:20:39 UTC (rev 491) @@ -1,127 +0,0 @@ -<window> - <id>6800</id> - <defaultcontrol>50</defaultcontrol> - <allowoverlay>yes</allowoverlay> - <define>#header.label:UitGemist</define> -<controls> - <import>common.window.xml</import> - <control> - <type>image</type> - <description>BackGround</description> - <id>1</id> - <posX>0</posX> - <posY>0</posY> - <width>720</width> - <height>576</height> - <texture>background3.png</texture> - </control> - <control> - <type>group</type> - <description>group element</description> - <animation>FlyInFromLeft</animation> - <layout>StackLayout</layout> - <posX>5</posX> - <posY>125</posY> - <control> - <description>Favorieten</description> - <type>button</type> - <id>2</id> - <label>Favorieten</label> - <onup>17</onup> - <ondown>3</ondown> - </control> - <control> - <type>selectbutton</type> - <description>Letter button</description> - <id>3</id> - <label>Titel</label> - <onup>2</onup> - <ondown>4</ondown> - </control> - <control> - <type>selectbutton</type> - <description>Letter button</description> - <id>4</id> - <label>Dag</label> - <onup>3</onup> - <ondown>5</ondown> - </control> - <control> - <type>selectbutton</type> - <description>Letter button</description> - <id>5</id> - <label>Net/zender</label> - <onup>4</onup> - <ondown>6</ondown> - </control> - <control> - <type>selectbutton</type> - <description>Letter button</description> - <id>6</id> - <label>Omroep</label> - <onup>5</onup> - <ondown>7</ondown> - </control> - <control> - <type>selectbutton</type> - <description>Letter button</description> - <id>7</id> - <label>Genre</label> - <onup>6</onup> - <ondown>8</ondown> - </control> - <control> - <description>Moet je Zien</description> - <type>button</type> - <id>8</id> - <label>Moet je zien</label> - <onup>7</onup> - <onright>50</onright> - <ondown>50</ondown> - </control> - <control> - <type>group</type> - <description>group element</description> - <control> - <type>imagelist</type> - <id>11</id> - <posX>550</posX> - <posY>350</posY> - <width>100</width> - <height>32</height> - <textureWidth>16</textureWidth> - <textureHeight>16</textureHeight> - <subitems> - <subitem>greystar.png</subitem> - <subitem>star.png</subitem> - </subitems> - <orientation>horizontal</orientation> - <align>left</align> - <percentage>#rating</percentage> - </control> - <control> - <type>textboxscrollup</type> - <description>Programma-info</description> - <id>12</id> - <posX>260</posX> - <posY>380</posY> - <width>375</width> - <height>100</height> - <label>#plot</label> - <textcolor>ffffffff</textcolor> - <font>font12</font> - </control> - <control> - <description>Bekeken</description> - <type>label</type> - <id>13</id> - <posX>260</posX> - <posY>350</posY> - <label>#votes keer bekeken</label> - <textcolor>ffffffff</textcolor> - </control> - </control> - </control> - <import>common.facade.xml</import> -</controls> -</window> \ No newline at end of file Deleted: trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemist2.xml.bak =================================================================== --- trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemist2.xml.bak 2007-06-06 21:53:56 UTC (rev 490) +++ trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemist2.xml.bak 2007-06-06 23:20:39 UTC (rev 491) @@ -1,136 +0,0 @@ -<window> - <id>6801</id> - <defaultcontrol>10</defaultcontrol> - <allowoverlay>yes</allowoverlay> - <define>#header.label:Programma</define> - <controls> - <import>common.window.xml</import> - <control> - <type>image</type> - <description>BackGround</description> - <id>9</id> - <posX>0</posX> - <posY>0</posY> - <width>720</width> - <height>576</height> - <texture>background.png</texture> - </control> - <control> - <type>group</type> - <description>group element</description> - <animation>FlyInFromTop</animation> - <control> - <type>image</type> - <description>Program image</description> - <id>3</id> - <posX>60</posX> - <posY>125</posY> - <width>100</width> - <height>75</height> - <texture>background.png</texture> - </control> - <control> - <description>Naam van gekozen programma</description> - <type>label</type> - <id>2</id> - <posX>170</posX> - <posY>105</posY> - <label>#title</label> - </control> - <control> - <description>Genre</description> - <type>label</type> - <id>0</id> - <posX>555</posX> - <posY>120</posY> - <label>Genre</label> - <textcolor>ffffffff</textcolor> - </control> - <control> - <description>Display wich genre</description> - <type>label</type> - <id>4</id> - <posX>555</posX> - <posY>138</posY> - <label>#genre</label> - </control> - <control> - <description>Omroep</description> - <type>label</type> - <id>8</id> - <posX>555</posX> - <posY>162</posY> - <label>Omroep</label> - <textcolor>ffffffff</textcolor> - </control> - <control> - <description>Display which omroep</description> - <type>label</type> - <id>5</id> - <posX>555</posX> - <posY>180</posY> - <label>#credits</label> - </control> - <control> - <type>imagelist</type> - <id>7</id> - <posX>555</posX> - <posY>205</posY> - <width>100</width> - <height>32</height> - <textureWidth>16</textureWidth> - <textureHeight>16</textureHeight> - <subitems> - <subitem>greystar.png</subitem> - <subitem>star.png</subitem> - </subitems> - <orientation>horizontal</orientation> - <align>left</align> - <percentage>#rating</percentage> - </control> - <control> - <type>textboxscrollup</type> - <description>Programma-info</description> - <id>6</id> - <posX>170</posX> - <posY>125</posY> - <width>375</width> - <height>105</height> - <label>#plot</label> - <font>font12</font> - <textcolor>ffffffff</textcolor> - </control> - <control> - <description>afleveringen</description> - <type>listcontrol</type> - <id>10</id> - <posX>170</posX> - <posY>240</posY> - <width>485</width> - <height>200</height> - <textXOff>10</textXOff> - <textYOff>2</textYOff> - <textXOff2>420</textXOff2> - <textYOff2>2</textYOff2> - <spaceBetweenItems>5</spaceBetweenItems> - <textureHeight>25</textureHeight> - <keepaspectratio>no</keepaspectratio> - <font2>font10</font2> - <font3>font10</font3> - <onup>17</onup> - </control> - <control> - <type>textboxscrollup</type> - <description>Programma-info</description> - <id>1</id> - <posX>170</posX> - <posY>400</posY> - <width>375</width> - <height>100</height> - <label>#plotoutline</label> - <font>font12</font> - <textcolor>ffffffff</textcolor> - </control> - </control> - </controls> -</window> Deleted: trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemistMain.xml.bak =================================================================== --- trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemistMain.xml.bak 2007-06-06 21:53:56 UTC (rev 490) +++ trunk/plugins/UitzendingGemist/skin/[Project Mayhem]/UitGemistMain.xml.bak 2007-06-06 23:20:39 UTC (rev 491) @@ -1,58 +0,0 @@ -<window> - <id>6799</id> - <defaultcontrol>2</defaultcontrol> - <allowoverlay>yes</allowoverlay> - <define>#header.label:UitzendingGemist</define> - <define>#header.image:</define> - <define>#header.hover:hover_uitgemist.png</define> - - <controls> - <import>common.window.xml</import> - <control> - <description>BackGround</description> - <type>image</type> - <id>1</id> - <posX>0</posX> - <posY>0</posY> - <texture>background.png</texture> - </control> - <control> - <type>group</type> - <description>group element</description> - <animation effect="fade" time="250">WindowOpen</animation> - <animation effect="fade" time="500">WindowClose</animation> - <animation effect="slide" time="250" start="-300,0">WindowOpen</animation> - <animation effect="slide" time="500" end="0,-300">WindowClose</animation> - <layout>StackLayout</layout> - <posX>80</posX> - <posY>120</posY> - - <!-- topmost item needs an onup with a value of 17 for topbar to work --> - <control> - <description>UitzendingGemist.nl</description> - <type>button</type> - <id>2</id> - <width>575</width> - <height>90</height> - <textureNoFocus>nlgemist.png</textureNoFocus> - <textureFocus>hover_nlgemist.png</textureFocus> - <onup>17</onup> - </control> - - <!-- last item needs an ondown with a value of 2 to support wraparound --> - <control> - <description>RTL Gemist</description> - <type>button</type> - <id>3</id> - <width>575</width> - <height>90</height> - <textXOff>10</textXOff> - <textYOff>5</textYOff> - <textureNoFocus>rtlgemist.png</textureNoFocus> - <textureFocus>hover_rtlgemist.png</textureFocus> - <ondown>2</ondown> - </control> - - </control> - </controls> -</window> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <an...@us...> - 2007-06-06 17:03:07
|
Revision: 489 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=489&view=rev Author: and-81 Date: 2007-06-06 09:52:56 -0700 (Wed, 06 Jun 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs trunk/plugins/IR Server Suite/Applications/Translator/Program.cs trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs trunk/plugins/IR Server Suite/Common/IrssUtils/CDRom.cs trunk/plugins/IR Server Suite/Common/MPUtils/ExternalChannelConfig.cs trunk/plugins/IR Server Suite/IR Server Suite.sln trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs Added Paths: ----------- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.Designer.cs trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.cs trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.resx trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLircServer.cs Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -111,10 +111,11 @@ while (_plugin == null) { _plugin = Program.GetPlugin(_pluginName); - IrssLog.Warn("Failed to load plugin \"{0}\"", _pluginName); if (_plugin == null) { + IrssLog.Warn("Failed to load plugin \"{0}\"", _pluginName); + if (Configure()) SaveSettings(); else @@ -282,6 +283,7 @@ return false; } + // Todo: Put in the proper retry system from other apps/plugins void StartMessageQueue() { _processMessageQueue = true; Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -37,6 +37,7 @@ // Open log file try { + // TODO: Change log level to info for release. IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "IR Server.log"); @@ -138,12 +139,8 @@ return null; foreach (IIRServerPlugin plugin in serverPlugins) - { - if (plugin.Name == pluginName) - { + if (plugin.Name.Equals(pluginName, StringComparison.InvariantCultureIgnoreCase)) return plugin; - } - } return null; } Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -153,6 +153,7 @@ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + // TODO: Change log level to info for release. IrssLog.LogLevel = IrssLog.Level.Debug; IrssLog.Open(Common.FolderIrssLogs + "Translator.log"); Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj 2007-06-06 16:52:56 UTC (rev 489) @@ -65,7 +65,6 @@ <DependentUpon>Setup.cs</DependentUpon> </Compile> <Compile Include="Tray.cs"> - <SubType>Form</SubType> </Compile> </ItemGroup> <ItemGroup> Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -15,7 +15,7 @@ namespace TrayLauncher { - public class Tray : Form + public class Tray { #region Constants @@ -491,7 +491,7 @@ setup.LaunchOnLoad = _launchOnLoad; setup.LaunchKeyCode = _launchKeyCode; - if (setup.ShowDialog(this) == DialogResult.OK) + if (setup.ShowDialog() == DialogResult.OK) { _autoRun = setup.AutoRun; _serverHost = setup.ServerHost; @@ -547,7 +547,7 @@ catch (Exception ex) { IrssLog.Error(ex.Message); - MessageBox.Show(this, ex.Message, "Tray Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Tray Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error); } } void ClickQuit(object sender, EventArgs e) Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/CDRom.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/CDRom.cs 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/CDRom.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -27,11 +27,20 @@ #region Static Methods + /// <summary> + /// Given a drive letter this function returns true if it is a CD-Rom. + /// </summary> + /// <param name="driveLetter">Drive letter to test.</param> + /// <returns>True if the drive is a CD-Rom, else false.</returns> public static bool IsCDRom(string driveLetter) { return (GetDriveType(driveLetter) == DRIVE_CDROM); } + /// <summary> + /// Open the tray on the given CD-Rom drive. + /// </summary> + /// <param name="driveLetter">Drive letter of CD-Rom to open.</param> public static void Open(string driveLetter) { string returnString = ""; @@ -39,6 +48,10 @@ mciSendStringA(command, returnString, 0, 0); } + /// <summary> + /// Close the tray on the given CD-Rom drive. + /// </summary> + /// <param name="driveLetter">Drive letter of CD-Rom to close.</param> public static void Close(string driveLetter) { string returnString = ""; Modified: trunk/plugins/IR Server Suite/Common/MPUtils/ExternalChannelConfig.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/MPUtils/ExternalChannelConfig.cs 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/Common/MPUtils/ExternalChannelConfig.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -12,7 +12,7 @@ #region Constants - const int DefaultCardID = -1; + const int DefaultCardID = 0; const int DefaultPauseTime = 250; const bool DefaultSendSelect = false; @@ -28,19 +28,19 @@ string _fileName; - int _cardID = -1; + int _cardID; - int _pauseTime = 250; - bool _sendSelect = false; - bool _doubleChannelSelect = false; - int _repeatChannelCommands = 0; - int _channelDigits = 0; - int _repeatPauseTime = 1000; - bool _usePreChangeCommand = false; + int _pauseTime; + bool _sendSelect; + bool _doubleChannelSelect; + int _repeatChannelCommands; + int _channelDigits; + int _repeatPauseTime; + bool _usePreChangeCommand; - string _selectCommand = String.Empty; - string _preChangeCommand = String.Empty; - string[] _digits = new string[10]; + string _selectCommand; + string _preChangeCommand; + string[] _digits; #endregion Variables @@ -212,7 +212,7 @@ ExternalChannelConfig newECC = new ExternalChannelConfig(fileName); XmlDocument doc = new XmlDocument(); - doc.Load(newECC._fileName); + doc.Load(fileName); newECC.PauseTime = GetInt(doc, "PauseTime", DefaultPauseTime); newECC.UsePreChangeCommand = GetBool(doc, "UsePreChangeCommand", DefaultUsePreChangeCommand); Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.Designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.Designer.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -0,0 +1,235 @@ +namespace WinLircReceiver +{ + partial class Configure + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.toolTips = new System.Windows.Forms.ToolTip(this.components); + this.textBoxServerAddress = new System.Windows.Forms.TextBox(); + this.numericUpDownServerPort = new System.Windows.Forms.NumericUpDown(); + this.checkBoxStartServer = new System.Windows.Forms.CheckBox(); + this.textBoxServerPath = new System.Windows.Forms.TextBox(); + this.buttonLocate = new System.Windows.Forms.Button(); + this.numericUpDownButtonReleaseTime = new System.Windows.Forms.NumericUpDown(); + this.labelServerAddress = new System.Windows.Forms.Label(); + this.labelServerPort = new System.Windows.Forms.Label(); + this.groupBoxServerDetails = new System.Windows.Forms.GroupBox(); + this.labelButtonReleaseTime = new System.Windows.Forms.Label(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownServerPort)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonReleaseTime)).BeginInit(); + this.groupBoxServerDetails.SuspendLayout(); + 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(104, 208); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(64, 24); + this.buttonOK.TabIndex = 3; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(176, 208); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(64, 24); + this.buttonCancel.TabIndex = 4; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // textBoxServerAddress + // + this.textBoxServerAddress.Location = new System.Drawing.Point(128, 24); + this.textBoxServerAddress.Name = "textBoxServerAddress"; + this.textBoxServerAddress.Size = new System.Drawing.Size(96, 20); + this.textBoxServerAddress.TabIndex = 1; + this.toolTips.SetToolTip(this.textBoxServerAddress, "IP Address for WinLirc server"); + // + // numericUpDownServerPort + // + this.numericUpDownServerPort.Location = new System.Drawing.Point(128, 56); + this.numericUpDownServerPort.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.numericUpDownServerPort.Name = "numericUpDownServerPort"; + this.numericUpDownServerPort.Size = new System.Drawing.Size(96, 20); + this.numericUpDownServerPort.TabIndex = 3; + this.numericUpDownServerPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTips.SetToolTip(this.numericUpDownServerPort, "TCP Port for WinLirc server"); + // + // checkBoxStartServer + // + this.checkBoxStartServer.AutoSize = true; + this.checkBoxStartServer.Location = new System.Drawing.Point(8, 96); + this.checkBoxStartServer.Name = "checkBoxStartServer"; + this.checkBoxStartServer.Size = new System.Drawing.Size(119, 17); + this.checkBoxStartServer.TabIndex = 4; + this.checkBoxStartServer.Text = "Start WinLirc server"; + this.toolTips.SetToolTip(this.checkBoxStartServer, "Start the WinLirc server application?"); + this.checkBoxStartServer.UseVisualStyleBackColor = true; + // + // textBoxServerPath + // + this.textBoxServerPath.Location = new System.Drawing.Point(8, 120); + this.textBoxServerPath.Name = "textBoxServerPath"; + this.textBoxServerPath.Size = new System.Drawing.Size(184, 20); + this.textBoxServerPath.TabIndex = 5; + this.toolTips.SetToolTip(this.textBoxServerPath, "Path to WinLirc server application"); + // + // buttonLocate + // + this.buttonLocate.AutoEllipsis = true; + this.buttonLocate.Location = new System.Drawing.Point(200, 120); + this.buttonLocate.Name = "buttonLocate"; + this.buttonLocate.Size = new System.Drawing.Size(24, 20); + this.buttonLocate.TabIndex = 6; + this.buttonLocate.Text = "..."; + this.toolTips.SetToolTip(this.buttonLocate, "Locate WinLirc server application"); + this.buttonLocate.UseVisualStyleBackColor = true; + this.buttonLocate.Click += new System.EventHandler(this.buttonLocate_Click); + // + // numericUpDownButtonReleaseTime + // + this.numericUpDownButtonReleaseTime.Location = new System.Drawing.Point(144, 176); + this.numericUpDownButtonReleaseTime.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.numericUpDownButtonReleaseTime.Name = "numericUpDownButtonReleaseTime"; + this.numericUpDownButtonReleaseTime.Size = new System.Drawing.Size(96, 20); + this.numericUpDownButtonReleaseTime.TabIndex = 2; + this.numericUpDownButtonReleaseTime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTips.SetToolTip(this.numericUpDownButtonReleaseTime, "Button release time"); + // + // labelServerAddress + // + this.labelServerAddress.Location = new System.Drawing.Point(8, 24); + this.labelServerAddress.Name = "labelServerAddress"; + this.labelServerAddress.Size = new System.Drawing.Size(112, 20); + this.labelServerAddress.TabIndex = 0; + this.labelServerAddress.Text = "Server address:"; + this.labelServerAddress.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelServerPort + // + this.labelServerPort.Location = new System.Drawing.Point(8, 56); + this.labelServerPort.Name = "labelServerPort"; + this.labelServerPort.Size = new System.Drawing.Size(112, 20); + this.labelServerPort.TabIndex = 2; + this.labelServerPort.Text = "Server port:"; + this.labelServerPort.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // groupBoxServerDetails + // + this.groupBoxServerDetails.Controls.Add(this.buttonLocate); + this.groupBoxServerDetails.Controls.Add(this.textBoxServerPath); + this.groupBoxServerDetails.Controls.Add(this.checkBoxStartServer); + this.groupBoxServerDetails.Controls.Add(this.numericUpDownServerPort); + this.groupBoxServerDetails.Controls.Add(this.labelServerAddress); + this.groupBoxServerDetails.Controls.Add(this.labelServerPort); + this.groupBoxServerDetails.Controls.Add(this.textBoxServerAddress); + this.groupBoxServerDetails.Location = new System.Drawing.Point(8, 8); + this.groupBoxServerDetails.Name = "groupBoxServerDetails"; + this.groupBoxServerDetails.Size = new System.Drawing.Size(232, 152); + this.groupBoxServerDetails.TabIndex = 0; + this.groupBoxServerDetails.TabStop = false; + this.groupBoxServerDetails.Text = "WinLirc Server"; + // + // labelButtonReleaseTime + // + this.labelButtonReleaseTime.Location = new System.Drawing.Point(8, 176); + this.labelButtonReleaseTime.Name = "labelButtonReleaseTime"; + this.labelButtonReleaseTime.Size = new System.Drawing.Size(112, 20); + this.labelButtonReleaseTime.TabIndex = 1; + this.labelButtonReleaseTime.Text = "Button release time:"; + this.labelButtonReleaseTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // openFileDialog + // + this.openFileDialog.FileName = "openFileDialog"; + this.openFileDialog.Filter = "All Files|*.*"; + this.openFileDialog.Title = "Locate WinLirc server application"; + // + // Configure + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonCancel; + this.ClientSize = new System.Drawing.Size(248, 241); + this.Controls.Add(this.numericUpDownButtonReleaseTime); + this.Controls.Add(this.labelButtonReleaseTime); + this.Controls.Add(this.groupBoxServerDetails); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(256, 275); + this.Name = "Configure"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "WinLirc Configuration"; + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownServerPort)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonReleaseTime)).EndInit(); + this.groupBoxServerDetails.ResumeLayout(false); + this.groupBoxServerDetails.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.ToolTip toolTips; + private System.Windows.Forms.Label labelServerAddress; + private System.Windows.Forms.TextBox textBoxServerAddress; + private System.Windows.Forms.Label labelServerPort; + private System.Windows.Forms.NumericUpDown numericUpDownServerPort; + private System.Windows.Forms.GroupBox groupBoxServerDetails; + private System.Windows.Forms.TextBox textBoxServerPath; + private System.Windows.Forms.CheckBox checkBoxStartServer; + private System.Windows.Forms.Button buttonLocate; + private System.Windows.Forms.Label labelButtonReleaseTime; + private System.Windows.Forms.NumericUpDown numericUpDownButtonReleaseTime; + private System.Windows.Forms.OpenFileDialog openFileDialog; + } +} \ No newline at end of file Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Net; +using System.Windows.Forms; + +namespace WinLircReceiver +{ + + public partial class Configure : Form + { + + #region Properties + + public IPAddress ServerIP + { + get { return IPAddress.Parse(textBoxServerAddress.Text); } + set { textBoxServerAddress.Text = value.ToString(); } + } + public int ServerPort + { + get { return Decimal.ToInt32(numericUpDownServerPort.Value); } + set { numericUpDownServerPort.Value = new Decimal(value); } + } + public bool StartServer + { + get { return checkBoxStartServer.Checked; } + set { checkBoxStartServer.Checked = value; } + } + public string ServerPath + { + get { return textBoxServerPath.Text; } + set { textBoxServerPath.Text = value; } + } + public int ButtonReleaseTime + { + get { return Decimal.ToInt32(numericUpDownButtonReleaseTime.Value); } + set { numericUpDownButtonReleaseTime.Value = new Decimal(value); } + } + + #endregion Properties + + #region Constructor + + public Configure() + { + InitializeComponent(); + } + + #endregion Constructor + + #region Buttons + + private void buttonOK_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + private void buttonLocate_Click(object sender, EventArgs e) + { + if (openFileDialog.ShowDialog(this) == DialogResult.OK) + textBoxServerPath.Text = openFileDialog.FileName; + } + + #endregion Buttons + + + } + +} Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.resx =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.resx (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.resx 2007-06-06 16:52:56 UTC (rev 489) @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="toolTips.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>107, 17</value> + </metadata> +</root> \ No newline at end of file Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/AssemblyInfo.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -0,0 +1,35 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WinLirc Receiver")] +[assembly: AssemblyDescription("IR Server plugin to support WinLirc")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("and-81")] +[assembly: AssemblyProduct("WinLircReceiver")] +[assembly: AssemblyCopyright("Aaron Dinnage")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.3.1")] +[assembly: AssemblyFileVersion("1.0.3.1")] + +[assembly: CLSCompliant(true)] Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -0,0 +1,183 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Net; +using System.Net.Sockets; +using System.Windows.Forms; +using System.Xml; + +using IRServerPluginInterface; + +namespace WinLircReceiver +{ + + public class WinLircReceiver : IIRServerPlugin + { + + #region Constants + + static readonly string ConfigurationFile = + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + + "\\IR Server Suite\\IR Server\\WinLirc Receiver.xml"; + + static readonly string[] Ports = new string[] { "None" }; + static readonly string[] Speeds = new string[] { "None" }; + + #endregion Constants + + #region Variables + + RemoteButtonHandler _remoteButtonHandler = null; + WinLircServer _server; + + IPAddress _serverIP; + int _serverPort; + bool _startServer; + string _serverPath; + int _buttonReleaseTime; + + #endregion Variables + + #region IIRServerPlugin Members + + public string Name { get { return "WinLirc"; } } + public string Version { get { return "1.0.3.1"; } } + public string Author { get { return "and-81, original code for MediaPortal by Sven"; } } + public string Description { get { return "Supports WinLirc as a reciever"; } } + public bool CanReceive { get { return true; } } + public bool CanTransmit { get { return false; } } + public bool CanLearn { get { return false; } } + public bool CanConfigure { get { return true; } } + + public RemoteButtonHandler RemoteButtonCallback + { + get { return _remoteButtonHandler; } + set { _remoteButtonHandler = value; } + } + + public string[] AvailablePorts { get { return Ports; } } + public string[] AvailableSpeeds { get { return Speeds; } } + + public void Configure() + { + LoadSettings(); + + Configure config = new Configure(); + + config.ServerIP = _serverIP; + config.ServerPort = _serverPort; + config.StartServer = _startServer; + config.ServerPath = _serverPath; + config.ButtonReleaseTime = _buttonReleaseTime; + + if (config.ShowDialog() == DialogResult.OK) + { + _serverIP = config.ServerIP; + _serverPort = config.ServerPort; + _startServer = config.StartServer; + _serverPath = config.ServerPath; + _buttonReleaseTime = config.ButtonReleaseTime; + + SaveSettings(); + } + } + public bool Start() + { + LoadSettings(); + + if (_startServer) + { + if (!WinLircServer.StartServer(_serverPath)) + return false; + } + + _server = new WinLircServer(_serverIP, _serverPort, TimeSpan.FromMilliseconds(_buttonReleaseTime)); + _server.CommandEvent += new WinLircServer.CommandEventHandler(CommandHandler); + + return true; + } + public void Suspend() { } + public void Resume() { } + public void Stop() + { + _server.CommandEvent -= new WinLircServer.CommandEventHandler(CommandHandler); + } + + public bool Transmit(string file) { return false; } + public LearnStatus Learn(string file) { return LearnStatus.Failure; } + + public bool SetPort(string port) { return true; } + public bool SetSpeed(string speed) { return true; } + + #endregion IIRServerPlugin Members + + #region Implementation + + void LoadSettings() + { + try + { + XmlDocument doc = new XmlDocument(); + doc.Load(ConfigurationFile); + + _serverIP = IPAddress.Parse(doc.DocumentElement.Attributes["ServerIP"].Value); + _serverPort = int.Parse(doc.DocumentElement.Attributes["ServerPort"].Value); + _startServer = bool.Parse(doc.DocumentElement.Attributes["StartServer"].Value); + _serverPath = doc.DocumentElement.Attributes["ServerPath"].Value; + _buttonReleaseTime = int.Parse(doc.DocumentElement.Attributes["ButtonReleaseTime"].Value); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + + _serverIP = IPAddress.Parse("127.0.0.1"); + _serverPort = 8765; + _startServer = false; + _serverPath = "winlirc.exe"; + _buttonReleaseTime = 200; + } + } + void SaveSettings() + { + try + { + XmlTextWriter writer = new XmlTextWriter(ConfigurationFile, System.Text.Encoding.UTF8); + writer.Formatting = Formatting.Indented; + writer.Indentation = 1; + writer.IndentChar = (char)9; + writer.WriteStartDocument(true); + writer.WriteStartElement("settings"); // <settings> + + writer.WriteAttributeString("ServerIP", _serverIP.ToString()); + writer.WriteAttributeString("ServerPort", _serverPort.ToString()); + writer.WriteAttributeString("StartServer", _startServer.ToString()); + writer.WriteAttributeString("ServerPath", _serverPath); + writer.WriteAttributeString("ButtonReleaseTime", _buttonReleaseTime.ToString()); + + writer.WriteEndElement(); // </settings> + writer.WriteEndDocument(); + writer.Close(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } + } + + void CommandHandler(WinLircServer.Command cmd) + { + if (_remoteButtonHandler == null) + return; + + string buttonCode = cmd.Remote + ": " + cmd.Button; + + _remoteButtonHandler(buttonCode); + } + + #endregion Implementation + + } + +} Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.csproj (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.csproj 2007-06-06 16:52:56 UTC (rev 489) @@ -0,0 +1,78 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{E6A68244-8C31-44A9-9F85-B4A102B5F209}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>WinLircReceiver</RootNamespace> + <AssemblyName>WinLirc Receiver</AssemblyName> + <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>false</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>none</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants> + </DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Configure.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Configure.Designer.cs"> + <DependentUpon>Configure.cs</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="WinLirc Receiver.cs" /> + <Compile Include="WinLircServer.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\IR Server Plugin Interface\IR Server Plugin Interface.csproj"> + <Project>{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}</Project> + <Name>IR Server Plugin Interface</Name> + <Private>False</Private> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Configure.resx"> + <DependentUpon>Configure.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <PostBuildEvent>copy "$(TargetFileName)" "\MediaPortal Development\Plugin Releases\IR Server Suite\IR Server Plugins\"</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLircServer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLircServer.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLircServer.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -0,0 +1,226 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Net; +using System.Net.Sockets; +using System.Diagnostics; + +namespace WinLircReceiver +{ + /// <summary> + /// WinLIRC server class implementing communication with WinLIRC + /// all remotes are supported as long as WinLIRC supports them + /// </summary> + public class WinLircServer + { + #region Variables + + public delegate void CommandEventHandler(Command cmd); + public event CommandEventHandler CommandEvent; + Socket _socket; // Socket for WinLIRC communication + TimeSpan _buttonReleaseTime; // Time span in which multiple receptions of the same command are ignored + AsyncCallback _dataCallback; // Callback function receiving data from WinLIRC + IAsyncResult _dataCallbackResult; // Result of the callback function + Command _lastCommand; // Last command actually sent to InputHandler + + #endregion + + #region Constructors + Initialization + + public WinLircServer(IPAddress ip, int port, TimeSpan buttonReleaseTime) + { + _buttonReleaseTime = buttonReleaseTime; + _lastCommand = new Command(); + + _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _socket.Connect(ip, port); // Connect; error handling is done in SetupDataCallback() + + SetupDataCallback(); // Setup callback function that will receive data + } + + /// <summary> + /// Set up callback function receiving data from WinLIRC + /// </summary> + private void SetupDataCallback() + { + try + { + if (_dataCallback == null) + _dataCallback = new AsyncCallback(OnDataReceived); + + SocketInfo info = new SocketInfo(); + info._socket = _socket; + _dataCallbackResult = _socket.BeginReceive(info._dataBuffer, 0, info._dataBuffer.Length, SocketFlags.None, _dataCallback, info); + } + catch (SocketException se) + { + Console.WriteLine("WLirc: Error listening to socket: " + se.Message); + } + + } + #endregion + + #region Public Methods + + public static bool StartServer(String path) + { + if (IsServerRunning()) + Console.WriteLine("WLirc: WinLIRC server was not started (already running)"); + else + { + Console.WriteLine("WLirc: Starting WinLIRC server..."); + try + { + Process.Start(path); + } + catch (Exception) + { + Console.WriteLine("WLirc: WinLIRC server start failed"); + return false; + } + } + + return true; + } + + public static bool IsServerRunning() + { + Process[] processes = Process.GetProcessesByName("winlirc"); + return (processes.Length > 0); + } + + #endregion + + #region Private Methods + /// <summary> + /// Callback function receiving data from WinLIRC + /// </summary> + private void OnDataReceived(IAsyncResult async) + { + try + { + SocketInfo info = (SocketInfo)async.AsyncState; + int receivedBytesCount = info._socket.EndReceive(async); + + // Convert received bytes to string + char[] chars = new char[receivedBytesCount + 1]; + System.Text.Decoder decoder = System.Text.Encoding.UTF8.GetDecoder(); + decoder.GetChars(info._dataBuffer, 0, receivedBytesCount, chars, 0); + System.String data = new System.String(chars); + + String[] commands = data.Split(new char[] { '\n', '\r', '\0' }, StringSplitOptions.RemoveEmptyEntries); + foreach (String cmd in commands) + ProcessData(cmd); + + SetupDataCallback(); // Listen to new signals again + } + catch (ObjectDisposedException) + { + Console.WriteLine("WLirc: OnDataReceived: Socket has been closed"); + } + catch (SocketException se) + { + Console.WriteLine("WLirc: OnDataReceived: Socket exception: " + se.Message); + } + } + + /// <summary> + /// Process received data, i.e. send event to event handlers + /// </summary> + private void ProcessData(String data) + { + // Ignore commands we do not need (like the startup message) + if ((data == "BEGIN") || (data == "END") || (data == "SIGHUP")) + return; + + Command command = new Command(data); + + #region Time-based repeat filter + if (_lastCommand.IsSameCommand(command)) + if ((command.Time - _lastCommand.Time) < _buttonReleaseTime) + { + Console.WriteLine("WLirc: Command '" + command.Button + "' ignored because of repeat filter"); + return; + } + #endregion + + Console.WriteLine("WLirc: Command '" + command.Button + "' accepted"); + _lastCommand = command; + + if (CommandEvent != null) + CommandEvent(command); + } + #endregion + + #region Helper classes + /// <summary> + /// Class containing information for the data callback function + /// </summary> + private class SocketInfo + { + public Socket _socket; + public byte[] _dataBuffer = new byte[512]; + } + + /// <summary> + /// Class containing information on a WinLIRC command + /// </summary> + public class Command + { + String _remote; + String _button; + DateTime _time; + + public Command() + { + _time = DateTime.Now; + } + + public Command(string data) + { + String[] dataElements = data.Split(' '); + _button = dataElements[2]; + _remote = dataElements[3]; + _time = DateTime.Now; + } + + public bool IsSameCommand(Command second) + { + if ((_button == second._button) && (_remote == second._remote)) + return true; + return false; + } + + public String Button { get { return _button; } } + public String Remote { get { return _remote; } } + public DateTime Time { get { return _time; } } + } + #endregion + } +} Modified: trunk/plugins/IR Server Suite/IR Server Suite.sln =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite.sln 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/IR Server Suite.sln 2007-06-06 16:52:56 UTC (rev 489) @@ -65,6 +65,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IR Server Plugin Interface", "IR Server Plugins\IR Server Plugin Interface\IR Server Plugin Interface.csproj", "{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinLirc Receiver", "IR Server Plugins\WinLirc Receiver\WinLirc Receiver.csproj", "{E6A68244-8C31-44A9-9F85-B4A102B5F209}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -179,6 +181,10 @@ {D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}.Debug|Any CPU.Build.0 = Debug|Any CPU {D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}.Release|Any CPU.ActiveCfg = Release|Any CPU {D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}.Release|Any CPU.Build.0 = Release|Any CPU + {E6A68244-8C31-44A9-9F85-B4A102B5F209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6A68244-8C31-44A9-9F85-B4A102B5F209}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6A68244-8C31-44A9-9F85-B4A102B5F209}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6A68244-8C31-44A9-9F85-B4A102B5F209}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -202,6 +208,7 @@ {9FDD649E-0502-4FED-9AC1-AA0346394375} = {0D1620EE-01B9-43B5-9FAA-E983BD9EBDBD} {8B3CC9D2-A673-4B1B-8BE4-7AA6C0210F84} = {0D1620EE-01B9-43B5-9FAA-E983BD9EBDBD} {D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C} = {0D1620EE-01B9-43B5-9FAA-E983BD9EBDBD} + {E6A68244-8C31-44A9-9F85-B4A102B5F209} = {0D1620EE-01B9-43B5-9FAA-E983BD9EBDBD} {E98F1F7E-40B6-44C8-AC66-EC867B141FA1} = {0E9CCB69-CEF0-4680-816B-18E949DEA727} {077B53BB-404A-4B2F-BA17-AAE98C5E9C66} = {0E9CCB69-CEF0-4680-816B-18E949DEA727} {F4EA6055-7133-4F18-8971-E19ADEB482C1} = {0E9CCB69-CEF0-4680-816B-18E949DEA727} Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs =================================================================== --- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs 2007-06-03 17:34:14 UTC (rev 488) +++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs 2007-06-06 16:52:56 UTC (rev 489) @@ -547,7 +547,7 @@ string fileName; for (int index = 0; index < cardCount; index++) { - fileName = String.Format("{0}ExternalChannelConfig{1}.xml", ExtCfgFolder, index + 1); + fileName = String.Format("{0}ExternalChannelConfig{1}.xml", ExtCfgFolder, Convert.ToString(index + 1)); try { ExternalChannelConfigs[index] = ExternalChannelConfig.Load(fileName); @@ -557,6 +557,8 @@ ExternalChannelConfigs[index] = new ExternalChannelConfig(fileName); Log.Error(ex); } + + ExternalChannelConfigs[index].CardId = index; } } @@ -601,7 +603,7 @@ { int card = int.Parse(tunerCard); - // To fix a known bug in MediaPortal scheduled recording (Added: 25-Feb-2007) + // To work around a known bug in MediaPortal scheduled recording (Added: 25-Feb-2007) if (card < 0) card = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-06-03 17:34:15
|
Revision: 488 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=488&view=rev Author: northern_sky Date: 2007-06-03 10:34:14 -0700 (Sun, 03 Jun 2007) Log Message: ----------- Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj.user Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj.user =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj.user 2007-06-03 17:32:54 UTC (rev 487) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj.user 2007-06-03 17:34:14 UTC (rev 488) @@ -1,5 +0,0 @@ -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <ProjectView>ShowAllFiles</ProjectView> - </PropertyGroup> -</Project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-06-03 17:32:55
|
Revision: 487 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=487&view=rev Author: northern_sky Date: 2007-06-03 10:32:54 -0700 (Sun, 03 Jun 2007) Log Message: ----------- Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt.suo Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-06-03 17:31:56
|
Revision: 486 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=486&view=rev Author: northern_sky Date: 2007-06-03 10:31:54 -0700 (Sun, 03 Jun 2007) Log Message: ----------- Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/bin/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/obj/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-06-03 17:27:50
|
Revision: 485 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=485&view=rev Author: northern_sky Date: 2007-06-03 10:27:48 -0700 (Sun, 03 Jun 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSettings.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsPrePost.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsPrePost.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.resx trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj.user trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltFileDetailsInfo.xml trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltPreconfiguration.xml trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramFilterItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Properties/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Properties/AssemblyInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/bin/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/bin/Debug/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/obj/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/obj/Debug/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/obj/Debug/TempPE/ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt.sln trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt.suo trunk/plugins/myGUIProgramsAlt/README.txt Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs 2007-06-03 17:27:48 UTC (rev 485) @@ -0,0 +1,1283 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.IO; +using System.Collections.Generic; +using System.Diagnostics; +using System.Xml; +using SQLite.NET; +using MediaPortal.Ripper; +using MediaPortal.Player; +using MediaPortal.GUI.Library; +using MediaPortal.Util; + +using GUIPrograms; +using GUIPrograms.Database; +using GUIPrograms.FileItems; + +namespace GUIPrograms.ApplicationItems +{ + /// <summary> + /// Summary description for Application. + /// </summary> + public class ApplicationItem + { + protected static SQLiteClient sqlDB = null; + private DatabaseSorter dbPc = new DatabaseSorter(); + + public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + + public event FilelinkLaunchEventHandler OnLaunchFilelink = null; + + int appID; + int fatherID; + string title; + string shortTitle; + string filename; + string arguments; + ProcessWindowStyle windowStyle; + Process proc; + string startupDir; + bool useShellExecute; + bool useQuotes; + ApplicationType sourceType; + string sourceFile; + string imageFile; + string imageDirectories; // in one string for sqlite db field + public string[] imageDirs; // imageDirectories splitted + string fileDirectory; + string validExtensions; + bool importValidImagesOnly; + int appPosition; + bool enabled; + bool enableGUIRefresh; + int pincode; + int contentID; + string systemDefault; + bool waitForExit; + string preLaunch; + string postLaunch; + bool importMamePlaychoice10 = false; + + public bool ImportMamePlaychoice10 + { + get { return importMamePlaychoice10; } + set { importMamePlaychoice10 = value; } + } + bool importMameMahjong = false; + + public bool ImportMameMahjong + { + get { return importMameMahjong; } + set { importMameMahjong = value; } + } + + + string launchErrorMsg; + + + // two magic image-slideshow counters + int thumbIndex = 0; + int thumbFolderIndex = -1; + + string lastFilepath = ""; // cached path + + public bool filesAreLoaded = false; // load on demand.... + protected FileItemList fileList = null; + + public bool linksAreLoaded = false; + protected FilelinkItemList fileLinks = null; + + // event: read new file + public delegate void RefreshInfoEventHandler(string informationMessage, int progressBarProgess); + + public event RefreshInfoEventHandler OnRefreshInfo = null; + + protected void SendRefreshInfo(string informationMessage, int progressBarCtr) + { + if (OnRefreshInfo != null) + { + OnRefreshInfo(informationMessage, progressBarCtr); + } + } + + protected int GetID = ProgramUtils.GetID; + + public ApplicationItem(SQLiteClient initSqlDB) + { + + // constructor: save SQLiteDB object + sqlDB = initSqlDB; + // .. init member variables ... + appID = -1; + fatherID = -1; + title = ""; + shortTitle = ""; + filename = ""; + arguments = ""; + windowStyle = ProcessWindowStyle.Normal; + startupDir = "%FILEDIR%"; + useShellExecute = false; + useQuotes = true; + enabled = true; + sourceType = ApplicationType.UNKNOWN; + sourceFile = ""; + imageFile = ""; + fileDirectory = ""; + imageDirectories = ""; + validExtensions = ""; + appPosition = 0; + importValidImagesOnly = false; + enableGUIRefresh = false; + pincode = -1; + contentID = 100; + systemDefault = ""; + waitForExit = true; + filesAreLoaded = false; + preLaunch = ""; + postLaunch = ""; + + } + + public SQLiteClient db + { + get { return sqlDB; } + } + + public int CurrentSortIndex + { + get { return GetCurrentSortIndex(); } + set { SetCurrentSortIndex(value); } + } + + public bool CurrentSortIsAscending + { + get { return GetCurrentSortIsAscending(); } + set { SetCurrentSortIsAscending(value); } + } + + + public FileItem PrevFile(FileItem curFile) + { + if (Files == null) + { + return null; + } + if (Files.Count == 0) + { + return null; + } + int index = this.Files.IndexOf(curFile); + index = index - 1; + if (index < 0) + index = Files.Count - 1; + return (FileItem)Files[index]; + } + + public FileItem NextFile(FileItem curFile) + { + if (Files == null) + { + return null; + } + if (Files.Count == 0) + { + return null; + } + int index = this.Files.IndexOf(curFile); + index = index + 1; + if (index > Files.Count - 1) + index = 0; + return (FileItem)Files[index]; + } + + + public virtual void LaunchFile(FileItem curFile, bool mpGuiMode) + { + string curFilename = curFile.Filename; + if (curFilename == "") + { + return; + } + + // Launch File by item + if (mpGuiMode) + { + curFile.UpdateLaunchInfo(); + } + ProcessStartInfo procStart = new ProcessStartInfo(); + + if (Filename != "") + { + // use the APPLICATION launcher and add current file information + procStart.FileName = Filename; // filename of the application + // set the arguments: one of the arguments is the fileitem-filename + procStart.Arguments = " " + this.Arguments + " "; + if (UseQuotes) + { + // avoid double quotes around the filename-argument..... + curFilename = "\"" + (curFile.Filename.TrimStart('\"')).TrimEnd('\"') + "\""; + } + + if (procStart.Arguments.IndexOf("%FILEnoPATHnoEXT%") >= 0) + { + // ex. kawaks: + // winkawaks.exe alpham2 + // => filename without path and extension is necessary! + string filenameNoPathNoExt = curFile.ExtractFileName(); + filenameNoPathNoExt = (filenameNoPathNoExt.TrimStart('\"')).TrimEnd('\"'); + filenameNoPathNoExt = Path.GetFileNameWithoutExtension(filenameNoPathNoExt); + procStart.Arguments = procStart.Arguments.Replace("%FILEnoPATHnoEXT%", filenameNoPathNoExt); + } + else + { + // the fileitem-argument can be positioned anywhere in the argument string... + if (procStart.Arguments.IndexOf("%FILE%") == -1) + { + // no placeholder found => default handling: add the fileitem as the last argument + procStart.Arguments = procStart.Arguments + curFilename; + } + else + { + // placeholder found => replace the placeholder by the correct filename + procStart.Arguments = procStart.Arguments.Replace("%FILE%", curFilename); + } + } + procStart.WorkingDirectory = Startupdir; + if (procStart.WorkingDirectory.IndexOf("%FILEDIR%") != -1) + { + procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); + } + procStart.UseShellExecute = UseShellExecute; + } + else + { + // application has no launch-file + // => try to make a correct launch using the current FILE object + procStart.FileName = curFile.Filename; + procStart.WorkingDirectory = Path.GetFullPath(curFile.Filename); + + + if (Startupdir != "") + { + if (Startupdir.Contains("%FILEDIR%")) + { + procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); + } + else + { + procStart.WorkingDirectory = Startupdir; + } + } + + procStart.UseShellExecute = UseShellExecute; + } + procStart.WindowStyle = this.WindowStyle; + + this.LaunchErrorMsg = ""; + try + { + DoPreLaunch(); + + + if (mpGuiMode) + { + AutoPlay.StopListening(); + if (g_Player.Playing) + { + g_Player.Stop(); + } + } + + proc = new Process(); + proc.EnableRaisingEvents = true; + proc.Exited += new EventHandler(proc_Exited); + + proc.StartInfo = procStart; + ProgramUtils.StartProcess(proc, WaitForExit); + + + if (mpGuiMode) + { + //GUIGraphicsContext.DX9Device.Reset(GUIGraphicsContext.DX9Device.PresentationParameters); + AutoPlay.StartListening(); + } + + } + catch (Exception ex) + { + string ErrorString = String.Format("myPrograms: error launching program\n filename: {0}\n arguments: {1}\n WorkingDirectory: {2}\n stack: {3} {4} {5}", + procStart.FileName, + procStart.Arguments, + procStart.WorkingDirectory, + ex.Message, + ex.Source, + ex.StackTrace); + Log.Info(ErrorString); + this.LaunchErrorMsg = ErrorString; + } + finally + { + DoPostLaunch(); + } + } + + void proc_Exited(object sender, EventArgs e) + { + + if (proc != null) + { + proc.Dispose(); + proc = null; + } + } + + protected void DoPreLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(preLaunch); + } + } + + protected void DoPostLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(postLaunch); + } + } + + protected void LaunchCmd(string commands) + { + string results = ""; + string errors = ""; + string[] script; + string curLine; + Process p = new Process(); + StreamWriter sw; + StreamReader sr; + StreamReader err; + + script = commands.Split(';'); + if (script.Length > 0) + { + ProcessStartInfo psI = new ProcessStartInfo("cmd"); + psI.UseShellExecute = false; + psI.RedirectStandardInput = true; + psI.RedirectStandardOutput = true; + psI.RedirectStandardError = true; + psI.CreateNoWindow = true; + p.StartInfo = psI; + + p.Start(); + sw = p.StandardInput; + sr = p.StandardOutput; + err = p.StandardError; + + sw.AutoFlush = true; + + for (int i = 0; i < script.Length; i++) + { + curLine = script[i].Trim(); + curLine = curLine.TrimStart('\n'); + if (curLine != "") + sw.WriteLine(curLine); + } + sw.Close(); + + results += sr.ReadToEnd(); + errors += err.ReadToEnd(); + + if (errors.Trim() != "") + { + Log.Info("Application PrePost errors: {0}", errors); + } + } + } + + public virtual void LaunchFile(GUIListItem item) + { + // Launch File by GUILISTITEM + // => look for FileItem and launch it using the found object + if (item.MusicTag == null) + { + return; + } + FileItem curFile = (FileItem)item.MusicTag; + + if (curFile == null) + { + return; + } + this.LaunchFile(curFile, true); + } + + protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + { + this.OnLaunchFilelink(curLink, MPGUIMode); + } + + public virtual string DefaultFilepath() + { + return ""; // override this if the appitem can have subfolders + } + + public virtual int DisplayFiles(string filePath, GUIFacadeControl facadeView) + { + int totalItems = 0; + if (filePath != lastFilepath) + { + Files.Load(AppID, filePath); + Filelinks.Load(AppID, filePath); + } + totalItems = totalItems + DisplayArrayList(filePath, this.Files, facadeView); + totalItems = totalItems + DisplayArrayList(filePath, this.Filelinks, facadeView); + lastFilepath = filePath; + return totalItems; + } + + protected int DisplayArrayList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) + { + int totalItems = 0; + //foreach (FileItem currentFileItem in dbItems) + foreach (object obj in dbItems) + { + totalItems = totalItems + 1; + if (obj is FileItem) + { + FileItem curFile = obj as FileItem; + GUIListItem gli = new GUIListItem(curFile.Title); + gli.Label2 = curFile.Title2; + gli.MusicTag = curFile; + gli.IsFolder = curFile.IsFolder; + gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(gli); + } + else if (obj is ProgramFilterItem) + { + ProgramFilterItem curFilter = obj as ProgramFilterItem; + GUIListItem gli = new GUIListItem(curFilter.Title); + gli.Label2 = curFilter.Title2; // some filters may have more than one text + gli.MusicTag = curFilter; + gli.IsFolder = true; + //ck + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + + + facadeView.Add(gli); + + } + } + return totalItems; + } + + + void OnRetrieveCoverArt(GUIListItem gli) + { + if ((gli.MusicTag != null) && (gli.MusicTag is FileItem)) + { + FileItem curFile = (FileItem)gli.MusicTag; + if (curFile.Imagefile != "") + { + gli.ThumbnailImage = curFile.Imagefile; + gli.IconImageBig = curFile.Imagefile; + gli.IconImage = curFile.Imagefile; + } + else + { + gli.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + gli.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + gli.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; + } + } + } + + /* private void OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; + if (filmstrip == null) return; + if (item == null) return; + if ((item.MusicTag != null) && (item.MusicTag is FileItem) && (!item.IsFolder)) + { + filmstrip.InfoImageFileName = item.ThumbnailImage; + } + else + { + filmstrip.InfoImageFileName = ""; + } + }*/ + private void OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIPrograms.ThumbnailPath = ""; + if (item.ThumbnailImage != "" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" + ) + { + // only show big thumb if there is really one.... + GUIPrograms.ThumbnailPath = item.ThumbnailImage; + } + } + + public virtual void OnSort(GUIFacadeControl view, bool doSwitchState) + { + /* + * if (!filesAreLoaded) + { + LoadFiles(); + } + + if (doSwitchState) + { + dbPc.UpdateState(); + } + view.Sort(dbPc); + */ + } + + public virtual void OnSortToggle(GUIFacadeControl view) + { + dbPc.sortAscending = (!dbPc.sortAscending); + view.Sort(dbPc); + } + + public virtual int GetCurrentSortIndex() + { + return dbPc.CurrentSortMethodIndex; + } + + public virtual void SetCurrentSortIndex(int newValue) + { + dbPc.CurrentSortMethodIndex = newValue; + } + + public virtual string CurrentSortTitle() + { + return dbPc.CurrentSortMethodAsText; + } + + public virtual bool GetCurrentSortIsAscending() + { + return dbPc.sortAscending; + } + + public virtual void SetCurrentSortIsAscending(bool newValue) + { + dbPc.sortAscending = newValue; + } + + public virtual bool RefreshButtonVisible() + { + return false; // otherwise, override this in child class + } + + public virtual bool FileEditorAllowed() + { + return true; // otherwise, override this in child class + } + + public virtual bool FileAddAllowed() + { + return true; // otherwise, override this in child class + } + + public virtual bool FilesCanBeFavourites() + { + return true; // otherwise, override this in child class + } + + public virtual bool FileBrowseAllowed() + { + // set this to true, if SUBDIRECTORIES are allowed + // (example: possible for DIRECTORY-CACHE) + return false; // otherwise, override this in child class + } + + public virtual bool SubItemsAllowed() + { + return false; + } + + public virtual bool ProfileLoadingAllowed() + { + return false; + } + + public virtual void Refresh(bool mpGuiMode) + { + // descendant classes do that! + } + + + public virtual void OnInfo(GUIListItem item, ref bool isOverviewVisible, ref ProgramInfoAction modalResult, ref int selectedFileID) + { + GUIFileInfo fileInfoDialog = (GUIFileInfo)GUIWindowManager.GetWindow(ProgramUtils.ProgramInfoID); + if (null != fileInfoDialog) + { + if (item.MusicTag == null) + { + return; + } + FileItem curFile = (FileItem)item.MusicTag; + fileInfoDialog.App = this; + fileInfoDialog.File = curFile; + fileInfoDialog.IsOverviewVisible = isOverviewVisible; + fileInfoDialog.DoModal(GetID); + isOverviewVisible = fileInfoDialog.IsOverviewVisible; + modalResult = fileInfoDialog.ModalResult; + selectedFileID = fileInfoDialog.SelectedFileID; + return; + } + } + + public int AppID + { + get { return appID; } + set { appID = value; } + } + + public int FatherID + { + get { return fatherID; } + set { fatherID = value; } + } + + public string Title + { + get { return title; } + set { title = value; } + } + + public string ShortTitle + { + get { return shortTitle; } + set { shortTitle = value; } + } + + public string Filename + { + get { return filename; } + set { filename = value; } + } + + public string Arguments + { + get { return arguments; } + set { arguments = value; } + } + + public bool UseQuotes + { + get { return useQuotes; } + set { useQuotes = value; } + } + + public bool UseShellExecute + { + get { return useShellExecute; } + set { useShellExecute = value; } + } + + public bool Enabled + { + get { return enabled; } + set { enabled = value; } + } + + public ProcessWindowStyle WindowStyle + { + get { return windowStyle; } + set { windowStyle = value; } + } + + public string Startupdir + { + get { return startupDir; } + set { startupDir = value; } + } + + public string FileDirectory + { + get { return fileDirectory; } + set { fileDirectory = value; } + } + + public string ImageDirectory + { + get { return imageDirectories; } + set { SetImageDirectory(value); } + } + + private void SetImageDirectory(string value) + { + imageDirectories = value; + imageDirs = imageDirectories.Split(';'); + for (int i = 0; i < imageDirs.Length; i++) + { + imageDirs[i] = imageDirs[i].Trim(); + // hack the \n away.... + // imageDirs[i] = imageDirs[i].TrimStart('\n'); + // hack trailing backslashes away + imageDirs[i] = imageDirs[i].TrimEnd('\\'); + } + } + + public string Imagefile + { + get { return imageFile; } + set { imageFile = value; } + } + + public string Source + { + get { return sourceFile; } + set { sourceFile = value; } + } + + public ApplicationType SourceType + { + get { return sourceType; } + set { sourceType = value; } + } + + public string ValidExtensions + { + get { return validExtensions; } + set { validExtensions = value; } + } + + public bool ImportValidImagesOnly + { + get { return importValidImagesOnly; } + set { importValidImagesOnly = value; } + } + + public int Position + { + get { return appPosition; } + set { appPosition = value; } + } + + public int ContentID + { + get { return contentID; } + set { contentID = value; } + } + + public string SystemDefault + { + get { return systemDefault; } + set { systemDefault = value; } + } + + public bool WaitForExit + { + get { return waitForExit; } + set { waitForExit = value; } + } + + + public bool GUIRefreshPossible + { + get { return RefreshButtonVisible(); } + } + + public bool EnableGUIRefresh + { + get { return enableGUIRefresh; } + set { enableGUIRefresh = value; } + } + + public string LaunchErrorMsg + { + get { return launchErrorMsg; } + set { launchErrorMsg = value; } + } + + public string PreLaunch + { + get { return preLaunch; } + set { preLaunch = value; } + } + + public string PostLaunch + { + get { return postLaunch; } + set { postLaunch = value; } + } + + + public FileItemList Files + { + // load on demand.... + get + { + if (!filesAreLoaded) + { + LoadFiles(); + } + return fileList; + } + } + + + public FilelinkItemList Filelinks + { + // load on demand.... + get + { + if (!linksAreLoaded) + { + LoadFileLinks(); + } + return fileLinks; + } + } + + + private int GetNewAppID() + { + // get an unused SQL application KEY-number + if (sqlDB != null) + { + // won't work in multiuser environment :) + SQLiteResultSet results; + int res = 0; + results = sqlDB.Execute("SELECT MAX(APPID) FROM application"); + SQLiteResultSet.Row arr = results.Rows[0]; + if (arr.fields[0] != null) + { + if (arr.fields[0] != "") + { + res = Int32.Parse(arr.fields[0]); + } + } + return res + 1; + } + else return -1; + } + + private void Insert() + { + if (sqlDB != null) + { + try + { + if (ContentID <= 0) + { + ContentID = 100; + } + //to remove + string Pincode = ""; + AppID = GetNewAppID(); // important to avoid subsequent inserts! + string sql = String.Format("insert into application (appid, fatherID, title, shorttitle, filename, arguments, windowstyle, startupdir, useshellexecute, usequotes, source_type, source, imagefile, filedirectory, imagedirectory, validextensions, importvalidimagesonly, iposition, enabled, enableGUIRefresh, GUIRefreshPossible, pincode, contentID, systemDefault, WaitForExit, preLaunch, postLaunch) values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}')", + AppID, FatherID, ProgramUtils.Encode(Title), ProgramUtils.Encode(ShortTitle), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Arguments), + ProgramUtils.WindowStyleToStr(WindowStyle), ProgramUtils.Encode(Startupdir), ProgramUtils.BooleanToStr(UseShellExecute), + ProgramUtils.BooleanToStr(UseQuotes), ProgramUtils.ApplicationTypeToString(SourceType), ProgramUtils.Encode(Source), ProgramUtils.Encode(Imagefile), + ProgramUtils.Encode(FileDirectory), ProgramUtils.Encode(ImageDirectory), ProgramUtils.Encode(ValidExtensions), ProgramUtils.BooleanToStr(importValidImagesOnly), Position, + ProgramUtils.BooleanToStr(Enabled), ProgramUtils.BooleanToStr(EnableGUIRefresh), ProgramUtils.BooleanToStr(GUIRefreshPossible),Pincode , + ContentID, ProgramUtils.Encode(SystemDefault), ProgramUtils.BooleanToStr(WaitForExit), ProgramUtils.Encode(PreLaunch), ProgramUtils.Encode(PostLaunch) + ); + sqlDB.Execute(sql); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + } + + private void Update() + { + string sql = ""; + //to remove + string Pincode = ""; + if ((AppID >= 0) && (sqlDB != null)) + { + if (ContentID <= 0) + { + ContentID = 100; + } + try + { + sql = String.Format("update application set title = '{0}', shorttitle = '{1}', filename = '{2}', arguments = '{3}', windowstyle = '{4}', startupdir = '{5}', useshellexecute = '{6}', usequotes = '{7}', source_type = '{8}', source = '{9}', imagefile = '{10}',filedirectory = '{11}',imagedirectory = '{12}',validextensions = '{13}',importvalidimagesonly = '{14}',iposition = {15}, enabled = '{16}', fatherID = '{17}', enableGUIRefresh = '{18}', GUIRefreshPossible = '{19}', pincode = '{20}', contentID = '{21}', systemDefault = '{22}', WaitForExit = '{23}', preLaunch = '{24}', postLaunch = '{25}' where appID = {26}", + ProgramUtils.Encode(Title), ProgramUtils.Encode(ShortTitle), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Arguments), + ProgramUtils.WindowStyleToStr(WindowStyle), ProgramUtils.Encode(Startupdir), ProgramUtils.BooleanToStr(UseShellExecute), + ProgramUtils.BooleanToStr(UseQuotes), ProgramUtils.ApplicationTypeToString(SourceType), ProgramUtils.Encode(Source), ProgramUtils.Encode(Imagefile), + ProgramUtils.Encode(FileDirectory), ProgramUtils.Encode(ImageDirectory), ProgramUtils.Encode(ValidExtensions), ProgramUtils.BooleanToStr(importValidImagesOnly), Position, + ProgramUtils.BooleanToStr(Enabled), FatherID, ProgramUtils.BooleanToStr(EnableGUIRefresh), ProgramUtils.BooleanToStr(GUIRefreshPossible), + Pincode, ContentID, ProgramUtils.Encode(SystemDefault), ProgramUtils.BooleanToStr(WaitForExit), ProgramUtils.Encode(PreLaunch), ProgramUtils.Encode(PostLaunch), + AppID); + sqlDB.Execute(sql); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + Log.Info("sql \n{0}", sql); + } + } + } + + public void Delete() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try + { + DeleteFiles(); + DeleteFileLinks(); + sqlDB.Execute(String.Format("delete from application where appid = {0}", AppID)); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + } + + + + + protected void DeleteFiles() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try + { + sqlDB.Execute(String.Format("delete from tblfile where appid = {0}", AppID)); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + } + + protected void DeleteFileLinks() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try + { + sqlDB.Execute(String.Format("delete from filteritem where appid = {0} or grouperappid = {0}", AppID)); + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + } + } + + + public virtual void LoadFiles() + { + if (sqlDB != null) + { + // load Files and fill Files-List<string> here! + if (fileList == null) + { + fileList = new FileItemList(sqlDB); + } + else + { + fileList.Clear(); + } + lastFilepath = ""; + fileList.Load(AppID, ""); + filesAreLoaded = true; + } + } + + public virtual void LoadFileLinks() + { + if (sqlDB != null) + { + if (fileLinks == null) + { + fileLinks = new FilelinkItemList(sqlDB); + } + else + { + fileLinks.Clear(); + } + lastFilepath = ""; + fileLinks.Load(AppID, ""); + linksAreLoaded = true; + } + } + + protected virtual void FixFileLinks() + { + // after a import the appitem has completely new + // fileitems (new ids) and LINKS stored in filteritems + // are out of sync... fix this here! + + // query with data to fix + string sqlSelectDataToFix = String.Format("select fi.appid, fi.fileid as oldfileid, f.fileid as newfileid, fi.filename as filename from filteritem fi, tblfile f where fi.appID = f.appid and fi.filename = f.filename and fi.appID = {0}", AppID); + + // update command to fix one single link + string sqlFixOneLink = "update filteritem set fileID = {0}, tag = 0 where appID = {1} and filename = '{2}'"; + + SQLiteResultSet rows2fix; + + + try + { + // 1) initialize TAG + sqlDB.Execute(String.Format("update filteritem set tag = 1234 where appid = {0}", AppID)); + + // 2) fix all fileids of the newly imported files + rows2fix = sqlDB.Execute(sqlSelectDataToFix); + int newFileID; + string filenameToFix; + if (rows2fix.Rows.Count == 0) return; + for (int row = 0; row < rows2fix.Rows.Count; row++) + { + newFileID = ProgramUtils.GetIntDef(rows2fix, row, "newfileid", -1); + filenameToFix = ProgramUtils.Get(rows2fix, row, "filename"); + sqlDB.Execute(String.Format(sqlFixOneLink, newFileID, AppID, ProgramUtils.Encode(filenameToFix))); + } + + // 3) delete untouched links ( they were not imported anymore ) + sqlDB.Execute(String.Format("delete from filteritem where appid = {0} and tag = 1234", AppID)); + + } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception (Application.FixFileLinks) err:{0} stack:{1}", ex.Message, ex.StackTrace); + } + + } + + + public void InsertOrUpdateSettings() + { + if (appID == -1) + { + Insert(); + } + else + { + Update(); + } + } + + public virtual string CurrentFilePath() + { + return this.FileDirectory; + } + + + public void Assign(ApplicationItem sourceApp) + { + this.Enabled = sourceApp.Enabled; + this.AppID = sourceApp.AppID; + this.FatherID = sourceApp.FatherID; + this.Title = sourceApp.Title; + this.ShortTitle = sourceApp.ShortTitle; + this.Filename = sourceApp.Filename; + this.Arguments = sourceApp.Arguments; + this.WindowStyle = sourceApp.WindowStyle; + this.Startupdir = sourceApp.Startupdir; + this.UseShellExecute = sourceApp.UseShellExecute; + this.UseQuotes = sourceApp.UseQuotes; + this.SourceType = sourceApp.SourceType; + this.Source = sourceApp.Source; + this.Imagefile = sourceApp.Imagefile; + this.FileDirectory = sourceApp.FileDirectory; + this.ImageDirectory = sourceApp.ImageDirectory; + this.ValidExtensions = sourceApp.ValidExtensions; + this.ImportValidImagesOnly = sourceApp.ImportValidImagesOnly; + this.Position = sourceApp.Position; + this.EnableGUIRefresh = sourceApp.EnableGUIRefresh; + this.WaitForExit = sourceApp.WaitForExit; + this.PreLaunch = sourceApp.PreLaunch; + this.PostLaunch = sourceApp.PostLaunch; + this.SystemDefault = sourceApp.SystemDefault; + this.ContentID = sourceApp.ContentID; + } + + + + // imagedirectory stuff + // get next imagedirectory that holds at least one image for a fileitem + // * m_pFile: the file we're looking images for + private void GetNextThumbFolderIndex(FileItem fileItem) + { + if (fileItem == null) return; + bool foundThumb = false; + while (!foundThumb) + { + thumbFolderIndex++; + if (thumbFolderIndex >= imageDirs.Length) + { + thumbFolderIndex = -1; + foundThumb = true; + } + else + { + string candFolder = imageDirs[thumbFolderIndex]; + string candThumb = candFolder + "\\" + fileItem.ExtractImageFileNoPath(); + if (candThumb.ToLower() != fileItem.Imagefile.ToLower()) + { + foundThumb = (System.IO.File.Exists(candThumb)); + } + else + { + // skip the initial directory, in case it's reentered as a search directory! + foundThumb = false; + } + } + } + } + + public virtual string GetCurThumb(GUIListItem item) + { + if (item.MusicTag == null) + { + return ""; + } + if (item.MusicTag is FileItem) + { + FileItem curFile = item.MusicTag as FileItem; + return GetCurThumb(curFile); + } + else if (item.MusicTag is ApplicationItem) + { + ApplicationItem curApp = item.MusicTag as ApplicationItem; + return curApp.Imagefile; + } + else + { + return ""; + } + } + + + public string GetCurThumb(FileItem fileItem) + { + string curThumb = ""; + if (thumbFolderIndex == -1) + { + curThumb = fileItem.Imagefile; + } + else + { + string curFolder = imageDirs[thumbFolderIndex]; + curThumb = curFolder + "\\" + fileItem.ExtractImageFileNoPath(); + } + if (thumbIndex > 0) + { + // try to find another thumb.... + // use the myGames convention: + // every thumb has the postfix "_1", "_2", etc with the same file extension + string curExtension = fileItem.ExtractImageExtension(); + if (curThumb != "") + { + string cand = curThumb.Replace(curExtension, "_" + thumbIndex.ToString() + curExtension); + if (System.IO.File.Exists(cand)) + { + // found another thumb => override the filename! + curThumb = cand; + } + else + { + thumbIndex = 0; // restart at the first thumb! + GetNextThumbFolderIndex(fileItem); + } + } + } + return curThumb; + } + + public void ResetThumbs() + { + thumbIndex = 0; + thumbFolderIndex = -1; + } + + public void NextThumb() + { + thumbIndex++; + } + + + public void LoadFromXmlProfile(XmlNode node) + { + + XmlNode titleNode = node.SelectSingleNode("title"); + if (titleNode != null) + { + this.Title = titleNode.InnerText; + } + + XmlNode launchingAppNode = node.SelectSingleNode("launchingApplication"); + if (launchingAppNode != null) + { + this.Filename = launchingAppNode.InnerText; + } + + XmlNode useShellExecuteNode = node.SelectSingleNode("useShellExecute"); + if (useShellExecuteNode != null) + { + this.UseShellExecute = ProgramUtils.StrToBoolean(useShellExecuteNode.InnerText); + } + + XmlNode argumentsNode = node.SelectSingleNode("arguments"); + if (argumentsNode != null) + { + this.Arguments = argumentsNode.InnerText; + } + + XmlNode windowStyleNode = node.SelectSingleNode("windowStyle"); + if (windowStyleNode != null) + { + this.WindowStyle = ProgramUtils.StringToWindowStyle(windowStyleNode.InnerText); + } + + XmlNode startupDirNode = node.SelectSingleNode("startupDir"); + if (startupDirNode != null) + { + this.Startupdir = startupDirNode.InnerText; + } + + XmlNode useQuotesNode = node.SelectSingleNode("useQuotes"); + if (useQuotesNode != null) + { + this.UseQuotes = ProgramUtils.StrToBoolean(useQuotesNode.InnerText); + } + + XmlNode fileExtensioneNode = node.SelectSingleNode("fileextensions"); + if (fileExtensioneNode != null) + { + this.ValidExtensions = fileExtensioneNode.InnerText; + } + } + + } +} \ No newline at end of file Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs 2007-06-03 17:27:48 UTC (rev 485) @@ -0,0 +1,362 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.Collections; +using System.IO; +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; +using MediaPortal.Util; +using GUIPrograms; +using SQLite.NET; +using System.Windows.Forms; + + +using GUIPrograms.FileItems; + +using GUIPrograms.Database; + +namespace GUIPrograms.ApplicationItems +{ + /// <summary> + /// Summary description for ApplicationItemDirectoryCache. + /// </summary> + public class ApplicationItemDirectoryCache : ApplicationItem + { + GUIDialogProgress progressDialog = null; + + public ApplicationItemDirectoryCache(SQLiteClient initSqlDB) : base(initSqlDB) { } + + private void ShowProgressDialog() + { + progressDialog = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); + progressDialog.ShowWaitCursor = true; + progressDialog.SetHeading(GUILocalizeStrings.Get(13014)); + progressDialog.SetLine(0, GUILocalizeStrings.Get(13014)); + progressDialog.SetLine(1, ""); + progressDialog.SetLine(2, ""); + progressDialog.StartModal(GetID); + progressDialog.Progress(); + } + + private void CloseProgressDialog() + { + progressDialog.Close(); + } + + private string GetThumbsFile(GUIListItem guiFile, string fileTitle) + { + string thumbFolder = ""; + if (imageDirs.Length > 0) + { + string mainImgFolder = ""; + + foreach (string imgFolder in imageDirs) + { + if (System.IO.Directory.Exists(imgFolder)) + { + mainImgFolder = imgFolder; + } + } + + if ("" != mainImgFolder) + { + string curDir = mainImgFolder + "\\"; + string filenameNoExtension = mainImgFolder + "\\" + guiFile.Label; + filenameNoExtension = Path.ChangeExtension(filenameNoExtension, null); + filenameNoExtension = Path.GetFileNameWithoutExtension(filenameNoExtension); + + string[] exactMatchesJPG = Directory.GetFiles(curDir, filenameNoExtension + ".jpg"); + string[] exactMatchesGIF = Directory.GetFiles(curDir, filenameNoExtension + ".gif"); + string[] exactMatchesPNG = Directory.GetFiles(curDir, filenameNoExtension + ".png"); + if (exactMatchesJPG.Length > 0) + { + thumbFolder = exactMatchesJPG[0]; + } + else if (exactMatchesGIF.Length > 0) + { + thumbFolder = exactMatchesGIF[0]; + } + else if (exactMatchesPNG.Length > 0) + { + thumbFolder = exactMatchesPNG[0]; + } + else + { + string[] almostexactMatchesJPG = Directory.GetFiles(curDir, filenameNoExtension + "*.jpg"); + string[] almostexactMatchesGIF = Directory.GetFiles(curDir, filenameNoExtension + "*.gif"); + string[] almostexactMatchesPNG = Directory.GetFiles(curDir, filenameNoExtension + "*.png"); + if (almostexactMatchesJPG.Length > 0) + { + thumbFolder = almostexactMatchesJPG[0]; + } + else if (almostexactMatchesGIF.Length > 0) + { + thumbFolder = almostexactMatchesGIF[0]; + } + else if (almostexactMatchesPNG.Length > 0) + { + thumbFolder = almostexactMatchesPNG[0]; + } + else + { + // no exact match found! Redo with near matches! + string[] nearMatchesJPG = Directory.GetFiles(curDir, fileTitle + "*.jpg"); + string[] nearMatchesGIF = Directory.GetFiles(curDir, fileTitle + "*.gif"); + string[] nearMatchesPNG = Directory.GetFiles(curDir, fileTitle + "*.png"); + if (nearMatchesJPG.Length > 0) + { + thumbFolder = nearMatchesJPG[0]; + } + else if (nearMatchesGIF.Length > 0) + { + thumbFolder = nearMatchesGIF[0]; + } + else if (nearMatchesPNG.Length > 0) + { + thumbFolder = nearMatchesPNG[0]; + } + } + } + } + } + return thumbFolder; + } + + + private void ImportFileItem(GUIListItem guiFile) + { + FileItem curFile = new FileItem(sqlDB); + curFile.FileID = -1; // to force an INSERT statement when writing the item + curFile.AppID = this.AppID; + curFile.Title = guiFile.Label; + curFile.Title = curFile.TitleNormalized; + curFile.Filename = guiFile.Path; + if (this.UseQuotes) + { + curFile.Filename = "\"" + curFile.Filename + "\""; + } + curFile.Filepath = Path.GetDirectoryName(guiFile.Path); + curFile.Imagefile = GetThumbsFile(guiFile, curFile.TitleNormalized); + // not imported properties => set default values + curFile.ManualFilename = ""; + curFile.LastTimeLaunched = DateTime.MinValue; + curFile.LaunchCount = 0; + curFile.Write(); + } + + private void WriteFolderItem(string directoryPath) + { + FileItem curFile = new FileItem(sqlDB); + curFile.FileID = -1; + curFile.AppID = this.AppID; + curFile.Filename = directoryPath; + curFile.Title = Path.GetFileNameWithoutExtension(directoryPath); + curFile.Filepath = Path.GetDirectoryName(directoryPath); + curFile.IsFolder = true; + curFile.ManualFilename = ""; + curFile.LastTimeLaunched = DateTime.MinValue; + curFile.LaunchCount = 0; + curFile.Write(); + } + + + private void UpdateProgressDialog(GUIListItem guiFile, bool mpGuiMode) + { + if (mpGuiMode) + { + progressDialog.SetLine(2, String.Format("{0} {1}", GUILocalizeStrings.Get(13005), guiFile.Label)); // "last imported file {0}" + progressDialog.Progress(); + } + SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), guiFile.Label), 0); + } + + private void DeleteOrphaned() + { + string TheFileName; + this.Files.Load(AppID, ""); + foreach (FileItem DBfile in this.Files) + { + if (this.UseQuotes && !DBfile.IsFolder) + { + TheFileName = DBfile.Filename.Substring(1, DBfile.Filename.Length - 2); + } + else + { + TheFileName = DBfile.Filename; + } + if (!DBfile.IsFolder) + { + if (!File.Exists(TheFileName)) { DBfile.Delete(); } + ... [truncated message content] |
From: <che...@us...> - 2007-05-27 11:20:29
|
Revision: 484 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=484&view=rev Author: chef_koch Date: 2007-05-27 04:20:27 -0700 (Sun, 27 May 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj Added Paths: ----------- trunk/plugins/My Minesweeper/Source/postbuild.bat Modified: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj 2007-05-27 11:15:26 UTC (rev 483) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj 2007-05-27 11:20:27 UTC (rev 484) @@ -14,7 +14,7 @@ <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>..\..\..\..\MediaPortal\xbmc\bin\Debug\plugins\windows\</OutputPath> + <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -65,4 +65,8 @@ <Target Name="AfterBuild"> </Target> --> + <PropertyGroup> + <PostBuildEvent>cd "$(SolutionDir)" +call postbuild.bat "$(TargetPath)" "$(TargetFileName)"</PostBuildEvent> + </PropertyGroup> </Project> \ No newline at end of file Added: trunk/plugins/My Minesweeper/Source/postbuild.bat =================================================================== --- trunk/plugins/My Minesweeper/Source/postbuild.bat (rev 0) +++ trunk/plugins/My Minesweeper/Source/postbuild.bat 2007-05-27 11:20:27 UTC (rev 484) @@ -0,0 +1,8 @@ +set TargetPath=%1 +set TargetFile=%2 + +rem echo %TargetPath% > log.txt +rem echo %TargetFile% >> log.txt + +copy %TargetPath% "%ProgramFiles%\Team MediaPortal\MediaPortal\plugins\Windows\*" +copy %TargetPath% "..\Release\plugins\Windows\*" \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 11:15:28
|
Revision: 483 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=483&view=rev Author: chef_koch Date: 2007-05-27 04:15:26 -0700 (Sun, 27 May 2007) Log Message: ----------- Removed Paths: ------------- trunk/plugins/My Minesweeper/Skin/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 11:13:56
|
Revision: 482 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=482&view=rev Author: chef_koch Date: 2007-05-27 04:13:53 -0700 (Sun, 27 May 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml trunk/plugins/My Minesweeper/Release/skin/_default/Media/ trunk/plugins/My Minesweeper/Release/skin/_default/Sounds/ Removed Paths: ------------- trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml trunk/plugins/My Minesweeper/Skin/SimpleMP/Media/ trunk/plugins/My Minesweeper/Skin/SimpleMP/Sounds/ Copied: trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml (from rev 480, trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml) =================================================================== --- trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml (rev 0) +++ trunk/plugins/My Minesweeper/Release/skin/BlueTwo/MyMinesweeper.xml 2007-05-27 11:13:53 UTC (rev 482) @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<window> + <id>32327501</id> + <defaultcontrol>2</defaultcontrol> + <allowoverlay>yes</allowoverlay> + <autohidetopbar>yes</autohidetopbar> + <controls> + <import>common.time.xml</import> + <control> + <description>Minesweeper label</description> + <type>label</type> + <posX>55</posX> + <posY>20</posY> + <align>left</align> + <font>font48</font> + <label>Minesweeper</label> + <textcolor>20ffffff</textcolor> + <id>1</id> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>BackGround</description> + <type>image</type> + <id>1</id> + <posX>0</posX> + <posY>0</posY> + <width>720</width> + <height>576</height> + <texture>background.png</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>11</id> + <posX>250</posX> + <posY>70</posY> + <label>Minesweeper</label> + <font>font16</font> + <align>right</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Start</description> + <type>button</type> + <id>2</id> + <posX>60</posX> + <posY>97</posY> + <label>Start</label> + <onleft>2</onleft> + <onright>21</onright> + <onup>8</onup> + <ondown>4</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Level</description> + <type>button</type> + <id>4</id> + <posX>60</posX> + <posY>131</posY> + <label>Level: Amateur</label> + <onleft>4</onleft> + <onright>21</onright> + <onup>2</onup> + <ondown>8</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Smily</description> + <type>image</type> + <id>1</id> + <posX>60</posX> + <posY>185</posY> + <width>60</width> + <height>60</height> + <texture>#minesweeper_smiley</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>5</id> + <posX>70</posX> + <posY>264</posY> + <label>#minesweeper_bombs</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>6</id> + <posX>70</posX> + <posY>298</posY> + <label>#minesweeper_seconds</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>7</id> + <posX>70</posX> + <posY>332</posY> + <label>#minesweeper_record</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Whatsthis</description> + <type>button</type> + <id>8</id> + <posX>60</posX> + <posY>361</posY> + <label>What's this?</label> + <onleft>8</onleft> + <onright>21</onright> + <onup>4</onup> + <ondown>2</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + + <control> + <description>hidden hex</description> + <type>image</type> + <id>1200</id> + <posX>280</posX> + <posY>120</posY> + <width>20</width> + <height>20</height> + <texture>\Minesweeper\Board\topleftcorner.jpg</texture> + </control> + </controls> +</window> Copied: trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml (from rev 480, trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml) =================================================================== --- trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml (rev 0) +++ trunk/plugins/My Minesweeper/Release/skin/SimpleMP/MyMinesweeper.xml 2007-05-27 11:13:53 UTC (rev 482) @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<window> + <id>32327501</id> + <defaultcontrol>2</defaultcontrol> + <allowoverlay>yes</allowoverlay> + <autohidetopbar>yes</autohidetopbar> + <controls> + <import>common.time.xml</import> + <control> + <description>Minesweeper label</description> + <type>label</type> + <posX>55</posX> + <posY>20</posY> + <align>left</align> + <font>font48</font> + <label>Minesweeper</label> + <textcolor>20ffffff</textcolor> + <id>1</id> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>BackGround</description> + <type>image</type> + <id>1</id> + <posX>0</posX> + <posY>0</posY> + <width>720</width> + <height>576</height> + <texture>background.png</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>11</id> + <posX>250</posX> + <posY>70</posY> + <label>Minesweeper</label> + <font>font16</font> + <align>right</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Start</description> + <type>button</type> + <id>2</id> + <posX>60</posX> + <posY>97</posY> + <label>Start</label> + <onleft>2</onleft> + <onright>21</onright> + <onup>8</onup> + <ondown>4</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Level</description> + <type>button</type> + <id>4</id> + <posX>60</posX> + <posY>131</posY> + <label>Level: Amateur</label> + <onleft>4</onleft> + <onright>21</onright> + <onup>2</onup> + <ondown>8</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Smily</description> + <type>image</type> + <id>1</id> + <posX>60</posX> + <posY>185</posY> + <width>60</width> + <height>60</height> + <texture>#minesweeper_smiley</texture> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>5</id> + <posX>70</posX> + <posY>264</posY> + <label>#minesweeper_bombs</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>6</id> + <posX>70</posX> + <posY>298</posY> + <label>#minesweeper_seconds</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>text label</description> + <type>label</type> + <id>7</id> + <posX>70</posX> + <posY>332</posY> + <label>#minesweeper_record</label> + <font>font12</font> + <align>Left</align> + <textcolor>ffffffff</textcolor> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + <control> + <description>Whatsthis</description> + <type>button</type> + <id>8</id> + <posX>60</posX> + <posY>361</posY> + <label>What's this?</label> + <onleft>8</onleft> + <onright>21</onright> + <onup>4</onup> + <ondown>2</ondown> + <animation effect="fade" time="150">WindowOpen</animation> + <animation effect="fade" time="150">WindowClose</animation> + </control> + + <control> + <description>hidden hex</description> + <type>image</type> + <id>1200</id> + <posX>280</posX> + <posY>120</posY> + <width>20</width> + <height>20</height> + <texture>\Minesweeper\Board\topleftcorner.jpg</texture> + </control> + </controls> +</window> Copied: trunk/plugins/My Minesweeper/Release/skin/_default/Media (from rev 480, trunk/plugins/My Minesweeper/Skin/SimpleMP/Media) Copied: trunk/plugins/My Minesweeper/Release/skin/_default/Sounds (from rev 480, trunk/plugins/My Minesweeper/Skin/SimpleMP/Sounds) Deleted: trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml =================================================================== --- trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml 2007-05-27 11:11:22 UTC (rev 481) +++ trunk/plugins/My Minesweeper/Skin/MyMinesweeper.xml 2007-05-27 11:13:53 UTC (rev 482) @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<window> - <id>32327501</id> - <defaultcontrol>2</defaultcontrol> - <allowoverlay>yes</allowoverlay> - <autohidetopbar>yes</autohidetopbar> - <controls> - <import>common.time.xml</import> - <control> - <description>Minesweeper label</description> - <type>label</type> - <posX>55</posX> - <posY>20</posY> - <align>left</align> - <font>font48</font> - <label>Minesweeper</label> - <textcolor>20ffffff</textcolor> - <id>1</id> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>BackGround</description> - <type>image</type> - <id>1</id> - <posX>0</posX> - <posY>0</posY> - <width>720</width> - <height>576</height> - <texture>background.png</texture> - </control> - <control> - <description>text label</description> - <type>label</type> - <id>11</id> - <posX>250</posX> - <posY>70</posY> - <label>Minesweeper</label> - <font>font16</font> - <align>right</align> - <textcolor>ffffffff</textcolor> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>Start</description> - <type>button</type> - <id>2</id> - <posX>60</posX> - <posY>97</posY> - <label>Start</label> - <onleft>2</onleft> - <onright>21</onright> - <onup>8</onup> - <ondown>4</ondown> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>Level</description> - <type>button</type> - <id>4</id> - <posX>60</posX> - <posY>131</posY> - <label>Level: Amateur</label> - <onleft>4</onleft> - <onright>21</onright> - <onup>2</onup> - <ondown>8</ondown> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>Smily</description> - <type>image</type> - <id>1</id> - <posX>60</posX> - <posY>185</posY> - <width>60</width> - <height>60</height> - <texture>#minesweeper_smiley</texture> - </control> - <control> - <description>text label</description> - <type>label</type> - <id>5</id> - <posX>70</posX> - <posY>264</posY> - <label>#minesweeper_bombs</label> - <font>font12</font> - <align>Left</align> - <textcolor>ffffffff</textcolor> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>text label</description> - <type>label</type> - <id>6</id> - <posX>70</posX> - <posY>298</posY> - <label>#minesweeper_seconds</label> - <font>font12</font> - <align>Left</align> - <textcolor>ffffffff</textcolor> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>text label</description> - <type>label</type> - <id>7</id> - <posX>70</posX> - <posY>332</posY> - <label>#minesweeper_record</label> - <font>font12</font> - <align>Left</align> - <textcolor>ffffffff</textcolor> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - <control> - <description>Whatsthis</description> - <type>button</type> - <id>8</id> - <posX>60</posX> - <posY>361</posY> - <label>What's this?</label> - <onleft>8</onleft> - <onright>21</onright> - <onup>4</onup> - <ondown>2</ondown> - <animation effect="fade" time="150">WindowOpen</animation> - <animation effect="fade" time="150">WindowClose</animation> - </control> - - <control> - <description>hidden hex</description> - <type>image</type> - <id>1200</id> - <posX>280</posX> - <posY>120</posY> - <width>20</width> - <height>20</height> - <texture>\Minesweeper\Board\topleftcorner.jpg</texture> - </control> - </controls> -</window> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 11:11:24
|
Revision: 481 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=481&view=rev Author: chef_koch Date: 2007-05-27 04:11:22 -0700 (Sun, 27 May 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/My Minesweeper/Release/skin/ trunk/plugins/My Minesweeper/Release/skin/BlueTwo/ trunk/plugins/My Minesweeper/Release/skin/SimpleMP/ trunk/plugins/My Minesweeper/Release/skin/_default/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 11:09:32
|
Revision: 480 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=480&view=rev Author: chef_koch Date: 2007-05-27 04:09:30 -0700 (Sun, 27 May 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/My Minesweeper/Skin/ Removed Paths: ------------- trunk/plugins/My Minesweeper/Release/Skin/ Copied: trunk/plugins/My Minesweeper/Skin (from rev 473, trunk/plugins/My Minesweeper/Release/Skin) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 11:09:12
|
Revision: 479 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=479&view=rev Author: chef_koch Date: 2007-05-27 04:09:10 -0700 (Sun, 27 May 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/My Minesweeper/Release/language/ trunk/plugins/My Minesweeper/Release/language/MyMinesweeper/ trunk/plugins/My Minesweeper/Release/plugins/ trunk/plugins/My Minesweeper/Release/plugins/Windows/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 11:04:59
|
Revision: 478 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=478&view=rev Author: chef_koch Date: 2007-05-27 04:04:53 -0700 (Sun, 27 May 2007) Log Message: ----------- Removed Paths: ------------- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 11:03:53
|
Revision: 477 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=477&view=rev Author: chef_koch Date: 2007-05-27 04:03:51 -0700 (Sun, 27 May 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.csproj trunk/plugins/My Minesweeper/Source/MyMinesweeper/Properties/ trunk/plugins/My Minesweeper/Source/MyMinesweeper/minesweeper.png trunk/plugins/My Minesweeper/Source/MyMinesweeper/minesweeperDisabled.png trunk/plugins/My Minesweeper/Source/MyMinesweeper.sln Removed Paths: ------------- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.csproj trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/Properties/ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/minesweeper.png trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/minesweeperDisabled.png trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.sln Deleted: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs 2007-05-27 10:46:40 UTC (rev 476) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs 2007-05-27 11:03:51 UTC (rev 477) @@ -1,1065 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - - -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; - -using MediaPortal.GUI.Library; -using MediaPortal.Dialogs; -using MediaPortal.Util; -using MediaPortal.Configuration; - -namespace MediaPortal.GUI.MyMinesweeper -{ - [PluginIcons("MyMinesweeper.minesweeper.png", "MyMinesweeper.minesweeperDisabled.png")] - public class MyMinesweeper : GUIWindow, ISetupForm - { - #region SkinControl - - [SkinControlAttribute(2)] - protected GUIButtonControl BtnStart = null; - [SkinControlAttribute(4)] - protected GUIButtonControl BtnLevel = null; - [SkinControlAttribute(8)] - protected GUIButtonControl BtnWhatsThis = null; - - #endregion - - #region Private variables - - string Level = "Am"; // Choosen level - bool GameOver = false; // not game over - bool GameON = false; // Game is on - - int[,] board = new int[30, 30]; - int[,] bombs = new int[30, 30]; - bool initBoard = false; - - int bx = 10; - int by = 10; - int bcnt = 10; - - int time = 0; - string time_rec = "999"; - string time_name = "unknown"; - - string t_pro; - string t_nor; - string t_am; - - string n_pro; - string n_nor; - string n_am; - - int ID = 0; - - private static OnActionHandler ah; - - // game ticker for the timer - private System.Windows.Forms.Timer _Game = new System.Windows.Forms.Timer(); - - int[] posX = { -1, 0, 1, -1, 1, -1 , 0 , 1 }; - int[] posY = { -1, -1, -1, 0, 0, 1, 1, 1 }; - - #endregion - - #region ISetupForm Members - - // Returns the name of the plugin which is shown in the plugin menu - public string PluginName() - { - return "My Minesweeper"; - } - - // Returns the description of the plugin is shown in the plugin menu - public string Description() - { - return "My Minesweeper"; - } - - // Returns the author of the plugin which is shown in the plugin menu - public string Author() - { - return "Mark Koenig (kroko)"; - } - - // show the setup dialog - public void ShowPlugin() - { - MessageBox.Show("Nothing to configure, this is just an example"); - } - - // Indicates whether plugin can be enabled/disabled - public bool CanEnable() - { - return true; - } - - // get ID of windowplugin belonging to this setup - public int GetWindowId() - { - return 32327501; - } - - // Indicates if plugin is enabled by default; - public bool DefaultEnabled() - { - return true; - } - - // indicates if a plugin has its own setup screen - public bool HasSetup() - { - return false; - } - - /// <summary> - /// If the plugin should have its own button on the main menu of MediaPortal then it - /// should return true to this method, otherwise if it should not be on home - /// it should return false - /// </summary> - /// <param name="strButtonText">text the button should have</param> - /// <param name="strButtonImage">image for the button, or empty for default</param> - /// <param name="strButtonImageFocus">image for the button, or empty for default</param> - /// <param name="strPictureImage">subpicture for the button or empty for none</param> - /// <returns>true : plugin needs its own button on home - /// false : plugin does not need its own button on home</returns> - - public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) - { - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - if (xmlreader.GetValue("general", "myprefix")=="no") - { - strButtonText = "Minesweeper"; - } - else - { - strButtonText = "My Minesweeper"; - } - - } - //strButtonText = PluginName(); - strButtonImage = String.Empty; - strButtonImageFocus = String.Empty; - strPictureImage = @"hover_my_minesweeper.png"; - return true; - } - - #endregion - - public override int GetID - { - get - { - return 32327501; - } - set - { - base.GetID = value; - } - } - - public override bool Init() - { - if (ah == null) ah = new OnActionHandler(OnAction2); - bool result = Load(GUIGraphicsContext.Skin + @"\MyMinesweeper.xml"); - return result; - } - - #region Actions - - public override void OnAction(Action action) - { - base.OnAction(action); - } - - public void OnAction2(Action action) - { - switch (action.wID) - { - case Action.ActionType.ACTION_KEY_PRESSED: - switch (action.m_key.KeyChar) - { - case '1': - SetBomb(); - break; - case '2': - SetQuest(); - break; - case '3': - Check9(); - break; - case '0': - NewGame(); - break; - } - break; - } - } - - #endregion - - public override bool OnMessage(GUIMessage message) - { - if (message.Message == GUI.Library.GUIMessage.MessageType.GUI_MSG_SETFOCUS) - { - ID = message.TargetControlId; - } - return base.OnMessage(message); - } - - public void Dispose() - { - _Game.Stop(); - _Game.Tick -= new EventHandler(_Game_Tick); - } - - protected override void OnPageLoad() - { - - // start game ticker - _Game.Interval = 1000; - _Game.Tick += new EventHandler(_Game_Tick); - _Game.Start(); - - base.OnPageLoad(); - - LoadSettings(); - - NewGame(); - ShowLevel(); - - GUIGraphicsContext.OnNewAction -= ah; - GUIGraphicsContext.OnNewAction += ah; - - GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); - GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); - - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); - - } - - protected override void OnPageDestroy(int new_windowId) - { - _Game.Stop(); - _Game.Tick -= new EventHandler(_Game_Tick); - - SaveSettings(); - } - - protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) - { - if ((controlId >= 500) && (!GameOver)) - { - GameON = true; - - int y = controlId - 500; - y = (int)y / 30; - - int x = controlId - 500; - x = x - (y * 30); - - x = x - 1; - y = y - 1; - - if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - - SetPlace(pt); - } - } - - - if (control == BtnWhatsThis) - { - OnBtnWhatsThis(); - } - if (control == BtnLevel) - { - OnBtnLevel(); - } - if (control == BtnStart) - { - NewGame(); - } - - - } - - protected override void OnShowContextMenu() - { - base.OnShowContextMenu(); - } - - private void CreateButton(int ID, int posx, int posy, int height, int width, string focusimg, string nofocusimg) - { - GUIButtonControl button = new GUIButtonControl(GetID, ID, posx, posy, width, height, focusimg, nofocusimg); - button.AllocResources(); - GUIControl btnControl = (GUIControl)button; - Add(ref btnControl); - } - - void _Game_Tick(object sender, EventArgs e) - { - if ((!GameOver) && (time<999) && (GameON == true)) - { - time++; - } - GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); - GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); - } - - private void OnBtnWhatsThis() - { - GUIDialogText dlg = (GUIDialogText)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TEXT); - dlg.SetHeading("What's Minesweeper"); - dlg.SetText("Your goal in Minesweeper is to discover all\n" + - "hidden mines as soon as possible. If you click\n" + - "on a hidden mine it will explode and the game\n" + - "ends.\n" + - "Game board design by Mikael S\xF6derstr\xF6m\n\n" + - "OK check actual position\n" + - "1 mark as bomb\n" + - "2 mark as not sure\n" + - "3 check surrounding\n" + - "0 new game\n\n" + - "Good luck\nMark Koenig (kroko)"); - dlg.DoModal(GetID); - } - - private void OnBtnLevel() - { //Choose level for the game - { - if (Level == "Nor") - { - Level = "Pro"; - } - else if (Level == "Pro") - { - Level = "Am"; - } - else - { - Level = "Nor"; - } - NewGame(); - ShowLevel(); - } - } - - private void ShowLevel() - { - if (Level == "Pro") - { - GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Professional"); - } - if (Level == "Am") - { - GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Amateur"); - } - if (Level == "Nor") - { - GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Normal"); - } - } - - private void Init_board() - { - // get position from the start button - int StartX = GetControl(1200).XPosition; - int StartY = GetControl(1200).YPosition; - // Disable level control - GUIControl.HideControl(GetID, 1200); - - try - { - int StartT = GetControl(500).XPosition; - } - catch - { - initBoard = false; - } - - if (!initBoard) - { - initBoard = true; - - // set start button navigation - GetControl(2).SetNavigation(8, 4, 2, 531); - - for (int y = 0; y < (by+2); y++) - { - for (int x = 0; x < (bx+2); x++) - { - int nr = 500 + x + (y * 30); - - int xp = StartX + (20 * x); - int yp = StartY + (20 * y); - - //default navigation - int up = nr - 30; - int dn = nr + 30; - int le = nr - 1; - int ri = nr + 1; - //top bottom navigation - if ((y == 0) || (y==by+1)) - { - up = nr; - dn = nr; - le = nr; - ri = nr; - } - //left right navigation - if ((x == 0) || (x == bx + 1)) - { - up = nr; - dn = nr; - le = nr; - ri = nr; - } - //left to start - if (x == 1) - { - le = 2; - } - // right stop - if (x == bx) - { - ri = nr; - } - // top stop - if (y == 1) - { - up = nr; - } - // right stop - if (y == by) - { - dn = nr; - } - - CreateButton(nr, xp, yp, 20, 20, "#F" + nr, "#NF" + nr); - GetControl(nr).SetNavigation(up, dn, le, ri); - - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); - - } - } - for (int x = 0; x < (bx + 2); x++) - { - int nr = 500 + x; - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\topborder.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\topborder.png"); - } - for (int x = 0; x < (bx + 2); x++) - { - int nr = 500 + (30*(by+1)) + x; - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bottomborder.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bottomborder.png"); - } - for (int y = 0; y < by; y++) - { - int nr = 530 + (y*30); - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\leftborder.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\leftborder.png"); - nr = nr + bx + 1; - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\rightborder.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\rightborder.png"); - } - GUIPropertyManager.SetProperty("#F" + 500, @"\Minesweeper\Board\topleftcorner.png"); - GUIPropertyManager.SetProperty("#NF" + 500, @"\Minesweeper\Board\topleftcorner.png"); - GUIPropertyManager.SetProperty("#F" + (501+bx), @"\Minesweeper\Board\toprightcorner.png"); - GUIPropertyManager.SetProperty("#NF" + (501+bx), @"\Minesweeper\Board\toprightcorner.png"); - - GUIPropertyManager.SetProperty("#F" + (500+(30*(by+1))), @"\Minesweeper\Board\bottomleftcorner.png"); - GUIPropertyManager.SetProperty("#NF" + (500+(30*(by+1))), @"\Minesweeper\Board\bottomleftcorner.png"); - GUIPropertyManager.SetProperty("#F" + (501+(30*(by+1)+bx)), @"\Minesweeper\Board\bottomrightcorner.png"); - GUIPropertyManager.SetProperty("#NF" + (501+(30*(by+1)+bx)), @"\Minesweeper\Board\bottomrightcorner.png"); - - } - - GUIControl.FocusControl(GetID, 531); - } - - private void SetPlace(Point pos) - { - if ((bombs[pos.X, pos.Y] != 0) && (board[pos.X, pos.Y] != 9)) - { - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\sad.png"); - GameOver = true; - MediaPortal.Util.Utils.PlaySound("bomb.wav", false, true); - EndGame(); - board[pos.X, pos.Y] = 12; - SetPoint(pos); - } - if (board[pos.X, pos.Y] == 20) - { - board[pos.X, pos.Y] = GetValue(pos); - SetPoint(pos); - if (board[pos.X, pos.Y] == 0) - { - EmptyPos(); - } - if (Finished() == true) - { - CheckAllBoms(); - GameOver = true; - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); - CheckHiScore(); - } - } - } - - private void SetPoint(Point pos) - { - int nr = 531 + (pos.Y * 30) + pos.X; - - if (board[pos.X, pos.Y] == 0) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check0sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check0unsel.png"); - } - if (board[pos.X, pos.Y] == 1) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check1sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check1unsel.png"); - } - if (board[pos.X, pos.Y] == 2) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check2sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check2unsel.png"); - } - if (board[pos.X, pos.Y] == 3) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check3sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check3unsel.png"); - } - if (board[pos.X, pos.Y] == 4) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check4sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check4unsel.png"); - } - if (board[pos.X, pos.Y] == 5) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check5sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check5unsel.png"); - } - if (board[pos.X, pos.Y] == 6) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check6sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check6unsel.png"); - } - if (board[pos.X, pos.Y] == 7) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check7sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check7unsel.png"); - } - if (board[pos.X, pos.Y] == 8) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\check8sel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\check8unsel.png"); - } - if (board[pos.X, pos.Y] == 9) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\markedasbomsel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\markedasbom.png"); - } - if (board[pos.X, pos.Y] == 10) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\questionmarksel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\questionmark.png"); - } - if (board[pos.X, pos.Y] == 11) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bomb.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bomb.png"); - } - if (board[pos.X, pos.Y] == 12) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bombexplode.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bombexplode.png"); - } - if (board[pos.X, pos.Y] == 20) - { - GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); - GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); - } - } - - private void NewGame() - { - GameOver = false; - GameON = false; - time = 0; - ID = 0; - - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); - - if (Level == "Am") - { - bx = 10; - by = 10; - bcnt = 10; - time_rec = t_am; - time_name = n_am; - } - if (Level == "Nor") - { - bx = 15; - by = 15; - bcnt = 40; - time_rec = t_nor; - time_name = n_nor; - } - if (Level == "Pro") - { - bx = 20; - by = 20; - bcnt = 100; - time_rec = t_pro; - time_name = n_pro; - } - - GUIPropertyManager.SetProperty("#minesweeper_record", "Record: " + time_rec + "s - " + time_name); - - // remove controls from form - try - { - for (int i = 500; i < 1180; i++) - { - Remove(i); - } - } - catch - { - - } - - for (int i = 0; i < 30; i++) - { - for (int j = 0; j < 30; j++) - { // 20 = not checked - board[i, j] = 20; - // no bombs - bombs[i, j] = 0; - } - } - - Random rnd = new Random(); - - for (int i = 0; i < bcnt ; i++) - { - int x = rnd.Next(0,bx); - int y = rnd.Next(0,by); - if (bombs[x, y] == 1) - { // already bomb - i = i - 1; - } - else - { - Point px = new Point(); - px.X=x; - px.Y=y; - if (GetValue(px) < 4) - { - bombs[x, y] = 1; - } - else - { - i = i - 1; - } - } - - } - - Init_board(); - } - - private int GetValue(Point pos) - { - int val=0; - - for (int i = 0; i < 8; i++) - { - int x = pos.X + posX[i]; - int y = pos.Y + posY[i]; - if ((x>=0) && (y>=0) && (x<bx) && (y<by)) - { - if (bombs[x, y] != 0) - { - val++; - } - } - - } - return val; - } - - private int GetMBombs(Point pos) - { - int val = 0; - - for (int i = 0; i < 8; i++) - { - int x = pos.X + posX[i]; - int y = pos.Y + posY[i]; - if ((x >= 0) && (y >= 0) && (x < 30) && (y < 30)) - { - if (board[x, y] == 9) - { - val++; - } - } - - } - return val; - } - - private void EndGame() - { - for (int y = 0; y < by; y++) - { - for (int x = 0; x < bx; x++) - { - if (bombs[x, y] != 0) - { - board[x, y] = 11; - Point pos = new Point(); - pos.X = x; - pos.Y = y; - SetPoint(pos); - } - } - } - } - - private void EmptyPos() - { - bool rep = true; - - while (rep) - { - rep = false; - for (int y = 0; y < by; y++) - { - for (int x = 0; x < bx; x++) - { - if (board[x, y] == 0) - { - // bomb counter = 0 - int cnt = 0; - for (int i = 0; i < 8; i++) - { - int x1 = x + posX[i]; - int y1 = y + posY[i]; - if ((x1 >= 0) && (y1 >= 0) && (x1 < bx) && (y1 < by)) - { - if (bombs[x1, y1] != 0) - { // found bomb - cnt++; - } - } - } - - if (cnt == 0) - { - for (int i = 0; i < 8; i++) - { - int x1 = x + posX[i]; - int y1 = y + posY[i]; - if ((x1 >= 0) && (y1 >= 0) && (x1 < bx) && (y1 < by)) - { - if (board[x1, y1] == 20) - { - Point pos = new Point(); - pos.X = x1; - pos.Y = y1; - - board[x1, y1] = GetValue(pos) ; - SetPoint(pos); - rep = true; - } - } - } - } - } - } - } - } - - } - - private void SetBomb() - { - if ((ID >= 500) && (!GameOver)) - { - GameON = true; - - int y = ID - 500; - y = (int)y / 30; - - int x = ID - 500; - x = x - (y * 30); - - x = x - 1; - y = y - 1; - - int val = board[x, y]; - - if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) - { - if (val == 20) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - board[x, y] = 9; - SetPoint(pt); - bcnt--; - } - if (val == 9) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - board[x, y] = 20; - SetPoint(pt); - bcnt++; - } - } - if (Finished() == true) - { - CheckAllBoms(); - GameOver = true; - GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); - CheckHiScore(); - } - } - } - - private void SetQuest() - { - if ((ID >= 500) && (!GameOver)) - { - GameON = true; - - int y = ID - 500; - y = (int)y / 30; - - int x = ID - 500; - x = x - (y * 30); - - x = x - 1; - y = y - 1; - - int val = board[x, y]; - - if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) - { - if (val == 20) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - board[x, y] = 10; - SetPoint(pt); - } - if (val == 10) - { - Point pt = new Point(); - pt.X = x; - pt.Y = y; - board[x, y] = 20; - SetPoint(pt); - } - } - } - } - - private void Check9() - { - if ((ID >= 500) && (!GameOver) && (GameON)) - { - int y = ID - 500; - y = (int)y / 30; - - int x = ID - 500; - x = x - (y * 30); - - x = x - 1; - y = y - 1; - - if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) - { - int val = board[x, y]; - Point pt = new Point(); - pt.X = x; - pt.Y = y; - - if (val == GetMBombs(pt)) - { - for (int i = 0; i < 8; i++) - { - Point px = new Point(); - px.X = x + posX[i]; - px.Y = y + posY[i]; - - if ((px.X >= 0) && (px.Y >= 0) && (px.X < bx) && (px.Y < by)) - { - SetPlace(px); - } - } - } - } - } - - } - - private void CheckAllBoms() - { - for (int y = 0; y < by; y++) - { - for (int x = 0; x < bx; x++) - { - if ((board[x,y]==20) && (bombs[x,y]==1)) - { - board[x, y] = 9; - Point px = new Point(); - px.X = x; - px.Y = y; - SetPoint(px); - } - } - } - bcnt = 0; - } - - private bool Finished() - { - bool state = true; - - for (int y = 0; y < by; y++) - { - for (int x = 0; x < bx; x++) - { - if ((board[x, y] == 20) && (bombs[x, y] == 0)) - { - state = false; - break; - } - if ((bombs[x,y]==1) && !((board[x, y] == 20) || (board[x, y] == 9))) - { - state = false; - break; - } - } - } - - return state; - - } - - private void CheckHiScore() - { - if (time < int.Parse (time_rec)) - { - time_rec = time.ToString(); - - VirtualKeyboard menu = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); - menu.Reset(); - menu.DoModal(GetID); - - if (menu.Text == "") - { - menu.Text = "me"; - } - - time_name = menu.Text; - - SetScore(); - GUIPropertyManager.SetProperty("#minesweeper_record", "Record: " + time_rec + "s - " + time_name); - - } - } - - private void SetScore() - { - if (Level == "Pro") - { - t_pro = time_rec; - n_pro = time_name; - } - if (Level == "Am") - { - t_am = time_rec; - n_am = time_name; - } - if (Level == "Nor") - { - t_nor = time_rec; - n_nor = time_name; - } - } - - void LoadSettings() - { - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - n_am = xmlreader.GetValueAsString("My Minesweeper", "Name_Am", "Mark"); - n_nor = xmlreader.GetValueAsString("My Minesweeper", "Name_Nor", "Mark"); - n_pro = xmlreader.GetValueAsString("My Minesweeper", "Name_Pro", "Mark"); - - t_am = xmlreader.GetValueAsString("My Minesweeper", "Time_Am", "60"); - t_nor = xmlreader.GetValueAsString("My Minesweeper", "Time_Nor", "300"); - t_pro = xmlreader.GetValueAsString("My Minesweeper", "Time_Pro", "800"); - - - } - } - - void SaveSettings() - { - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - xmlwriter.SetValue("My Minesweeper", "Name_Am", n_am); - xmlwriter.SetValue("My Minesweeper", "Name_Nor", n_nor); - xmlwriter.SetValue("My Minesweeper", "Name_Pro", n_pro); - - xmlwriter.SetValue("My Minesweeper", "Time_Am", t_am); - xmlwriter.SetValue("My Minesweeper", "Time_Nor", t_nor); - xmlwriter.SetValue("My Minesweeper", "Time_Pro", t_pro); - } - } - } -} Deleted: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.csproj =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.csproj 2007-05-27 10:46:40 UTC (rev 476) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.csproj 2007-05-27 11:03:51 UTC (rev 477) @@ -1,68 +0,0 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>8.0.50727</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{04306ABC-5261-4EBB-B7CA-3D4AFA862739}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>MyMinesweeper</RootNamespace> - <AssemblyName>MyMinesweeper</AssemblyName> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>..\..\..\..\MediaPortal\xbmc\bin\Debug\plugins\windows\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Core, Version=1.0.2681.38747, Culture=neutral, processorArchitecture=x86"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\MediaPortal\xbmc\bin\Debug\Core.dll</HintPath> - <Private>False</Private> - </Reference> - <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\MediaPortal\xbmc\bin\Debug\plugins\windows\Dialogs.dll</HintPath> - <Private>False</Private> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Data" /> - <Reference Include="System.Drawing" /> - <Reference Include="System.Windows.Forms" /> - <Reference Include="System.Xml" /> - <Reference Include="Utils, Version=1.0.2681.38745, Culture=neutral, processorArchitecture=x86"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\MediaPortal\xbmc\bin\Debug\Utils.dll</HintPath> - <Private>False</Private> - </Reference> - </ItemGroup> - <ItemGroup> - <Compile Include="MyMinesweeper.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="minesweeper.png" /> - <EmbeddedResource Include="minesweeperDisabled.png" /> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file Deleted: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/minesweeper.png =================================================================== (Binary files differ) Deleted: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/minesweeperDisabled.png =================================================================== (Binary files differ) Copied: trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs (from rev 473, trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper/MyMinesweeper.cs) =================================================================== --- trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs (rev 0) +++ trunk/plugins/My Minesweeper/Source/MyMinesweeper/MyMinesweeper.cs 2007-05-27 11:03:51 UTC (rev 477) @@ -0,0 +1,1065 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + + +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; +using System.Drawing; + +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +using MediaPortal.Util; +using MediaPortal.Configuration; + +namespace MediaPortal.GUI.MyMinesweeper +{ + [PluginIcons("MyMinesweeper.minesweeper.png", "MyMinesweeper.minesweeperDisabled.png")] + public class MyMinesweeper : GUIWindow, ISetupForm + { + #region SkinControl + + [SkinControlAttribute(2)] + protected GUIButtonControl BtnStart = null; + [SkinControlAttribute(4)] + protected GUIButtonControl BtnLevel = null; + [SkinControlAttribute(8)] + protected GUIButtonControl BtnWhatsThis = null; + + #endregion + + #region Private variables + + string Level = "Am"; // Choosen level + bool GameOver = false; // not game over + bool GameON = false; // Game is on + + int[,] board = new int[30, 30]; + int[,] bombs = new int[30, 30]; + bool initBoard = false; + + int bx = 10; + int by = 10; + int bcnt = 10; + + int time = 0; + string time_rec = "999"; + string time_name = "unknown"; + + string t_pro; + string t_nor; + string t_am; + + string n_pro; + string n_nor; + string n_am; + + int ID = 0; + + private static OnActionHandler ah; + + // game ticker for the timer + private System.Windows.Forms.Timer _Game = new System.Windows.Forms.Timer(); + + int[] posX = { -1, 0, 1, -1, 1, -1 , 0 , 1 }; + int[] posY = { -1, -1, -1, 0, 0, 1, 1, 1 }; + + #endregion + + #region ISetupForm Members + + // Returns the name of the plugin which is shown in the plugin menu + public string PluginName() + { + return "My Minesweeper"; + } + + // Returns the description of the plugin is shown in the plugin menu + public string Description() + { + return "My Minesweeper"; + } + + // Returns the author of the plugin which is shown in the plugin menu + public string Author() + { + return "Mark Koenig (kroko)"; + } + + // show the setup dialog + public void ShowPlugin() + { + MessageBox.Show("Nothing to configure, this is just an example"); + } + + // Indicates whether plugin can be enabled/disabled + public bool CanEnable() + { + return true; + } + + // get ID of windowplugin belonging to this setup + public int GetWindowId() + { + return 32327501; + } + + // Indicates if plugin is enabled by default; + public bool DefaultEnabled() + { + return true; + } + + // indicates if a plugin has its own setup screen + public bool HasSetup() + { + return false; + } + + /// <summary> + /// If the plugin should have its own button on the main menu of MediaPortal then it + /// should return true to this method, otherwise if it should not be on home + /// it should return false + /// </summary> + /// <param name="strButtonText">text the button should have</param> + /// <param name="strButtonImage">image for the button, or empty for default</param> + /// <param name="strButtonImageFocus">image for the button, or empty for default</param> + /// <param name="strPictureImage">subpicture for the button or empty for none</param> + /// <returns>true : plugin needs its own button on home + /// false : plugin does not need its own button on home</returns> + + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + if (xmlreader.GetValue("general", "myprefix")=="no") + { + strButtonText = "Minesweeper"; + } + else + { + strButtonText = "My Minesweeper"; + } + + } + //strButtonText = PluginName(); + strButtonImage = String.Empty; + strButtonImageFocus = String.Empty; + strPictureImage = @"hover_my_minesweeper.png"; + return true; + } + + #endregion + + public override int GetID + { + get + { + return 32327501; + } + set + { + base.GetID = value; + } + } + + public override bool Init() + { + if (ah == null) ah = new OnActionHandler(OnAction2); + bool result = Load(GUIGraphicsContext.Skin + @"\MyMinesweeper.xml"); + return result; + } + + #region Actions + + public override void OnAction(Action action) + { + base.OnAction(action); + } + + public void OnAction2(Action action) + { + switch (action.wID) + { + case Action.ActionType.ACTION_KEY_PRESSED: + switch (action.m_key.KeyChar) + { + case '1': + SetBomb(); + break; + case '2': + SetQuest(); + break; + case '3': + Check9(); + break; + case '0': + NewGame(); + break; + } + break; + } + } + + #endregion + + public override bool OnMessage(GUIMessage message) + { + if (message.Message == GUI.Library.GUIMessage.MessageType.GUI_MSG_SETFOCUS) + { + ID = message.TargetControlId; + } + return base.OnMessage(message); + } + + public void Dispose() + { + _Game.Stop(); + _Game.Tick -= new EventHandler(_Game_Tick); + } + + protected override void OnPageLoad() + { + + // start game ticker + _Game.Interval = 1000; + _Game.Tick += new EventHandler(_Game_Tick); + _Game.Start(); + + base.OnPageLoad(); + + LoadSettings(); + + NewGame(); + ShowLevel(); + + GUIGraphicsContext.OnNewAction -= ah; + GUIGraphicsContext.OnNewAction += ah; + + GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); + GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); + + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\smile.png"); + + } + + protected override void OnPageDestroy(int new_windowId) + { + _Game.Stop(); + _Game.Tick -= new EventHandler(_Game_Tick); + + SaveSettings(); + } + + protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) + { + if ((controlId >= 500) && (!GameOver)) + { + GameON = true; + + int y = controlId - 500; + y = (int)y / 30; + + int x = controlId - 500; + x = x - (y * 30); + + x = x - 1; + y = y - 1; + + if ((x >= 0) && (y >= 0) && (x < bx) && (y < by)) + { + Point pt = new Point(); + pt.X = x; + pt.Y = y; + + SetPlace(pt); + } + } + + + if (control == BtnWhatsThis) + { + OnBtnWhatsThis(); + } + if (control == BtnLevel) + { + OnBtnLevel(); + } + if (control == BtnStart) + { + NewGame(); + } + + + } + + protected override void OnShowContextMenu() + { + base.OnShowContextMenu(); + } + + private void CreateButton(int ID, int posx, int posy, int height, int width, string focusimg, string nofocusimg) + { + GUIButtonControl button = new GUIButtonControl(GetID, ID, posx, posy, width, height, focusimg, nofocusimg); + button.AllocResources(); + GUIControl btnControl = (GUIControl)button; + Add(ref btnControl); + } + + void _Game_Tick(object sender, EventArgs e) + { + if ((!GameOver) && (time<999) && (GameON == true)) + { + time++; + } + GUIPropertyManager.SetProperty("#minesweeper_seconds", "Time: " + time.ToString()); + GUIPropertyManager.SetProperty("#minesweeper_bombs", "Bombs: " + bcnt.ToString()); + } + + private void OnBtnWhatsThis() + { + GUIDialogText dlg = (GUIDialogText)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TEXT); + dlg.SetHeading("What's Minesweeper"); + dlg.SetText("Your goal in Minesweeper is to discover all\n" + + "hidden mines as soon as possible. If you click\n" + + "on a hidden mine it will explode and the game\n" + + "ends.\n" + + "Game board design by Mikael S\xF6derstr\xF6m\n\n" + + "OK check actual position\n" + + "1 mark as bomb\n" + + "2 mark as not sure\n" + + "3 check surrounding\n" + + "0 new game\n\n" + + "Good luck\nMark Koenig (kroko)"); + dlg.DoModal(GetID); + } + + private void OnBtnLevel() + { //Choose level for the game + { + if (Level == "Nor") + { + Level = "Pro"; + } + else if (Level == "Pro") + { + Level = "Am"; + } + else + { + Level = "Nor"; + } + NewGame(); + ShowLevel(); + } + } + + private void ShowLevel() + { + if (Level == "Pro") + { + GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Professional"); + } + if (Level == "Am") + { + GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Amateur"); + } + if (Level == "Nor") + { + GUIControl.SetControlLabel(GetID, BtnLevel.GetID, "Level: Normal"); + } + } + + private void Init_board() + { + // get position from the start button + int StartX = GetControl(1200).XPosition; + int StartY = GetControl(1200).YPosition; + // Disable level control + GUIControl.HideControl(GetID, 1200); + + try + { + int StartT = GetControl(500).XPosition; + } + catch + { + initBoard = false; + } + + if (!initBoard) + { + initBoard = true; + + // set start button navigation + GetControl(2).SetNavigation(8, 4, 2, 531); + + for (int y = 0; y < (by+2); y++) + { + for (int x = 0; x < (bx+2); x++) + { + int nr = 500 + x + (y * 30); + + int xp = StartX + (20 * x); + int yp = StartY + (20 * y); + + //default navigation + int up = nr - 30; + int dn = nr + 30; + int le = nr - 1; + int ri = nr + 1; + //top bottom navigation + if ((y == 0) || (y==by+1)) + { + up = nr; + dn = nr; + le = nr; + ri = nr; + } + //left right navigation + if ((x == 0) || (x == bx + 1)) + { + up = nr; + dn = nr; + le = nr; + ri = nr; + } + //left to start + if (x == 1) + { + le = 2; + } + // right stop + if (x == bx) + { + ri = nr; + } + // top stop + if (y == 1) + { + up = nr; + } + // right stop + if (y == by) + { + dn = nr; + } + + CreateButton(nr, xp, yp, 20, 20, "#F" + nr, "#NF" + nr); + GetControl(nr).SetNavigation(up, dn, le, ri); + + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\unchecksel.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\uncheckunsel.png"); + + } + } + for (int x = 0; x < (bx + 2); x++) + { + int nr = 500 + x; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\topborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\topborder.png"); + } + for (int x = 0; x < (bx + 2); x++) + { + int nr = 500 + (30*(by+1)) + x; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\bottomborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\bottomborder.png"); + } + for (int y = 0; y < by; y++) + { + int nr = 530 + (y*30); + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\leftborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\leftborder.png"); + nr = nr + bx + 1; + GUIPropertyManager.SetProperty("#F" + nr, @"\Minesweeper\Board\rightborder.png"); + GUIPropertyManager.SetProperty("#NF" + nr, @"\Minesweeper\Board\rightborder.png"); + } + GUIPropertyManager.SetProperty("#F" + 500, @"\Minesweeper\Board\topleftcorner.png"); + GUIPropertyManager.SetProperty("#NF" + 500, @"\Minesweeper\Board\topleftcorner.png"); + GUIPropertyManager.SetProperty("#F" + (501+bx), @"\Minesweeper\Board\toprightcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (501+bx), @"\Minesweeper\Board\toprightcorner.png"); + + GUIPropertyManager.SetProperty("#F" + (500+(30*(by+1))), @"\Minesweeper\Board\bottomleftcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (500+(30*(by+1))), @"\Minesweeper\Board\bottomleftcorner.png"); + GUIPropertyManager.SetProperty("#F" + (501+(30*(by+1)+bx)), @"\Minesweeper\Board\bottomrightcorner.png"); + GUIPropertyManager.SetProperty("#NF" + (501+(30*(by+1)+bx)), @"\Minesweeper\Board\bottomrightcorner.png"); + + } + + GUIControl.FocusControl(GetID, 531); + } + + private void SetPlace(Point pos) + { + if ((bombs[pos.X, pos.Y] != 0) && (board[pos.X, pos.Y] != 9)) + { + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\sad.png"); + GameOver = true; + MediaPortal.Util.Utils.PlaySound("bomb.wav", false, true); + EndGame(); + board[pos.X, pos.Y] = 12; + SetPoint(pos); + } + if (board[pos.X, pos.Y] == 20) + { + board[pos.X, pos.Y] = GetValue(pos); + SetPoint(pos); + if (board[pos.X, pos.Y] == 0) + { + EmptyPos(); + } + if (Finished() == true) + { + CheckAllBoms(); + GameOver = true; + GUIPropertyManager.SetProperty("#minesweeper_smiley", @"\Minesweeper\cool.png"); + CheckHiScore(); + } + } + } + + private void SetPoint(Point pos) + { + int nr = 531 + (pos.Y * 30) + pos.X; + + if (board[pos.X, pos.Y] == 0) + ... [truncated message content] |
From: <che...@us...> - 2007-05-27 10:46:57
|
Revision: 476 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=476&view=rev Author: chef_koch Date: 2007-05-27 03:46:40 -0700 (Sun, 27 May 2007) Log Message: ----------- improved UpdateButtonStates, static labels will be set now only OnPageLoad Modified Paths: -------------- trunk/plugins/My Connect4/Source/MyConnect4/MyConnect4.cs trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon.cs trunk/plugins/MySimon/Source/SimonSay/MySimon.cs Modified: trunk/plugins/My Connect4/Source/MyConnect4/MyConnect4.cs =================================================================== --- trunk/plugins/My Connect4/Source/MyConnect4/MyConnect4.cs 2007-05-27 10:28:38 UTC (rev 475) +++ trunk/plugins/My Connect4/Source/MyConnect4/MyConnect4.cs 2007-05-27 10:46:40 UTC (rev 476) @@ -214,7 +214,7 @@ Drawfield(); - // set localized labels + // set localized labels for static controls GUIPropertyManager.SetProperty("#header_label", MyConnect.GUILocalizeStrings.Get(0)); // MyConnect GUIControl.SetControlLabel(GetID, btnStart.GetID, MyConnect.GUILocalizeStrings.Get(1)); // New Game GUIControl.SetControlLabel(GetID, btnSound.GetID, MyConnect.GUILocalizeStrings.Get(9)); // Sounds @@ -354,7 +354,7 @@ private void UpdateButtonStates() { - // enable/disable button + // enable/disable buttons btnSound.Selected = _soundOn; btnStart.Disabled = (Player != 0); btnLevel.Disabled = ((Player != 0) || (_currentMode == Mode.PlayerVsPlayer)); Modified: trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon.cs =================================================================== --- trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon.cs 2007-05-27 10:28:38 UTC (rev 475) +++ trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon.cs 2007-05-27 10:46:40 UTC (rev 476) @@ -66,6 +66,7 @@ protected GUIToggleButtonControl btnSound = null; [SkinControlAttribute(6)] protected GUIButtonControl btnWhatsThis = null; + [SkinControlAttribute(10)] protected GUIButtonControl btnUndo = null; [SkinControlAttribute(15)] @@ -344,6 +345,13 @@ Count(); UpdateBoard(); + // set localized labels for static controls + GUIPropertyManager.SetProperty("#header_label", MyHexxagon.GUILocalizeStrings.Get(0)); // MyHexxagon + GUIControl.SetControlLabel(GetID, btnStart.GetID, MyHexxagon.GUILocalizeStrings.Get(1)); // New Game + GUIControl.SetControlLabel(GetID, btnSound.GetID, MyHexxagon.GUILocalizeStrings.Get(9)); // Sounds + GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, MyHexxagon.GUILocalizeStrings.Get(31)); // What is MyHexxagon? + GUIControl.SetControlLabel(GetID, btnUndo.GetID, MyHexxagon.GUILocalizeStrings.Get(8)); // Undo + UpdateButtonStates(); } @@ -529,11 +537,13 @@ private void UpdateButtonStates() { - GUIPropertyManager.SetProperty("#header_label", MyHexxagon.GUILocalizeStrings.Get(0)); // MyHexxagon - - GUIControl.SetControlLabel(GetID, btnStart.GetID, MyHexxagon.GUILocalizeStrings.Get(1)); // Start + // enable/disable buttons + btnSound.Selected = _soundOn; + //btnMode.Disabled = (Player != 0); //btnStart.Disabled = (Player != 0); + //btnLevel.Disabled = ((Player != 0) || (_currentMode == Mode.PlayerVsPlayer)); + // refresh label for btnLevel string strLine = MyHexxagon.GUILocalizeStrings.Get(10); // Level: switch (_currentLevel) { @@ -548,8 +558,8 @@ break; } GUIControl.SetControlLabel(GetID, btnLevel.GetID, strLine); - //btnLevel.Disabled = ((Player != 0) || (_currentMode == Mode.PlayerVsPlayer)); + // refresh label for btnMode strLine = MyHexxagon.GUILocalizeStrings.Get(20); // Mode: Play vs switch (_currentMode) { @@ -561,13 +571,8 @@ break; } GUIControl.SetControlLabel(GetID, btnMode.GetID, strLine); - //btnMode.Disabled = (Player != 0); - GUIControl.SetControlLabel(GetID, btnSound.GetID, MyHexxagon.GUILocalizeStrings.Get(9)); // Sounds - btnSound.Selected = _soundOn; - - GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, MyHexxagon.GUILocalizeStrings.Get(31)); // What is MyConnect? - GUIControl.SetControlLabel(GetID, btnUndo.GetID, MyHexxagon.GUILocalizeStrings.Get(8)); // Undo + // refresh label for btnBoard GUIControl.SetControlLabel(GetID, btnBoard.GetID, MyHexxagon.GUILocalizeStrings.Get(7) + ": " + boardNo.ToString()); // Board: 1 } Modified: trunk/plugins/MySimon/Source/SimonSay/MySimon.cs =================================================================== --- trunk/plugins/MySimon/Source/SimonSay/MySimon.cs 2007-05-27 10:28:38 UTC (rev 475) +++ trunk/plugins/MySimon/Source/SimonSay/MySimon.cs 2007-05-27 10:46:40 UTC (rev 476) @@ -218,7 +218,11 @@ GUIPropertyManager.SetProperty("#Round", MySimon.GUILocalizeStrings.Get(5) + "1"); // Round: 1 GUIPropertyManager.SetProperty("#Player", MySimon.GUILocalizeStrings.Get(6)); // GAME OVER - GUIControl.EnableControl(GetID, btnWhatsThis.GetID); + // set localized labels for static controls + GUIPropertyManager.SetProperty("#header_label", MySimon.GUILocalizeStrings.Get(0)); // MySimon + GUIControl.SetControlLabel(GetID, btnStart.GetID, MySimon.GUILocalizeStrings.Get(1)); // New Game + GUIControl.SetControlLabel(GetID, btnSound.GetID, MySimon.GUILocalizeStrings.Get(9)); // Sounds + GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, MySimon.GUILocalizeStrings.Get(31)); // What is MySimon? UpdateButtonStates(); } @@ -350,11 +354,13 @@ private void UpdateButtonStates() { - GUIPropertyManager.SetProperty("#header_label", MySimon.GUILocalizeStrings.Get(0)); // My Simon - - GUIControl.SetControlLabel(GetID, btnStart.GetID, MySimon.GUILocalizeStrings.Get(1)); // Start + // enable/disable buttons + btnSound.Selected = _soundOn; btnStart.Disabled = (PlayerOn || SimonOn); + btnLevel.Disabled = (PlayerOn || SimonOn); + btnWhatsThis.Disabled = (PlayerOn || SimonOn); + // refresh label for btnLevel string strLine = MySimon.GUILocalizeStrings.Get(10); // Level: switch (_currentLevel) { @@ -369,13 +375,6 @@ break; } GUIControl.SetControlLabel(GetID, btnLevel.GetID, strLine); - btnLevel.Disabled = (PlayerOn || SimonOn); - - GUIControl.SetControlLabel(GetID, btnSound.GetID, MySimon.GUILocalizeStrings.Get(9)); // Sounds - btnSound.Selected = _soundOn; - - GUIControl.SetControlLabel(GetID, btnWhatsThis.GetID, MySimon.GUILocalizeStrings.Get(31)); // What is My Simon? - btnWhatsThis.Disabled = (PlayerOn || SimonOn); } #endregion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 10:28:41
|
Revision: 475 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=475&view=rev Author: chef_koch Date: 2007-05-27 03:28:38 -0700 (Sun, 27 May 2007) Log Message: ----------- changed id for button sounds to 5 Modified Paths: -------------- trunk/plugins/MySimon/Release/skin/BlueTwo/MySimon.xml trunk/plugins/MySimon/Release/skin/SimpleMP/MySimon.xml trunk/plugins/MySimon/Source/SimonSay/MySimon.cs Modified: trunk/plugins/MySimon/Release/skin/BlueTwo/MySimon.xml =================================================================== --- trunk/plugins/MySimon/Release/skin/BlueTwo/MySimon.xml 2007-05-27 10:20:21 UTC (rev 474) +++ trunk/plugins/MySimon/Release/skin/BlueTwo/MySimon.xml 2007-05-27 10:28:38 UTC (rev 475) @@ -46,6 +46,7 @@ <onleft>2</onleft> <onright>2</onright> <onup>6</onup> + <ondown>3</ondown> </control> <control> <description>Level</description> @@ -53,13 +54,17 @@ <id>3</id> <onleft>3</onleft> <onright>3</onright> + <onup>2</onup> + <ondown>5</ondown> </control> <control> <description>Sounds</description> <type>togglebutton</type> - <id>4</id> - <onleft>4</onleft> - <onright>4</onright> + <id>5</id> + <onleft>5</onleft> + <onright>5</onright> + <onup>3</onup> + <ondown>6</ondown> </control> <control> <description>Round</description> @@ -87,6 +92,7 @@ <id>6</id> <onleft>6</onleft> <onright>6</onright> + <onup>5</onup> <ondown>2</ondown> </control> </control> Modified: trunk/plugins/MySimon/Release/skin/SimpleMP/MySimon.xml =================================================================== --- trunk/plugins/MySimon/Release/skin/SimpleMP/MySimon.xml 2007-05-27 10:20:21 UTC (rev 474) +++ trunk/plugins/MySimon/Release/skin/SimpleMP/MySimon.xml 2007-05-27 10:28:38 UTC (rev 475) @@ -57,6 +57,7 @@ <onleft>2</onleft> <onright>2</onright> <onup>6</onup> + <ondown>3</ondown> </control> <control> <description>Level</description> @@ -64,13 +65,17 @@ <id>3</id> <onleft>3</onleft> <onright>3</onright> + <onup>2</onup> + <ondown>5</ondown> </control> <control> <description>Sounds</description> <type>togglebutton</type> - <id>4</id> - <onleft>4</onleft> - <onright>4</onright> + <id>5</id> + <onleft>5</onleft> + <onright>5</onright> + <onup>3</onup> + <ondown>6</ondown> </control> <control> <description>Round</description> @@ -98,6 +103,7 @@ <id>6</id> <onleft>6</onleft> <onright>6</onright> + <onup>5</onup> <ondown>2</ondown> </control> </control> Modified: trunk/plugins/MySimon/Source/SimonSay/MySimon.cs =================================================================== --- trunk/plugins/MySimon/Source/SimonSay/MySimon.cs 2007-05-27 10:20:21 UTC (rev 474) +++ trunk/plugins/MySimon/Source/SimonSay/MySimon.cs 2007-05-27 10:28:38 UTC (rev 475) @@ -55,7 +55,7 @@ protected GUIButtonControl btnStart = null; [SkinControlAttribute(3)] protected GUIButtonControl btnLevel = null; - [SkinControlAttribute(4)] + [SkinControlAttribute(5)] protected GUIToggleButtonControl btnSound = null; [SkinControlAttribute(6)] protected GUIButtonControl btnWhatsThis = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 10:20:23
|
Revision: 474 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=474&view=rev Author: chef_koch Date: 2007-05-27 03:20:21 -0700 (Sun, 27 May 2007) Log Message: ----------- added postbuild, this copies targetfile to %programfiles%\Team MP\MP\plugins\windows\* and to Release\plugins\windows\* Modified Paths: -------------- trunk/plugins/My Connect4/Source/MyConnect4/MyConnect4.csproj trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon.csproj trunk/plugins/MySimon/Source/SimonSay/MySimon.csproj Added Paths: ----------- trunk/plugins/My Connect4/Source/postbuild.bat trunk/plugins/My Hexxagon/Source/postbuild.bat trunk/plugins/MySimon/Source/postbuild.bat Modified: trunk/plugins/My Connect4/Source/MyConnect4/MyConnect4.csproj =================================================================== --- trunk/plugins/My Connect4/Source/MyConnect4/MyConnect4.csproj 2007-05-27 09:07:01 UTC (rev 473) +++ trunk/plugins/My Connect4/Source/MyConnect4/MyConnect4.csproj 2007-05-27 10:20:21 UTC (rev 474) @@ -68,4 +68,8 @@ <Target Name="AfterBuild"> </Target> --> + <PropertyGroup> + <PostBuildEvent>cd "$(SolutionDir)" +call postbuild.bat "$(TargetPath)" "$(TargetFileName)"</PostBuildEvent> + </PropertyGroup> </Project> \ No newline at end of file Added: trunk/plugins/My Connect4/Source/postbuild.bat =================================================================== --- trunk/plugins/My Connect4/Source/postbuild.bat (rev 0) +++ trunk/plugins/My Connect4/Source/postbuild.bat 2007-05-27 10:20:21 UTC (rev 474) @@ -0,0 +1,8 @@ +set TargetPath=%1 +set TargetFile=%2 + +rem echo %TargetPath% > log.txt +rem echo %TargetFile% >> log.txt + +copy %TargetPath% "%ProgramFiles%\Team MediaPortal\MediaPortal\plugins\Windows\*" +copy %TargetPath% "..\Release\plugins\Windows\*" \ No newline at end of file Modified: trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon.csproj =================================================================== --- trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon.csproj 2007-05-27 09:07:01 UTC (rev 473) +++ trunk/plugins/My Hexxagon/Source/MyHexxagon/MyHexxagon.csproj 2007-05-27 10:20:21 UTC (rev 474) @@ -22,7 +22,7 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>false</Optimize> - <OutputPath>..\..\..\..\..\Programme\Team MediaPortal\MediaPortal\Plugins\Windows\</OutputPath> + <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -67,4 +67,8 @@ <Target Name="AfterBuild"> </Target> --> + <PropertyGroup> + <PostBuildEvent>cd "$(SolutionDir)" +call postbuild.bat "$(TargetPath)" "$(TargetFileName)"</PostBuildEvent> + </PropertyGroup> </Project> \ No newline at end of file Added: trunk/plugins/My Hexxagon/Source/postbuild.bat =================================================================== --- trunk/plugins/My Hexxagon/Source/postbuild.bat (rev 0) +++ trunk/plugins/My Hexxagon/Source/postbuild.bat 2007-05-27 10:20:21 UTC (rev 474) @@ -0,0 +1,8 @@ +set TargetPath=%1 +set TargetFile=%2 + +rem echo %TargetPath% > log.txt +rem echo %TargetFile% >> log.txt + +copy %TargetPath% "%ProgramFiles%\Team MediaPortal\MediaPortal\plugins\Windows\*" +copy %TargetPath% "..\Release\plugins\Windows\*" \ No newline at end of file Modified: trunk/plugins/MySimon/Source/SimonSay/MySimon.csproj =================================================================== --- trunk/plugins/MySimon/Source/SimonSay/MySimon.csproj 2007-05-27 09:07:01 UTC (rev 473) +++ trunk/plugins/MySimon/Source/SimonSay/MySimon.csproj 2007-05-27 10:20:21 UTC (rev 474) @@ -65,4 +65,8 @@ <Target Name="AfterBuild"> </Target> --> + <PropertyGroup> + <PostBuildEvent>cd "$(SolutionDir)" +call postbuild.bat "$(TargetPath)" "$(TargetFileName)"</PostBuildEvent> + </PropertyGroup> </Project> \ No newline at end of file Added: trunk/plugins/MySimon/Source/postbuild.bat =================================================================== --- trunk/plugins/MySimon/Source/postbuild.bat (rev 0) +++ trunk/plugins/MySimon/Source/postbuild.bat 2007-05-27 10:20:21 UTC (rev 474) @@ -0,0 +1,8 @@ +set TargetPath=%1 +set TargetFile=%2 + +rem echo %TargetPath% > log.txt +rem echo %TargetFile% >> log.txt + +copy %TargetPath% "%ProgramFiles%\Team MediaPortal\MediaPortal\plugins\Windows\*" +copy %TargetPath% "..\Release\plugins\Windows\*" \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-05-27 09:07:04
|
Revision: 473 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=473&view=rev Author: chef_koch Date: 2007-05-27 02:07:01 -0700 (Sun, 27 May 2007) Log Message: ----------- Removed Paths: ------------- trunk/plugins/My Hexxagon/Skin/ trunk/plugins/My Hexxagon/language/ trunk/plugins/MySimon/Skin/ trunk/plugins/MySimon/language/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |