public static Channel Load(string path) { if (!File.Exists(path + @"Channel" + Info.extension)) { return(null); } SerializationReader SR = new SerializationReader(path + @"Channel" + Info.extension); SR.Read(); SR.ReadDeclaration(); SR.ReadStartElement(); Channel channel = new Channel(); channel.Load(SR); SR.Close(); channel.Appearances = Info.LoadFileAppearances(path + @"Appearances" + Info.extension); if (!Directory.Exists(path + @"\Channel\")) { Directory.CreateDirectory(path + @"\Channel\"); } DirectoryInfo dir = new DirectoryInfo(path + @"/Channel"); foreach (FileInfo file in dir.GetFiles()) { WebTVJSON webjson = LoadFileWebTVJSON(file.FullName); channel.Add(webjson); } channel.ForumList.Load(path + @"/Forum"); return(channel); }
public static WebTVJSON LoadFileWebTVJSON(string path) { WebTVJSON webtvjson = new WebTVJSON(); SerializationReader SR = new SerializationReader(path); SR.Read(); SR.ReadDeclaration(); SR.ReadStartElement(); SR.ReadStartElement(); int version = SR.ReadVersion(); switch (version) { case 0: { //webtvjson.Hourly.Title = SR.ReadString(); //webtvjson.Media.VideoPlayer = SR.ReadString(); //webtvjson.Media.Source = SR.ReadString(); //webtvjson.Media.Duration = SR.ReadInt(); //webtvjson.Media.StartSeconds = SR.ReadInt(); //webtvjson.Media.Quality = SR.ReadString(); //webtvjson.Hourly.Category = SR.ReadString(); //webtvjson.Hourly.Subcategory = SR.ReadString(); //webtvjson.Note.Like = SR.ReadInt(); //webtvjson.Note.Dislike = SR.ReadInt(); //webtvjson.Note.NumberView = SR.ReadInt(); //webtvjson.Hourly.Description = SR.ReadString(); //webtvjson.Hourly.ImageUrl = SR.ReadString(); //webtvjson.Hourly.BackGroundUrl = SR.ReadString(); //webtvjson.Social.WebSite = SR.ReadString(); //webtvjson.Social.Youtube = SR.ReadString(); //webtvjson.Social.Facebook = SR.ReadString(); //webtvjson.Social.Twitter = SR.ReadString(); //webtvjson.Social.Google = SR.ReadString(); //webtvjson.Social.Dailymotion = SR.ReadString(); //webtvjson.Social.Vimeo = SR.ReadString(); //webtvjson.Social.Email = SR.ReadString(); break; } } SR.ReadEndElement(); SR.Close(); return(webtvjson); }