private void ChannelTable(int SatN, HtmlAgilityPack.HtmlNode N, ref StreamWriter FS1W, ref StreamWriter FS2W, bool TypeByPID) { PrepareInfoFlySat = true; List <List <HtmlAgilityPack.HtmlNode> > TableObj = new List <List <HtmlAgilityPack.HtmlNode> >(); for (int i = 0; i < N.ChildNodes.Count; i++) { if (N.ChildNodes[i].Name == "tr") { List <HtmlAgilityPack.HtmlNode> TableObjRow = new List <HtmlAgilityPack.HtmlNode>(); for (int ii = 0; ii < N.ChildNodes[i].ChildNodes.Count; ii++) { if (N.ChildNodes[i].ChildNodes[ii].Name == "td") { TableObjRow.Add(N.ChildNodes[i].ChildNodes[ii]); } } if ((TableObjRow.Count > 3) || ((TableObjRow.Count == 1) && TableObjRow[0].InnerText.Contains("Stream"))) { if ((!TableObjRow[0].InnerText.Contains("Txp No")) && (!TableObjRow[0].InnerText.Contains("Source")) && (!TableObjRow[0].InnerText.Contains("Date"))) { TableObj.Add(TableObjRow); } } } } string[] SatTrans = null; string[] SatChan = null; int RowN0 = 0; int RowN = 0; int RowSpanCounter = 0; for (int i = 0; i < TableObj.Count; i++) { if (RowSpanCounter == 0) { RowN0 = RowN; RowN = i; try { SatTrans = new string[20]; int TdI = 0; PrepareInfo(TableObj[i][TdI]); // Txp No SatTrans[0] = Prepare(InfoText[0]); // Source int TempI = 0; SatTrans[1] = ""; for (int ii = 1; ii < (InfoText.Count - 1); ii++) { if (Prepare(InfoText[ii]) != "") { if (TempI > 0) { SatTrans[1] += Separator; } SatTrans[1] += Prepare(InfoText[ii]); TempI++; } } // Date SatTrans[2] += Prepare(InfoText[InfoText.Count - 1]); TdI++; // Freq, Pol PrepareInfoFlySat = false; PrepareInfo(TableObj[i][TdI]); PrepareInfoFlySat = true; TableObj[i][TdI].InnerText.ToString(); string TempS = InfoText[0].Trim(); TempI = TempS.IndexOf(" "); if (TempI < 0) { throw new Exception("XXX"); } SatTrans[3] += TempS.Substring(0, TempI); SatTrans[4] += TempS.Substring(TempI + 1); // Mode SatTrans[5] += ""; for (int ii = 1; ii < InfoText.Count; ii++) { if (ii > 1) { SatTrans[5] += Separator; } SatTrans[5] += Prepare(InfoText[ii]); } // SR-FEC TdI++; PrepareInfo(TableObj[i][TdI]); SatTrans[6] = ""; for (int ii = 0; ii < InfoText.Count; ii++) { if (ii > 0) { SatTrans[6] += Separator; } SatTrans[6] += Prepare(InfoText[ii]); } // Provider Name TdI++; PrepareInfo(TableObj[i][TdI]); if (InfoText.Count > 0) { SatTrans[7] = Prepare(InfoText[0]); } else { SatTrans[7] = ""; } // Encryption TdI++; TdI++; TdI++; TdI++; PrepareInfo(TableObj[i][TdI]); TempI = 0; SatTrans[8] = ""; for (int ii = 0; ii < InfoText.Count; ii++) { if (InfoColor[ii] == "") { if (TempI > 0) { SatTrans[8] += Separator; } SatTrans[8] += Prepare(InfoText[ii]); TempI++; } } // ONID-TID TempI = 0; SatTrans[9] += ""; for (int ii = 0; ii < InfoText.Count; ii++) { if (InfoColor[ii] != "") { if (TempI > 0) { SatTrans[9] += Separator; } SatTrans[9] += Prepare(InfoText[ii]); TempI++; } } // FootPrints TdI++; PrepareInfo(TableObj[i][TdI]); if (InfoText[0] == "") { InfoText.RemoveAt(0); InfoColor.RemoveAt(0); } if (InfoText.Count < 1) { throw new Exception("XXX"); } SatTrans[10] = ""; for (int ii = 0; ii < (InfoText.Count - 1); ii++) { if (ii > 0) { SatTrans[10] += Separator; } SatTrans[10] += InfoText[ii]; } if (!InfoText[InfoText.Count - 1].Contains("dBW")) { if (InfoText.Count > 1) { SatTrans[10] += Separator; } SatTrans[10] += InfoText[InfoText.Count - 1]; } SatTrans[10] = SatTrans[10].Replace(Separator, " "); BeamListAdd(SatTrans[10]); // EIRP(dBW) if (InfoText[InfoText.Count - 1].Contains("dBW")) { SatTrans[11] = InfoText[InfoText.Count - 1]; } else { SatTrans[11] = ""; } // Comments TdI++; PrepareInfo(TableObj[i][TdI]); TempI = 0; SatTrans[12] = ""; for (int ii = 0; ii < InfoText.Count; ii++) { if (InfoText[ii] != "") { if (TempI > 0) { SatTrans[12] += Separator; } SatTrans[12] += Prepare(InfoText[ii]); TempI++; } } // Row SatTrans[13] = RowN.ToString(); for (int ii = 0; ii < 14; ii++) { if (ii > 0) { FS1W.Write("\t"); } FS1W.Write(SatTrans[ii]); } FS1W.WriteLine(); if (TableObj[i][0].Attributes.Contains("rowspan")) { RowSpanCounter = ToInt(TableObj[i][0].Attributes["rowspan"].Value); } else { RowSpanCounter = 1; } if (SpanChange[SatN].ContainsKey(RowN)) { RowSpanCounter += SpanChange[SatN][RowN]; } } catch (Exception e) { string ErrMsg = ""; ErrMsg = ErrMsg + "Previous row: " + RowN0.ToString() + "\r\n"; ErrMsg = ErrMsg + "Current row: " + RowN.ToString() + "\r\n"; if (SatTrans != null) { ErrMsg = ErrMsg + "Transponder:"; for (int ii = 0; ii < 12; ii++) { ErrMsg = ErrMsg + "[" + SatTrans[ii] + "]"; } ErrMsg = ErrMsg + "\r\n"; } if (SatChan != null) { ErrMsg = ErrMsg + "Channel:"; for (int ii = 0; ii < 8; ii++) { ErrMsg = ErrMsg + "[" + SatChan[ii] + "]"; } ErrMsg = ErrMsg + "\r\n"; } ErrMsg = ErrMsg + "Parse error: " + e.Message + "\r\n" + e.StackTrace; FS1W.Close(); FS2W.Close(); throw new Exception(ErrMsg); } } else { if (TableObj[i].Count > 4) { SatChan = new string[20]; // Channel Name int TdI = 0; SatChan[4] = Prepare(TableObj[i][TdI].InnerText); // FTA TdI++; SatChan[5] = (TableObj[i][TdI].InnerText.Contains("F")) ? "Yes" : "No"; // V.PID TdI++; SatChan[6] = Prepare(TableObj[i][TdI].InnerText); // A.PID TdI++; PrepareInfo(TableObj[i][TdI]); for (int ii = InfoText.Count - 1; ii >= 0; ii--) { if (InfoText[ii].Contains("AC3")) { InfoText.RemoveAt(ii); InfoColor.RemoveAt(ii); } } SatChan[7] = LangList(); // SID TdI++; PrepareInfo(TableObj[i][TdI]); SatChan[8] = ""; if (InfoText.Count > 0) { if (!InfoText[0].Contains("MPEG")) { SatChan[8] = Prepare(InfoText[0]); } } // Type SatChan[3] = "UNK"; if (TypeByPID) { SatChan[3] = "UNK"; if ((SatChan[6] == "") && (SatChan[7] == "")) { SatChan[3] = "DATA"; } if ((SatChan[6] != "") && (SatChan[7] != "")) { SatChan[3] = "TV"; } if ((SatChan[6] == "") && (SatChan[7] != "")) { SatChan[3] = "R"; } if ((SatChan[6] != "") && (SatChan[7] == "")) { SatChan[3] = "IMG"; } } // Row SatChan[9] = RowN.ToString(); // Freq FS2W.Write(SatTrans[3]); // Pol FS2W.Write("\t"); FS2W.Write(SatTrans[4]); // SR FS2W.Write("\t"); FS2W.Write(SatTrans[6]); // Beam FS2W.Write("\t"); FS2W.Write(SatTrans[10]); for (int ii = 3; ii < 10; ii++) { if (ii > 0) { FS2W.Write("\t"); } FS2W.Write(SatChan[ii]); } FS2W.WriteLine(); } } RowSpanCounter--; } PrepareInfoFlySat = false; }
private void ChannelTable(int SatN, HtmlAgilityPack.HtmlNode N, ref StreamWriter FS1W, ref StreamWriter FS2W, bool TypeByPID) { List <int> Rowlist = new List <int>(); List <List <int> > RowlistTD = new List <List <int> >(); for (int i = 0; i < N.ChildNodes.Count; i++) { if (N.ChildNodes[i].Name == "tr") { Rowlist.Add(i); List <int> RowlistTD_ = new List <int>(); for (int i_ = 0; i_ < N.ChildNodes[i].ChildNodes.Count; i_++) { if (N.ChildNodes[i].ChildNodes[i_].Name == "td") { RowlistTD_.Add(i_); } } RowlistTD.Add(RowlistTD_); } } if (Rowlist.Count >= 4) { Rowlist.RemoveAt(Rowlist.Count - 1); RowlistTD.RemoveAt(RowlistTD.Count - 1); Rowlist.RemoveAt(0); Rowlist.RemoveAt(0); RowlistTD.RemoveAt(0); RowlistTD.RemoveAt(0); //FS1W.WriteLine("TABLE BEGIN"); string[] SatTrans = null; string[] SatChan = null; int TransSpan = 0; bool FirstItem = false; for (int i = 0; i < Rowlist.Count; i++) { HtmlAgilityPack.HtmlNode NN = N.ChildNodes[Rowlist[i]]; if (RowlistTD[i].Count >= 4) { string ChannelType = ""; SatChan = null; int PrepareChannel = 0; if (TransSpan == 0) { RowN0 = RowN; RowN = i + RowX; FirstItem = true; SatTrans = new string[20]; TransSpan = 0; if (NN.ChildNodes[RowlistTD[i][1]].Attributes.Contains("rowspan")) { TransSpan = ToInt(NN.ChildNodes[RowlistTD[i][0]].Attributes["rowspan"].Value); TransSpan--; } if (SpanChange[SatN].ContainsKey(RowN)) { TransSpan += SpanChange[SatN][RowN]; } int SatTransI = 0; int TDi = 0; HtmlAgilityPack.HtmlNode NNN = NN.ChildNodes[RowlistTD[i][TDi]]; for (int i_ = 0; i_ < NNN.ChildNodes.Count; i_++) { if (NNN.ChildNodes[i_].Name == "font") { int Trans0 = 0; for (int ii_ = 0; ii_ < NNN.ChildNodes[i_].ChildNodes.Count; ii_++) { if (NNN.ChildNodes[i_].ChildNodes[ii_].Name == "font") { for (int iii_ = 0; iii_ < NNN.ChildNodes[i_].ChildNodes[ii_].ChildNodes.Count; iii_++) { if (NNN.ChildNodes[i_].ChildNodes[ii_].ChildNodes[iii_].Name == "br") { SatTransI++; Trans0++; } else { if (Trans0 == 0) { string Temp = NNN.ChildNodes[i_].ChildNodes[ii_].ChildNodes[iii_].InnerText; int TempI = Temp.IndexOf(" "); SatTrans[SatTransI] = Temp.Substring(0, TempI); SatTransI++; SatTrans[SatTransI] = Temp.Substring(TempI + 6); } else { SatTrans[SatTransI] = Prepare(NNN.ChildNodes[i_].ChildNodes[ii_].ChildNodes[iii_].InnerText).Replace("tp ", ""); } } } } } while (Trans0 < 3) { SatTransI++; Trans0++; } } } BeamListAdd(SatTrans[3]); SatTransI++; TDi++; // System, Modulation, SR-FEC PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); if (InfoText.Count == 3) { SatTrans[SatTransI + 0] = InfoText[0]; SatTrans[SatTransI + 2] = InfoText[1] + "-" + InfoText[2]; } if (InfoText.Count == 4) { SatTrans[SatTransI + 0] = InfoText[0]; SatTrans[SatTransI + 1] = InfoText[1]; SatTrans[SatTransI + 2] = InfoText[2] + "-" + InfoText[3]; } SatTransI++; SatTransI++; SatTransI++; TDi++; TDi++; TDi++; // Provider name SatTrans[SatTransI] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); ChannelType = ""; string ChannelString = NN.ChildNodes[RowlistTD[i][TDi]].InnerHtml.ToLowerInvariant(); int ChannelStringT = ChannelString.IndexOf("<a"); if (ChannelStringT >= 0) { ChannelString = ChannelString.Substring(ChannelStringT); int ChannelStringTX = ChannelString.IndexOf(">"); if (ChannelStringTX > 0) { ChannelString = ChannelString.Substring(0, ChannelStringTX + 1); if (ChannelString.Contains("tvchannels")) { ChannelType = "TV"; } if (ChannelString.Contains("radiochannels")) { ChannelType = "R"; } //SatTrans[SatTransI] = "{" + ChannelString + "}"; } } SatTransI++; TDi++; TDi++; // ONID-TID SatTrans[SatTransI] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); SatTransI++; TDi++; TDi++; if (RowlistTD[i].Count <= 10) { TDi--; } // C/N lock SatTrans[SatTransI] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); SatTransI++; TDi++; // Encryption PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); SatTrans[SatTransI] = ""; for (int i_ = 0; i_ < InfoText.Count; i_++) { if (InfoText[i_] != "") { if (SatTrans[SatTransI] != "") { SatTrans[SatTransI] = SatTrans[SatTransI] + "|"; } SatTrans[SatTransI] = SatTrans[SatTransI] + InfoText[i_]; } } SatTransI++; TDi++; // Source // Updated try { PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); SatTrans[SatTransI] = ""; for (int i_ = 0; i_ < (InfoText.Count - 1); i_++) { if (InfoText[i_] != "") { if (SatTrans[SatTransI] != "") { SatTrans[SatTransI] = SatTrans[SatTransI] + "|"; } SatTrans[SatTransI] = SatTrans[SatTransI] + InfoText[i_]; } } if (InfoText.Count > 0) { SatTrans[SatTransI + 1] = InfoText[InfoText.Count - 1]; } } catch { } SatTransI++; SatTransI++; TDi++; // Row SatTrans[SatTransI] = RowN.ToString(); for (int ii = 0; ii < 15; ii++) { if (ii > 0) { FS1W.Write("\t"); } FS1W.Write(SatTrans[ii]); } FS1W.WriteLine(); if ((ChannelType != "") && ChannelFromFirstRow) { PrepareChannel = 2; } } else { if (ChannelFromOtherRows) { PrepareChannel = 1; TransSpan--; } } if (PrepareChannel > 0) { SatChan = new string[20]; int TDi = 0; if (PrepareChannel == 2) { TDi = 2; } else { if (FirstItem) { TDi = 0; FirstItem = false; } } //SID SatChan[1] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText).Replace("*", ""); TDi++; //Name, Type SatChan[2] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); ChannelType = "UNK"; string ChannelString = NN.ChildNodes[RowlistTD[i][TDi]].InnerHtml.ToLowerInvariant(); int ChannelStringT = ChannelString.IndexOf("<a"); if (ChannelStringT >= 0) { ChannelString = ChannelString.Substring(ChannelStringT); int ChannelStringTX = ChannelString.IndexOf(">"); if (ChannelStringTX > 0) { ChannelString = ChannelString.Substring(0, ChannelStringTX + 1); if (ChannelString.Contains("tvchannels")) { ChannelType = "TV"; } if (ChannelString.Contains("radiochannels")) { ChannelType = "R"; } //SatTrans[SatTransI] = "{" + ChannelString + "}"; } } // FTA SatChan[3] = "No"; if (NN.ChildNodes[RowlistTD[i][TDi]].Attributes["style"] != null) { string ColorVal = NN.ChildNodes[RowlistTD[i][TDi]].Attributes["style"].Value; ColorVal = ColorVal.Substring(ColorVal.IndexOf("#")).ToUpperInvariant(); if (ColorVal == "#BBFFBB") { SatChan[3] = "Yes"; } if (ColorVal == "#FFFFBB") { SatChan[3] = "Yes"; } } TDi++; TDi++; // VPID { SatChan[4] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); int ColSpan = 1; if (NN.ChildNodes[RowlistTD[i][TDi]].Attributes.Contains("colspan")) { ColSpan = ToInt(NN.ChildNodes[RowlistTD[i][TDi]].Attributes["colspan"].Value); SatChan[5] = ColSpan.ToString(); } if (ColSpan == 1) { TDi++; SatChan[5] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); } else { if (ColSpan == 2) { SatChan[5] = ""; } } } TDi++; // APID Lang. PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); if (PrepareChannel == 2) { if (InfoColor[0] == "darkgreen") { InfoColor.RemoveAt(0); InfoText.RemoveAt(0); } if (InfoColor[0] == "blue") { InfoColor.RemoveAt(0); InfoText.RemoveAt(0); } } SatChan[6] = LangList(); // Type if (TypeByPID) { ChannelType = "UNK"; if ((SatChan[5] == "") && (SatChan[6] == "")) { ChannelType = "DATA"; } if ((SatChan[5] != "") && (SatChan[6] != "")) { ChannelType = "TV"; } if ((SatChan[5] == "") && (SatChan[6] != "")) { ChannelType = "R"; } if ((SatChan[5] != "") && (SatChan[6] == "")) { ChannelType = "IMG"; } } SatChan[0] = ChannelType; PrepareChannel = 0; // Row SatChan[7] = RowN.ToString(); } if (SatChan != null) { FS2W.Write(SatTrans[0]); FS2W.Write("\t"); FS2W.Write(SatTrans[1]); FS2W.Write("\t"); FS2W.Write(SatTrans[7]); FS2W.Write("\t"); FS2W.Write(SatTrans[3]); for (int ii = 0; ii < 8; ii++) { FS2W.Write("\t"); FS2W.Write(SatChan[ii]); } FS2W.WriteLine(); } } } //FS1W.WriteLine("TABLE END"); } }
private void ChannelTable(int SatN, HtmlAgilityPack.HtmlNode N, ref StreamWriter FS1W, ref StreamWriter FS2W, bool TypeByPID) { List <int> Rowlist = new List <int>(); List <List <int> > RowlistTD = new List <List <int> >(); for (int i = 0; i < N.ChildNodes.Count; i++) { if (N.ChildNodes[i].Name == "tr") { Rowlist.Add(i); List <int> RowlistTD_ = new List <int>(); for (int i_ = 0; i_ < N.ChildNodes[i].ChildNodes.Count; i_++) { if (N.ChildNodes[i].ChildNodes[i_].Name == "td") { RowlistTD_.Add(i_); } } RowlistTD.Add(RowlistTD_); } } if (Rowlist.Count >= 4) { Rowlist.RemoveAt(Rowlist.Count - 1); RowlistTD.RemoveAt(RowlistTD.Count - 1); Rowlist.RemoveAt(0); Rowlist.RemoveAt(0); RowlistTD.RemoveAt(0); RowlistTD.RemoveAt(0); //FS1W.WriteLine("TABLE BEGIN"); string[] SatTrans = null; string[] SatChan = null; int TransSpan = 0; bool FirstItem = false; for (int i = 0; i < Rowlist.Count; i++) { HtmlAgilityPack.HtmlNode NN = N.ChildNodes[Rowlist[i]]; if (RowlistTD[i].Count >= 4) { string ChannelType = ""; SatChan = null; int PrepareChannel = 0; if (TransSpan == 0) { RowN0 = RowN; RowN = i + RowX; FirstItem = true; SatTrans = new string[20]; TransSpan = 0; if (NN.ChildNodes[RowlistTD[i][1]].Attributes.Contains("rowspan")) { TransSpan = ToInt(NN.ChildNodes[RowlistTD[i][1]].Attributes["rowspan"].Value); TransSpan--; } if (SpanChange[SatN].ContainsKey(RowN)) { TransSpan += SpanChange[SatN][RowN]; } int SatTransI = 0; int TDi = 1; HtmlAgilityPack.HtmlNode NNN = NN.ChildNodes[RowlistTD[i][TDi]]; for (int i_ = 0; i_ < NNN.ChildNodes.Count; i_++) { if (NNN.ChildNodes[i_].Name == "font") { int Trans0 = 0; for (int ii_ = 0; ii_ < NNN.ChildNodes[i_].ChildNodes.Count; ii_++) { if (NNN.ChildNodes[i_].ChildNodes[ii_].Name == "font") { for (int iii_ = 0; iii_ < NNN.ChildNodes[i_].ChildNodes[ii_].ChildNodes.Count; iii_++) { if (NNN.ChildNodes[i_].ChildNodes[ii_].ChildNodes[iii_].Name == "br") { SatTransI++; Trans0++; } else { if (Trans0 == 0) { string Temp = NNN.ChildNodes[i_].ChildNodes[ii_].ChildNodes[iii_].InnerText; int TempI = Temp.IndexOf(" "); SatTrans[SatTransI] = Temp.Substring(0, TempI); SatTransI++; SatTrans[SatTransI] = Temp.Substring(TempI + 6); } else { SatTrans[SatTransI] = Prepare(NNN.ChildNodes[i_].ChildNodes[ii_].ChildNodes[iii_].InnerText).Replace("tp ", ""); } } } } } while (Trans0 < 3) { SatTransI++; Trans0++; } } } BeamListAdd(SatTrans[3]); SatTransI++; TDi++; TDi++; // Provider name SatTrans[SatTransI] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); ChannelType = ""; string ChannelString = NN.ChildNodes[RowlistTD[i][TDi]].InnerHtml.ToLowerInvariant(); int ChannelStringT = ChannelString.IndexOf("<a"); if (ChannelStringT >= 0) { ChannelString = ChannelString.Substring(ChannelStringT); int ChannelStringTX = ChannelString.IndexOf(">"); if (ChannelStringTX > 0) { ChannelString = ChannelString.Substring(0, ChannelStringTX + 1); if (ChannelString.Contains("tvchannels")) { ChannelType = "TV"; } if (ChannelString.Contains("radiochannels")) { ChannelType = "R"; } //SatTrans[SatTransI] = "{" + ChannelString + "}"; } } SatTransI++; TDi++; TDi++; // System int TDii = 0; NNN = NN.ChildNodes[RowlistTD[i][TDi]]; int SystemColSpan = 1; if (NNN.Attributes.Contains("colspan")) { SystemColSpan = ToInt(NNN.Attributes["colspan"].Value); } for (int i_ = 0; i_ < NNN.ChildNodes.Count; i_++) { if (NNN.ChildNodes[i_].Name == "font") { for (int ii_ = 0; ii_ < NNN.ChildNodes[i_].ChildNodes.Count; ii_++) { if (TDii <= 0) { if (NNN.ChildNodes[i_].ChildNodes[ii_].Name == "br") { TDii++; } else { SatTrans[SatTransI] = Prepare(NNN.ChildNodes[i_].ChildNodes[ii_].InnerText); } } } } } SatTransI++; TDi++; // SR-FEC, Modulation PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); if (InfoText.Count > 0) { SatTrans[SatTransI] = InfoText[0]; } SatTransI++; if (InfoText.Count > 1) { if (InfoColor[1] != "darkgreen") { SatTrans[SatTransI] = InfoText[1]; } } SatTransI++; TDi++; // ONID-TID PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); if (InfoText.Count > 0) { if (InfoColor[0] == "darkgreen") { SatTrans[SatTransI] = InfoText[0]; } } SatTransI++; TDi++; // Source // Updated while (RowlistTD[i].Count <= TDi) { TDi--; } PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); if (InfoText.Count > 0) { SatTrans[SatTransI] = ""; for (int ii = 0; ii < (InfoText.Count - 1); ii++) { if (ii > 0) { SatTrans[SatTransI] += Separator; } SatTrans[SatTransI] += InfoText[ii]; } } SatTransI++; if (InfoText.Count > 0) { SatTrans[SatTransI] = InfoText[InfoText.Count - 1]; } // Row SatTransI++; SatTrans[SatTransI] = RowN.ToString(); for (int ii = 0; ii < 13; ii++) { if (ii > 0) { FS1W.Write("\t"); } FS1W.Write(SatTrans[ii]); } FS1W.WriteLine(); if ((ChannelType != "") && ChannelFromFirstRow) { PrepareChannel = 2; } } else { if (ChannelFromOtherRows) { PrepareChannel = 1; TransSpan--; } } if (PrepareChannel > 0) { SatChan = new string[20]; int TDi = 0; if (PrepareChannel == 2) { TDi = 3; } else { if (FirstItem) { TDi = 1; FirstItem = false; } } SatChan[1] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); ChannelType = "UNK"; string ChannelString = NN.ChildNodes[RowlistTD[i][TDi]].InnerHtml.ToLowerInvariant(); int ChannelStringT = ChannelString.IndexOf("<a"); if (ChannelStringT >= 0) { ChannelString = ChannelString.Substring(ChannelStringT); int ChannelStringTX = ChannelString.IndexOf(">"); if (ChannelStringTX > 0) { ChannelString = ChannelString.Substring(0, ChannelStringTX + 1); if (ChannelString.Contains("tvchannels")) { ChannelType = "TV"; } if (ChannelString.Contains("radiochannels")) { ChannelType = "R"; } //SatTrans[SatTransI] = "{" + ChannelString + "}"; } } TDi++; SatChan[2] = "No"; if (NN.ChildNodes[RowlistTD[i][TDi]].InnerHtml.Contains("freetv")) { if (ChannelType == "UNK") { ChannelType = "TV"; } SatChan[2] = "Yes"; } if (NN.ChildNodes[RowlistTD[i][TDi]].InnerHtml.Contains("freeradio")) { if (ChannelType == "UNK") { ChannelType = "R"; } SatChan[2] = "Yes"; } TDi++; // Encryption PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); SatChan[3] = ""; for (int ii = (PrepareChannel == 2 ? 1 : 0); ii < InfoText.Count; ii++) { if (ii > (PrepareChannel == 2 ? 1 : 0)) { SatChan[3] += "|"; } SatChan[3] += InfoText[ii]; } TDi++; // SID, VPID if (PrepareChannel == 2) { PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); int GreenItem = -1; for (int ii = 0; ii < InfoColor.Count; ii++) { if (InfoColor[ii] == "darkgreen") { GreenItem = ii; } } if (GreenItem < 0) { if (InfoText.Count == 2) { GreenItem = 1; } } if (GreenItem < 0) { throw new Exception("XXX"); } SatChan[4] = InfoText[GreenItem]; SatChan[5] = ""; if (true) { if (InfoText.Count > (GreenItem + 1)) { SatChan[5] = InfoText[GreenItem + 1]; if (SatChan[5].StartsWith("-")) { SatChan[5] = SatChan[5].Substring(1).Trim(); } } } InfoColor.ToString(); InfoText.ToString(); } else { SatChan[4] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); int ColSpan = 1; if (NN.ChildNodes[RowlistTD[i][TDi]].Attributes.Contains("colspan")) { ColSpan = ToInt(NN.ChildNodes[RowlistTD[i][TDi]].Attributes["colspan"].Value); SatChan[5] = ColSpan.ToString(); } if (ColSpan == 1) { TDi++; SatChan[5] = Prepare(NN.ChildNodes[RowlistTD[i][TDi]].InnerText); } else { if (ColSpan == 2) { SatChan[5] = ""; } } } TDi++; // APID Lang. PrepareInfo(NN.ChildNodes[RowlistTD[i][TDi]]); if (PrepareChannel == 2) { if (InfoColor[0] == "darkgreen") { InfoColor.RemoveAt(0); InfoText.RemoveAt(0); } if (InfoColor[0] == "blue") { InfoColor.RemoveAt(0); InfoText.RemoveAt(0); } } SatChan[6] = LangList(); // Type if (TypeByPID) { ChannelType = "UNK"; if ((SatChan[5] == "") && (SatChan[6] == "")) { ChannelType = "DATA"; } if ((SatChan[5] != "") && (SatChan[6] != "")) { ChannelType = "TV"; } if ((SatChan[5] == "") && (SatChan[6] != "")) { ChannelType = "R"; } if ((SatChan[5] != "") && (SatChan[6] == "")) { ChannelType = "IMG"; } } SatChan[0] = ChannelType; PrepareChannel = 0; // Row SatChan[7] = RowN.ToString(); } if (SatChan != null) { FS2W.Write(SatTrans[0]); FS2W.Write("\t"); FS2W.Write(SatTrans[1]); FS2W.Write("\t"); FS2W.Write(SatTrans[7]); FS2W.Write("\t"); FS2W.Write(SatTrans[3]); for (int ii = 0; ii < 8; ii++) { FS2W.Write("\t"); FS2W.Write(SatChan[ii]); } FS2W.WriteLine(); } } } //FS1W.WriteLine("TABLE END"); } }