架构:C#控制台程序+ASP.NET后台/前台+MySQL
开源第一篇,先公布最主要的部分:AutoRSS.exe
此程序负责:
1、解析XML,将数据写入DB(ActionArticle.cs)
2、DownLoad XML中包含的图片至本地服务器,存放地址写入DB(ActionLoadImg.cs)
3、DownLoad新闻优先级评定(依据关键字)(ActionPriority.cs)
4、自动推送优先级高的新闻(AutoPush.cs)
5、发送邮件,通知程序运行Log(SysLog.cs)
运行效果:
由于不是第一次运行,所以会有今日已添加和此次已添加log
主程序源码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Xml;
using ModuleFunction;
using System.Xml.Linq;
using System.IO;
//作者:jeremytian
//时间:20140114
//功能:自动下载RSS订阅信息
namespace AutoRss
{
class Program
{
static void Main(string[] args)
{
string strException = "AutoRss类名:Program;方法名:Main;";
SysLog.textAll = "============================================";
SysLog.textAll = strException + " 日志记录: ";
try
{
//获取订阅RSS新闻信息
ActionArticle actionart = new ActionArticle();
actionart.GetArticle();
给新闻信息进行优先级评定
ActionPriority actionpri = new ActionPriority();
actionpri.SetPriority();
//自动推送新闻
//规则:包含关键字
AutoPush autopush = new AutoPush();
autopush.AutoPushNews();
}
catch (Exception ex)
{
Console.WriteLine(strException + ex.Message);
}
finally
{
DotNetSendMail sendmail = new DotNetSendMail();
sendmail.SendMailConfig(SysLog.textPath, SysLog.textAll);
}
}
}
}
源码地址:http://pan.baidu.com/s/1nt9aW69
注:
源码中暂不包含DB和后台维护程式。
不过源码都挺简单,封装的部分也很容易重写。
如有疑问回复。