Skip to content

Commit

Permalink
Merge pull request #2020 from nicoschmitt/refactorwebsocket
Browse files Browse the repository at this point in the history
Refactor WebSocket Handler
  • Loading branch information
BornSupercharged authored Aug 2, 2016
2 parents f89ec85 + 712cfdf commit 412e51a
Show file tree
Hide file tree
Showing 24 changed files with 56 additions and 101 deletions.
42 changes: 20 additions & 22 deletions PoGo.NecroBot.CLI/PoGo.NecroBot.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,31 +110,29 @@
<Compile Include="SimpleSession.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Events\WebResponce.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Events\EggListResponce.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Events\ItemListResponce.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Events\TrainerProfileResponce.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\GetEggListHandler.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\GetItemsListHandler.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\GetPokemonSettingsHandler.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\GetTrainerProfileHandler.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Helpers\TrainerProfileWeb.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Tasks\GetPokemonSettingsTask.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Tasks\GetTrainerProfileTask.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Tasks\EvolvePokemonTask.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Tasks\TransferPokemonTask.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\EvolvePokemonHandler.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\TransferPokemonHandler.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Helpers\EggListWeb.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Tasks\GetEggListTask.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Tasks\GetItemListTask.cs" />
<Compile Include="WebSocketHandler\GetCommands\Events\WebResponce.cs" />
<Compile Include="WebSocketHandler\GetCommands\Events\EggListResponce.cs" />
<Compile Include="WebSocketHandler\GetCommands\Events\ItemListResponce.cs" />
<Compile Include="WebSocketHandler\GetCommands\Events\TrainerProfileResponce.cs" />
<Compile Include="WebSocketHandler\GetCommands\GetEggListHandler.cs" />
<Compile Include="WebSocketHandler\GetCommands\GetItemsListHandler.cs" />
<Compile Include="WebSocketHandler\GetCommands\GetPokemonSettingsHandler.cs" />
<Compile Include="WebSocketHandler\GetCommands\GetTrainerProfileHandler.cs" />
<Compile Include="WebSocketHandler\GetCommands\Helpers\TrainerProfileWeb.cs" />
<Compile Include="WebSocketHandler\GetCommands\Tasks\GetPokemonSettingsTask.cs" />
<Compile Include="WebSocketHandler\GetCommands\Tasks\GetTrainerProfileTask.cs" />
<Compile Include="WebSocketHandler\ActionCommands\EvolvePokemonHandler.cs" />
<Compile Include="WebSocketHandler\ActionCommands\TransferPokemonHandler.cs" />
<Compile Include="WebSocketHandler\GetCommands\Helpers\EggListWeb.cs" />
<Compile Include="WebSocketHandler\GetCommands\Tasks\GetEggListTask.cs" />
<Compile Include="WebSocketHandler\GetCommands\Tasks\GetItemListTask.cs" />
<Compile Include="WebSocketHandler\EncodingHelper.cs" />
<Compile Include="WebSocketHandler\IWebSocketResponce.cs" />
<Compile Include="WebSocketHandler\IWebSocketRequestHandler.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Events\PokemonListResponce.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Helpers\PokemonListWeb.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\GetPokemonListHandler.cs" />
<Compile Include="WebSocketHandler\BasicGetCommands\Tasks\GetPokemonListTask.cs" />
<Compile Include="WebSocketHandler\GetCommands\Events\PokemonListResponce.cs" />
<Compile Include="WebSocketHandler\GetCommands\Helpers\PokemonListWeb.cs" />
<Compile Include="WebSocketHandler\GetCommands\GetPokemonListHandler.cs" />
<Compile Include="WebSocketHandler\GetCommands\Tasks\GetPokemonListTask.cs" />
<Compile Include="WebSocketHandler\WebSocketEventManager.cs" />
<Compile Include="WebSocketInterface.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using System.Text;
using System.Threading.Tasks;
using SuperSocket.WebSocket;
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks;
using PoGo.NecroBot.Logic.State;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands
namespace PoGo.NecroBot.CLI.WebSocketHandler.ActionCommands
{
public class EvolvePokemonHandler : IWebSocketRequestHandler
{
Expand All @@ -20,7 +20,7 @@ public EvolvePokemonHandler()

public async Task Handle(ISession session, WebSocketSession webSocketSession, dynamic message)
{
await EvolvePokemonTask.Execute(session, webSocketSession, (ulong)message.PokemonId, (string)message.RequestID);
await Logic.Tasks.EvolveSpecificPokemonTask.Execute(session, (ulong)message.PokemonId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using System.Text;
using System.Threading.Tasks;
using SuperSocket.WebSocket;
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks;
using PoGo.NecroBot.Logic.State;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands
namespace PoGo.NecroBot.CLI.WebSocketHandler.ActionCommands
{
public class TransferPokemonHandler : IWebSocketRequestHandler
{
Expand All @@ -20,7 +20,7 @@ public TransferPokemonHandler()

public async Task Handle(ISession session, WebSocketSession webSocketSession, dynamic message)
{
await TransferPokemonTask.Execute(session, webSocketSession, (ulong)message.PokemonId, (string)message.RequestID);
await Logic.Tasks.TransferPokemonTask.Execute(session, (ulong)message.PokemonId);
}
}
}

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion PoGo.NecroBot.CLI/WebSocketHandler/EncodingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace PoGo.NecroBot.CLI.WebSocketHandler
{
class EncodingHelper
{

public static string Serialize(dynamic evt)
{
var jsonSerializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events
{
public class EggListResponce : IWebSocketResponce
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events
{
class ItemListResponce : IWebSocketResponce
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events
{
public class PokemonListResponce : IWebSocketResponce, IEvent
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events
{
class TrainerProfileResponce : IWebSocketResponce
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events
{
public class WebResponce : IWebSocketResponce
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks;
using PoGo.NecroBot.Logic.State;
using SuperSocket.WebSocket;
using System;
Expand All @@ -7,7 +7,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands
{
class GetEggListHandler : IWebSocketRequestHandler
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks;
using PoGo.NecroBot.Logic.State;
using SuperSocket.WebSocket;
using System;
Expand All @@ -7,7 +7,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands
{
class GetItemsListHandler : IWebSocketRequestHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using System.Text;
using System.Threading.Tasks;
using SuperSocket.WebSocket;
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks;
using PoGo.NecroBot.Logic.State;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands
{
public class GetPokemonListHandler : IWebSocketRequestHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using System.Text;
using System.Threading.Tasks;
using SuperSocket.WebSocket;
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks;
using PoGo.NecroBot.Logic.State;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands
{
public class GetPokemonSettingsHandler : IWebSocketRequestHandler
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks;
using PoGo.NecroBot.Logic.State;
using SuperSocket.WebSocket;
using System;
Expand All @@ -7,7 +7,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands
{
class GetTrainerProfileHandler : IWebSocketRequestHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Helpers
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Helpers
{
class EggListWeb
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands
{
public class PokemonListWeb
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Helpers
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Helpers
{
class TrainerProfileWeb
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events;
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Helpers;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Helpers;
using PoGo.NecroBot.Logic.State;
using POGOProtos.Inventory.Item;
using SuperSocket.WebSocket;
Expand All @@ -9,7 +9,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks
{
class GetEggListTask
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events;
using PoGo.NecroBot.Logic.State;
using SuperSocket.WebSocket;
using System;
Expand All @@ -7,7 +7,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks
{
class GetItemListTask
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events;
using PoGo.NecroBot.Logic.State;
using SuperSocket.WebSocket;
using System;
Expand All @@ -7,7 +7,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks
{
class GetPokemonListTask
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events;
using PoGo.NecroBot.Logic.State;
using SuperSocket.WebSocket;
using System;
Expand All @@ -7,7 +7,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks
{
class GetPokemonSettingsTask
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events;
using PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Helpers;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Events;
using PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Helpers;
using PoGo.NecroBot.Logic.State;
using SuperSocket.WebSocket;
using System;
Expand All @@ -8,7 +8,7 @@
using System.Text;
using System.Threading.Tasks;

namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks
namespace PoGo.NecroBot.CLI.WebSocketHandler.GetCommands.Tasks
{
class GetTrainerProfileTask
{
Expand Down

0 comments on commit 412e51a

Please sign in to comment.