mirror of
https://github.com/project-redbud/FunGame-Server.git
synced 2025-04-22 12:09:36 +08:00
45 lines
1.2 KiB
C#
45 lines
1.2 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 WriteLine(string? msg)
|
||
{
|
||
Console.Write("\r" + GetPrefix() + msg + "\n\r> ");
|
||
}
|
||
|
||
public static void Type()
|
||
{
|
||
Console.Write("\r> ");
|
||
}
|
||
|
||
public static string GetServerNotice()
|
||
{
|
||
try
|
||
{
|
||
string? ServerNotice = (string?)Config.DefaultAssemblyHelper.GetFunGameCoreValue((int)InterfaceType.ServerInterface, (int)InterfaceMethod.ServerNotice);
|
||
if (ServerNotice != null)
|
||
return ServerNotice;
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
ServerHelper.WriteLine(e.StackTrace);
|
||
}
|
||
return "";
|
||
}
|
||
}
|
||
}
|