Skip to content

Commit

Permalink
Review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanYappert committed Nov 15, 2024
1 parent 702cfa5 commit 4293f92
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 31 deletions.
3 changes: 0 additions & 3 deletions Arrowgene.Ddon.GameServer/RpcManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,13 @@ public RpcManager(DdonGameServer server)
Id = x.Id,
Name = x.Name,
Brief = x.Brief,
TrafficName = x.TrafficName,
TrafficLevel = x.TrafficLevel,
MaxLoginNum = x.MaxLoginNum,
LoginNum = x.LoginNum,
Addr = x.Addr,
Port = x.Port,
IsHide = x.IsHide,
RpcPort = x.RpcPort,
RpcAuthToken = x.RpcAuthToken,
IsHead = x.IsHead,
});
CharacterTrackingMap = new();
foreach (var info in ChannelInfo.Values)
Expand Down
4 changes: 2 additions & 2 deletions Arrowgene.Ddon.Rpc.Web/Route/ServerStatusRoute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public override RpcCommandResult Execute(DdonGameServer gameServer)
Id = server.Id,
Name = server.Name,
Brief = server.Brief,
TrafficName = server.TrafficName,
TrafficLevel = server.TrafficLevel,
TrafficName = string.Empty,
TrafficLevel = 0,
MaxLoginNum = server.MaxLoginNum,
LoginNum = (uint)connections.Count(x => x.ServerId == server.Id && x.Type == ConnectionType.GameServer),
Addr = server.Addr,
Expand Down
20 changes: 7 additions & 13 deletions Arrowgene.Ddon.Shared/Csv/GameServerListInfoCsv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,31 @@ namespace Arrowgene.Ddon.Shared.Csv;

public class GameServerListInfoCsv : CsvReaderWriter<ServerInfo>
{
protected override int NumExpectedItems => 12;
protected override int NumExpectedItems => 9;
protected override ServerInfo CreateInstance(string[] properties)
{
if (!ushort.TryParse(properties[0], out ushort id)) return null;
string name = properties[1];
string brief = properties[2];
string trafficName = properties[3];
if (!uint.TryParse(properties[4], out uint trafficLevel)) return null;
if (!uint.TryParse(properties[5], out uint maxLoginNum)) return null;
string address = properties[6];
if (!ushort.TryParse(properties[7], out ushort port)) return null;
if (!bool.TryParse(properties[8], out bool isHide)) return null;
if (!ushort.TryParse(properties[9], out ushort rpcPort)) return null;
string authToken = properties[10];
if (!bool.TryParse(properties[11], out bool isHead)) return null;
if (!uint.TryParse(properties[3], out uint maxLoginNum)) return null;
string address = properties[4];
if (!ushort.TryParse(properties[5], out ushort port)) return null;
if (!bool.TryParse(properties[6], out bool isHide)) return null;
if (!ushort.TryParse(properties[7], out ushort rpcPort)) return null;
string authToken = properties[8];

return new ServerInfo()
{
Id = id,
Name = name,
Brief = brief,
TrafficName = trafficName,
TrafficLevel = trafficLevel,
MaxLoginNum = maxLoginNum,
LoginNum = 0, // Current Players
Addr = address,
Port = port,
IsHide = isHide,
RpcPort = rpcPort,
RpcAuthToken = authToken,
IsHead = isHead
};
}
}
4 changes: 2 additions & 2 deletions Arrowgene.Ddon.Shared/Files/Assets/GameServerList.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Id,Name,Brief,TrafficName,TrafficLevel,MaxLoginNum,IpAddress,Port,IsHide,RpcPort,RpcAuth,IsHead
10,Local Host,Brief,Traffic Name,0,1000,127.0.0.1,52000,false,52099,AuthToken,true
#Id,Name,Brief,MaxLoginNum,IpAddress,Port,IsHide,RpcPort,RpcAuth
10,Local Host,Brief,1000,127.0.0.1,52000,false,52099,AuthToken
13 changes: 2 additions & 11 deletions Arrowgene.Ddon.Shared/Model/ServerInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Arrowgene.Ddon.Shared.Entity.Structure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Arrowgene.Ddon.Shared.Model
{
Expand All @@ -13,23 +8,19 @@ public ServerInfo()
{
Name = string.Empty;
Brief = string.Empty;
TrafficName = string.Empty;
RpcAuthToken = string.Empty;
}

public ushort Id { get; set; }
public string Name { get; set; }
public string Brief { get; set; }
public string TrafficName { get; set; }
public uint TrafficLevel { get; set; }
public uint MaxLoginNum { get; set; }
public uint LoginNum { get; set; }
public string Addr { get; set; }
public ushort Port { get; set; }
public bool IsHide { get; set; }
public ushort RpcPort { get; set; }
public string RpcAuthToken { get; set; }
public bool IsHead { get; set; }

public CDataGameServerListInfo ToCDataGameServerListInfo()
{
Expand All @@ -38,8 +29,8 @@ public CDataGameServerListInfo ToCDataGameServerListInfo()
Id = Id,
Name = Name,
Brief = Brief,
TrafficName = TrafficName,
TrafficLevel = TrafficLevel,
TrafficName = string.Empty,
TrafficLevel = 0,
MaxLoginNum = MaxLoginNum,
LoginNum = LoginNum,
Addr = Addr,
Expand Down

0 comments on commit 4293f92

Please sign in to comment.