C# 9 Cleanup (#325)
- [X] Removes EventArgs - not needed - [X] Merges sequential checks - [X] Removes redundant type declarations
This commit is contained in:
parent
351611a23a
commit
3551d962f7
417 changed files with 2209 additions and 2213 deletions
|
|
@ -19,22 +19,22 @@ namespace Server.Network
|
|||
{
|
||||
public partial class NetState
|
||||
{
|
||||
private static readonly ClientVersion m_Version400a = new ClientVersion("4.0.0a");
|
||||
private static readonly ClientVersion m_Version407a = new ClientVersion("4.0.7a");
|
||||
private static readonly ClientVersion m_Version500a = new ClientVersion("5.0.0a");
|
||||
private static readonly ClientVersion m_Version502b = new ClientVersion("5.0.2b");
|
||||
private static readonly ClientVersion m_Version6000 = new ClientVersion("6.0.0.0");
|
||||
private static readonly ClientVersion m_Version6017 = new ClientVersion("6.0.1.7");
|
||||
private static readonly ClientVersion m_Version60142 = new ClientVersion("6.0.14.2");
|
||||
private static readonly ClientVersion m_Version7000 = new ClientVersion("7.0.0.0");
|
||||
private static readonly ClientVersion m_Version7090 = new ClientVersion("7.0.9.0");
|
||||
private static readonly ClientVersion m_Version70130 = new ClientVersion("7.0.13.0");
|
||||
private static readonly ClientVersion m_Version70160 = new ClientVersion("7.0.16.0");
|
||||
private static readonly ClientVersion m_Version70300 = new ClientVersion("7.0.30.0");
|
||||
private static readonly ClientVersion m_Version70331 = new ClientVersion("7.0.33.1");
|
||||
private static readonly ClientVersion m_Version704565 = new ClientVersion("7.0.45.65");
|
||||
private static readonly ClientVersion m_Version70500 = new ClientVersion("7.0.50.0");
|
||||
private static readonly ClientVersion m_Version70610 = new ClientVersion("7.0.61.0");
|
||||
private static readonly ClientVersion m_Version400a = new("4.0.0a");
|
||||
private static readonly ClientVersion m_Version407a = new("4.0.7a");
|
||||
private static readonly ClientVersion m_Version500a = new("5.0.0a");
|
||||
private static readonly ClientVersion m_Version502b = new("5.0.2b");
|
||||
private static readonly ClientVersion m_Version6000 = new("6.0.0.0");
|
||||
private static readonly ClientVersion m_Version6017 = new("6.0.1.7");
|
||||
private static readonly ClientVersion m_Version60142 = new("6.0.14.2");
|
||||
private static readonly ClientVersion m_Version7000 = new("7.0.0.0");
|
||||
private static readonly ClientVersion m_Version7090 = new("7.0.9.0");
|
||||
private static readonly ClientVersion m_Version70130 = new("7.0.13.0");
|
||||
private static readonly ClientVersion m_Version70160 = new("7.0.16.0");
|
||||
private static readonly ClientVersion m_Version70300 = new("7.0.30.0");
|
||||
private static readonly ClientVersion m_Version70331 = new("7.0.33.1");
|
||||
private static readonly ClientVersion m_Version704565 = new("7.0.45.65");
|
||||
private static readonly ClientVersion m_Version70500 = new("7.0.50.0");
|
||||
private static readonly ClientVersion m_Version70610 = new("7.0.61.0");
|
||||
|
||||
public ProtocolChanges ProtocolChanges { get; set; }
|
||||
public ClientFlags Flags { get; set; }
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Server.Network
|
|||
private static int HuePickerCap = 512;
|
||||
private static int MenuCap = 512;
|
||||
|
||||
private static readonly ConcurrentQueue<NetState> m_Disposed = new ConcurrentQueue<NetState>();
|
||||
private static readonly ConcurrentQueue<NetState> m_Disposed = new();
|
||||
private static NetworkState m_NetworkState = NetworkState.ResumeState;
|
||||
|
||||
public static NetStateCreatedCallback CreatedCallback { get; set; }
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace Server.Network
|
|||
{
|
||||
public class NetworkState
|
||||
{
|
||||
public static readonly NetworkState PauseState = new NetworkState(true);
|
||||
public static readonly NetworkState ResumeState = new NetworkState(false);
|
||||
public static readonly NetworkState PauseState = new(true);
|
||||
public static readonly NetworkState ResumeState = new(false);
|
||||
|
||||
public bool Paused { get; }
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
private readonly object _object = new object();
|
||||
private readonly object _object = new();
|
||||
|
||||
public byte[] Compile(bool compress, out int length)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Server.Network
|
|||
/// </summary>
|
||||
public class PacketWriter
|
||||
{
|
||||
private static readonly ConcurrentQueue<PacketWriter> m_Pool = new ConcurrentQueue<PacketWriter>();
|
||||
private static readonly ConcurrentQueue<PacketWriter> m_Pool = new();
|
||||
|
||||
/// <summary>
|
||||
/// Internal format buffer.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Server.Network
|
|||
{
|
||||
private const int m_AuthIDWindowSize = 128;
|
||||
private static readonly Dictionary<int, AuthIDPersistence> m_AuthIDWindow =
|
||||
new Dictionary<int, AuthIDPersistence>(m_AuthIDWindowSize);
|
||||
new(m_AuthIDWindowSize);
|
||||
|
||||
internal struct AuthIDPersistence
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Server.Network
|
|||
public static class IncomingExtendedCommandPackets
|
||||
{
|
||||
private static readonly PacketHandler[] m_ExtendedHandlersLow = new PacketHandler[0x100];
|
||||
private static readonly Dictionary<int, PacketHandler> m_ExtendedHandlersHigh = new Dictionary<int, PacketHandler>();
|
||||
private static readonly Dictionary<int, PacketHandler> m_ExtendedHandlersHigh = new();
|
||||
|
||||
// TODO: Change to outside configuration
|
||||
public static int[] ValidAnimations { get; set; } =
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server.Network
|
|||
|
||||
public static class IncomingMessagePackets
|
||||
{
|
||||
private static readonly KeywordList m_KeywordList = new KeywordList();
|
||||
private static readonly KeywordList m_KeywordList = new();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Server.Network
|
|||
private static readonly EncodedPacketHandler[] m_EncodedHandlersLow = new EncodedPacketHandler[0x100];
|
||||
|
||||
private static readonly Dictionary<int, EncodedPacketHandler> m_EncodedHandlersHigh =
|
||||
new Dictionary<int, EncodedPacketHandler>();
|
||||
new();
|
||||
|
||||
public static PacketHandler[] Handlers { get; } = new PacketHandler[0x100];
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ namespace Server.Network
|
|||
|
||||
var p = from.Prompt;
|
||||
|
||||
if (p != null && p.Serial == serial && p.Serial == prompt)
|
||||
if (p?.Serial == serial && p.Serial == prompt)
|
||||
{
|
||||
from.Prompt = null;
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ namespace Server.Network
|
|||
|
||||
var p = from.Prompt;
|
||||
|
||||
if (p != null && p.Serial == serial && p.Serial == prompt)
|
||||
if (p?.Serial == serial && p.Serial == prompt)
|
||||
{
|
||||
from.Prompt = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -541,8 +541,8 @@ namespace Server.Network
|
|||
|
||||
public sealed class MobileIncoming : Packet
|
||||
{
|
||||
private static readonly ThreadLocal<int[]> m_DupedLayersTL = new ThreadLocal<int[]>(() => new int[256]);
|
||||
private static readonly ThreadLocal<int> m_VersionTL = new ThreadLocal<int>();
|
||||
private static readonly ThreadLocal<int[]> m_DupedLayersTL = new(() => new int[256]);
|
||||
private static readonly ThreadLocal<int> m_VersionTL = new();
|
||||
|
||||
public MobileIncoming(Mobile beholder, Mobile beheld) : base(0x78)
|
||||
{
|
||||
|
|
@ -673,8 +673,8 @@ namespace Server.Network
|
|||
|
||||
public sealed class MobileIncomingSA : Packet
|
||||
{
|
||||
private static readonly ThreadLocal<int[]> m_DupedLayersTL = new ThreadLocal<int[]>(() => new int[256]);
|
||||
private static readonly ThreadLocal<int> m_VersionTL = new ThreadLocal<int>();
|
||||
private static readonly ThreadLocal<int[]> m_DupedLayersTL = new(() => new int[256]);
|
||||
private static readonly ThreadLocal<int> m_VersionTL = new();
|
||||
|
||||
public MobileIncomingSA(Mobile beholder, Mobile beheld) : base(0x78)
|
||||
{
|
||||
|
|
@ -820,8 +820,8 @@ namespace Server.Network
|
|||
// Pre-7.0.0.0 Mobile Incoming
|
||||
public sealed class MobileIncomingOld : Packet
|
||||
{
|
||||
private static readonly ThreadLocal<int[]> m_DupedLayersTL = new ThreadLocal<int[]>(() => new int[256]);
|
||||
private static readonly ThreadLocal<int> m_VersionTL = new ThreadLocal<int>();
|
||||
private static readonly ThreadLocal<int[]> m_DupedLayersTL = new(() => new int[256]);
|
||||
private static readonly ThreadLocal<int> m_VersionTL = new();
|
||||
|
||||
public MobileIncomingOld(Mobile beholder, Mobile beheld) : base(0x78)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace Server.Network
|
|||
{
|
||||
private readonly Pipe<T> _pipe;
|
||||
|
||||
private Result _result = new Result(2);
|
||||
private Result _result = new(2);
|
||||
|
||||
internal PipeWriter(Pipe<T> pipe) => _pipe = pipe;
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ namespace Server.Network
|
|||
{
|
||||
private readonly Pipe<T> _pipe;
|
||||
|
||||
private Result _result = new Result(2);
|
||||
private Result _result = new(2);
|
||||
|
||||
internal PipeReader(Pipe<T> pipe) => _pipe = pipe;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,19 +20,19 @@ namespace Server.Network
|
|||
public static class StaticPacketHandlers
|
||||
{
|
||||
private static readonly ConcurrentDictionary<IPropertyListObject, OPLInfo> OPLInfoPackets =
|
||||
new ConcurrentDictionary<IPropertyListObject, OPLInfo>();
|
||||
new();
|
||||
|
||||
private static readonly ConcurrentDictionary<IEntity, RemoveEntity> RemoveEntityPackets =
|
||||
new ConcurrentDictionary<IEntity, RemoveEntity>();
|
||||
new();
|
||||
|
||||
private static readonly ConcurrentDictionary<Item, WorldItem> WorldItemPackets =
|
||||
new ConcurrentDictionary<Item, WorldItem>();
|
||||
new();
|
||||
|
||||
private static readonly ConcurrentDictionary<Item, WorldItemSA> WorldItemSAPackets =
|
||||
new ConcurrentDictionary<Item, WorldItemSA>();
|
||||
new();
|
||||
|
||||
private static readonly ConcurrentDictionary<Item, WorldItemHS> WorldItemHSPackets =
|
||||
new ConcurrentDictionary<Item, WorldItemHS>();
|
||||
new();
|
||||
|
||||
public static OPLInfo GetOPLInfoPacket(IPropertyListObject obj)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ namespace Server.Network
|
|||
|
||||
public static IPEndPoint[] ListeningAddresses { get; private set; }
|
||||
public static TcpListener[] Listeners { get; private set; }
|
||||
public static HashSet<NetState> Instances { get; } = new HashSet<NetState>(128);
|
||||
public static HashSet<NetState> Instances { get; } = new(128);
|
||||
|
||||
public static ConcurrentQueue<NetState> m_ConnectedQueue = new ConcurrentQueue<NetState>();
|
||||
public static ConcurrentQueue<NetState> m_ConnectedQueue = new();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue