Shared crée et serveur à jour, pas encore testé
continuous-integration/drone/push Build is failing Details

pull/7/head^2
Bruno DA COSTA CUNHA 2 years ago
parent 553be67324
commit 95fbe12aad

@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{12A97D16-3
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientConsole", "ClientConsole\ClientConsole.csproj", "{33F7C629-F92B-459C-BCC5-6A4601D6D9EA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "Shared\Shared.csproj", "{CA1465F2-A006-4AF6-8231-59DB00963BD0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -47,6 +49,10 @@ Global
{33F7C629-F92B-459C-BCC5-6A4601D6D9EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33F7C629-F92B-459C-BCC5-6A4601D6D9EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33F7C629-F92B-459C-BCC5-6A4601D6D9EA}.Release|Any CPU.Build.0 = Release|Any CPU
{CA1465F2-A006-4AF6-8231-59DB00963BD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA1465F2-A006-4AF6-8231-59DB00963BD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA1465F2-A006-4AF6-8231-59DB00963BD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA1465F2-A006-4AF6-8231-59DB00963BD0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -4,6 +4,9 @@ using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using DataBase.Entity;
using Shared.DTO;
using System.Text.Json;
class Program
{
@ -26,9 +29,11 @@ class Program
{
IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
byte[] receivedData = serverSocket.Receive(ref remoteEndPoint);
string message = Encoding.ASCII.GetString(receivedData);
string fileJson = Encoding.UTF8.GetString(receivedData);
ObjectTransfert<Player> data = JsonSerializer.Deserialize<ObjectTransfert<Player>>(fileJson);
if (message == "Connect")
if (data.Informations.Action == Shared.DTO.Action.Connect)
{
Console.WriteLine("New connection from " + remoteEndPoint.ToString());

@ -0,0 +1,15 @@
using DataBase.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Server
{
public class Room
{
public ICollection<Player> MaxPlayers { get; set; }
public int Port { get; set; }
}
}

@ -7,4 +7,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DataBase\DataBase.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.DTO
{
public enum Action
{
Start,
Connect,
End
}
}

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.DTO
{
public class Informations
{
public Action Action { get; set; }
}
}

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.DTO
{
public class ObjectTransfert<T>
{
public Informations Informations { get; set; }
public T Data { get; set; }
}
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Loading…
Cancel
Save