Hi, I'm working on a "personal-can-it-work" sort of thing, and i have everything working great except for trying to parse some information from a .asp sourcefile into my Program.
This is the parsing code i have so far
// parse out the results
try
{
int snr_start = result.IndexOf("SNR");
int snr_end = result.IndexOf("</TR>", snr_start);
snr = result.Substring(snr_start, snr_end - snr_start);
snr = snr.Substring(snr.IndexOf("<TD>") + 1);
snr = snr.Substring(0, snr.Length - 6);
iSNR = Convert.ToInt32(snr.Substring(0, snr.IndexOf(" ")));
int dnpwr_start = result.IndexOf("Downstream Power", snr_end);
int dnpwr_stop = result.IndexOf("</TR>", dnpwr_start);
dnpwr = result.Substring(dnpwr_start, dnpwr_stop - dnpwr_start);
dnpwr = dnpwr.Substring(dnpwr.IndexOf("<TD>") + 1);
dnpwr = dnpwr.Substring(0, dnpwr.IndexOf("<TABLE") - 1);
iDPWR = Convert.ToInt32(dnpwr.Substring(0, dnpwr.IndexOf(" ")));
int uppwr_start = result.IndexOf("Upstream Power", dnpwr_stop);
int uppwr_stop = result.IndexOf("</TR>", uppwr_start);
uppwr = result.Substring(uppwr_start, uppwr_stop - uppwr_start);
uppwr = uppwr.Substring(uppwr.IndexOf("<TD>") + 1);
uppwr = uppwr.Substring(0, uppwr.IndexOf("</TD>") - 1);
iUPWR = Convert.ToInt32(uppwr.Substring(0, uppwr.IndexOf(" ")));
}
catch
And this is the Sourcefile and the Information i'm trying to scrape from it (SNR, Downstream Power, Upstream Power)
<td class="headerR">Downstream Power</td>
<td class="contentL">1.0 dBmV</td>
</tr>
<tr>
<td class="headerR">SNR</td>
<td class="contentL">39.656 dB</td>
</tr>
<tr>
<td class="headerR">Upstream Power</td>
<td class="contentL">42.0 dBmV</td>
</tr>
Not too sure where i'm going wrong to, but any helpwould be greatly appreaciated. The focus of the project is so i can parse the signal levels off of my modem (I'm a MSO employee) for extended monitoring. If needed i can post the full source from the .asp page
Thanks, Matt