23 using System.Globalization;
28 namespace Ntp.Analyzer.Data.Import
37 private const string ServerTagStart =
@"<div class=""twikiAfterText""></div><div class=""twikiForm"">";
38 private const string ServerTagEnd =
@"</div><!-- /twikiForm --></div><!-- /patternContent-->";
40 protected override string Provider =>
"support.ntp.org";
44 string table = ImportServer(orgId);
49 var server = importer.ParseTable(table, orgId);
55 string orgString = orgId.ToString(CultureInfo.InvariantCulture).PadLeft(6,
'0');
56 string url = $
"http://support.ntp.org/bin/view/Servers/PublicTimeServer{orgString}";
57 string html = FetchHtml(url, orgId);
62 html = html.Replace(
"<nos>",
string.Empty);
66 int serverTagPos = html.IndexOf(ServerTagStart, StringComparison.Ordinal);
67 int tableStartPos = html.IndexOf(
"<table", serverTagPos, StringComparison.Ordinal);
68 int tableEndPos = html.IndexOf(ServerTagEnd, serverTagPos, StringComparison.Ordinal);
69 string table = html.Substring(tableStartPos, tableEndPos - tableStartPos);
74 Log.TimeServerParseError(
"HTML", e);
override TimeServer Import(int orgId)
TimeServerLoader(LogBase log)
string ImportServer(int orgId)