WIP
parent
e4d945ebd5
commit
5311c627f1
|
@ -9,6 +9,8 @@ using System.Net;
|
||||||
using ln.application.service;
|
using ln.application.service;
|
||||||
using ln.http.resources;
|
using ln.http.resources;
|
||||||
using ln.types.btree;
|
using ln.types.btree;
|
||||||
|
using ln.types.rpc;
|
||||||
|
using ln.application.slots;
|
||||||
|
|
||||||
namespace ln.application
|
namespace ln.application
|
||||||
{
|
{
|
||||||
|
@ -24,8 +26,11 @@ namespace ln.application
|
||||||
|
|
||||||
public int ApplicationContextTimeout { get; set; } = 1200;
|
public int ApplicationContextTimeout { get; set; } = 1200;
|
||||||
|
|
||||||
|
public RPCContainer RPCContainer { get; } = new RPCContainer();
|
||||||
|
public BinarySlotContainer BinarySlots { get; } = new BinarySlotContainer();
|
||||||
|
|
||||||
MappingBTree<Guid, ApplicationContext> applicationContexts = new MappingBTree<Guid, ApplicationContext>((x)=>x.ContextID);
|
|
||||||
|
MappingBTree<Guid, ApplicationContext> applicationContexts = new MappingBTree<Guid, ApplicationContext>((x)=>x.ContextID);
|
||||||
|
|
||||||
public Application()
|
public Application()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,104 +1,147 @@
|
||||||
using System;
|
using System;
|
||||||
using ln.http.resources.websocket;
|
|
||||||
using ln.http.resources;
|
|
||||||
using ln.http.websocket;
|
using ln.http.websocket;
|
||||||
using System.Collections.Generic;
|
|
||||||
using ln.json;
|
using ln.json;
|
||||||
using ln.logging;
|
using ln.logging;
|
||||||
using ln.types.rpc;
|
using ln.types.rpc;
|
||||||
using System.Linq;
|
using ln.http;
|
||||||
using System.IO;
|
using System.Collections.Generic;
|
||||||
|
using ln.application.slots;
|
||||||
namespace ln.application
|
namespace ln.application
|
||||||
{
|
{
|
||||||
public class ApplicationWebSocket : WebsocketResource
|
public class ApplicationWebSocket : WebSocket
|
||||||
{
|
{
|
||||||
public WebSocket[] CurrentWebSockets
|
public IApplicationInterface ApplicationInterface { get; }
|
||||||
|
|
||||||
|
Dictionary<string, Func<JSONValue, object>> messageConverters = new Dictionary<string, Func<JSONValue, object>>();
|
||||||
|
|
||||||
|
public ApplicationWebSocket(IApplicationInterface applicationInterface,HttpRequest httpRequest)
|
||||||
|
:base(httpRequest)
|
||||||
{
|
{
|
||||||
get
|
ApplicationInterface = applicationInterface;
|
||||||
{
|
|
||||||
lock (currentWebSockets)
|
|
||||||
{
|
|
||||||
return currentWebSockets.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashSet<WebSocket> currentWebSockets = new HashSet<WebSocket>();
|
|
||||||
|
|
||||||
public RPCContainer RPCContainer { get; private set; }
|
|
||||||
|
|
||||||
|
|
||||||
public ApplicationWebSocket(Resource container, string name,RPCContainer rpcContainer)
|
|
||||||
:this(container,name)
|
|
||||||
{
|
|
||||||
RPCContainer = rpcContainer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationWebSocket(Resource container,string name)
|
public void AddMessageConverter(string messageType, Func<JSONValue, object> converter)
|
||||||
:base(container,name)
|
{
|
||||||
{
|
messageConverters[messageType] = converter;
|
||||||
Connection += WebSocketInterface_Connection;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void WebSocketInterface_Connection(WebsocketResource webSocketResource, ln.http.websocket.WebSocket webSocket, WSREvent ev)
|
public Func<JSONValue, object> FindConverter(string messageType)
|
||||||
{
|
{
|
||||||
lock (currentWebSockets)
|
return messageConverters[messageType];
|
||||||
{
|
}
|
||||||
switch (ev)
|
|
||||||
{
|
|
||||||
case WSREvent.CONNECT:
|
|
||||||
currentWebSockets.Add(webSocket);
|
|
||||||
break;
|
|
||||||
case WSREvent.CLOSE:
|
|
||||||
case WSREvent.ERROR:
|
|
||||||
currentWebSockets.Remove(webSocket);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Broadcast(JSONObject json)
|
public override bool Received(string textMessage)
|
||||||
{
|
{
|
||||||
Broadcast(json.ToString());
|
JSONObject json = (JSONObject)JSONParser.Parse(textMessage);
|
||||||
}
|
|
||||||
|
|
||||||
public void Broadcast(String text)
|
if (!json.ContainsKey("id"))
|
||||||
{
|
{
|
||||||
foreach (WebSocket webSocket in CurrentWebSockets)
|
Logging.Log(LogLevel.WARNING, "ApplicatioNWebSocket received json message without id");
|
||||||
{
|
return false;
|
||||||
try
|
|
||||||
{
|
|
||||||
webSocket.Send(text);
|
|
||||||
}
|
|
||||||
catch (IOException)
|
|
||||||
{ }
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public override void MessageReceived(WebSocketResourceRequestContext requestContext, string textMessage)
|
long messageID = (long)json["id"].ToNative();
|
||||||
|
|
||||||
|
if (!json.ContainsKey("type"))
|
||||||
|
{
|
||||||
|
SendError(messageID, "type missing", "ApplicationWebSocket received message without 'type' attribute");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string messageType = json["type"].ToNative() as string;
|
||||||
|
JSONValue message = json.ContainsKey("message") ? json["message"] : JSONNull.Instance;
|
||||||
|
|
||||||
|
return ReceivedMessage(messageID,messageType,message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool ReceivedMessage(long messageId,string messageType,JSONValue message)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
object convertedMessage = FindConverter(messageType)(message);
|
||||||
|
return ReceivedMessage(messageId, messageType, convertedMessage);
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
Logging.Log(e);
|
||||||
|
SendError(messageId, e.ToString(), e.InnerException.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool ReceivedMessage(long messageId, string messageType, object message)
|
||||||
|
{
|
||||||
|
switch (messageType)
|
||||||
|
{
|
||||||
|
case "RPCCall":
|
||||||
|
SendMessage(messageId, ApplicationInterface.RPCContainer.Invoke(message as RPCCall));
|
||||||
|
return true;
|
||||||
|
case "SlotRequest":
|
||||||
|
SlotAllocation slotAllocation = ApplicationInterface.BinarySlots.RequestSlot(message as SlotRequest);
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Received(byte[] binaryMessage)
|
||||||
|
{
|
||||||
|
return base.Received(binaryMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendMessage(long messageID, object message)
|
||||||
|
{
|
||||||
|
string messageType = message.GetType().Name;
|
||||||
|
JSONObject jsonMessage = JSONObject.From(message);
|
||||||
|
|
||||||
|
SendMessage(messageID, messageType, jsonMessage);
|
||||||
|
}
|
||||||
|
public virtual void SendMessage(long messageID,string messageType,JSONObject message)
|
||||||
|
{
|
||||||
|
JSONObject messageFrame = new JSONObject();
|
||||||
|
messageFrame["id"] = new JSONNumber(messageID);
|
||||||
|
messageFrame["type"] = new JSONString(messageType);
|
||||||
|
messageFrame["message"] = message;
|
||||||
|
|
||||||
|
Send(messageFrame.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void SendError(long messageId, string error, string cause) => SendError(messageId, error, cause, null);
|
||||||
|
public virtual void SendError(long messageId, string error,string cause,JSONValue details)
|
||||||
|
{
|
||||||
|
JSONObject failed = new JSONObject();
|
||||||
|
failed["message"] = new JSONString(error);
|
||||||
|
failed["cause"] = new JSONString(cause);
|
||||||
|
failed["details"] = details;
|
||||||
|
|
||||||
|
Logging.Log(LogLevel.WARNING, "ApplicationWebSocket sends error: {0}\n{1}",error,cause);
|
||||||
|
SendMessage(messageId, "error", failed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a()
|
||||||
{
|
{
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
Logging.Log(LogLevel.DEBUGDETAIL, "ApplicationWebSocket: Received: {0}",textMessage);
|
// Logging.Log(LogLevel.DEBUGDETAIL, "ApplicationWebSocket: Received: {0}",textMessage);
|
||||||
JSONObject json = (JSONObject)JSONParser.Parse(textMessage);
|
|
||||||
RPCCall rpcCall = json.ToObject<RPCCall>();
|
// RPCCall rpcCall = json.ToObject<RPCCall>();
|
||||||
|
|
||||||
RPCResult rpcResult = Invoke(rpcCall);
|
// RPCResult rpcResult = Invoke(rpcCall);
|
||||||
string resultText = JSONObject.From(rpcResult).ToString();
|
// string resultText = JSONObject.From(rpcResult).ToString();
|
||||||
|
|
||||||
Logging.Log(LogLevel.DEBUGDETAIL, "ApplicationWebSocket: Sending: {0}", resultText);
|
// Logging.Log(LogLevel.DEBUGDETAIL, "ApplicationWebSocket: Sending: {0}", resultText);
|
||||||
requestContext.WebSocket.Send(resultText);
|
// requestContext.WebSocket.Send(resultText);
|
||||||
|
|
||||||
}
|
//}
|
||||||
catch (Exception e)
|
//catch (Exception e)
|
||||||
{
|
//{
|
||||||
Logging.Log(e);
|
// Logging.Log(e);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual RPCResult Invoke(RPCCall call)
|
public virtual RPCResult Invoke(RPCCall call)
|
||||||
{
|
{
|
||||||
RPCResult result = null;
|
RPCResult result = null;
|
||||||
result = RPCContainer.Invoke(call);
|
result = ApplicationInterface.RPCContainer.Invoke(call);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ using ln.application.service;
|
||||||
using ln.http.resources;
|
using ln.http.resources;
|
||||||
using ln.http;
|
using ln.http;
|
||||||
using ln.types;
|
using ln.types;
|
||||||
|
using ln.types.rpc;
|
||||||
|
using ln.application.slots;
|
||||||
namespace ln.application
|
namespace ln.application
|
||||||
{
|
{
|
||||||
public interface IApplicationInterface
|
public interface IApplicationInterface
|
||||||
|
@ -15,5 +17,8 @@ namespace ln.application
|
||||||
ResourceApplication HTTPApplication { get; }
|
ResourceApplication HTTPApplication { get; }
|
||||||
ServiceContainer ServiceContainer { get; }
|
ServiceContainer ServiceContainer { get; }
|
||||||
|
|
||||||
|
RPCContainer RPCContainer { get; }
|
||||||
|
BinarySlotContainer BinarySlots { get; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
<Compile Include="ApplicationWebSocket.cs" />
|
<Compile Include="ApplicationWebSocket.cs" />
|
||||||
<Compile Include="ApplicationContext.cs" />
|
<Compile Include="ApplicationContext.cs" />
|
||||||
<Compile Include="AuthenticatedUser.cs" />
|
<Compile Include="AuthenticatedUser.cs" />
|
||||||
|
<Compile Include="slots\BinarySlot.cs" />
|
||||||
|
<Compile Include="slots\SlotRequest.cs" />
|
||||||
|
<Compile Include="slots\BinarySlotContainer.cs" />
|
||||||
|
<Compile Include="slots\SlotAllocation.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ln.types\ln.types.csproj">
|
<ProjectReference Include="..\ln.types\ln.types.csproj">
|
||||||
|
@ -65,15 +69,85 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="service\" />
|
<Folder Include="service\" />
|
||||||
<Folder Include="www\" />
|
<Folder Include="www\" />
|
||||||
|
<Folder Include="slots\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="www\ln.application.js">
|
<None Include="www\ln.application.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="www\vue.js">
|
<None Include="www\controls.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="www\vue-router.js">
|
<None Include="www\demo.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\table.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\webauthn.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\css\ln.vue.css">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\typicons.svg">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-regular-400.ttf">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-regular-400.eot">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\typicons.woff">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-solid-900.woff2">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-solid-900.eot">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-regular-400.woff">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-solid-900.svg">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\typicons.ttf">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\typicons.eot">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-regular-400.woff2">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-solid-900.ttf">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-solid-900.woff">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\fonts\fa-regular-400.svg">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\js\ln.vue.table.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\js\ln.vue.components.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\js\ln.vue.webauthn.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\js\vue-router.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\js\ln.vue.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="www\js\vue.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
// /**
|
||||||
|
// * 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;
|
||||||
|
namespace ln.application.demo
|
||||||
|
{
|
||||||
|
public class ApplicationDemo : Application
|
||||||
|
{
|
||||||
|
public override void PrepareStart()
|
||||||
|
{
|
||||||
|
base.PrepareStart();
|
||||||
|
|
||||||
|
ServiceContainer.Add(ServiceDefinition.From<ApplicationService>(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
class ApplicationService : ApplicationServiceBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public ApplicationService() : base("core") { }
|
||||||
|
|
||||||
|
|
||||||
|
public override void ServiceMain(IApplicationInterface applicationInterface)
|
||||||
|
{
|
||||||
|
DirectoryResource directoryResource = new DirectoryResource(new string[] { "../../www", "www" });
|
||||||
|
directoryResource.DefaultResource = directoryResource.GetResource("demo.html");
|
||||||
|
directoryResource.FallBackResource = directoryResource.DefaultResource;
|
||||||
|
|
||||||
|
CurrentApplicationInterface.HTTPApplication.RootResource = directoryResource;
|
||||||
|
|
||||||
|
//applicationInterface.HttpServer.AddListener(new HttpsListener(8443));
|
||||||
|
|
||||||
|
base.ServiceMain(applicationInterface);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
// /**
|
||||||
|
// * File: Program.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;
|
||||||
|
|
||||||
|
namespace ln.application.demo
|
||||||
|
{
|
||||||
|
class MainClass
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
new ApplicationDemo().Start(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
// /**
|
||||||
|
// * File: AssemblyInfo.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.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following attributes.
|
||||||
|
// Change them to the values specific to your project.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("ln.application.demo")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||||
|
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||||
|
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
// The following attributes are used to specify the signing key for the assembly,
|
||||||
|
// if desired. See the Mono documentation for more information about signing.
|
||||||
|
|
||||||
|
//[assembly: AssemblyDelaySign(false)]
|
||||||
|
//[assembly: AssemblyKeyFile("")]
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{2CBEE2D5-C4D4-4DBD-8AA4-B54E99812808}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>ln.application.demo</RootNamespace>
|
||||||
|
<AssemblyName>ln.application.demo</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ExternalConsole>true</ExternalConsole>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ExternalConsole>true</ExternalConsole>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="ApplicationDemo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ln.application.csproj">
|
||||||
|
<Project>{44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}</Project>
|
||||||
|
<Name>ln.application</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ln.http\ln.http.csproj">
|
||||||
|
<Project>{CEEEEB41-3059-46A2-A871-2ADE22C013D9}</Project>
|
||||||
|
<Name>ln.http</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ln.http.resources\ln.http.resources.csproj">
|
||||||
|
<Project>{F9086FE4-8925-42FF-A59C-607341604293}</Project>
|
||||||
|
<Name>ln.http.resources</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ln.json\ln.json.csproj">
|
||||||
|
<Project>{D9342117-3249-4D8B-87C9-51A50676B158}</Project>
|
||||||
|
<Name>ln.json</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ln.logging\ln.logging.csproj">
|
||||||
|
<Project>{D471A566-9FB6-41B2-A777-3C32874ECD0E}</Project>
|
||||||
|
<Name>ln.logging</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ln.templates\ln.templates.csproj">
|
||||||
|
<Project>{AD0267BB-F08C-4BE1-A88D-010D49041761}</Project>
|
||||||
|
<Name>ln.templates</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ln.types\ln.types.csproj">
|
||||||
|
<Project>{8D9AB9A5-E513-4BA7-A450-534F6456BF28}</Project>
|
||||||
|
<Name>ln.types</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="www\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.application", "ln.application.csproj", "{44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.http", "..\ln.http\ln.http.csproj", "{CEEEEB41-3059-46A2-A871-2ADE22C013D9}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.http.resources", "..\ln.http.resources\ln.http.resources.csproj", "{F9086FE4-8925-42FF-A59C-607341604293}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.json", "..\ln.json\ln.json.csproj", "{D9342117-3249-4D8B-87C9-51A50676B158}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.logging", "..\ln.logging\ln.logging.csproj", "{D471A566-9FB6-41B2-A777-3C32874ECD0E}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.templates", "..\ln.templates\ln.templates.csproj", "{AD0267BB-F08C-4BE1-A88D-010D49041761}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.types", "..\ln.types\ln.types.csproj", "{8D9AB9A5-E513-4BA7-A450-534F6456BF28}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.application.demo", "ln.application.demo\ln.application.demo.csproj", "{2CBEE2D5-C4D4-4DBD-8AA4-B54E99812808}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{CEEEEB41-3059-46A2-A871-2ADE22C013D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CEEEEB41-3059-46A2-A871-2ADE22C013D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CEEEEB41-3059-46A2-A871-2ADE22C013D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CEEEEB41-3059-46A2-A871-2ADE22C013D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F9086FE4-8925-42FF-A59C-607341604293}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F9086FE4-8925-42FF-A59C-607341604293}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F9086FE4-8925-42FF-A59C-607341604293}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F9086FE4-8925-42FF-A59C-607341604293}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D9342117-3249-4D8B-87C9-51A50676B158}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D9342117-3249-4D8B-87C9-51A50676B158}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D9342117-3249-4D8B-87C9-51A50676B158}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D9342117-3249-4D8B-87C9-51A50676B158}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D471A566-9FB6-41B2-A777-3C32874ECD0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D471A566-9FB6-41B2-A777-3C32874ECD0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D471A566-9FB6-41B2-A777-3C32874ECD0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D471A566-9FB6-41B2-A777-3C32874ECD0E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8D9AB9A5-E513-4BA7-A450-534F6456BF28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8D9AB9A5-E513-4BA7-A450-534F6456BF28}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8D9AB9A5-E513-4BA7-A450-534F6456BF28}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8D9AB9A5-E513-4BA7-A450-534F6456BF28}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{2CBEE2D5-C4D4-4DBD-8AA4-B54E99812808}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2CBEE2D5-C4D4-4DBD-8AA4-B54E99812808}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2CBEE2D5-C4D4-4DBD-8AA4-B54E99812808}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2CBEE2D5-C4D4-4DBD-8AA4-B54E99812808}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -49,7 +49,17 @@ namespace ln.application.service
|
||||||
return serviceBase;
|
return serviceBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ServiceMain(IApplicationInterface applicationInterface) => throw new NotImplementedException();
|
public virtual void ServiceMain(IApplicationInterface applicationInterface)
|
||||||
|
{
|
||||||
|
Ready();
|
||||||
|
while (!StopRequested)
|
||||||
|
{
|
||||||
|
lock (Thread.CurrentThread)
|
||||||
|
{
|
||||||
|
Monitor.Wait(Thread.CurrentThread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool Start(IApplicationInterface applicationInterface, String[] arguments)
|
public virtual bool Start(IApplicationInterface applicationInterface, String[] arguments)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
// /**
|
||||||
|
// * File: BinarySlot.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;
|
||||||
|
namespace ln.application.slots
|
||||||
|
{
|
||||||
|
public class BinarySlot
|
||||||
|
{
|
||||||
|
public BinarySlot()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
// /**
|
||||||
|
// * File: BinarySlotContainer.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.types.btree;
|
||||||
|
namespace ln.application.slots
|
||||||
|
{
|
||||||
|
public class BinarySlotContainer
|
||||||
|
{
|
||||||
|
BTree<Guid, BinarySlot> slots = new BTree<Guid, BinarySlot>();
|
||||||
|
|
||||||
|
public BinarySlotContainer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public SlotAllocation RequestSlot(SlotRequest slotRequest)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
// /**
|
||||||
|
// * File: SlotAllocation.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;
|
||||||
|
namespace ln.application.slots
|
||||||
|
{
|
||||||
|
public class SlotAllocation
|
||||||
|
{
|
||||||
|
public long maxchunksize;
|
||||||
|
public byte[] slotidentifier;
|
||||||
|
|
||||||
|
public SlotAllocation()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
// /**
|
||||||
|
// * File: SlotRequest.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;
|
||||||
|
namespace ln.application.slots
|
||||||
|
{
|
||||||
|
public class SlotRequest
|
||||||
|
{
|
||||||
|
public long datasize;
|
||||||
|
public long chunksize;
|
||||||
|
|
||||||
|
public SlotRequest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
www
2
www
|
@ -1 +1 @@
|
||||||
Subproject commit 0de72abc3d46603c95f6986cc8add6cbd0066ea8
|
Subproject commit d1663cbbbe0d91631c4bd6b7b0f7228621329705
|
Loading…
Reference in New Issue