chore: move to thread application logic, updated logo

This commit is contained in:
2022-05-18 22:17:25 +04:00
parent 8481cb89ad
commit 35ca016520
4 changed files with 22 additions and 9 deletions

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

+14 -6
View File
@@ -16,6 +16,8 @@ namespace Ragon.Core
private readonly ENetServer _socketServer; private readonly ENetServer _socketServer;
private int _roomThreadBalancer = 0; private int _roomThreadBalancer = 0;
private Thread _thread;
public Application(PluginFactory factory, Configuration configuration, int threadsCount) public Application(PluginFactory factory, Configuration configuration, int threadsCount)
{ {
_socketServer = new ENetServer(); _socketServer = new ENetServer();
@@ -29,13 +31,8 @@ namespace Ragon.Core
} }
} }
public void Start() private void Loop()
{ {
_socketServer.Start(_configuration.Server.Port);
foreach (var roomThread in _roomThreads)
roomThread.Start();
while (true) while (true)
{ {
foreach (var roomThread in _roomThreads) foreach (var roomThread in _roomThreads)
@@ -79,6 +76,17 @@ namespace Ragon.Core
} }
} }
public void Start()
{
_socketServer.Start(_configuration.Server.Port);
foreach (var roomThread in _roomThreads)
roomThread.Start();
_thread = new Thread(Loop);
_thread.Start();
}
public void Dispose() public void Dispose()
{ {
foreach (var roomThread in _roomThreads) foreach (var roomThread in _roomThreads)
+6 -2
View File
@@ -1,4 +1,7 @@
using NLog; using System;
using System.Diagnostics;
using System.IO;
using NLog;
namespace Ragon.Core namespace Ragon.Core
{ {
@@ -9,7 +12,8 @@ namespace Ragon.Core
public void Configure(PluginFactory factory) public void Configure(PluginFactory factory)
{ {
_logger.Info("Configure application..."); _logger.Info("Configure application...");
var configuration = ConfigurationLoader.Load("config.json"); var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json");
var configuration = ConfigurationLoader.Load(filePath);
var app = new Application(factory, configuration, 2); var app = new Application(factory, configuration, 2);
app.Start(); app.Start();
} }
+2 -1
View File
@@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="Images/logo.png" width="200" > <img src="Images/ragon-logo.png" width="200" >
</p> </p>
## Ragon Server ## Ragon Server
@@ -37,6 +37,7 @@ Ragon is fully free high perfomance room based game server with plugin based arc
### Requirements ### Requirements
- OSX, Windows, Linux(Ubuntu, Debian) - OSX, Windows, Linux(Ubuntu, Debian)
- .NET 6.0 - .NET 6.0
### Dependencies ### Dependencies
* ENet-Sharp v2.4.8 * ENet-Sharp v2.4.8
* NetStack latest * NetStack latest