you can look now it's fixed

but it still sucks
This commit is contained in:
Malloc of Kuzkycyziklistan 2017-06-08 16:01:34 -05:00
parent 5a54d0c834
commit 8b9cbd0550
17 changed files with 55 additions and 45 deletions

View file

@ -1,8 +0,0 @@
using System;
namespace ClassLibrary1
{
public class Class1
{
}
}

View file

@ -1,7 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -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'))" />
</Target>
<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>
</PropertyGroup>
<Import Project="packages\Fody.2.0.4\build\dotnet\Fody.targets" Condition=" '$(Configuration)' == 'Release' " />

View file

@ -7,13 +7,33 @@ using System.Threading.Tasks;
using System.Numerics;
using Square;
using System.Net;
using Kneesocks.WebSocket;
namespace CircleScape {
class Entrypoint {
static void Main(string[] args) {
foreach()
var server = new Kneesocks.Server<PlayerConnection>(6770, PoolManager.Pending);
server.Start();
Dictionary<int, Server> servers
= 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) {
var send = Console.ReadLine();
@ -24,8 +44,7 @@ namespace CircleScape {
Console.ReadLine();
server.Stop();
PoolManager.Dispose();
//server.Stop();
}
}
}

View file

@ -40,14 +40,14 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Connection.cs" />
<Compile Include="Frame.cs" />
<Compile Include="Handshake.cs" />
<Compile Include="Pool.cs" />
<Compile Include="WebSocket\Connection.cs" />
<Compile Include="WebSocket\Frame.cs" />
<Compile Include="WebSocket\Handshake.cs" />
<Compile Include="WebSocket\Pool.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReadBuffer.cs" />
<Compile Include="Server.cs" />
<Compile Include="Stack.cs" />
<Compile Include="WebSocket\ReadBuffer.cs" />
<Compile Include="WebSocket\Server.cs" />
<Compile Include="WebSocket\Stack.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Square\Square.csproj">
@ -55,6 +55,9 @@
<Name>Square</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="UDP\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.

View file

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Kneesocks")]
[assembly: AssemblyTitle("Kneesocks.WebSocket")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kneesocks")]
[assembly: AssemblyProduct("Kneesocks.WebSocket")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -8,7 +8,7 @@ using Square;
using System.IO;
using System.Net;
namespace Kneesocks {
namespace Kneesocks.WebSocket {
public class Connection {
private bool Initialized = false;

View file

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Square;
namespace Kneesocks {
namespace Kneesocks.WebSocket {
public class Frame {
public enum kClosingReason {
Normal = 1000,

View file

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Square;
namespace Kneesocks {
namespace Kneesocks.WebSocket {
public class Handshake {
private const string HttpVersion = "1.1";
public bool IsRequest = false;

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading;
namespace Kneesocks {
namespace Kneesocks.WebSocket {
public class Pool<T> where T : Connection {
// number of threads that should be started when the pool is created
// these threads will run for as long as the pool exists

View file

@ -5,7 +5,7 @@ using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace Kneesocks {
namespace Kneesocks.WebSocket {
internal class ReadBuffer {
private const int BufferSize = 1024;

View file

@ -6,7 +6,7 @@ using System.Threading;
using System.Net.Sockets;
using System.Net;
namespace Kneesocks {
namespace Kneesocks.WebSocket {
public abstract class Server {
protected TcpListener Socket;
protected Thread Listener = null;
@ -45,8 +45,9 @@ namespace Kneesocks {
while(Started) {
if(Socket.Pending()) {
var templatedConnection = new T();
templatedConnection.Server = this;
var templatedConnection = new T() {
Server = this
};
templatedConnection.Initialize(Socket.AcceptTcpClient());
ConnectionPool.AddConnection(templatedConnection);
}

View file

@ -5,7 +5,7 @@ using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace Kneesocks {
namespace Kneesocks.WebSocket {
internal class Stack<T> where T : Connection {
private Pool<T> PoolRef = null;
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;

View file

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Square.INI {
public class Section : IEnumerable<Instance> {
private List<Instance> Instances;
private List<Instance> Instances = new List<Instance>();
internal Section() { }

View file

@ -22,8 +22,8 @@ namespace Square.INI {
: false;
}
public static implicit operator int(Value value) {
return Int32.TryParse(value.Raw, out int retval)
public static implicit operator Int32(Value value) {
return Int32.TryParse(value.Raw, out Int32 retval)
? retval
: 0;
}

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kneesocks;
using Kneesocks.WebSocket;
using Square;
namespace CircleScape.Socks {

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using Kneesocks;
using Kneesocks.WebSocket;
using Square;
using CircleScape.Encryption;