61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
// /**
|
|
// * File: ApplicationDemo.cs
|
|
// * Author: haraldwolff
|
|
// *
|
|
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
|
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
|
// *
|
|
// *
|
|
// **/
|
|
using System;
|
|
using ln.http.resources;
|
|
using ln.application.service;
|
|
using ln.http;
|
|
using ln.http.listener;
|
|
using ln.http.resources.websocket;
|
|
namespace ln.application.demo
|
|
{
|
|
public class ApplicationDemo : Application
|
|
{
|
|
|
|
public ApplicationDemo()
|
|
:base(new DemoIdentityProvider())
|
|
{
|
|
}
|
|
|
|
public override void PrepareStart()
|
|
{
|
|
base.PrepareStart();
|
|
|
|
ServiceContainer.Add(ServiceDefinition.From<ApplicationService>(true));
|
|
}
|
|
|
|
class ApplicationService : ApplicationServiceBase
|
|
{
|
|
|
|
public ApplicationService() : base("core") { }
|
|
|
|
|
|
public override void ServiceMain(Application application)
|
|
{
|
|
DirectoryResource directoryResource = new DirectoryResource(new string[] { "../../../www", "www" });
|
|
directoryResource.DefaultResource = directoryResource.GetResource("demo.html");
|
|
directoryResource.FallBackResource = directoryResource.DefaultResource;
|
|
|
|
CurrentApplication.RootResource = directoryResource;
|
|
|
|
WebsocketResource websocketResource = new WebsocketResource(null, "socket", (HttpRequest arg) => new ApplicationWebSocket((Application)this.CurrentApplication, arg));
|
|
directoryResource.InjectResource(websocketResource);
|
|
|
|
//applicationInterface.HttpServer.AddListener(new HttpsListener(8443));
|
|
|
|
base.ServiceMain(application);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|