public ReplayGuide(ReplayDevice rd) { this.theDevice = rd; this.guideFile = ReplayHelper.MakePathAndFile(this.theDevice.serialNumber + ".guide"); this.guideXMLFile = ReplayHelper.MakePathAndFile(this.theDevice.serialNumber + ".xml"); OperatingSystem oSVersion = Environment.OSVersion; if (((oSVersion.Platform == PlatformID.Win32NT) || (oSVersion.Platform == PlatformID.Win32S)) || (oSVersion.Platform == PlatformID.Win32Windows)) { ReplayLogger.DebugLog("Using Default Encoding for Windows - " + oSVersion.Platform); this.encoding = Encoding.Default; } else { ReplayLogger.DebugLog("Request iso-8859-1 Encoding for " + oSVersion.Platform); this.encoding = Encoding.GetEncoding("iso-8859-1"); } }
private void LogSend(string showID) { this.recipientDevice.ivsNickname = "n/a"; try { string xml = null; xml = HTTPClient.GetAsString("http://" + this.recipientDevice.ip + ":" + this.recipientDevice.port + "/ivs-IVSGetUnitInfo"); XmlDocument document = new XmlDocument(); document.LoadXml(xml); foreach (XmlNode node in document.SelectNodes("/UnitInfo")) { XmlElement element = node as XmlElement; if (element != null) { this.recipientDevice.ivsNickname = element.GetAttribute("nickname"); } } } catch { ReplayLogger.Log("Send logging: Unable to query remote replay for ivsNickname"); } string text2 = "n/a"; string text3 = "n/a"; string text4 = "n/a"; XmlDocument document2 = new XmlDocument(); string path = ReplayHelper.MakePathAndFile(this.theDevice.serialNumber + ".xml"); if (System.IO.File.Exists(path)) { document2.Load(path); XmlElement element2 = document2.SelectSingleNode(string.Format("/result/channel-list/channel/show[@showID=\"{0}\"]", showID)) as XmlElement; if (element2 != null) { text2 = element2.GetAttribute("title"); text3 = element2.GetAttribute("episodeTitle"); text4 = element2.GetAttribute("startTimeGMT"); } else { ReplayLogger.Log("showID not found in guide xml file: " + showID); } } else { ReplayLogger.Log("guide xml file not found."); } string filename = ReplayHelper.MakePathAndFile("sendlog.xml"); XmlDocument document3 = new XmlDocument(); try { document3.Load(filename); } catch (FileNotFoundException) { XmlTextWriter writer = new XmlTextWriter(filename, Encoding.UTF8); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(); writer.WriteStartElement("sendlog"); writer.Close(); document3.Load(filename); } try { XmlElement newChild = document3.CreateElement("send"); XmlAttribute newAttr = document3.CreateAttribute("show"); newAttr.Value = text2; XmlAttribute attribute2 = document3.CreateAttribute("episode"); attribute2.Value = text3; XmlAttribute attribute3 = document3.CreateAttribute("showdate"); attribute3.Value = text4; XmlAttribute attribute4 = document3.CreateAttribute("isn"); attribute4.Value = this.recipientDevice.isn; XmlAttribute attribute5 = document3.CreateAttribute("ivsname"); attribute5.Value = this.recipientDevice.ivsNickname; XmlAttribute attribute6 = document3.CreateAttribute("senddate"); attribute6.Value = DateTime.Now.ToString(); XmlAttribute attribute7 = document3.CreateAttribute("unit"); attribute7.Value = this.theDevice.friendlyName; newChild.SetAttributeNode(newAttr); newChild.SetAttributeNode(attribute2); newChild.SetAttributeNode(attribute3); newChild.SetAttributeNode(attribute4); newChild.SetAttributeNode(attribute5); newChild.SetAttributeNode(attribute6); newChild.SetAttributeNode(attribute7); document3.DocumentElement.InsertBefore(newChild, document3.DocumentElement.FirstChild); document3.Save(filename); } catch (Exception exception) { ReplayLogger.Log("Send Log write exception: " + exception.ToString()); } }
public ReplayClient(ReplayDevice re) { this.theDevice = re; this.guideFile = ReplayHelper.MakePathAndFile(this.theDevice.serialNumber + ".guide"); }