internal static M3UElement Read(string content, string basepath, ReaderConfiguration config, int activeDepth) { string[] tContent = content.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); return(Read(tContent, basepath, config, activeDepth)); tContent = null; }
private void btnerasesave_Click(object sender, EventArgs e) { ReaderConfiguration rdrconf = new ReaderConfiguration(ReaderConfiguration.SaveConfCode.SaveConf_Erase); try { rdr.ParamSet("SaveConfiguration", rdrconf); MessageBox.Show("erase successfully, please reconnect reader"); } catch (Exception ex) { MessageBox.Show("operation failed:" + ex.ToString()); return; } }
internal static M3U8Element Read(string[] tContent, string basepath, ReaderConfiguration config, int activeDepth) { M3U8Element oReturn = new M3U8Element(activeDepth); if (tContent.Length > 1) { oReturn.Path = tContent[tContent.Length - 1]; Helper.ConvertRelative2Absolute(basepath, oReturn); } string[] tOptions = tContent[0].Replace(Constantes.M3U8_INFO_MARKER + ":", "").Split(','); oReturn.Options = new System.Collections.Hashtable(); foreach (string opt in tOptions) { Helper.ReadOptions(opt, oReturn.Options, '='); } if (!string.IsNullOrEmpty(oReturn.Path)) { if (oReturn.Path.ToLower().Contains("m3u8") && config.Depth > activeDepth) { string sChilds = Helper.GetWebData(oReturn.Path); List <M3UComponent> childs = new List <M3UComponent>(); childs.AddRange(Helper.ReadM3uElement(sChilds, basepath, config, activeDepth)); if (childs.Count > 0) { oReturn.AddRange(childs); } } } else { oReturn = null; } tOptions = null; return(oReturn); }
internal static M3UElement[] ReadM3uElement(M3UPlaylist m3UPlaylist, string[] tcontent, string basepath, ReaderConfiguration config, int activeDepth) { List <M3UElement> tReturn = new List <M3UElement>(); List <string> tElement = new List <string>(); int index = 0; while (index < tcontent.Length) { string line = tcontent[index].Trim(); tElement.Add(line); if (!line.StartsWith("#")) { //An M3Ux Element is found string sline = tElement[0].Trim(); if (sline.StartsWith(Constantes.M3U_INFO_MARKER)) { tReturn.Add(M3UElement.Read(tElement.ToArray(), basepath, config, activeDepth + 1)); } else if (sline.StartsWith(Constantes.M3U8_INFO_MARKER)) { tReturn.Add(M3U8Element.Read(tElement.ToArray(), basepath, config, activeDepth + 1)); } tElement = new List <string>(); } index++; } if (m3UPlaylist != null) { m3UPlaylist.AddRange(tReturn.ToArray()); } tElement.Clear(); return(tReturn.ToArray()); }
internal static M3UElement[] ReadM3uElement(string[] tcontent, string basepath, ReaderConfiguration config, int activeDepth) { return(ReadM3uElement(null, tcontent, basepath, config, activeDepth)); }
internal static M3UElement[] ReadM3uElement(string content, string basepath, ReaderConfiguration config, int activeDepth) { var tcontent = content.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); return(ReadM3uElement(tcontent, basepath, config, activeDepth)); }
/// <summary> /// Constructor /// </summary> public M3UPlaylist() : base() { Configuration = new ReaderConfiguration(); Options = new System.Collections.Hashtable(); }
internal static M3UElement Read(string[] tContent, string basepath, ReaderConfiguration config, int activeDepth) { M3UElement oReturn = new M3UElement(activeDepth); if (tContent.Length > 1) { oReturn.Path = tContent[tContent.Length - 1]; Helper.ConvertRelative2Absolute(basepath, oReturn); } else if (tContent.Length == 1) { oReturn.Path = tContent[0]; Helper.ConvertRelative2Absolute(basepath, oReturn); } oReturn.Options = new System.Collections.Hashtable(); if (tContent[0].StartsWith(Constantes.M3U_INFO_MARKER)) { string[] tOptions = tContent[0].Replace(Constantes.M3U_INFO_MARKER + ":", "").Split(','); if (tOptions.Length > 0) { oReturn.Options.Add("LENGHT", tOptions[0].Trim()); } if (tOptions.Length > 1) { oReturn.Options.Add("INFOS", tOptions[1].Trim()); } tOptions = null; } //Try Recursive. if (oReturn.Path.ToLower().Contains("m3u") && config.Depth > activeDepth) { string sChilds = Helper.GetWebData(oReturn.Path); string sbasepath = Helper.GetWebBasePath(oReturn.Path); int contentPosition = 0; string[] fullcontent = sChilds.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); //Analysing Playlist Options for (int idx = 1; idx < fullcontent.Length; idx++) { string sline = fullcontent[idx].Trim(); if (sline.StartsWith("#EXT") && sline.Contains(":") && (!sline.StartsWith(Constantes.M3U8_INFO_MARKER) && !sline.StartsWith(Constantes.M3U_INFO_MARKER) && !sline.Contains("EXTVLCOPT"))) { Helper.ReadOptions(sline, oReturn.Options); contentPosition = idx; } } List <M3UComponent> childs = new List <M3UComponent>(); string[] contentStreams = fullcontent.Where((x, idx) => idx > contentPosition).ToArray(); childs.AddRange(Helper.ReadM3uElement(contentStreams, sbasepath, config, 0)); if (childs.Count > 0) { oReturn.AddRange(childs); } fullcontent = null; } return(oReturn); }