public EpisodeListNetworkMessage(byte messageId, Episode episode)
 {
     base.Id = messageId;
     base.TypeVal = (byte)NetworkEventType.Answer;
     base.SpecificTypeVal = (byte)NetworkRequestEvent.EpisodeList;
     if (episode == null)
     {
         base.Data = new byte[] { 1, 2, 3, 4 };  //end marker
     }
     else
     {
         base.Data = episode.GetByteData();
     }
 }
 public EpisodeChangeEventArgs(Episode newEpisode)
 {
     this.newEpisode = newEpisode;
 }
Esempio n. 3
0
 public async static Task<Series> ReadCachedSeriesAsync(string providerName, string fileName)
 {
     string filepath = Path.Combine(Util.GetRalativePath(Settings.NOSETTING_CACHE_PATH), providerName + "." + fileName + ".series");
     if (!File.Exists(filepath)) return null;
     List<List<Episode>> seasons = new List<List<Episode>>();
     string seriesName = fileName;
     string seriesProvider = providerName;
     string linkExtension = fileName;
     string seriesLink = "";
     int lastPlayedEpisode = 1, lastPlayedSeason = 1; 
     using (StreamReader sr = new StreamReader(File.OpenRead(filepath)))
     {
         Episode currEpisode = new Episode();
         while (!sr.EndOfStream)
         {
             string line = await sr.ReadLineAsync();
             if (line.Contains("[Season "))
             {
                 seasons.Add(new List<Episode>());
                 continue;
             }
             else if (line.Contains("[Episode "))
             {
                 seasons[seasons.Count - 1].Add(new Episode());
                 currEpisode = seasons[seasons.Count - 1][seasons[seasons.Count - 1].Count - 1]; //seasons[last][last]
                 continue;
             }
             string[] parts = line.Split(new char[]{ '.' }, 2);
             if (parts.Length != 2) return null;
             int res;
             switch (parts[0])
             {
                 case "name":
                     currEpisode.Name = parts[1];
                     break;
                 case "season":
                     if (int.TryParse(parts[1], out res)) currEpisode.Season = res;
                     break;
                 case "episode":
                     if (int.TryParse(parts[1], out res)) currEpisode.Number = res;
                     break;
                 case "link":
                     string[] hostAndLink = parts[1].Split(new char[] { ' ' }, 2);
                     currEpisode.AddLink(hostAndLink[0], hostAndLink[1]);
                     break;
                 case "seriesLink":
                     seriesLink = parts[1];
                     break;
                 case "seriesname":
                     seriesName = parts[1];
                     break;
                 case "provider":
                     seriesProvider = parts[1];
                     break;
                 case "linkExtension":
                     linkExtension = parts[1];
                     break;
                 case "lastPlayedSeason":
                     if (int.TryParse(parts[1], out res)) lastPlayedSeason = res;
                     break;
                 case "lastPlayedEpisode":
                     if (int.TryParse(parts[1], out res)) lastPlayedEpisode = res;
                     break;
                 case "playLocation":
                     long resL;
                     if (long.TryParse(parts[1], out resL)) currEpisode.PlayLocation = resL;
                     break;
             }
         }
     }
     Series series = new Series(seasons, seriesName, providerName, linkExtension, seriesLink);
     series.LastPlayedEpisode = lastPlayedEpisode;
     series.LastPlayedSeason = lastPlayedSeason;
     return series;
 }
Esempio n. 4
0
 public static void SeriesOpenCallback(Episode episode)
 {
     if (episode == null)
     {
         return;
     }
 }