private string loadExportedData() { XmlReader reader = null; XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; WMCChannel channel = null; try { reader = XmlReader.Create(Path.Combine(RunParameters.DataDirectory, "WMC Export.xml"), settings); } catch (IOException) { return("Failed to open " + Path.Combine(RunParameters.DataDirectory, "WMC Export.xml")); } try { while (!reader.EOF) { reader.Read(); if (reader.IsStartElement()) { switch (reader.Name) { case "channel": channel = new WMCChannel(); channel.Load(reader); break; case "dvbTuningInfo": channel.LoadDVBTuningInfo(reader); break; case "atscTuningInfo": channel.LoadATSCTuningInfo(reader); break; case "recording": WMCRecording recording = new WMCRecording(); recording.Load(reader); break; default: break; } } } } catch (XmlException e) { return("Failed to load export file: " + e.Message); } catch (IOException e) { Logger.Instance.Write("Failed to load export file: " + e.Message); } if (reader != null) reader.Close(); return (null); }
private void setWMCStationInfo(TVStation station, WMCChannel channel, string matchMethod) { if (RunParameters.Instance.Options.Contains("AUTOMAPEPG")) { station.WMCUniqueID = channel.Uid; station.WMCMatchName = channel.MatchName; } string uniqueID; string matchName; if (station.WMCUniqueID != null) uniqueID = station.WMCUniqueID; else uniqueID = "undefined"; if (station.WMCMatchName != null) matchName = station.WMCMatchName; else matchName = "undefined"; Logger.Instance.Write("Station " + station.Name + " (" + station.FullID + ") unique ID " + uniqueID + " match name " + matchName + " set using " + matchMethod); }