Esempio n. 1
0
 private Playlist(ExtPlayList templ)
 {
     this._templ = templ;
     switch (this._type)
     {
         case Playlist.ContentType.Channel:
             this._result.AppendLine(this._templ.Channel.Header);
             break;
         case Playlist.ContentType.Record:
             this._result.AppendLine(this._templ.Record.Header);
             break;
         case Playlist.ContentType.Archive:
             this._result.AppendLine(this._templ.Archive.Header);
             break;
         case Playlist.ContentType.Plugin:
             this._result.AppendLine(this._templ.Plugin.Header);
             break;
     }
 }
Esempio n. 2
0
 public static ExtPlayList LoadPlaylist(string fname)
 {
     if (!File.Exists(fname))
         return (ExtPlayList)null;
     ExtPlayList extPlayList = new ExtPlayList();
     XElement xelement1 = XDocument.Load(fname).Element((XName)"pltempl");
     if (xelement1 == null)
         return (ExtPlayList)null;
     XElement xelement2 = xelement1.Element((XName)"manifest");
     if (xelement2 == null)
         return (ExtPlayList)null;
     XElement xelement3 = xelement2.Element((XName)"format");
     if (xelement3 == null)
         return (ExtPlayList)null;
     extPlayList.Format = xelement3.Value.Replace(ExtPlayList.SPECIAL_CHAR_AMP, "&").Replace(ExtPlayList.SPECIAL_CHAR_GT, ">").Replace(ExtPlayList.SPECIAL_CHAR_LT, "<");
     XElement xelement4 = xelement2.Element((XName)"out");
     if (xelement4 == null)
         return (ExtPlayList)null;
     string str1 = xelement4.Value.Replace(" ", "");
     if (str1 == string.Empty)
         return (ExtPlayList)null;
     string[] strArray1 = str1.Split(Enumerable.ToArray<char>((IEnumerable<char>)","), StringSplitOptions.RemoveEmptyEntries);
     extPlayList.Out = new ExtPlayList.OutTypes[strArray1.Length];
     for (int index = 0; index < strArray1.Length; ++index)
     {
         if (strArray1[index].Length < 3)
             return (ExtPlayList)null;
         extPlayList.Out[index] = (ExtPlayList.OutTypes)Enum.Parse(typeof(ExtPlayList.OutTypes), strArray1[index], true);
     }
     ExtPlayList.OutTypes[] outTypesArray = extPlayList.Out;
     Func<ExtPlayList.OutTypes, bool> func = (Func<ExtPlayList.OutTypes, bool>)(o => o == ExtPlayList.OutTypes.File);
     //Func<ExtPlayList.OutTypes, bool> predicate;
     //if (Enumerable.Any<ExtPlayList.OutTypes>((IEnumerable<ExtPlayList.OutTypes>) outTypesArray, predicate))
     if (Enumerable.Any<ExtPlayList.OutTypes>((IEnumerable<ExtPlayList.OutTypes>)outTypesArray, func))
     {
         XElement xelement5 = xelement2.Element((XName)"ext");
         if (xelement5 == null)
             return (ExtPlayList)null;
         extPlayList.Ext = xelement5.Value;
     }
     XElement xelement6 = xelement2.Element((XName)"icon");
     string str2 = string.Empty;
     if (xelement6 != null)
         str2 = xelement6.Value.Replace(" ", "");
     extPlayList.Icon = new string[strArray1.Length];
     for (int index = 0; index < extPlayList.Icon.Length; ++index)
         extPlayList.Icon[index] = ExtPlayList.CONST_NONE;
     string[] strArray2 = str2.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
     string directoryName = Path.GetDirectoryName(fname);
     for (int index = 0; index < strArray2.Length && index < extPlayList.Out.Length; ++index)
         extPlayList.Icon[index] = strArray2[index] == string.Empty || strArray2[index] == "None" ? ExtPlayList.CONST_NONE : directoryName + "/" + strArray2[index];
     XElement element1 = xelement1.Element((XName)"channels");
     if (element1 != null)
         extPlayList.Channel = ExtPlayList.GetTemplate(element1);
     XElement element2 = xelement1.Element((XName)"archive");
     if (element2 != null)
         extPlayList.Archive = ExtPlayList.GetTemplate(element2);
     XElement element3 = xelement1.Element((XName)"records");
     if (element3 != null)
         extPlayList.Record = ExtPlayList.GetTemplate(element3);
     XElement element4 = xelement1.Element((XName)"plugin");
     if (element4 != null)
         extPlayList.Plugin = ExtPlayList.GetTemplate(element4);
     return extPlayList;
 }