/// <summary> /// Sets a new path for a skin files <import></import> /// </summary> public static void SetSkinImport(string file, string importtag, string value) { CheckSum checkSum = new CheckSum(); XmlDocument doc = LoadXMLDocument(file); if (doc == null) return; // build xpath string string xpath = string.Format("/window/controls/import[@tag='{0}']", importtag); XmlNode node = doc.DocumentElement.SelectSingleNode(xpath); if (node == null) return; try { smcLog.WriteLog(string.Format("Setting skin import '<import tag='{0}'>{1}</import>' in '{2}'", importtag, value, file), LogLevel.Debug); node.InnerText = value; doc.Save(file); checkSum.Replace(file); } catch (Exception ex) { smcLog.WriteLog("Exception setting skin import: " + ex.Message, LogLevel.Error); } }
/// <summary> /// Set XML Property /// </summary> public static void SetNodeText(string file, string path, string value) { CheckSum checkSum = new CheckSum(); XmlDocument doc = LoadXMLDocument(file); if (doc == null) return; XmlNode node = doc.SelectSingleNode(path); if (node == null) return; try { smcLog.WriteLog(string.Format("Setting skin text property '{0}' with value '{1}'", path, value), LogLevel.Debug); node.InnerText = value; doc.Save(file); checkSum.Replace(file); } catch (Exception ex) { smcLog.WriteLog("Exception setting skin text property: " + ex.Message, LogLevel.Error); } }
/// <summary> /// Set Define in Skin /// </summary> public static void SetSkinDefine(string file, string define, string value) { CheckSum checkSum = new CheckSum(); XmlDocument doc = LoadXMLDocument(file); if (doc == null) return; string path = "/window/define"; XmlNodeList nodes = doc.SelectNodes(path); if (nodes == null) return; try { foreach (XmlNode node in nodes) { if (node.InnerText.StartsWith(define)) { smcLog.WriteLog(string.Format("Setting skin define '{0}' with value '{1}' in '{2}'", define, value, file), LogLevel.Debug); node.InnerText = string.Format("{0}:{1}", define, value); } } doc.Save(file); checkSum.Replace(file); } catch (Exception ex) { smcLog.WriteLog("Exception setting skin define: " + ex.Message, LogLevel.Error); } }
public static void SetMusicNowPlayingStyle() { CheckSum checkSum = new CheckSum(); // Copy the style files to the main skin directory string sourceFiles = Path.Combine(Path.Combine(SkinInfo.mpPaths.streamedMPpath, "NowPlayingScreens"), "style" + ((int)nowPlayingStyle).ToString()); File.Copy(Path.Combine(sourceFiles, "MyMusicPlayingNow.xml"), Path.Combine(SkinInfo.mpPaths.streamedMPpath, "MyMusicPlayingNow.xml"), true); File.Copy(Path.Combine(sourceFiles, "MyMusicPlayingNowAnVU.xml"), Path.Combine(SkinInfo.mpPaths.streamedMPpath, "MyMusicPlayingNowAnVU.xml"), true); File.Copy(Path.Combine(sourceFiles, "MyMusicPlayingNowLedVU.xml"), Path.Combine(SkinInfo.mpPaths.streamedMPpath, "MyMusicPlayingNowLedVU.xml"), true); // Checksum them checkSum.Replace(Path.Combine(SkinInfo.mpPaths.streamedMPpath, "MyMusicPlayingNow.xml")); checkSum.Replace(Path.Combine(SkinInfo.mpPaths.streamedMPpath, "MyMusicPlayingNowAnVU.xml")); checkSum.Replace(Path.Combine(SkinInfo.mpPaths.streamedMPpath, "MyMusicPlayingNowLedVU.xml")); }