Cleanup & Fixes for .NET 5 (#309)
- [X] Fixes several bugs - [X] Updates more ordinal issues - [X] Cleans up the code a bit - [X] Turns classes static that should have been - [X] Changes TcpServer.Instances to a HashSet Bumps release version
This commit is contained in:
parent
4ad8811df2
commit
525cda5413
266 changed files with 1348 additions and 1800 deletions
|
|
@ -5,7 +5,7 @@ using Server.Accounting;
|
|||
|
||||
namespace Server.Commands
|
||||
{
|
||||
public class CommandLogging
|
||||
public static class CommandLogging
|
||||
{
|
||||
private static readonly char[] m_NotSafe = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };
|
||||
public static bool Enabled { get; set; } = true;
|
||||
|
|
@ -44,25 +44,13 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
public static object Format(object o)
|
||||
{
|
||||
if (o is Mobile m)
|
||||
public static object Format(object o) =>
|
||||
o switch
|
||||
{
|
||||
if (m.Account == null)
|
||||
{
|
||||
return $"{m} (no account)";
|
||||
}
|
||||
|
||||
return $"{m} ('{m.Account.Username}')";
|
||||
}
|
||||
|
||||
if (o is Item item)
|
||||
{
|
||||
return $"0x{item.Serial.Value:X} ({item.GetType().Name})";
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
Mobile m => m.Account == null ? $"{m} (no account)" : $"{m} ('{m.Account.Username}')",
|
||||
Item item => $"0x{item.Serial.Value:X} ({item.GetType().Name})",
|
||||
_ => o
|
||||
};
|
||||
|
||||
public static void WriteLine(Mobile from, string format, params object[] args)
|
||||
{
|
||||
|
|
@ -126,7 +114,7 @@ namespace Server.Commands
|
|||
|
||||
for (var i = 0; isSafe && i < m_NotSafe.Length; ++i)
|
||||
{
|
||||
isSafe = ip.IndexOf(m_NotSafe[i]) == -1;
|
||||
isSafe = !ip.Contains(m_NotSafe[i], StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
if (isSafe)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue