Fixing broken KingOfSat parser.
authorStephaneLenclud
Thu, 04 Oct 2018 19:25:35 +0200
changeset 8adff2dec03a0
parent 7 bf908f6c7758
child 9 b77b09f680e7
Fixing broken KingOfSat parser.
KingOfSat.cs
SatChanGen.csproj
SatIndex.cs
     1.1 --- a/KingOfSat.cs	Sun May 17 20:35:37 2015 +0200
     1.2 +++ b/KingOfSat.cs	Thu Oct 04 19:25:35 2018 +0200
     1.3 @@ -41,7 +41,7 @@
     1.4                  Channel common = new Channel();
     1.5  
     1.6                  //Parse channel details
     1.7 -                common.OrbitalPosition = WebUtility.HtmlDecode(frq.Cq().Find("tbody > tr > td > a > font").Get(0).InnerText).Trim();
     1.8 +                common.OrbitalPosition = WebUtility.HtmlDecode(frq.Cq().Find("tbody > tr > td")?.Get(0).InnerText).Trim();
     1.9                  if (common.OrbitalPosition != aOrbitalPosition)
    1.10                  {
    1.11                      //Wrong sat, skip
    1.12 @@ -71,10 +71,10 @@
    1.13                  }
    1.14                  //
    1.15                  common.NetworkID = WebUtility.HtmlDecode(frq.Cq().Find("tbody > tr > td:nth-child(11)").Get(0).InnerText);
    1.16 -                common.NetworkID = common.NetworkID.Substring("NID:".Length, common.NetworkID.Length - "NID:".Length);
    1.17 +                //common.NetworkID = common.NetworkID.Substring("NID:".Length, common.NetworkID.Length - "NID:".Length);
    1.18                  //
    1.19                  common.TransponderID = WebUtility.HtmlDecode(frq.Cq().Find("tbody > tr > td:nth-child(12)").Get(0).InnerText);
    1.20 -                common.TransponderID = common.TransponderID.Substring("TID:".Length, common.TransponderID.Length - "TID:".Length);
    1.21 +                //common.TransponderID = common.TransponderID.Substring("TID:".Length, common.TransponderID.Length - "TID:".Length);
    1.22  
    1.23                  //We got common properties for the coming channels
    1.24                  //Debug.Write(common.ToString());
    1.25 @@ -115,11 +115,11 @@
    1.26                          channelName = cqChannelName.Get(0).InnerText;
    1.27                      }
    1.28  
    1.29 -                    //We spend a lot of time trying to get this right until we found our answer in the following thread.
    1.30 -                    //http://stackoverflow.com/questions/14057434/how-can-i-transform-string-to-utf-8-in-c
    1.31                      //Decode HTML
    1.32                      channel.Name = WebUtility.HtmlDecode(channelName);
    1.33                      //Convert from default encoding to UTF8
    1.34 +                    //We spend a lot of time trying to get this right until we found our answer in the following thread.
    1.35 +                    //http://stackoverflow.com/questions/14057434/how-can-i-transform-string-to-utf-8-in-c
    1.36                      byte[] bytes = Encoding.Default.GetBytes(channel.Name);
    1.37                      channel.Name = Encoding.UTF8.GetString(bytes);
    1.38  
     2.1 --- a/SatChanGen.csproj	Sun May 17 20:35:37 2015 +0200
     2.2 +++ b/SatChanGen.csproj	Thu Oct 04 19:25:35 2018 +0200
     2.3 @@ -58,6 +58,7 @@
     2.4      </Compile>
     2.5      <Compile Include="Program.cs" />
     2.6      <Compile Include="Properties\AssemblyInfo.cs" />
     2.7 +    <Compile Include="SatIndex.cs" />
     2.8      <EmbeddedResource Include="MainForm.resx">
     2.9        <DependentUpon>MainForm.cs</DependentUpon>
    2.10      </EmbeddedResource>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/SatIndex.cs	Thu Oct 04 19:25:35 2018 +0200
     3.3 @@ -0,0 +1,12 @@
     3.4 +using System;
     3.5 +using System.Collections.Generic;
     3.6 +using System.Linq;
     3.7 +using System.Text;
     3.8 +using System.Threading.Tasks;
     3.9 +
    3.10 +namespace SatChanGen
    3.11 +{
    3.12 +    class SatIndex
    3.13 +    {
    3.14 +    }
    3.15 +}