.NET 4.x Парсинг html страницы с выводом в Lable - C#
Формулировка задачи:
Приветствую программисты
Вообщем понадобилось сделать парсинг данной страницы
Исходный код страницы
Что выделено цветом желательно вывести в label
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<meta name="generator" content="vBulletin 3.8.7" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<!-- CSS Stylesheet -->
<link type="text/css" href="http://zhyk.ru/forum/web-optimizer/cache/e301272f9f.css" rel="stylesheet"/>
<!-- / CSS Stylesheet -->
<script type="text/javascript">
<!--
var SESSIONURL = "";
var SECURITYTOKEN = "1360874104-72a89b809ac26cfe3c7e7b2f9a66189f639ce809";
var IMGDIR_MISC = "/zhyk/misc";
var vb_disable_ajax = parseInt("0", 10);
// -->
</script>
<link rel="alternate" type="application/rss+xml" title="Zhyk.Ru Forums RSS Feed" href="external.php?type=RSS2" />
<title>Авторы сообщений - Zhyk.Ru Forums</title>
<script type="text/javascript" src="http://zhyk.ru/forum/web-optimizer/cache/7600268c9a.js"></script></head>
<body onload="self.focus()" style="margin:0px">
<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%">
<tr>
<td class="tcat" colspan="2">
Авторы сообщений
<div class="smallfont">Всего сообщений: 104</div>
</td>
</tr>
<tr>
<td class="thead" width="100%">Имя</td>
<td class="thead">Сообщений</td>
</tr>
<tr>
<td class="alt1">
<a href="member.php?u=1070606" target="_blank">sedrik1992</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=1070606&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=1070606&searchthreadid=289420'); self.close();">8</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=562953" target="_blank">'TOR'</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=562953&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=562953&searchthreadid=289420'); self.close();">6</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=151618" target="_blank">BeyondNoise</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=151618&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=151618&searchthreadid=289420'); self.close();">5</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=13909" target="_blank">semoder</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=13909&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=13909&searchthreadid=289420'); self.close();">4</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=7379" target="_blank">Nitrogen</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=7379&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=7379&searchthreadid=289420'); self.close();">4</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=610578" target="_blank">Beigbeder</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=610578&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=610578&searchthreadid=289420'); self.close();">3</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=278599" target="_blank">{Ass}</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=278599&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=278599&searchthreadid=289420'); self.close();">3</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=264342" target="_blank">jdark</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=264342&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=264342&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=648096" target="_blank">Hunnrc</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=648096&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=648096&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=760830" target="_blank">MANCPG</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=760830&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=760830&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=262422" target="_blank">Rusfoxmen</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=262422&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=262422&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=563009" target="_blank">ktulx</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=563009&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=563009&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=647288" target="_blank">nonchik</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=647288&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=647288&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=415685" target="_blank">Ssslimmm</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=415685&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=415685&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=605326" target="_blank">xbaskx</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=605326&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=605326&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=401973" target="_blank">nik995995</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=401973&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=401973&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=593718" target="_blank">kokosin</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=593718&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=593718&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=656984" target="_blank">Kiss4Dead</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=656984&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=656984&searchthreadid=289420'); self.close();">2</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=389001" target="_blank">HellD</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=389001&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=389001&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=440747" target="_blank">Triton7</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=440747&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=440747&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=585859" target="_blank">ka0</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=585859&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=585859&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=1028720" target="_blank">Jctym1992</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=1028720&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=1028720&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=118504" target="_blank">Savval</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=118504&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=118504&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=373580" target="_blank">union+select</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=373580&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=373580&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=436352" target="_blank">brat75</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=436352&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=436352&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=732978" target="_blank">YaoiIsLove</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=732978&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=732978&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=883610" target="_blank">Ginrey</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=883610&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=883610&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=84705" target="_blank">FoXaV11</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=84705&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=84705&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=257904" target="_blank">bilimon111</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=257904&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=257904&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=317888" target="_blank">arleta</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=317888&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=317888&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=430022" target="_blank">dbnfcjr</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=430022&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=430022&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=636096" target="_blank">АРЧИ</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=636096&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=636096&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=678709" target="_blank">koliabest</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=678709&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=678709&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=862621" target="_blank">Anen</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=862621&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=862621&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=70543" target="_blank">ange</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=70543&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=70543&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=256592" target="_blank">KrevedkoO</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=256592&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=256592&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=300834" target="_blank">TyB</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=300834&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=300834&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=424573" target="_blank">ROMAMAN01</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=424573&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=424573&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=518982" target="_blank">Pa'</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=518982&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=518982&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=633975" target="_blank">ferrarri</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=633975&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=633975&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=670004" target="_blank">nnmsada</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=670004&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=670004&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=858142" target="_blank">zorobog</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=858142&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=858142&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=63064" target="_blank">sumikot</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=63064&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=63064&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=245078" target="_blank">skew222</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=245078&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=245078&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=299071" target="_blank">NFS_MW</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=299071&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=299071&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=514134" target="_blank">udik666</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=514134&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=514134&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=669948" target="_blank">sprritek</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=669948&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=669948&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=817269" target="_blank">NoFaction</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=817269&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=817269&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=25595" target="_blank">krysun</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=25595&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=25595&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=176353" target="_blank">ouase</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=176353&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=176353&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=415138" target="_blank">Zaratustra</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=415138&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=415138&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=496455" target="_blank">buxbunny</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=496455&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=496455&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=669279" target="_blank">spritik</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=669279&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=669279&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=787065" target="_blank">onneon</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=787065&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=787065&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=1060116" target="_blank">khb</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=1060116&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=1060116&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=273979" target="_blank">NyaKawai</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=273979&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=273979&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=466774" target="_blank">SanRuy</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=466774&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=466774&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=658211" target="_blank">taluoltaluol</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=658211&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=658211&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=766769" target="_blank">Stefan_fun</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=766769&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=766769&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=1032147" target="_blank">lero4ka_pisya</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=1032147&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=1032147&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=175682" target="_blank">AzZoT</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=175682&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=175682&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=270769" target="_blank">vadimchiter</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=270769&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=270769&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=390117" target="_blank">Plata123</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=390117&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=390117&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=465633" target="_blank">Ivka33</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=465633&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=465633&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=589132" target="_blank">xolodinka</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=589132&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=589132&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt2">
<a href="member.php?u=762025" target="_blank">d1amon</a>
</td>
<td class="alt2"><a href="search.php?do=finduser&userid=762025&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=762025&searchthreadid=289420'); self.close();">1</a></td>
</tr><tr>
<td class="alt1">
<a href="member.php?u=1030827" target="_blank">Adiyko00</a>
</td>
<td class="alt1"><a href="search.php?do=finduser&userid=1030827&searchthreadid=289420" onclick="opener.location=('search.php?do=finduser&userid=1030827&searchthreadid=289420'); self.close();">1</a></td>
</tr>
<tr>
<td class="tfoot" colspan="2" align="center"><div class="smallfont">
<a href="showthread.php?t=289420" onclick="opener.location=('showthread.php?t=289420'); self.close();"><strong>Перейти к теме и закрыть окно</strong></a>
</div></td>
</tr>
</table>
</body>
</html><!--WSS-->
Решение задачи: «.NET 4.x Парсинг html страницы с выводом в Lable»
textual
Листинг программы
using System; namespace Pars.MyToolsLibrary { /// <summary> /// Класс для извлечения нужной информации из разнородного текста /// </summary> public class TextScanner { //--- members --------------------------------------------------------- string mText; int mPosition; int mStartRead; //--- public ---------------------------------------------------------- /// <summary> /// Конструктор /// </summary> /// <param name="text">Текст для обработки</param> public TextScanner(string text) { mText = text; mPosition = 0; mStartRead = -1; } public void refresh() { mPosition = 0; } /// <summary> /// Перемещение указателя в конец текста /// </summary> public void GoToEnd() { mPosition = mText.Length; } /// <summary> /// Перемещение указателя на начало искомого текста /// </summary> /// <param name="text">Искомый текст</param> public void GoTo(string text) { if (!TryGoTo(text)) throw new Exception("Неверный формат текста"); } /// <summary> /// Попытка перемещения указателя на начало искомого текста /// </summary> /// <param name="text">Искомый текст</param> /// <returns>true в случае удачи</returns> public bool TryGoTo(string text) { int p = mText.IndexOf(text, mPosition); if (p == -1) return false; mPosition = p; return true; } /// <summary> /// Перемещение указателя за искомый текст /// </summary> /// <param name="text">Искомый текст</param> public void Skip(string text) { if (!TrySkip(text)) throw new Exception("Неверный формат текста"); } /// <summary> /// Попытка перемещения указателя за искомый текст /// </summary> /// <param name="text">Искомый текст</param> /// <returns>true в случае удачи</returns> public bool TrySkip(string text) { int p = mText.IndexOf(text, mPosition); if (p == -1) return false; mPosition = p + text.Length; return true; } /// <summary> /// Начать чтение с текущего места /// </summary> public void BeginRead() { if (mPosition == mText.Length) throw new Exception("Указатель в конце текста"); mStartRead = mPosition; } /// <summary> /// Завершить чтение /// </summary> /// <returns>Прочитанный текст</returns> public string EndRead() { if (mStartRead == -1) throw new Exception("Необходимо предварительно начать чтение"); string r = mText.Substring(mStartRead, mPosition - mStartRead); mStartRead = -1; return r; } /// <summary> /// Прочитать текст с текущей позиции до указанного текста /// </summary> /// <param name="text">Стоп-текст</param> /// <returns>Прочитанный текст</returns> public string ReadTo(string text) { BeginRead(); GoTo(text); return EndRead(); } } }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д