Small changes relating to config class names.

This commit is contained in:
Lucca Faria Ferri 2023-02-06 10:27:38 -08:00
parent 6b5fcda1dd
commit a0ddd8f8c9
8 changed files with 27 additions and 41 deletions

View File

@ -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)

View File

@ -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")
{
}
}

View File

@ -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;

View File

@ -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; } }
}
}

View File

@ -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()
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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)