Example #1
0
        public static ExtPlayList LoadPlaylist(string fname)
        {
            if (!File.Exists(fname))
            {
                return(null);
            }
            var pl    = new ExtPlayList();
            var xd    = XDocument.Load(fname);
            var xroot = xd.Element("pltempl");

            if (xroot == null)
            {
                return(null);
            }
            var xmanifest = xroot.Element("manifest");

            if (xmanifest == null)
            {
                return(null);
            }
            var xformat = xmanifest.Element("format");

            if (xformat == null)
            {
                return(null);
            }
            pl.Format = xformat.Value.Replace(SPECIAL_CHAR_AMP, "&").Replace(SPECIAL_CHAR_GT, ">").Replace(SPECIAL_CHAR_LT, "<");

            var xchannel = xroot.Element("channels");

            if (xchannel != null)
            {
                pl.Channel = GetTemplate(xchannel);
            }
            var xarchive = xroot.Element("archive");

            if (xarchive != null)
            {
                pl.Archive = GetTemplate(xarchive);
            }
            var xrecrod = xroot.Element("records");

            if (xrecrod != null)
            {
                pl.Record = GetTemplate(xrecrod);
            }
            var xplugin = xroot.Element("plugin");

            if (xplugin != null)
            {
                pl.Plugin = GetTemplate(xplugin);
            }

            return(pl);
        }
Example #2
0
        public static ExtPlayList LoadPlaylist(string fname)
        {
            if (!File.Exists(fname))
                return null;
            var pl = new ExtPlayList();
            var xd = XDocument.Load(fname);
            var xroot = xd.Element("pltempl");
            if (xroot == null)
                return null;
            var xmanifest = xroot.Element("manifest");
            if (xmanifest == null)
                return null;
            var xformat = xmanifest.Element("format");
            if (xformat == null)
                return null;
            pl.Format = xformat.Value.Replace(SPECIAL_CHAR_AMP, "&").Replace(SPECIAL_CHAR_GT, ">").Replace(SPECIAL_CHAR_LT, "<");

            var xchannel = xroot.Element("channels");
            if (xchannel != null)
            {

                pl.Channel = GetTemplate(xchannel);
            }
            var xarchive = xroot.Element("archive");
            if (xarchive != null)
            {
                pl.Archive = GetTemplate(xarchive);
            }
            var xrecrod = xroot.Element("records");
            if (xrecrod != null)
            {
                pl.Record = GetTemplate(xrecrod);
            }
            var xplugin = xroot.Element("plugin");
            if (xplugin != null)
            {
                pl.Plugin = GetTemplate(xplugin);
            }
            
            return pl;
        }