mirror of
https://github.com/project-redbud/FunGame-Server.git
synced 2025-04-21 03:29:38 +08:00
48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using FunGameServer.Models.Config;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using static FunGame.Core.Api.Model.Enum.CommonEnums;
|
||
|
||
namespace FunGameServer.Utils
|
||
{
|
||
public class ServerHelper
|
||
{
|
||
public static string GetPrefix()
|
||
{
|
||
DateTime now = System.DateTime.Now;
|
||
return now.AddMilliseconds(-now.Millisecond).ToString() + " " + Config.SERVER_NAME + ":";
|
||
}
|
||
|
||
public static void Error(Exception e)
|
||
{
|
||
Console.Write("\r" + GetPrefix() + e.Message + "\n" + e.StackTrace + "\n\r> ");
|
||
}
|
||
|
||
public static void WriteLine(string? msg)
|
||
{
|
||
Console.Write("\r" + GetPrefix() + msg + "\n\r> ");
|
||
}
|
||
|
||
public static void Type()
|
||
{
|
||
Console.Write("\r> ");
|
||
}
|
||
|
||
public static string GetServerNotice()
|
||
{
|
||
try
|
||
{
|
||
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
ServerHelper.WriteLine(e.StackTrace);
|
||
}
|
||
return "";
|
||
}
|
||
}
|
||
}
|