1
0
mirror of https://bitbucket.org/anguist/ntpa synced 2025-11-23 20:09:20 +00:00
Files
ntpa/Ntp.Analyzer.Process/Description/HostPageJob.cs
2016-04-03 15:58:11 +02:00

80 lines
2.6 KiB
C#

//
// HostPageJob.cs
//
// Author:
// Carsten Sonne Larsen <cs@innolan.dk>
//
// Copyright (c) 2013-2016 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.IO;
using Ntp.Analyzer.Config.Navigation;
using Ntp.Analyzer.Config.Page;
using Ntp.Analyzer.Log;
using Ntp.Analyzer.Page;
using Ntp.Analyzer.Statistics;
namespace Ntp.Analyzer.Process.Description
{
public sealed class HostPageJob : StreamJob
{
private readonly MenuConfiguration menu;
private readonly HostPageConfiguration page;
public HostPageJob(MenuConfiguration menu, HostPageConfiguration page, LogBase log)
: base(page, log)
{
this.menu = menu;
this.page = page;
}
public override bool SingleThread {
get { return false; }
}
public override string JobType
{
get { return "Host page build"; }
}
public override int Priority
{
get { return 10; }
}
protected override void InternalExecute()
{
// Build status objects
StatusBuilder builder = new StatusBuilder(
new ServerName(page.ServerName),
new FileInfo(page.ConfigFile));
builder.Build();
PageBuilderBase pageBuilder;
if (page.Theme == "bootstrap")
pageBuilder = new BootstrapHostPageBuilder(menu, page, builder.Entries.ToArray());
else
pageBuilder = new DefaultHostPageBuilder(page, builder.Entries.ToArray());
SaveStream(pageBuilder);
}
}
}