internal static void CreateRSS(TheRequestData pRequest, List <TheEventLogData> pLog, int MaxCnt) { try { using (MemoryStream tW = new MemoryStream()) { TheRSSGenerator gen = new TheRSSGenerator(tW) { Title = TheBaseAssets.MyServiceHostInfo.ApplicationTitle + " - Event Feed", Description = "All Events coming from the Rules Event Log", LastBuildDate = DateTimeOffset.Now, Link = TheBaseAssets.MyServiceHostInfo.SiteName, PubDate = DateTimeOffset.Now }; //gen.Category = "Home-Automation"; gen.WriteStartDocument(); gen.WriteStartChannel(); int cnt = 0; foreach (TheEventLogData tEntry in pLog) { gen.WriteItem( tEntry.EventName, TheBaseAssets.MyServiceHostInfo.SiteName + "/" + TheBaseAssets.MyServiceHostInfo.PortalPage, //"url to the item page", string.Format("{0} occured at {1} on stations {2}. {3}", tEntry.EventName, tEntry.EventTime, tEntry.StationName, tEntry.EventString), // "the description of the item", tEntry.StationName, // "the author", tEntry.EventTrigger, // "the category", "", //"comments", tEntry.cdeMID.ToString(), //"the guid", tEntry.EventTime, // DateTimeOffset.Now, tEntry.StationName, //"the source", "", //"enclosure URL", "", //"enclosure length", "" //"enclosure type" ); if (MaxCnt > 0 && cnt > MaxCnt) { break; } cnt++; } gen.WriteEndChannel(); gen.WriteEndDocument(); gen.Close(); pRequest.ResponseBuffer = tW.ToArray(); } pRequest.StatusCode = 200; pRequest.ResponseMimeType = "application/rss+xml"; pRequest.DontCompress = true; } catch { // do something with the error } }
internal static void CreateRSS(TheRequestData pRequest, List <TheEventLogEntry> pLog, int MaxCnt) { try { using (MemoryStream tW = new MemoryStream()) { TheRSSGenerator gen = new TheRSSGenerator(tW) { Title = TheBaseAssets.MyServiceHostInfo.ApplicationTitle + " - System Log Feed", Description = "Last Events of the System Log", LastBuildDate = DateTimeOffset.Now, Link = TheBaseAssets.MyServiceHostInfo.SiteName, PubDate = DateTimeOffset.Now }; gen.WriteStartDocument(); gen.WriteStartChannel(); int cnt = 0; foreach (TheEventLogEntry tEntry in pLog) { gen.WriteItem( tEntry.Message.TXT, TheBaseAssets.MyServiceHostInfo.SiteName + "/" + TheBaseAssets.MyServiceHostInfo.PortalPage, //"url to the item page", tEntry.Message.PLS, // "the description of the item", tEntry.Message.ENG, // "the author", tEntry.Message.ENG, //"the category", "", //"comments", tEntry.cdeMID.ToString(), //"the guid", tEntry.cdeCTIM, // DateTimeOffset.Now, tEntry.Message.ENG, //"the source", "", //"enclosure URL", "", //"enclosure length", "" //"enclosure type" ); if (MaxCnt > 0 && cnt > MaxCnt) { break; } cnt++; } gen.WriteEndChannel(); gen.WriteEndDocument(); gen.Close(); pRequest.ResponseBuffer = tW.ToArray(); } pRequest.StatusCode = 200; pRequest.ResponseMimeType = "application/rss+xml"; pRequest.DontCompress = true; } catch { // do something with the error } }