internal class Program
{
public Program()
{
}
[STAThread]
private static void Main()
{
if (!File.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), string.Format("{0}{1}", Assembly.GetExecutingAssembly().ManifestModule.Name, ".Config"))))
{
throw new FileNotFoundException("Log configuration file was not found");
}
XmlConfigurator.Configure();
DomainMapper.Map();
HostFactory.Run((HostConfigurator c) => {
Action<Engine> action = null;
Action<Engine> action1 = null;
c.SetServiceName("Falcon.Service");
c.SetDisplayName("Falcon Service");
c.SetDescription("Backend gateway to various components");
c.RunAsLocalSystem();
StandardKernel standardKernel = new StandardKernel(new NinjectSettings()
{
LoadExtensions = true
}, new INinjectModule[0]);
standardKernel.Load(new INinjectModule[] { new FalconServiceRegistry() });
c.Service<Engine>((ServiceConfigurator<Engine> s) => {
s.ConstructUsing((HostSettings builder) => standardKernel.Get<Engine>(new IParameter[0]));
ServiceConfigurator<Engine> serviceConfigurator = s;
if (action == null)
{
action = (Engine o) => o.Start();
}
serviceConfigurator.WhenStarted<Engine>(action);
ServiceConfigurator<Engine> serviceConfigurator1 = s;
if (action1 == null)
{
action1 = (Engine o) => o.Stop();
}
serviceConfigurator1.WhenStopped<Engine>(action1);
});
});
}
}
}