chore: move to thread application logic, updated logo
This commit is contained in:
@@ -16,6 +16,8 @@ namespace Ragon.Core
|
||||
private readonly ENetServer _socketServer;
|
||||
private int _roomThreadBalancer = 0;
|
||||
|
||||
private Thread _thread;
|
||||
|
||||
public Application(PluginFactory factory, Configuration configuration, int threadsCount)
|
||||
{
|
||||
_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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
foreach (var roomThread in _roomThreads)
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using NLog;
|
||||
|
||||
namespace Ragon.Core
|
||||
{
|
||||
@@ -9,7 +12,8 @@ namespace Ragon.Core
|
||||
public void Configure(PluginFactory factory)
|
||||
{
|
||||
_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);
|
||||
app.Start();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user