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,7 +19,7 @@ namespace Server.Commands
|
|||
|
||||
public string Condition { get; set; } = "";
|
||||
|
||||
public List<BatchCommand> BatchCommands { get; } = new List<BatchCommand>();
|
||||
public List<BatchCommand> BatchCommands { get; } = new();
|
||||
|
||||
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -520,9 +520,9 @@ namespace Server.Commands
|
|||
}
|
||||
|
||||
private static StreamWriter GetWriter(string root, string name) =>
|
||||
new StreamWriter(Path.Combine(Path.Combine(m_RootDirectory, root), name));
|
||||
new(Path.Combine(Path.Combine(m_RootDirectory, root), name));
|
||||
|
||||
private static StreamWriter GetWriter(string path) => new StreamWriter(Path.Combine(m_RootDirectory, path));
|
||||
private static StreamWriter GetWriter(string path) => new(Path.Combine(m_RootDirectory, path));
|
||||
|
||||
public static string GetPair(Type varType, string name, bool ignoreRef)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ namespace Server.Commands.Generic
|
|||
|
||||
public abstract class BaseCommand
|
||||
{
|
||||
private readonly List<MessageEntry> m_Failures = new List<MessageEntry>();
|
||||
private readonly List<MessageEntry> m_Responses = new List<MessageEntry>();
|
||||
private readonly List<MessageEntry> m_Failures = new();
|
||||
private readonly List<MessageEntry> m_Responses = new();
|
||||
|
||||
public bool ListOptimized { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public static class TargetCommands
|
||||
{
|
||||
public static List<BaseCommand> AllCommands { get; } = new List<BaseCommand>();
|
||||
public static List<BaseCommand> AllCommands { get; } = new();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Server.Commands.Generic
|
|||
}
|
||||
|
||||
public static Dictionary<string, ExtensionInfo> Table { get; } =
|
||||
new Dictionary<string, ExtensionInfo>(StringComparer.InvariantCultureIgnoreCase);
|
||||
new(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
public int Order { get; }
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public sealed class TypeCondition : ICondition
|
||||
{
|
||||
public static TypeCondition Default = new TypeCondition();
|
||||
public static TypeCondition Default = new();
|
||||
|
||||
void ICondition.Construct(TypeBuilder typeBuilder, ILGenerator il, int index)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Commands.Generic
|
|||
public sealed class DistinctExtension : BaseExtension
|
||||
{
|
||||
public static ExtensionInfo ExtInfo =
|
||||
new ExtensionInfo(30, "Distinct", -1, () => new DistinctExtension());
|
||||
new(30, "Distinct", -1, () => new DistinctExtension());
|
||||
|
||||
private readonly List<Property> m_Properties;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public sealed class LimitExtension : BaseExtension
|
||||
{
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(80, "Limit", 1, () => new LimitExtension());
|
||||
public static ExtensionInfo ExtInfo = new(80, "Limit", 1, () => new LimitExtension());
|
||||
|
||||
public override ExtensionInfo Info => ExtInfo;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public sealed class SortExtension : BaseExtension
|
||||
{
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(40, "Order", -1, () => new SortExtension());
|
||||
public static ExtensionInfo ExtInfo = new(40, "Order", -1, () => new SortExtension());
|
||||
|
||||
private readonly List<OrderInfo> m_Orders;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public sealed class WhereExtension : BaseExtension
|
||||
{
|
||||
public static ExtensionInfo ExtInfo = new ExtensionInfo(20, "Where", -1, () => new WhereExtension());
|
||||
public static ExtensionInfo ExtInfo = new(20, "Where", -1, () => new WhereExtension());
|
||||
|
||||
public override ExtensionInfo Info => ExtInfo;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Server.Commands.Generic
|
|||
private static readonly Type typeofItem = typeof(Item);
|
||||
private static readonly Type typeofMobile = typeof(Mobile);
|
||||
|
||||
public static readonly ObjectConditional Empty = new ObjectConditional(null, null);
|
||||
public static readonly ObjectConditional Empty = new(null, null);
|
||||
|
||||
private readonly ICondition[][] m_Conditions;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ namespace Server.Commands
|
|||
{
|
||||
public static class HelpInfo
|
||||
{
|
||||
public static Dictionary<string, CommandInfo> HelpInfos { get; } = new Dictionary<string, CommandInfo>();
|
||||
public static Dictionary<string, CommandInfo> HelpInfos { get; } = new();
|
||||
|
||||
public static List<CommandInfo> SortedHelpInfo { get; private set; } = new List<CommandInfo>();
|
||||
public static List<CommandInfo> SortedHelpInfo { get; private set; } = new();
|
||||
|
||||
[CallPriority(100)]
|
||||
public static void Initialize()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace Server.Commands
|
|||
{
|
||||
public class LocationCommand : BaseCommand
|
||||
{
|
||||
private static readonly List<int> m_DefaultGraphics = new List<int> { 0x17AF, 0x17B0, 0x17B1, 0x17B2 };
|
||||
private static readonly List<int> m_DefaultGraphics = new() { 0x17AF, 0x17B0, 0x17B1, 0x17B2 };
|
||||
|
||||
public LocationCommand()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Server.Commands
|
|||
private static readonly Type typeofCannon = typeof(Cannon);
|
||||
private static readonly Type typeofSerpentPillar = typeof(SerpentPillar);
|
||||
|
||||
private static readonly Queue<Item> m_DeleteQueue = new Queue<Item>();
|
||||
private static readonly Queue<Item> m_DeleteQueue = new();
|
||||
|
||||
private static readonly string[] m_EmptyParams = Array.Empty<string>();
|
||||
private List<DecorationEntry> m_Entries;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace Server.Commands
|
|||
private static readonly Type typeofCannon = typeof(Cannon);
|
||||
private static readonly Type typeofSerpentPillar = typeof(SerpentPillar);
|
||||
|
||||
private static readonly Queue m_DeleteQueue = new Queue();
|
||||
private static readonly Queue m_DeleteQueue = new();
|
||||
|
||||
private static readonly string[] m_EmptyParams = Array.Empty<string>();
|
||||
private List<DecorationEntryMag> m_Entries;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace Server.Commands
|
|||
{
|
||||
public static class SignParser
|
||||
{
|
||||
private static readonly Queue<Item> m_ToDelete = new Queue<Item>();
|
||||
private static readonly Queue<Item> m_ToDelete = new();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server
|
|||
"It is strongly recommended that you make backup of the data files mentioned above. " +
|
||||
"Do you wish to proceed?";
|
||||
|
||||
private static readonly Point3D NullP3D = new Point3D(int.MinValue, int.MinValue, int.MinValue);
|
||||
private static readonly Point3D NullP3D = new(int.MinValue, int.MinValue, int.MinValue);
|
||||
|
||||
private static byte[] m_Buffer;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue