コード例 #1
0
        private static void OutputToRSS(bool console_mode, string application_path, DataTable datatable)
        {
            try
            {
                DataSet original = new DataSet();

                if (File.Exists(application_path + "log.rss") == true)
                {
                    original.ReadXml(application_path + "log.rss");
                }

                TextWriter textwriter = new StreamWriter(application_path + "log.rss");

                RSS_Writer rsswriter = new myRSS.RSS_Writer(textwriter);
                rsswriter.WriteStartDocument();
                rsswriter.WriteStartChannel("title", "url", "description", "Copyright © Matt Brown", "Matt Brown");

                if (original.Tables["item"] != null)
                {
                    foreach (DataRow datarow in original.Tables["item"].Select(string.Format("pubdate >= #{0}#", DateTime.Today.AddDays(-1)), "pubdate"))
                    {
                        rsswriter.WriteItem(Convert.ToString(datarow["title"]), Convert.ToString(datarow["link"]), Convert.ToString(datarow["description"]), Convert.ToString(datarow["author"]), Convert.ToDateTime(datarow["pubdate"]), Convert.ToString(datarow["subject"]));
                    }
                }

                DataView dataview = new DataView(datatable);
                dataview.Sort = "Revision";

                foreach (DataRow datarow in dataview.ToTable().Rows)
                {
                    rsswriter.WriteItem(Convert.ToString(datarow["Revision"]), string.Empty, Convert.ToString(datarow["LogMessage"]).Replace(Environment.NewLine, "<br />") + "<br />" + Convert.ToString(datarow["ChangedPaths"]).Replace(Environment.NewLine, "<br />"), Convert.ToString(datarow["Author"]), Convert.ToDateTime(datarow["Time"]), Convert.ToString(datarow["Revision"]).Replace(Environment.NewLine, "<br />"));
                }

                rsswriter.WriteEndChannel();
                rsswriter.WriteEndDocument();
                rsswriter.Close();

                textwriter.Close();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);

                if (console_mode == true)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
コード例 #2
0
        private static void OutputToRSS(bool console_mode, string application_path, DataTable datatable)
        {
            try
            {
                DataSet original = new DataSet();

                if (File.Exists(application_path + "log.rss") == true)
                {
                    original.ReadXml(application_path + "log.rss");
                }

                TextWriter textwriter = new StreamWriter(application_path + "log.rss");

                RSS_Writer rsswriter = new myRSS.RSS_Writer(textwriter);
                rsswriter.WriteStartDocument();
                rsswriter.WriteStartChannel("title", "url", "description", "Copyright © Matt Brown", "Matt Brown");

                if (original.Tables["item"] != null)
                {
                    foreach (DataRow datarow in original.Tables["item"].Select(string.Format("pubdate >= #{0}#", DateTime.Today.AddDays(-1)), "pubdate"))
                    {
                        rsswriter.WriteItem(Convert.ToString(datarow["title"]), Convert.ToString(datarow["link"]), Convert.ToString(datarow["description"]), Convert.ToString(datarow["author"]), Convert.ToDateTime(datarow["pubdate"]), Convert.ToString(datarow["subject"]));
                    }
                }

                DataView dataview = new DataView(datatable);
                dataview.Sort = "Revision";

                foreach (DataRow datarow in dataview.ToTable().Rows)
                {
                    rsswriter.WriteItem(Convert.ToString(datarow["Revision"]), string.Empty, Convert.ToString(datarow["LogMessage"]).Replace(Environment.NewLine, "<br />") + "<br />" + Convert.ToString(datarow["ChangedPaths"]).Replace(Environment.NewLine, "<br />"), Convert.ToString(datarow["Author"]), Convert.ToDateTime(datarow["Time"]), Convert.ToString(datarow["Revision"]).Replace(Environment.NewLine, "<br />"));
                }

                rsswriter.WriteEndChannel();
                rsswriter.WriteEndDocument();
                rsswriter.Close();

                textwriter.Close();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);

                if (console_mode == true)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }