161 lines
5.8 KiB
C#
161 lines
5.8 KiB
C#
//using System.Configuration;
|
|
//using ServerCore; using ServerBase;
|
|
//using System.Runtime.InteropServices;
|
|
//using CommandLine;
|
|
//using ServerCommon;
|
|
//using Nettention.Proud;
|
|
//using System.Diagnostics;
|
|
//using System.Reflection;
|
|
//using Amazon.Runtime.Internal.Util;
|
|
//using System.Threading;
|
|
//using ControlCenter.NamedPipe;
|
|
//using Google.Protobuf.WellKnownTypes;
|
|
//using ServerControlCenter;
|
|
|
|
|
|
//namespace GameServer
|
|
//{
|
|
// class Options
|
|
// {
|
|
// [Option("port", Default = (int)9200)]
|
|
// public int Port { get; set; }
|
|
|
|
// [Option("config", Default = "ServerConfig.json")]
|
|
// public string Config { get; set; } = string.Empty;
|
|
|
|
// [Option("type", Default = 0)]
|
|
// public int Type { get; set; } = 0;
|
|
|
|
// [Option("worldid", Default = 1)]
|
|
// public int worldid { get; set; } = 1;
|
|
|
|
// [Option("channel", Default = 0)]
|
|
// public int channel { get; set; } = 1;
|
|
|
|
// [Option("default", Default = 0)]
|
|
// public int DefaultMaxUser { get; set; } = 0;
|
|
// }
|
|
|
|
|
|
|
|
// public class Program
|
|
// {
|
|
// //public NetServer _srv { get; } = new NetServer();
|
|
// //PClientToGame.Stub _stub = new PClientToGame.Stub();
|
|
|
|
|
|
|
|
// static GameServer gameServer = GameServer.Instance;
|
|
|
|
// public static async Task ExitMain(bool isExit = false)
|
|
// {
|
|
// Log.getLogger().info("ExitMain");
|
|
|
|
// try
|
|
// {
|
|
// await gameServer.StopServer();
|
|
// GameServerApp.Instance.Stop();
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// Log.getLogger().error($"{nameof(ExitMain)}: Exception - {e}");
|
|
// }
|
|
// finally
|
|
// {
|
|
// if (isExit)
|
|
// {
|
|
// Environment.Exit(0);
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// static async Task<int> Main(string[] args)
|
|
// {
|
|
// System.Threading.ThreadPool.GetMinThreads(out int workerThreads, out int completionPortThreads);
|
|
// int updateMinWorkerThreads = 128;
|
|
// int updateCompletionPortThreads = 128;
|
|
// System.Threading.ThreadPool.SetMinThreads(updateMinWorkerThreads, updateCompletionPortThreads);
|
|
// System.Threading.ThreadPool.GetMinThreads(out int outWorkerThreads, out int outCompletionPortThreads);
|
|
// Log.getLogger().info($"MinWorkerThreadCount = {outWorkerThreads}, outCompletionPortThreadsCount = {outCompletionPortThreads}");
|
|
|
|
// // SIGINT에 반응
|
|
// Console.CancelKeyPress += async (s, e) =>
|
|
// {
|
|
// await ExitMain();
|
|
// };
|
|
|
|
// // 프로세스 종료에 반응
|
|
// AppDomain.CurrentDomain.ProcessExit += async (s, e) =>
|
|
// {
|
|
// await ExitMain();
|
|
// };
|
|
|
|
// BusinessLogger.setup( new NLogAppender("./Config/nlog.config")
|
|
// , new JsonText()
|
|
// , LogTransToOutputType.TransToMultyLine );
|
|
|
|
|
|
// try
|
|
// {
|
|
// _ = await Parser.Default.ParseArguments<Options>(args)
|
|
// .MapResult(async (Options opts) =>
|
|
// {
|
|
// await GameServerApp.Instance.Init(opts.Config, opts.Type);
|
|
|
|
// //IMG서버들은 config파일의 ip와 비교해서 실행되지 않도록함.
|
|
// if (GameServerApp.Instance.Config.ServiceType != "Dev")
|
|
// {
|
|
// if (ServerUtil.GetPublicIPv4() == GameServerApp.Instance.Config.EC2TemplateIMG)
|
|
// {
|
|
// return 0;
|
|
// }
|
|
// }
|
|
|
|
// var type = opts.Type == 1 ? ServerType.Indun : ServerType.Game;
|
|
// GameServerApp.Instance.Config.DefaultMaxUser = opts.DefaultMaxUser > 0 ? opts.DefaultMaxUser : GameServerApp.Instance.Config.DefaultMaxUser;
|
|
// await NamedPipeMonitor.StartNamedPipeService(GameServerApp.Instance.Config.ControlAgentEnable, type, opts.Port, GameServerApp.Instance.Config.DefaultMaxUser, opts.channel);
|
|
|
|
// TableData.Instance.LoadTableAll();
|
|
// MapDataTable.Instance.Load();
|
|
// MapManager.Instance.Load();
|
|
// QuestManager.Instance.Load();
|
|
|
|
// await LandManager.Instance.LoadDB();
|
|
// await BuildingManager.Instance.LoadDB();
|
|
|
|
// await AccountAuthorityManager.Instance.LoadDB(GameServerApp.Instance.MainDB);
|
|
|
|
// await SystemMailManager.Instance.LoadSystemMail();
|
|
// await NoticeChatManager.Instance.LoadNoticeChat();
|
|
|
|
// await gameServer.StartServer(opts);
|
|
|
|
// Log.getLogger().info($"Game Server Start GameType:{GameServerApp.Instance.Config.GameServerType}");
|
|
// await NamedPipeMonitor.ChangeServerStatus(ServerStatus.Running);
|
|
|
|
// Task? runningTask = gameServer.Running();
|
|
// if (runningTask == null)
|
|
// {
|
|
// await NamedPipeMonitor.SetStopReason(StopReason.CannotRunning);
|
|
// return -1;
|
|
// }
|
|
|
|
// await runningTask;
|
|
// return 0;
|
|
// },
|
|
// errs => Task.FromResult(-1));
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// // 차후에 자신의 서버 정보에 상세히 남길 수 있도록 수정해야 한다. - kangms
|
|
// ServerLog.Fatal($"Exception GameServer !!! : errDesc:{e.Message}, GameServerTpe:{GameServerApp.Instance.Config.GameServerType}");
|
|
// }
|
|
|
|
|
|
// Log.getLogger().info("Game Server End");
|
|
// ServerLog.End();
|
|
// return 0;
|
|
// }
|
|
// }
|
|
//}
|