static void MakeRSS(string input, string output) { rss = new RSS.RSS(); c = rss.NewChannel("Mono Project News", "http://www.go-mono.com"); c.Title = "Mono Project News"; c.Link = "http://www.go-mono.com"; c.Description = "News from the Mono project: a portable implementation of the .NET Framework"; c.WebMaster = "*****@*****.**"; c.ManagingEditor = "*****@*****.**"; string t = File.GetLastWriteTime(input).ToString("r"); c.PubDate = t; c.LastBuildDate = t; using (FileStream fs = new FileStream(input, FileMode.Open)){ using (StreamReader input_stream = new StreamReader(fs)){ try { PopulateRSS(input_stream); } catch { Console.WriteLine("{0} failure while loading: {1}", line, input); throw; } } } rss.XmlDocument.Save(output); }
static void MakeRSS(string input, string output) { rss = new RSS.RSS (); c = rss.NewChannel ("Mono Project News", "http://www.go-mono.com"); c.Title = "Mono Project News"; c.Link = "http://www.go-mono.com"; c.Description = "News from the Mono project: a portable implementation of the .NET Framework"; c.WebMaster = "*****@*****.**"; c.ManagingEditor = "*****@*****.**"; string t = File.GetLastWriteTime (input).ToString ("r"); c.PubDate = t; c.LastBuildDate = t; using (FileStream fs = new FileStream (input, FileMode.Open)){ using (StreamReader input_stream = new StreamReader (fs)){ try { PopulateRSS (input_stream); } catch { Console.WriteLine ("{0} failure while loading: {1}", line, input); throw; } } } rss.XmlDocument.Save (output); }
/// <summary> /// Return Serialized String version of [data] Object /// </summary> /// <param name="data">as RSS</param> /// <returns></returns> /// <remarks></remarks> private static string XMLSerializeToString(RSS data) { try { XmlSerializer xmlSer = new XmlSerializer(typeof(RSS)); MemoryStream ms = new MemoryStream(); StreamReader strReader = default(StreamReader); string output = null; xmlSer.Serialize(ms, data); ms.Position = 0; strReader = new StreamReader(ms); output = strReader.ReadToEnd(); return output; } catch (Exception ex) { GetLastError = ex; return null; } }
/// <summary> /// Set My Base to values of data /// </summary> /// <param name="data">as rss feed</param> /// <returns></returns> protected Boolean SetBase(RSS data) { try { RSSID = data.RSSID; Name = data.Name; Icon = data.Icon; Description = data.Description; Channels = data.Channels; return true; } catch (Exception ex) { GetLastError = ex; throw ex; } }