2015-08-21 21:14:02 -04:00
|
|
|
|
using System;
|
|
|
|
|
using SharedLibrary;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
namespace Webfront_Plugin
|
|
|
|
|
{
|
2015-08-22 02:04:30 -04:00
|
|
|
|
public class Webfront : Plugin
|
2015-08-21 21:14:02 -04:00
|
|
|
|
{
|
2015-08-22 12:41:14 -04:00
|
|
|
|
private static Thread webManagerThread;
|
2015-08-21 21:14:02 -04:00
|
|
|
|
|
|
|
|
|
public override void onEvent(Event E)
|
|
|
|
|
{
|
2015-08-23 17:58:48 -04:00
|
|
|
|
if (E.Type == Event.GType.Start)
|
2015-08-21 21:14:02 -04:00
|
|
|
|
{
|
2015-08-23 17:58:48 -04:00
|
|
|
|
Manager.webFront.addServer(E.Owner);
|
|
|
|
|
E.Owner.Log.Write("Webfront now has access to server on port " + E.Owner.getPort(), Log.Level.Production);
|
|
|
|
|
}
|
|
|
|
|
if (E.Type == Event.GType.Stop)
|
|
|
|
|
{
|
|
|
|
|
Manager.webFront.removeServer(E.Owner);
|
|
|
|
|
E.Owner.Log.Write("Webfront has lost access to server on port " + E.Owner.getPort(), Log.Level.Production);
|
2015-08-21 21:14:02 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void onLoad()
|
|
|
|
|
{
|
2015-08-23 17:58:48 -04:00
|
|
|
|
webManagerThread = new Thread(new ThreadStart(Manager.Init));
|
2015-08-21 21:14:02 -04:00
|
|
|
|
webManagerThread.Name = "Webfront";
|
|
|
|
|
|
|
|
|
|
webManagerThread.Start();
|
|
|
|
|
}
|
2015-08-22 02:04:30 -04:00
|
|
|
|
|
2015-08-22 12:41:14 -04:00
|
|
|
|
public override void onUnload()
|
|
|
|
|
{
|
2015-08-23 17:58:48 -04:00
|
|
|
|
Manager.webScheduler.Stop();
|
2015-08-22 12:41:14 -04:00
|
|
|
|
webManagerThread.Join();
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-22 02:04:30 -04:00
|
|
|
|
public override String Name
|
|
|
|
|
{
|
|
|
|
|
get { return "Webfront"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override float Version
|
|
|
|
|
{
|
|
|
|
|
get { return 0.1f; }
|
|
|
|
|
}
|
2015-08-21 21:14:02 -04:00
|
|
|
|
}
|
|
|
|
|
}
|