you can look now it's fixed
but it still sucks
This commit is contained in:
parent
5a54d0c834
commit
8b9cbd0550
17 changed files with 55 additions and 45 deletions
|
@ -1,8 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace ClassLibrary1
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netstandard1.4</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
|
@ -141,7 +141,8 @@
|
||||||
<Error Condition="!Exists('packages\Costura.Fody.1.4.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.1.4.0\build\Costura.Fody.targets'))" />
|
<Error Condition="!Exists('packages\Costura.Fody.1.4.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.1.4.0\build\Costura.Fody.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>XCOPY "$(ProjectDir)Assets" "$(TargetDir)" /Y /E
|
<PostBuildEvent>mkdir "$(TargetDir)Assets"
|
||||||
|
XCOPY "$(ProjectDir)Assets" "$(TargetDir)Assets" /Y /E
|
||||||
COPY "$(ProjectDir)config.ini" "$(TargetDir)" /Y</PostBuildEvent>
|
COPY "$(ProjectDir)config.ini" "$(TargetDir)" /Y</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="packages\Fody.2.0.4\build\dotnet\Fody.targets" Condition=" '$(Configuration)' == 'Release' " />
|
<Import Project="packages\Fody.2.0.4\build\dotnet\Fody.targets" Condition=" '$(Configuration)' == 'Release' " />
|
||||||
|
|
|
@ -7,13 +7,33 @@ using System.Threading.Tasks;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Square;
|
using Square;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using Kneesocks.WebSocket;
|
||||||
|
|
||||||
namespace CircleScape {
|
namespace CircleScape {
|
||||||
class Entrypoint {
|
class Entrypoint {
|
||||||
static void Main(string[] args) {
|
static void Main(string[] args) {
|
||||||
foreach()
|
|
||||||
var server = new Kneesocks.Server<PlayerConnection>(6770, PoolManager.Pending);
|
Dictionary<int, Server> servers
|
||||||
server.Start();
|
= new Dictionary<int, Server>();
|
||||||
|
Dictionary<int, Pool<PlayerConnection>> pools
|
||||||
|
= new Dictionary<int, Pool<PlayerConnection>>();
|
||||||
|
|
||||||
|
foreach(var server in Configuration.Servers) {
|
||||||
|
var pool = new Pool<PlayerConnection> {
|
||||||
|
InitialCount = 3,
|
||||||
|
InitialSize = 3,
|
||||||
|
SizeGrowth = 3,
|
||||||
|
MaxSize = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
pools.Add(server["Id"], pool);
|
||||||
|
servers.Add(server["Id"], new Server<PlayerConnection>((ushort)server["Port"], pool, server));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//var server = new Server<PlayerConnection>(6770, PoolManager.Pending);
|
||||||
|
//server.Start();
|
||||||
|
|
||||||
/*while(true) {
|
/*while(true) {
|
||||||
var send = Console.ReadLine();
|
var send = Console.ReadLine();
|
||||||
|
@ -24,8 +44,7 @@ namespace CircleScape {
|
||||||
|
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
|
|
||||||
server.Stop();
|
//server.Stop();
|
||||||
PoolManager.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,14 +40,14 @@
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Connection.cs" />
|
<Compile Include="WebSocket\Connection.cs" />
|
||||||
<Compile Include="Frame.cs" />
|
<Compile Include="WebSocket\Frame.cs" />
|
||||||
<Compile Include="Handshake.cs" />
|
<Compile Include="WebSocket\Handshake.cs" />
|
||||||
<Compile Include="Pool.cs" />
|
<Compile Include="WebSocket\Pool.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ReadBuffer.cs" />
|
<Compile Include="WebSocket\ReadBuffer.cs" />
|
||||||
<Compile Include="Server.cs" />
|
<Compile Include="WebSocket\Server.cs" />
|
||||||
<Compile Include="Stack.cs" />
|
<Compile Include="WebSocket\Stack.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Square\Square.csproj">
|
<ProjectReference Include="..\Square\Square.csproj">
|
||||||
|
@ -55,6 +55,9 @@
|
||||||
<Name>Square</Name>
|
<Name>Square</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="UDP\" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Kneesocks")]
|
[assembly: AssemblyTitle("Kneesocks.WebSocket")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("Kneesocks")]
|
[assembly: AssemblyProduct("Kneesocks.WebSocket")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
|
@ -8,7 +8,7 @@ using Square;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace Kneesocks {
|
namespace Kneesocks.WebSocket {
|
||||||
public class Connection {
|
public class Connection {
|
||||||
private bool Initialized = false;
|
private bool Initialized = false;
|
||||||
|
|
|
@ -5,7 +5,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Square;
|
using Square;
|
||||||
|
|
||||||
namespace Kneesocks {
|
namespace Kneesocks.WebSocket {
|
||||||
public class Frame {
|
public class Frame {
|
||||||
public enum kClosingReason {
|
public enum kClosingReason {
|
||||||
Normal = 1000,
|
Normal = 1000,
|
|
@ -5,7 +5,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Square;
|
using Square;
|
||||||
|
|
||||||
namespace Kneesocks {
|
namespace Kneesocks.WebSocket {
|
||||||
public class Handshake {
|
public class Handshake {
|
||||||
private const string HttpVersion = "1.1";
|
private const string HttpVersion = "1.1";
|
||||||
public bool IsRequest = false;
|
public bool IsRequest = false;
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Kneesocks {
|
namespace Kneesocks.WebSocket {
|
||||||
public class Pool<T> where T : Connection {
|
public class Pool<T> where T : Connection {
|
||||||
// number of threads that should be started when the pool is created
|
// number of threads that should be started when the pool is created
|
||||||
// these threads will run for as long as the pool exists
|
// these threads will run for as long as the pool exists
|
|
@ -5,7 +5,7 @@ using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Kneesocks {
|
namespace Kneesocks.WebSocket {
|
||||||
internal class ReadBuffer {
|
internal class ReadBuffer {
|
||||||
private const int BufferSize = 1024;
|
private const int BufferSize = 1024;
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.Threading;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace Kneesocks {
|
namespace Kneesocks.WebSocket {
|
||||||
public abstract class Server {
|
public abstract class Server {
|
||||||
protected TcpListener Socket;
|
protected TcpListener Socket;
|
||||||
protected Thread Listener = null;
|
protected Thread Listener = null;
|
||||||
|
@ -45,8 +45,9 @@ namespace Kneesocks {
|
||||||
|
|
||||||
while(Started) {
|
while(Started) {
|
||||||
if(Socket.Pending()) {
|
if(Socket.Pending()) {
|
||||||
var templatedConnection = new T();
|
var templatedConnection = new T() {
|
||||||
templatedConnection.Server = this;
|
Server = this
|
||||||
|
};
|
||||||
templatedConnection.Initialize(Socket.AcceptTcpClient());
|
templatedConnection.Initialize(Socket.AcceptTcpClient());
|
||||||
ConnectionPool.AddConnection(templatedConnection);
|
ConnectionPool.AddConnection(templatedConnection);
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Kneesocks {
|
namespace Kneesocks.WebSocket {
|
||||||
internal class Stack<T> where T : Connection {
|
internal class Stack<T> where T : Connection {
|
||||||
private Pool<T> PoolRef = null;
|
private Pool<T> PoolRef = null;
|
||||||
private List<T> Clients = new List<T>();
|
private List<T> Clients = new List<T>();
|
||||||
|
@ -64,7 +64,8 @@ namespace Kneesocks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep(10);
|
// TODO consider changing this later
|
||||||
|
Thread.Sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Finished = true;
|
Finished = true;
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Square.INI {
|
namespace Square.INI {
|
||||||
public class Section : IEnumerable<Instance> {
|
public class Section : IEnumerable<Instance> {
|
||||||
private List<Instance> Instances;
|
private List<Instance> Instances = new List<Instance>();
|
||||||
|
|
||||||
internal Section() { }
|
internal Section() { }
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ namespace Square.INI {
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator int(Value value) {
|
public static implicit operator Int32(Value value) {
|
||||||
return Int32.TryParse(value.Raw, out int retval)
|
return Int32.TryParse(value.Raw, out Int32 retval)
|
||||||
? retval
|
? retval
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Kneesocks;
|
using Kneesocks.WebSocket;
|
||||||
using Square;
|
using Square;
|
||||||
|
|
||||||
namespace CircleScape.Socks {
|
namespace CircleScape.Socks {
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Kneesocks;
|
using Kneesocks.WebSocket;
|
||||||
using Square;
|
using Square;
|
||||||
using CircleScape.Encryption;
|
using CircleScape.Encryption;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue