Initial commit

This commit is contained in:
2016-03-05 14:06:38 +01:00
commit 92e69371b4
254 changed files with 58742 additions and 0 deletions
@@ -0,0 +1,71 @@
//
// BootstrapAboutPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Collections.Generic;
using Ntp.Analyzer.Config.Page;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Render;
using Ntp.Analyzer.Render.Host;
using Ntp.Analyzer.Render.Summery;
using Ntp.Analyzer.Config.Navigation;
namespace Ntp.Analyzer.Page
{
public sealed class BootstrapAboutPageBuilder: PageBuilderBase
{
public BootstrapAboutPageBuilder (
MenuConfiguration menu,
AboutPageConfiguration page)
{
this.menu = menu;
this.page = page;
}
private readonly MenuConfiguration menu;
private readonly AboutPageConfiguration page;
public override IEnumerable<StreamDestination> Destinations {
get { return page.Destinations; }
}
public override Stream Generate ()
{
// Create page
BootstrapAboutPageRender aboutPage = new BootstrapAboutPageRender (
page.WebPath, page.Title, page.Header, page.Content, page.ServerId);
aboutPage.Add (new BootstrapMenuRender (page.WebPath, menu, page));
// Generate HTML
HtmlRenderer htmlRender = new HtmlRenderer (aboutPage);
string html = htmlRender.Render ();
return ToStream (html);
}
}
}
@@ -0,0 +1,91 @@
//
// BootstrapHostPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Ntp.Analyzer.Data;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Objects;
using Ntp.Analyzer.Render;
using Ntp.Analyzer.Render.Host;
using Ntp.Analyzer.Config.Page;
using Ntp.Analyzer.Config.Navigation;
namespace Ntp.Analyzer.Page
{
public sealed class BootstrapHostPageBuilder : PageBuilderBase
{
public BootstrapHostPageBuilder (
MenuConfiguration menu,
HostPageConfiguration page,
IEnumerable<StatusLine> lines)
{
this.menu = menu;
this.page = page;
this.lines = new List<StatusLine>(lines);
}
private readonly MenuConfiguration menu;
private readonly HostPageConfiguration page;
private readonly List<StatusLine> lines;
public override IEnumerable<StreamDestination> Destinations {
get { return page.Destinations; }
}
public override Stream Generate ()
{
DateTime now = DateTime.Now;
DateTime next = Math.Schedule.CalculateNextRun (now, page.Frequency);
int wait = Convert.ToInt32 (next.Subtract (now).TotalSeconds) + 1;
Host host = DataFace.Instance.Hosts.Single (h => h.Id == page.HostId);
BootstrapHostPageRender hostPage = new BootstrapHostPageRender (page.WebPath, page.Title, wait);
BootstrapMenuRender menuBar = new BootstrapMenuRender (page.WebPath, menu, page);
hostPage.Add (menuBar);
BootstrapHostTableRender statusTable = new BootstrapHostTableRender (page, host.Ip, now, next);
hostPage.Add (statusTable);
// Create table content
foreach (StatusLine line in lines) {
statusTable.Add (new HostLineRender (line, page.PeerPage));
}
// Create graph links
hostPage.Add (new BootstrapHostGraphRender (page.WebPath, page, page.Graphs));
// Generate HTML
HtmlRenderer htmlRender = new HtmlRenderer (hostPage);
string html = htmlRender.Render ();
return ToStream (html);
}
}
}
@@ -0,0 +1,83 @@
//
// BootstrapPeerPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Collections.Generic;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Objects;
using Ntp.Analyzer.Render;
using Ntp.Analyzer.Render.Peer;
using Ntp.Analyzer.Config.Page;
using Ntp.Analyzer.Render.Host;
using Ntp.Analyzer.Config.Navigation;
namespace Ntp.Analyzer.Page
{
public sealed class BootstrapPeerPageBuilder : PageBuilderBase
{
public BootstrapPeerPageBuilder (
Host host,
Peer peer,
MenuConfiguration menu,
PeerPageConfiguration page)
{
this.host = host;
this.peer = peer;
this.menu = menu;
this.page = page;
}
private readonly Host host;
private readonly Peer peer;
private readonly MenuConfiguration menu;
private readonly PeerPageConfiguration page;
public override IEnumerable<StreamDestination> Destinations {
get { return page.Destinations; }
}
public override Stream Generate ()
{
DateTime now = DateTime.Now;
DateTime next = Math.Schedule.CalculateNextRun (now, page.Frequency);
int wait = Convert.ToInt32 (next.Subtract (now).TotalSeconds) + 1;
// Create page
BootstrapPeerPageRender peerPage = new BootstrapPeerPageRender (page.WebPath, peer.Name, wait);
peerPage.Add (new BootstrapMenuRender (page.WebPath, menu, page));
peerPage.Add (new BootstrapPeerInfoRender (page.WebPath, peer.Server, now, next));
peerPage.Add (new BootstrapPeerGraphRender (page.WebPath, host, page, peer.Server, page.Graphs));
// Generate HTML
HtmlRenderer htmlRender = new HtmlRenderer (peerPage);
string html = htmlRender.Render ();
return ToStream (html);
}
}
}
@@ -0,0 +1,69 @@
//
// BootstrapPeerSummeryPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Collections.Generic;
using Ntp.Analyzer.Config.Page;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Render;
using Ntp.Analyzer.Render.Host;
using Ntp.Analyzer.Render.Summery;
using Ntp.Analyzer.Config.Navigation;
namespace Ntp.Analyzer.Page
{
public sealed class BootstrapPeerSummeryPageBuilder: PageBuilderBase
{
public BootstrapPeerSummeryPageBuilder (
MenuConfiguration menu,
PeerSummeryPageConfiguration page)
{
this.menu = menu;
this.page = page;
}
private readonly MenuConfiguration menu;
private readonly PeerSummeryPageConfiguration page;
public override IEnumerable<StreamDestination> Destinations {
get { return page.Destinations; }
}
public override Stream Generate ()
{
// Create page
BootstrapSummeryPageRender peerSummeryPage = new BootstrapSummeryPageRender (page.WebPath, page.ServerName);
peerSummeryPage.Add (new BootstrapMenuRender (page.WebPath, menu, page));
peerSummeryPage.Add (new BootstrapSummeryGraphRender (page.WebPath, page, page.Graphs));
// Generate HTML
HtmlRenderer htmlRender = new HtmlRenderer (peerSummeryPage);
string html = htmlRender.Render ();
return ToStream (html);
}
}
}
@@ -0,0 +1,91 @@
//
// HtmlHostPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Render;
using Ntp.Analyzer.Render.Host;
using Ntp.Analyzer.Config.Page;
using Ntp.Analyzer.Objects;
using Ntp.Analyzer.Data;
namespace Ntp.Analyzer.Page
{
/// <summary>
/// Build a HTML status page showing the state of a hosted NTP server.
/// </summary>
public sealed class DefaultHostPageBuilder : PageBuilderBase
{
/// <summary>
/// Initializes a new instance of the <see cref="Ntp.Analyzer.Page.DefaultHostPageBuilder"/> class.
/// </summary>
/// <param name="config">Config.</param>
/// <param name="lines">Lines.</param>
public DefaultHostPageBuilder (
HostPageConfiguration config,
IEnumerable<StatusLine> lines)
{
this.config = config;
this.lines = new List<StatusLine>(lines);
}
private readonly HostPageConfiguration config;
private readonly List<StatusLine> lines;
public override IEnumerable<StreamDestination> Destinations {
get { return config.Destinations; }
}
public override Stream Generate ()
{
Host host = DataFace.Instance.Hosts.Single (h => h.Id == config.HostId);
// Create page and table
// TODO: Calculate refresh time till next interval.
DefaultHostPageRender hostPage = new DefaultHostPageRender (config, host.Ip, config.Frequency * 60);
DefaultHostTableRender statusTable = new DefaultHostTableRender (config.WebPath);
hostPage.Add (statusTable);
// Create table content
foreach (StatusLine line in lines) {
statusTable.Add (new HostLineRender (line, config.PeerPage));
}
// Create graph links
hostPage.Add (new DefaultHostGraphRender (config.WebPath, config.Graphs));
// Generate HTML
HtmlRenderer htmlRender = new HtmlRenderer (hostPage);
string html = htmlRender.Render ();
return ToStream (html);
}
}
}
@@ -0,0 +1,67 @@
//
// HtmlPeerPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Collections.Generic;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Objects;
using Ntp.Analyzer.Render;
using Ntp.Analyzer.Render.Peer;
using Ntp.Analyzer.Config.Page;
namespace Ntp.Analyzer.Page
{
public class DefaultPeerPageBuilder : PageBuilderBase
{
public DefaultPeerPageBuilder (Peer peer, PeerPageConfiguration config)
{
this.peer = peer;
this.config = config;
}
private readonly Peer peer;
private readonly PeerPageConfiguration config;
public override IEnumerable<StreamDestination> Destinations {
get { return config.Destinations; }
}
public override Stream Generate ()
{
// Create page
DefaultPeerPageRender peerPage = new DefaultPeerPageRender (config.WebPath, peer.Name);
peerPage.Add (new DefaultPeerInfoRender (config.WebPath, peer.Server));
peerPage.Add (new DefaultPeerGraphRender (config.WebPath, peer.Server, config.Graphs));
// Generate HTML
HtmlRenderer htmlRender = new HtmlRenderer (peerPage);
string html = htmlRender.Render ();
return ToStream (html);
}
}
}
@@ -0,0 +1,63 @@
//
// HtmlPeerSummeryPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Collections.Generic;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Config.Page;
using Ntp.Analyzer.Render;
using Ntp.Analyzer.Render.Summery;
namespace Ntp.Analyzer.Page
{
public sealed class DefaultPeerSummeryPageBuilder : PageBuilderBase
{
public DefaultPeerSummeryPageBuilder (PeerSummeryPageConfiguration config)
{
this.config = config;
}
private readonly PeerSummeryPageConfiguration config;
public override IEnumerable<StreamDestination> Destinations {
get { return config.Destinations; }
}
public override Stream Generate ()
{
// Create page
DefaultPeerSummeryPageRender peerSummeryPage = new DefaultPeerSummeryPageRender (config.WebPath, config.ServerName);
peerSummeryPage.Add (new DefaultPeerSummeryGraphRender (config, config.Graphs));
// Generate HTML
HtmlRenderer htmlRender = new HtmlRenderer (peerSummeryPage);
string html = htmlRender.Render ();
return ToStream (html);
}
}
}
+82
View File
@@ -0,0 +1,82 @@
//
// GraphPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Collections.Generic;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Config.Page;
using Ntp.Analyzer.Render;
using Ntp.Analyzer.Config.Graph;
using Ntp.Analyzer.Render.Graph;
using Ntp.Analyzer.Objects;
namespace Ntp.Analyzer.Page
{
public sealed class GraphPageBuilder : PageBuilderBase
{
public GraphPageBuilder (
GraphPageConfiguration config,
NamedObject namedObject,
string prefix,
GraphSetConfiguration graphSet,
GraphBaseConfiguration graph)
{
this.config = config;
this.namedObject = namedObject;
this.prefix = prefix;
this.graphSet = graphSet;
this.graph = graph;
}
private readonly GraphPageConfiguration config;
private readonly NamedObject namedObject;
private readonly string prefix;
private readonly GraphSetConfiguration graphSet;
private readonly GraphBaseConfiguration graph;
public override IEnumerable<StreamDestination> Destinations {
get { return config.Destinations; }
}
public override Stream Generate ()
{
BootstrapGrapPageRender page = new BootstrapGrapPageRender (
config.WebPath,
namedObject,
config.Title,
prefix,
graphSet,
graph);
// Generate HTML
HtmlRenderer htmlRender = new HtmlRenderer (page);
string html = htmlRender.Render ();
return ToStream (html);
}
}
}
+56
View File
@@ -0,0 +1,56 @@
//
// HtmlPageBuilder.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013 Carsten Sonne Larsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using Ntp.Analyzer.Export;
namespace Ntp.Analyzer.Page
{
public abstract class PageBuilderBase : IStreamGenerator
{
public PageBuilderBase ()
{
}
public abstract IEnumerable<StreamDestination> Destinations { get; }
protected Stream ToStream (string text)
{
MemoryStream stream = new MemoryStream ();
StreamWriter writer = new StreamWriter (stream, Encoding.UTF8);
writer.Write (text);
writer.Flush ();
return stream;
}
public abstract Stream Generate ();
}
}