From: <fr...@us...> - 2007-08-17 15:42:50
|
Revision: 843 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=843&view=rev Author: framug Date: 2007-08-17 08:42:46 -0700 (Fri, 17 Aug 2007) Log Message: ----------- Controls for Picture Name. (just for fun) :) 1/ PNG File must begin with "hover_" 2/ File must exist in MP installed folder\your skin\media Modified Paths: -------------- trunk/plugins/MultiShortcut/MultiShortcut/MultiShortcut.cs Modified: trunk/plugins/MultiShortcut/MultiShortcut/MultiShortcut.cs =================================================================== --- trunk/plugins/MultiShortcut/MultiShortcut/MultiShortcut.cs 2007-08-16 10:36:15 UTC (rev 842) +++ trunk/plugins/MultiShortcut/MultiShortcut/MultiShortcut.cs 2007-08-17 15:42:46 UTC (rev 843) @@ -196,21 +196,64 @@ if (cf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { +//fmu add control for Picture Name + if (ControlPictureName()) + { using (MediaPortal.Profile.Settings xmlwrite = new MediaPortal.Profile.Settings("MultiShortcut.xml")) + { + xmlwrite.SetValue(m_Name, "exefile", m_ExeFile); + xmlwrite.SetValue(m_Name, "arguments", m_Arguments); + xmlwrite.SetValue(m_Name, "picture", m_Picture); + xmlwrite.SetValue(m_Name, "buttonimage", m_ButtonImg); + xmlwrite.SetValue(m_Name, "buttonimagefocus", m_ButtonImgF); + xmlwrite.SetValue(m_Name, "caption", m_Caption); + xmlwrite.SetValue(m_Name, "pluginid", m_ID); + xmlwrite.SetValue(m_Name, "handlempwindow", m_HandleMPWindow ? 0 : 1); + } + } + else { - xmlwrite.SetValue(m_Name, "exefile", m_ExeFile); - xmlwrite.SetValue(m_Name, "arguments", m_Arguments); - xmlwrite.SetValue(m_Name, "picture", m_Picture); - xmlwrite.SetValue(m_Name, "buttonimage", m_ButtonImg); - xmlwrite.SetValue(m_Name, "buttonimagefocus", m_ButtonImgF); - xmlwrite.SetValue(m_Name, "caption", m_Caption); - xmlwrite.SetValue(m_Name, "pluginid", m_ID); - xmlwrite.SetValue(m_Name, "handlempwindow", m_HandleMPWindow ? 0 : 1); + ShowPlugin(); } } } + //fmu Controls for Picture Name + public bool ControlPictureName() + { +// If user wrote Picture Name then must begin with "hover_" + if (m_Picture != String.Empty) + { + int length_picture = m_Picture.Length; + if (length_picture < 6 || m_Picture.Substring(0, 6) != "hover_") + { + MessageBox.Show("Picture name must begin with \"hover_\""); + return false; + } +// Need to know what is the used skin + MediaPortal.Profile.Settings s = new MediaPortal.Profile.Settings("MediaPortal.xml"); + string skin_name = s.GetValueAsString("skin", "name", string.Empty); +/* Need to know where is MP installed (running) because we don't have it + in MediaPortal.xml neither in MediaPortalDirs.xml is MP is not installed */ + string picture_path = AppDomain.CurrentDomain.BaseDirectory + + @"skin\" + skin_name + @"\Media\" + m_Picture; +// if user didn't write .png extension, we add it automatically + bool png = m_Picture.EndsWith(".png"); + if (!png) + { + picture_path = picture_path + ".png"; + } +// PNG file exist ? + if (!System.IO.File.Exists(picture_path)) + { + MessageBox.Show("PNG File not found : " + picture_path); + return false; + } + } + return true; + } + #endregion #region GUIWindow This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |