NTP Analyzer  0.8.2
Analyze the operation of time servers
DefaultPeerPageRender.cs
Go to the documentation of this file.
1 //
2 // Copyright (c) 2013-2017 Carsten Sonne Larsen <cs@innolan.net>
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to deal
6 // in the Software without restriction, including without limitation the rights
7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 // copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 // THE SOFTWARE.
21 
22 using System;
23 using System.Text;
24 
25 namespace Ntp.Analyzer.Render.Peer
26 {
28  {
29  public DefaultPeerPageRender(Uri webPath, string name)
30  : base(webPath)
31  {
32  this.name = name;
33  }
34 
35  private readonly string name;
36 
37  public override string Render()
38  {
39  return "<body>";
40  }
41 
42  public override string RenderFooter()
43  {
44  var builder = new StringBuilder();
45 
46  builder.AppendLine("</body>");
47  builder.AppendLine("</html>");
48 
49  return builder.ToString();
50  }
51 
52  public override string RenderHead()
53  {
54  var builder = new StringBuilder();
55 
56  builder.AppendLine("<!DOCTYPE html>");
57  builder.AppendLine("<html><head>");
58  builder.AppendLine(@"<meta charset=""UTF-8"">");
59  builder.AppendLine(@"<style type=""text/css"">");
60  builder.AppendLine("body {font-family: Helvetica; font-size: 14px; line-height:100%; }");
61  builder.AppendLine("h2 { font-family: monospace; display: inline-block; }");
62  builder.AppendLine("h4 { font-family: monospace; display: inline-block; }");
63  builder.AppendLine("a:link { color:#33348e; text-decoration: none; }");
64  builder.AppendLine("a:visited { color:#33348e; text-decoration: none; }");
65  builder.AppendLine("a:hover { color:#33348e; text-decoration: underline;; }");
66  builder.AppendLine("a:active { color:#7476b4; text-decoration: underline; }");
67  builder.AppendLine(
68  "table { border-collapse:collapse; border-spacing: 0px; width: 975px; table-layout: fixed; }");
69  builder.AppendLine(
70  "td { padding: 0px; padding-right: 0px; padding-left: 0px; padding-top: 2px; padding-bottom: 3px; }");
71  builder.AppendLine("col.fst { width: 150px; }");
72  builder.AppendLine("col.sec { width: 275px; }");
73  builder.AppendLine("col.thd { width: 125px; }");
74  builder.AppendLine("col.frt { width: 425px; }");
75  builder.AppendLine("</style>");
76  builder.AppendLine("<title>");
77  builder.AppendLine(name);
78  builder.AppendLine("</title>");
79  builder.AppendLine("</head>");
80 
81  return builder.ToString();
82  }
83  }
84 }