초기커밋
This commit is contained in:
155
ServerBase/Network/Packet/PacketCommand.cs
Normal file
155
ServerBase/Network/Packet/PacketCommand.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
namespace ServerBase;
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// ProudNet Packet Header 처리 클래스 이다.
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public class ProudNetPacketCommand : IPacketCommand
|
||||
{
|
||||
private string m_command_key;
|
||||
|
||||
private Type m_packet_action_type;
|
||||
private Type m_command_type;
|
||||
|
||||
public ProudNetPacketCommand(Type packetActionType, Type commandType)
|
||||
{
|
||||
m_packet_action_type = packetActionType;
|
||||
m_command_type = commandType;
|
||||
m_command_key = toKeyString();
|
||||
}
|
||||
|
||||
public override Int32 GetHashCode()
|
||||
{
|
||||
return string.Format(m_command_key).GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object? packetCommand)
|
||||
{
|
||||
var packet_command = packetCommand as ProudNetPacketCommand;
|
||||
if (null == packet_command)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_packet_action_type.Equals(packet_command.getPacketActionType())
|
||||
&& m_command_type.Equals(packet_command.getCommandType()) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string getCommandKey()
|
||||
{
|
||||
return m_command_key;
|
||||
}
|
||||
|
||||
public Type getPacketActionType()
|
||||
{
|
||||
return m_packet_action_type;
|
||||
}
|
||||
|
||||
public Type getCommandType()
|
||||
{
|
||||
return m_command_type;
|
||||
}
|
||||
|
||||
public string toKeyString()
|
||||
{
|
||||
return $"a:{m_packet_action_type.Name.ToString()},c:{m_command_type.Name.ToString()}";
|
||||
}
|
||||
|
||||
public string toBasicString()
|
||||
{
|
||||
return $"AT:{m_packet_action_type.Name.ToString()},CT:{m_command_type.Name.ToString()}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// RabbitMQ Packet Header 처리 클래스 이다.
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public class RabbitMqPacketCommand : IPacketCommand
|
||||
{
|
||||
private string m_command_key;
|
||||
|
||||
private string m_exchange_name;
|
||||
private Type m_command_type;
|
||||
|
||||
public RabbitMqPacketCommand(string exchangeName, Type commandType)
|
||||
{
|
||||
m_exchange_name = exchangeName;
|
||||
m_command_type = commandType;
|
||||
|
||||
m_command_key = toKeyString();
|
||||
}
|
||||
|
||||
public override Int32 GetHashCode()
|
||||
{
|
||||
return string.Format(m_command_key).GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object? packetCommand)
|
||||
{
|
||||
var packet_command = packetCommand as RabbitMqPacketCommand;
|
||||
if (null == packet_command)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_exchange_name.Equals(packet_command.getExchangeName())
|
||||
&& m_command_type.Equals(packet_command.getCommandType()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string getCommandKey()
|
||||
{
|
||||
return m_command_key;
|
||||
}
|
||||
|
||||
public string getExchangeName()
|
||||
{
|
||||
return m_exchange_name;
|
||||
}
|
||||
|
||||
public Type getCommandType()
|
||||
{
|
||||
return m_command_type;
|
||||
}
|
||||
|
||||
public bool msgHook()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public string toKeyString()
|
||||
{
|
||||
return $"e:{m_exchange_name},c:{m_command_type.Name.ToString()}";
|
||||
}
|
||||
|
||||
public string toBasicString()
|
||||
{
|
||||
return $"EN:{m_exchange_name},CT:{m_command_type.Name.ToString()}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user