diff --git a/src/DiIiS-NA/BGS-Server/Battle/BattleClient.cs b/src/DiIiS-NA/BGS-Server/Battle/BattleClient.cs index 77fdd9a..dfc604d 100644 --- a/src/DiIiS-NA/BGS-Server/Battle/BattleClient.cs +++ b/src/DiIiS-NA/BGS-Server/Battle/BattleClient.cs @@ -64,12 +64,7 @@ namespace DiIiS_NA.LoginServer.Battle private Channel _currentChannel; public Channel CurrentChannel { - get - { - if (_currentChannel == null) - _currentChannel = Channels.Values.FirstOrDefault(c => !c.IsChatChannel); - return _currentChannel; - } + get => _currentChannel ??= Channels.Values.FirstOrDefault(c => !c.IsChatChannel); set { if (value == null) @@ -506,10 +501,10 @@ namespace DiIiS_NA.LoginServer.Battle } public void SendMotd() { - if (string.IsNullOrWhiteSpace(Config.Instance.Motd) || !Config.Instance.MotdEnabled) + if (string.IsNullOrWhiteSpace(LoginServerConfig.Instance.Motd) || !LoginServerConfig.Instance.MotdEnabled) return; Logger.Debug($"Motd sent to {Account.BattleTag}."); - SendServerWhisper(Config.Instance.Motd); + SendServerWhisper(LoginServerConfig.Instance.Motd); } public override void ChannelInactive(IChannelHandlerContext context) diff --git a/src/DiIiS-NA/BGS-Server/Config.cs b/src/DiIiS-NA/BGS-Server/LoginServerConfig.cs similarity index 86% rename from src/DiIiS-NA/BGS-Server/Config.cs rename to src/DiIiS-NA/BGS-Server/LoginServerConfig.cs index 5dce015..40649bf 100644 --- a/src/DiIiS-NA/BGS-Server/Config.cs +++ b/src/DiIiS-NA/BGS-Server/LoginServerConfig.cs @@ -1,5 +1,4 @@ -//Blizzless Project 2022 -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,7 +6,7 @@ using System.Threading.Tasks; namespace DiIiS_NA.LoginServer { - public sealed class Config : Core.Config.Config + public sealed class LoginServerConfig : Core.Config.Config { public bool Enabled { @@ -59,9 +58,9 @@ namespace DiIiS_NA.LoginServer set => Set(nameof(Motd), value); } - public static readonly Config Instance = new(); + public static readonly LoginServerConfig Instance = new(); - private Config() : base("Battle-Server") + private LoginServerConfig() : base("Battle-Server") { } } diff --git a/src/DiIiS-NA/BGS-Server/Toons/Toon.cs b/src/DiIiS-NA/BGS-Server/Toons/Toon.cs index d9dcc1c..e5df517 100644 --- a/src/DiIiS-NA/BGS-Server/Toons/Toon.cs +++ b/src/DiIiS-NA/BGS-Server/Toons/Toon.cs @@ -381,7 +381,7 @@ namespace DiIiS_NA.LoginServer.Toons { get { - if (_levelChanged || !Config.Instance.Enabled) + if (_levelChanged || !LoginServerConfig.Instance.Enabled) { _cachedLevel = DBToon.Level; _levelChanged = false; @@ -410,7 +410,7 @@ namespace DiIiS_NA.LoginServer.Toons { get { - if (_paragonLevelChanged || !Config.Instance.Enabled) + if (_paragonLevelChanged || !LoginServerConfig.Instance.Enabled) { _cachedParagonLevel = GameAccount.DBGameAccount.ParagonLevel; _paragonLevelChanged = false; diff --git a/src/DiIiS-NA/REST/Global/Instanse.cs b/src/DiIiS-NA/REST/Global/Instanse.cs deleted file mode 100644 index a991495..0000000 --- a/src/DiIiS-NA/REST/Global/Instanse.cs +++ /dev/null @@ -1,14 +0,0 @@ -using DiIiS_NA.REST.Manager; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DiIiS_NA.REST.Global -{ - public static class Global - { - public static SessionManager SessionMgr { get { return SessionManager.Instance; } } - } -} diff --git a/src/DiIiS-NA/REST/IO/StringArguments.cs b/src/DiIiS-NA/REST/IO/StringArguments.cs index a7c18b6..6657508 100644 --- a/src/DiIiS-NA/REST/IO/StringArguments.cs +++ b/src/DiIiS-NA/REST/IO/StringArguments.cs @@ -199,10 +199,7 @@ namespace DiIiS_NA.REST.IO activeposition++; } - public char this[int index] - { - get { return activestring[index]; } - } + public char this[int index] => activestring[index]; public string GetString() { diff --git a/src/DiIiS-NA/REST/IO/Zlib/Deflate.cs b/src/DiIiS-NA/REST/IO/Zlib/Deflate.cs index 0758f43..b756612 100644 --- a/src/DiIiS-NA/REST/IO/Zlib/Deflate.cs +++ b/src/DiIiS-NA/REST/IO/Zlib/Deflate.cs @@ -46,12 +46,20 @@ namespace DiIiS_NA.REST.IO.Zlib struct ct_data { ushort freq; - public ushort Freq { get { return freq; } set { freq = value; } } // frequency count - public ushort Code { get { return freq; } set { freq = value; } } // bit string + public ushort Freq { get => freq; + set => freq = value; + } // frequency count + public ushort Code { get => freq; + set => freq = value; + } // bit string ushort dad; - public ushort Dad { get { return dad; } set { dad = value; } } // father node in Huffman tree - public ushort Len { get { return dad; } set { dad = value; } } // length of bit string + public ushort Dad { get => dad; + set => dad = value; + } // father node in Huffman tree + public ushort Len { get => dad; + set => dad = value; + } // length of bit string public ct_data(ushort freq, ushort dad) { diff --git a/src/DiIiS-NA/REST/Manager/SessionManager.cs b/src/DiIiS-NA/REST/Manager/SessionManager.cs index 4304ed0..d795f27 100644 --- a/src/DiIiS-NA/REST/Manager/SessionManager.cs +++ b/src/DiIiS-NA/REST/Manager/SessionManager.cs @@ -14,13 +14,13 @@ namespace DiIiS_NA.REST.Manager public bool Initialize() { - int _port = Config.Instance.Port; + int _port = RestConfig.Instance.Port; if (_port < 0 || _port > 0xFFFF) { _port = 8081; } - string configuredAddress = Config.Instance.IP; + string configuredAddress = RestConfig.Instance.IP; IPAddress address; if (!IPAddress.TryParse(configuredAddress, out address)) { @@ -28,7 +28,7 @@ namespace DiIiS_NA.REST.Manager } _externalAddress = new IPEndPoint(address, _port); - configuredAddress = Config.Instance.IP; + configuredAddress = RestConfig.Instance.IP; if (!IPAddress.TryParse(configuredAddress, out address)) { return false; diff --git a/src/DiIiS-NA/REST/RestSession.cs b/src/DiIiS-NA/REST/RestSession.cs index 73e5e64..ef945eb 100644 --- a/src/DiIiS-NA/REST/RestSession.cs +++ b/src/DiIiS-NA/REST/RestSession.cs @@ -16,6 +16,7 @@ using System.Net.Security; using System.Web; using DiIiS_NA.GameServer.MessageSystem; using DiIiS_NA.REST.Data.Forms; +using DiIiS_NA.REST.Manager; namespace DiIiS_NA.REST { @@ -74,7 +75,7 @@ namespace DiIiS_NA.REST public void HandleConnectRequest(HttpHeader request) { - SendResponse(HttpCode.OK, Global.Global.SessionMgr.GetFormInput()); + SendResponse(HttpCode.OK, SessionManager.Instance.GetFormInput()); } public void HandleInfoRequest(HttpHeader request)