2 // Generates the Mono RSS feed
14 static int item_count;
16 static void PopulateRSS (StreamReader input)
20 while ((s = input.ReadLine ()) != null){
21 if (s.StartsWith ("@item "))
25 if (s == null || !s.StartsWith ("@item ")){
26 Console.WriteLine ("Could not find beginning of text to RSS");
31 string description = "";
33 if (s.StartsWith ("@item ")){
34 if (item_count++ > 25)
38 i.Description = description;
42 string title = s.Substring (6);
43 string link = "http://www.go-mono.com/index.html#";
44 foreach (char ch in title){
53 description += "\n" + (s == "\n" ? "<p>" : s);
55 } while ((s = input.ReadLine ()) != null);
58 i.Description = description;
62 static void MakeRSS (string input, string output)
65 c = rss.NewChannel ("Mono Project News", "http://www.go-mono.com");
67 c.Title = "Mono Project News";
68 c.Link = "http://www.go-mono.com";
70 "News from the Mono project: a portable implementation of the .NET Framework";
71 c.WebMaster = "webmaster@go-mono.com";
72 c.ManagingEditor = "miguel@ximian.com";
73 string t = File.GetLastWriteTime (input).ToString ("r");
77 using (FileStream fs = new FileStream (input, FileMode.Open)){
78 using (StreamReader input_stream = new StreamReader (fs)){
79 PopulateRSS (input_stream);
83 rss.XmlDocument.Save (output);
86 static int Main (string [] args)
90 MakeRSS ("index", "index.rss");
93 MakeRSS (args [0], args [1]);
97 Console.WriteLine ("Usage is: mono-rss [input output.rss]");