/// <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 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); } }
/// <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); } }
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")); }
public static void copyDirectory(string patchSource, string patchDestination) { String[] patchFiles; CheckSum checkSum = new CheckSum(); if (patchDestination[patchDestination.Length - 1] != Path.DirectorySeparatorChar) patchDestination += Path.DirectorySeparatorChar; if (!Directory.Exists(patchDestination)) Directory.CreateDirectory(patchDestination); patchFiles = Directory.GetFileSystemEntries(patchSource); foreach (string Element in patchFiles) { if (Directory.Exists(Element)) copyDirectory(Element, patchDestination + Path.GetFileName(Element)); else { if (Path.GetExtension(patchDestination + Path.GetFileName(Element)).ToLower() == ".xml") // checkSum on xmlrpc files only if (checkSum.Compare(patchDestination + Path.GetFileName(Element))) // Only copy if checksum exists and matches { File.Copy(Element, patchDestination + Path.GetFileName(Element), true); smcLog.WriteLog("Patching: Copy >" + Element + " to " + patchDestination + Path.GetFileName(Element), LogLevel.Debug); } } } }
void writeMenu(menuType direction, bool onFormClosing) { randomFanart.fanartGames = false; randomFanart.fanartMovies = false; randomFanart.fanartMoviesScraperFanart = false; randomFanart.fanartMovingPictures = false; randomFanart.fanartMusic = false; randomFanart.fanartMusicScraperFanart = false; randomFanart.fanartPictures = false; randomFanart.fanartPlugins = false; randomFanart.fanartTv = false; randomFanart.fanartTVSeries = false; randomFanart.fanartScoreCenter = false; switchOnOffFHControls(); assoicateDefaultItems(); generateXML(direction); generateBg(direction); if (fanartHandlerUsed) { generateFanartControls(); generateBackgroundLoading(); } if (!cbDisableClock.Checked) generateClock(); if (!cbHideFanartScraper.Checked) generatefanartScraper(); if (enableFiveDayWeather.Checked) GenerateFiveDayWeather(); if (summaryWeatherCheckBox.Checked) { bool itemHasWeather = false; foreach (backgroundItem item in bgItems) { // Check what item to hide weather summary on if (item.isWeather) { itemHasWeather = true; basicHomeValues.weatherControl = (int.Parse(item.ids[0]) + 200); generateWeathersummary(basicHomeValues.weatherControl); } } // always show weather summary if (!itemHasWeather) generateWeathersummary(null); } if (direction == menuType.horizontal) { if (!cbDisableExitMenu.Checked) generateTopBarH(); generateMenuGraphicsH(); if (menuStyle == chosenMenuStyle.graphicMenuStyle) generateGraphicCrowdingFixH(); else generateCrowdingFixH(); if (horizontalContextLabels.Checked) GenerateContextLabelsH(); } else if (direction == menuType.vertical) { if (!cbDisableExitMenu.Checked) { if (!cbExitStyleNew.Checked) generateTopBarV1(); else generateTopBarV(); } generateMenuGraphicsV(); generateCrowdingFixV(); GenerateContextLabelsV(); } if (enableRssfeed.Checked && infoserviceOptions.Enabled) { if (direction == menuType.horizontal) { generateRSSTicker(); if (enableTwitter.Checked && infoserviceOptions.Enabled) generateTwitter(); } else if (direction == menuType.vertical) { generateRSSTickerV(); if (enableTwitter.Checked && infoserviceOptions.Enabled) generateTwitterV(); } } generateMostRecentFilesAndImports("AddImports"); toolStripStatusLabel1.Text = "Done!"; if (System.IO.File.Exists(SkinInfo.mpPaths.streamedMPpath + "BasicHome.xml")) System.IO.File.Delete(SkinInfo.mpPaths.streamedMPpath + "BasicHome.xml"); xml = xml.Replace("<!-- BEGIN GENERATED ID CODE-->", "<id>35</id>"); CheckSum checkSum = new CheckSum(); writeXMLFile("BasicHome.xml"); generateMostRecentFilesAndImports("GenImports"); if (menuStyle == chosenMenuStyle.graphicMenuStyle) //generateOverlay(int.Parse(txtMenuPos.Text), 0, basicHomeValues.weatherControl); generateOverlay(0, 380, basicHomeValues.weatherControl); else generateOverlay(int.Parse(txtMenuPos.Text), 765, basicHomeValues.weatherControl); changeOutstanding = false; getBackupFileTotals(); if (!onFormClosing) { DialogResult result = helper.showError("BasicHome.xml Saved Sucessfully \n\n Backup file has been created \n\nDo you want to Contine Editing", errorCode.infoQuestion); if (result == DialogResult.No) { //reset everything //xmlFiles.Items.Clear(); //cboQuickSelect.Items.Clear(); itemsOnMenubar.Items.Clear(); prettyItems.Clear(); ids.Clear(); bgItems.Clear(); menuItems.Clear(); this.Close(); } // reset item id's as it is possible to generate again. foreach (menuItem item in menuItems) { item.id = menuItems.IndexOf(item); } } }