mirror of
https://github.com/project-redbud/FunGame-Server.git
synced 2025-04-22 12:09:36 +08:00
35 lines
836 B
C#
35 lines
836 B
C#
using FunGameServer.Models.Config;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.NetworkInformation;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using FunGame.Core.Api.Model.Enum;
|
|
|
|
namespace FunGameServer.Utils
|
|
{
|
|
public class SocketHelper
|
|
{
|
|
public static int GetType(string msg)
|
|
{
|
|
int index = msg.IndexOf(';') - 1;
|
|
if (index > 0)
|
|
return Convert.ToInt32(msg[..index]);
|
|
else
|
|
return Convert.ToInt32(msg[..1]);
|
|
}
|
|
|
|
public static string GetMessage(string msg)
|
|
{
|
|
int index = msg.IndexOf(';') + 1;
|
|
return msg[index..];
|
|
}
|
|
|
|
public static string MakeMessage(int type, string msg)
|
|
{
|
|
return type + ";" + msg;
|
|
}
|
|
}
|
|
}
|