网络精灵
来源:互联网 发布:ubuntu 更新gcc6.0 编辑:程序博客网 时间:2024/05/01 15:13
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Xml;namespace 网络电视{ public class ChannelA : ChannelBase { public override void Fetch() { XmlDocument doc = new XmlDocument(); doc.Load(Path); XmlNode root = doc.DocumentElement; foreach (XmlNode item in root.ChildNodes) { //一个Item if (item.Name == "tvProgramTable") { foreach (XmlNode child in item.ChildNodes) { //一个child是一个节目单对象 TvProgram tv = new TvProgram(); tv.PlayTime = Convert.ToDateTime(child["playTime"].InnerText); tv.Median = child["meridien"].InnerText; tv.ProgramName = child["programName"].InnerText; tv.FilePath = child["path"].InnerText; ProgramList.Add(tv); } } } } }}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Xml;namespace 网络电视{ public class ChannelB:ChannelBase { public override void Fetch() { XmlDocument doc = new XmlDocument(); doc.Load(Path); XmlNode root = doc.DocumentElement; foreach (XmlNode item in root.ChildNodes) { foreach (XmlNode child in item.ChildNodes) { TvProgram tp = new TvProgram(); tp.PlayTime = Convert.ToDateTime(child["playTime"].InnerText); tp.ProgramName = child["name"].InnerText; tp.FilePath = child["path"].InnerText; ProgramList.Add(tp); } } } }}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Xml;namespace 网络电视{ public abstract class ChannelBase { public ChannelBase() { programList = new List<TvProgram>(); } #region 属性 private string channelName; public string ChannelName { get { return channelName; } set { channelName = value; } } private string path; public string Path { get { return path; } set { path = value; } } private List<TvProgram> programList; public List<TvProgram> ProgramList { get { return programList; } set { this.programList = value; } } #endregion //Fetch,读取频道的xml文件 public abstract void Fetch(); }}
using System;using System.Collections.Generic;using System.Diagnostics;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 网络电视{ public class ChannelFactory { public static ChannelBase CreatChannel(string type) { ChannelBase channel = null; switch (type) { case "TypeA": channel = new ChannelA(); break; case "TypeB": channel = new ChannelB(); break; } return channel; } }}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Xml;namespace 网络电视{ public class ChannelManager { private Dictionary<string, ChannelBase> fullChannels = null; public Dictionary<string, ChannelBase> FullChannels { get { return fullChannels; } set { fullChannels = value; } } public ChannelManager() { fullChannels=new Dictionary<string, ChannelBase>(); } public void ChangeXmlToList() { XmlDocument doc=new XmlDocument(); doc.Load("files/FullChannels.xml"); XmlNode root = doc.DocumentElement; foreach (XmlNode item in root.ChildNodes) { string type = item["channelType"].InnerText; ChannelBase channel = ChannelFactory.CreatChannel(type); channel.ChannelName = item["tvChannel"].InnerText; channel.Path = item["path"].InnerText; fullChannels.Add(channel.ChannelName, channel); } } }}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 网络电视{ public class TvProgram { private DateTime playTime; public DateTime PlayTime { get { return playTime; } set { playTime = value; } } /// <summary> /// 时段 /// </summary> private string median; public string Median { get { return median; } set { median = value; } } private string programName; public string ProgramName { get { return programName; } set { programName = value; } } private string filePath; public string FilePath { get { return filePath; } set { filePath = value; } } }}
0 0
- 网络精灵
- 网络精灵
- 网络电视精灵
- 网络电视精灵
- 网络电视精灵 完整版
- 电视网络精灵
- 网络电视精灵
- 网络电视精灵
- 网络电视精灵
- day 08 网络电视精灵
- C#网络电视精灵系统
- 网络电视精灵 2003.08.03 官方
- 网络信息精灵 v1.0 bt
- Wifi网络共享----Wifi共享精灵
- Cocos2d-x 读取网络图片创建精灵
- wifi共享精灵 强大的网络伴侣
- wifi共享精灵轻松搞定wifi网络
- Cocos2d-x 读取网络图片创建精灵
- 一种新的状态机写法:current_state <= "Idle";
- CV Review
- 【Java学习】之(Write Once,Run Anywhere)
- 利用数组、vector对象分开图像的通道
- TimesTen的PL/SQL 函数和过程最多支持多少参数
- 网络精灵
- 函数式编程初探
- Yolo v2 训练 NAN解决过程
- ubuntu 16.04 安装配置 java pycharm
- 主席树
- 秒杀多线程
- vue实现双向绑定的原理Object.defineProperty
- SQL 备份表-造数据-还原表
- Java面向对象知识