diff --git a/Projects/SerializationGenerator/SerializableEntityGeneration/SerializableEntityGeneration.Class.cs b/Projects/SerializationGenerator/SerializableEntityGeneration/SerializableEntityGeneration.Class.cs
index f312d9330..4a13970bc 100644
--- a/Projects/SerializationGenerator/SerializableEntityGeneration/SerializableEntityGeneration.Class.cs
+++ b/Projects/SerializationGenerator/SerializableEntityGeneration/SerializableEntityGeneration.Class.cs
@@ -117,6 +117,7 @@ namespace SerializationGenerator
StringBuilder source = new StringBuilder();
+ source.AppendLine("#pragma warning disable\n");
source.GenerateNamespaceStart(namespaceName);
source.GenerateClassStart(
@@ -131,8 +132,7 @@ namespace SerializationGenerator
InstanceModifier.Const,
"int",
"_version",
- version.ToString(),
- true
+ version.ToString()
);
source.AppendLine();
diff --git a/Projects/SerializationGenerator/SerializableMigration/Rules/SerializationMethodSignatureMigrationRule.cs b/Projects/SerializationGenerator/SerializableMigration/Rules/SerializationMethodSignatureMigrationRule.cs
index 36ee040cf..91e92baed 100644
--- a/Projects/SerializationGenerator/SerializableMigration/Rules/SerializationMethodSignatureMigrationRule.cs
+++ b/Projects/SerializationGenerator/SerializableMigration/Rules/SerializationMethodSignatureMigrationRule.cs
@@ -15,7 +15,6 @@
using System;
using System.Collections.Immutable;
-using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis;
using SerializationGenerator;
diff --git a/Projects/SerializationGenerator/SourceGeneration/SourceGeneration.Class.cs b/Projects/SerializationGenerator/SourceGeneration/SourceGeneration.Class.cs
index 7068d5faf..50d9d2f99 100644
--- a/Projects/SerializationGenerator/SourceGeneration/SourceGeneration.Class.cs
+++ b/Projects/SerializationGenerator/SourceGeneration/SourceGeneration.Class.cs
@@ -53,24 +53,13 @@ namespace SerializationGenerator
InstanceModifier instance,
string type,
string variableName,
- string value,
- bool unusedPragma = false
+ string value
)
{
- if (unusedPragma)
- {
- source.AppendLine("#pragma warning disable 0414"); // assigned, but never used
- }
-
var instanceStr = instance == InstanceModifier.None ? "" : $"{instance.ToFriendlyString()} ";
var accessorStr = accessors == Accessibility.NotApplicable ? "" : $"{accessors.ToFriendlyString()} ";
var valueStr = value == null ? "" : $" = {value}";
source.AppendLine($" {accessorStr}{instanceStr}{type} {variableName}{valueStr};");
-
- if (unusedPragma)
- {
- source.AppendLine("#pragma warning restore 0414");
- }
}
}
}
diff --git a/Projects/SerializationGenerator/SourceGeneration/SymbolMetadata/SymbolMetadata.UO.cs b/Projects/SerializationGenerator/SourceGeneration/SymbolMetadata/SymbolMetadata.UO.cs
index 91654cf94..9c439941b 100644
--- a/Projects/SerializationGenerator/SourceGeneration/SymbolMetadata/SymbolMetadata.UO.cs
+++ b/Projects/SerializationGenerator/SourceGeneration/SymbolMetadata/SymbolMetadata.UO.cs
@@ -13,7 +13,6 @@
* along with this program. If not, see . *
*************************************************************************/
-using System;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
diff --git a/Projects/SerializationSchemaGenerator/Application.cs b/Projects/SerializationSchemaGenerator/Application.cs
index 02d35aa62..dae7d407f 100644
--- a/Projects/SerializationSchemaGenerator/Application.cs
+++ b/Projects/SerializationSchemaGenerator/Application.cs
@@ -16,7 +16,6 @@
using System;
using System.Collections.Immutable;
using System.IO;
-using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using SerializationGenerator;
diff --git a/Projects/Server.Tests/Tests/Buffers/CircularBufferWriterTests.cs b/Projects/Server.Tests/Tests/Buffers/CircularBufferWriterTests.cs
index 38f627ce8..4ccf19533 100644
--- a/Projects/Server.Tests/Tests/Buffers/CircularBufferWriterTests.cs
+++ b/Projects/Server.Tests/Tests/Buffers/CircularBufferWriterTests.cs
@@ -1,7 +1,6 @@
using System;
using System.Buffers;
using System.IO;
-using Server.Network;
using Xunit;
namespace Server.Tests.Buffers
diff --git a/Projects/Server/Items/Item.cs b/Projects/Server/Items/Item.cs
index 5ad68b15c..cffee465a 100644
--- a/Projects/Server/Items/Item.cs
+++ b/Projects/Server/Items/Item.cs
@@ -3553,8 +3553,7 @@ namespace Server
var landTile = map.Tiles.GetLandTile(x, y);
var landFlags = TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags;
- int landZ = 0, landAvg = 0, landTop = 0;
- map.GetAverageZ(x, y, ref landZ, ref landAvg, ref landTop);
+ map.GetAverageZ(x, y, out var landZ, out var landAvg, out _);
if (!landTile.Ignored && (landFlags & TileFlag.Impassable) == 0)
{
diff --git a/Projects/Server/Logging/SerilogLogger.cs b/Projects/Server/Logging/SerilogLogger.cs
index c4df66f29..6aa9178d9 100644
--- a/Projects/Server/Logging/SerilogLogger.cs
+++ b/Projects/Server/Logging/SerilogLogger.cs
@@ -14,6 +14,7 @@
*************************************************************************/
using System;
+using System.Runtime.CompilerServices;
namespace Server.Logging
{
@@ -24,33 +25,43 @@ namespace Server.Logging
public SerilogLogger(Serilog.ILogger serilogLogger) =>
this.serilogLogger = serilogLogger;
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Debug(string message, params object[] args) =>
serilogLogger.Debug(message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Debug(Exception exception, string message, params object[] args) =>
serilogLogger.Debug(exception, message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Information(string message, params object[] args) =>
serilogLogger.Information(message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Information(Exception exception, string message, params object[] args) =>
serilogLogger.Information(exception, message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Warning(string message, params object[] args) =>
serilogLogger.Warning(message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Warning(Exception exception, string message, params object[] args) =>
serilogLogger.Information(exception, message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Error(string message, params object[] args) =>
serilogLogger.Error(message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Error(Exception exception, string message, params object[] args) =>
serilogLogger.Error(exception, message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Fatal(string message, params object[] args) =>
serilogLogger.Fatal(message, args);
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Fatal(Exception exception, string message, params object[] args) =>
serilogLogger.Fatal(exception, message, args);
}
diff --git a/Projects/Server/Maps/Map.cs b/Projects/Server/Maps/Map.cs
index d5f9d38fd..170fe5ec0 100644
--- a/Projects/Server/Maps/Map.cs
+++ b/Projects/Server/Maps/Map.cs
@@ -435,14 +435,11 @@ namespace Server
public int GetAverageZ(int x, int y)
{
- int z = 0, avg = 0, top = 0;
-
- GetAverageZ(x, y, ref z, ref avg, ref top);
-
+ GetAverageZ(x, y, out _, out var avg, out _);
return avg;
}
- public void GetAverageZ(int x, int y, ref int z, ref int avg, ref int top)
+ public void GetAverageZ(int x, int y, out int z, out int avg, out int top)
{
var zTop = Tiles.GetLandTile(x, y).Z;
var zLeft = Tiles.GetLandTile(x, y + 1).Z;
@@ -556,8 +553,7 @@ namespace Server
var landTile = Tiles.GetLandTile(x, y);
var tiles = Tiles.GetStaticTiles(x, y, true);
- int landZ = 0, landAvg = 0, landTop = 0;
- GetAverageZ(x, y, ref landZ, ref landAvg, ref landTop);
+ GetAverageZ(x, y, out _, out var landAvg, out _);
var items = AcquireFixItems(this, x, y);
@@ -1010,8 +1006,7 @@ namespace Server
{
p = target.Location;
- int low = 0, avg = 0, top = 0;
- GetAverageZ(p.X, p.Y, ref low, ref avg, ref top);
+ GetAverageZ(p.X, p.Y, out _, out _, out var top);
p.Z = top + 1;
}
@@ -1108,9 +1103,7 @@ namespace Server
var hasSurface = false;
var lt = Tiles.GetLandTile(x, y);
- int lowZ = 0, avgZ = 0, topZ = 0;
-
- GetAverageZ(x, y, ref lowZ, ref avgZ, ref topZ);
+ GetAverageZ(x, y, out var lowZ, out var avgZ, out _);
var landFlags = TileData.LandTable[lt.ID & TileData.MaxLandValue].Flags;
if ((landFlags & TileFlag.Impassable) != 0 && avgZ > z && z + height > lowZ)
@@ -1327,8 +1320,7 @@ namespace Server
var pointTop = point.m_Z + 1;
var landTile = Tiles.GetLandTile(point.X, point.Y);
- int landZ = 0, landAvg = 0, landTop = 0;
- GetAverageZ(point.m_X, point.m_Y, ref landZ, ref landAvg, ref landTop);
+ GetAverageZ(point.m_X, point.m_Y, out var landZ, out _, out var landTop);
if (landZ <= pointTop && landTop >= point.m_Z &&
(point.m_X != end.m_X || point.m_Y != end.m_Y || landZ > endTop || landTop < end.m_Z) &&
diff --git a/Projects/Server/NativeReader.cs b/Projects/Server/NativeReader.cs
index 026ca99b4..78cbd4fe8 100644
--- a/Projects/Server/NativeReader.cs
+++ b/Projects/Server/NativeReader.cs
@@ -9,7 +9,7 @@ namespace Server
{
private static readonly INativeReader m_NativeReader;
- static NativeReader() => m_NativeReader = Core.Unix ? (INativeReader)new NativeReaderUnix() : new NativeReaderWin32();
+ static NativeReader() => m_NativeReader = Core.Unix ? new NativeReaderUnix() : new NativeReaderWin32();
public static unsafe int Read(FileStream source, void* buffer, int length) =>
m_NativeReader.Read(source, buffer, length);
diff --git a/Projects/Server/Serialization/SerializableAttribute.cs b/Projects/Server/Serialization/SerializableAttribute.cs
index e05af4a5e..052d81d11 100755
--- a/Projects/Server/Serialization/SerializableAttribute.cs
+++ b/Projects/Server/Serialization/SerializableAttribute.cs
@@ -23,6 +23,10 @@ namespace Server
public int Version { get; }
public bool EncodedVersion { get; }
- public SerializableAttribute(int version, bool encodedVersion = true) => Version = version;
+ public SerializableAttribute(int version, bool encodedVersion = true)
+ {
+ Version = version;
+ EncodedVersion = encodedVersion;
+ }
}
}
diff --git a/Projects/Server/Targeting/Target.cs b/Projects/Server/Targeting/Target.cs
index 02e68c609..d0035ed3b 100644
--- a/Projects/Server/Targeting/Target.cs
+++ b/Projects/Server/Targeting/Target.cs
@@ -252,9 +252,6 @@ namespace Server.Targeting
private class TimeoutTimer : Timer
{
- private static readonly TimeSpan ThirtySeconds = TimeSpan.FromSeconds(30.0);
- private static readonly TimeSpan TenSeconds = TimeSpan.FromSeconds(10.0);
- private static readonly TimeSpan OneSecond = TimeSpan.FromSeconds(1.0);
private readonly Mobile m_Mobile;
private readonly Target m_Target;
diff --git a/Projects/UOContent.Tests/Tests/Multis/Houses/HousePackets.cs b/Projects/UOContent.Tests/Tests/Multis/Houses/HousePackets.cs
index fe94744d3..75c757ea6 100644
--- a/Projects/UOContent.Tests/Tests/Multis/Houses/HousePackets.cs
+++ b/Projects/UOContent.Tests/Tests/Multis/Houses/HousePackets.cs
@@ -2,7 +2,6 @@ using System;
using System.Buffers;
using System.IO;
using System.IO.Compression;
-using Server.Multis;
namespace Server.Network
{
diff --git a/Projects/UOContent/Commands/Dupe.cs b/Projects/UOContent/Commands/Dupe.cs
index f5303453d..db7bfdbde 100644
--- a/Projects/UOContent/Commands/Dupe.cs
+++ b/Projects/UOContent/Commands/Dupe.cs
@@ -54,6 +54,7 @@ namespace Server.Commands
}
catch
{
+ // ignored
}
}
}
diff --git a/Projects/UOContent/Commands/Generic/Implementors/ObjectConditional.cs b/Projects/UOContent/Commands/Generic/Implementors/ObjectConditional.cs
index acf79a09a..bbd64e822 100644
--- a/Projects/UOContent/Commands/Generic/Implementors/ObjectConditional.cs
+++ b/Projects/UOContent/Commands/Generic/Implementors/ObjectConditional.cs
@@ -21,9 +21,9 @@ namespace Server.Commands.Generic
public Type Type { get; }
- public bool IsItem => Type == null || Type.IsAssignableTo(OfItem);
+ public bool IsItem => Type?.IsAssignableTo(OfItem) != false;
- public bool IsMobile => Type == null || Type.IsAssignableTo(OfMobile);
+ public bool IsMobile => Type?.IsAssignableTo(OfMobile) != false;
public bool HasCompiled => m_Conditionals != null;
diff --git a/Projects/UOContent/Commands/Logging.cs b/Projects/UOContent/Commands/Logging.cs
index 2abf6b2cb..a1a5ab3d2 100644
--- a/Projects/UOContent/Commands/Logging.cs
+++ b/Projects/UOContent/Commands/Logging.cs
@@ -1,4 +1,3 @@
-using System;
using System.IO;
using System.Text;
using Server.Accounting;
diff --git a/Projects/UOContent/Commands/Object Creation/CAGObject.cs b/Projects/UOContent/Commands/Object Creation/CAGObject.cs
index 6404cdb9d..4b8f19968 100644
--- a/Projects/UOContent/Commands/Object Creation/CAGObject.cs
+++ b/Projects/UOContent/Commands/Object Creation/CAGObject.cs
@@ -34,7 +34,7 @@ namespace Server.Commands
public CAGCategory Parent { get; set; }
- public override string Title => Type == null ? "bad type" : Type.Name;
+ public override string Title => Type?.Name ?? "bad type";
public override void OnClick(Mobile from, int page)
{
diff --git a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs
index 5a2bb58b1..62eeb73c1 100644
--- a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs
+++ b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections;
using System.Collections.Generic;
using System.IO;
using Server.Engines.Quests.Haven;
@@ -73,7 +72,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();
+ private static readonly Queue- m_DeleteQueue = new();
private static readonly string[] m_EmptyParams = Array.Empty();
private List m_Entries;
@@ -1143,7 +1142,7 @@ namespace Server.Commands
while (m_DeleteQueue.Count > 0)
{
- ((Item)m_DeleteQueue.Dequeue())?.Delete();
+ m_DeleteQueue.Dequeue()?.Delete();
}
return res;
diff --git a/Projects/UOContent/Commands/ShardTime.cs b/Projects/UOContent/Commands/ShardTime.cs
index 8453de7a1..a206d1340 100644
--- a/Projects/UOContent/Commands/ShardTime.cs
+++ b/Projects/UOContent/Commands/ShardTime.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Globalization;
+using System.Globalization;
namespace Server.Commands
{
diff --git a/Projects/UOContent/Configuration/EmailConfiguration.cs b/Projects/UOContent/Configuration/EmailConfiguration.cs
index 264718a21..8726a5df3 100644
--- a/Projects/UOContent/Configuration/EmailConfiguration.cs
+++ b/Projects/UOContent/Configuration/EmailConfiguration.cs
@@ -13,7 +13,6 @@
* along with this program. If not, see . *
*************************************************************************/
-using System;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
diff --git a/Projects/UOContent/Context Menus/OpenBankEntry.cs b/Projects/UOContent/Context Menus/OpenBankEntry.cs
index 66ccb4da7..faf3468f5 100644
--- a/Projects/UOContent/Context Menus/OpenBankEntry.cs
+++ b/Projects/UOContent/Context Menus/OpenBankEntry.cs
@@ -4,7 +4,7 @@ namespace Server.ContextMenus
{
private readonly Mobile m_Banker;
- public OpenBankEntry(Mobile from, Mobile banker) : base(6105, 12) => m_Banker = banker;
+ public OpenBankEntry(Mobile banker) : base(6105, 12) => m_Banker = banker;
public override void OnClick()
{
diff --git a/Projects/UOContent/Engines/Bulk Orders/BulkMaterialType.cs b/Projects/UOContent/Engines/Bulk Orders/BulkMaterialType.cs
index fd5e0196c..43a8a0e57 100644
--- a/Projects/UOContent/Engines/Bulk Orders/BulkMaterialType.cs
+++ b/Projects/UOContent/Engines/Bulk Orders/BulkMaterialType.cs
@@ -35,7 +35,7 @@ namespace Server.Engines.BulkOrders
return BulkGenericType.Iron;
}
- return itemType == null || itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes))
+ return itemType?.IsSubclassOf(typeof(BaseArmor)) != false || itemType.IsSubclassOf(typeof(BaseShoes))
? BulkGenericType.Leather
: BulkGenericType.Cloth;
}
diff --git a/Projects/UOContent/Engines/CannedEvil/DungeonChampionSpawn.cs b/Projects/UOContent/Engines/CannedEvil/DungeonChampionSpawn.cs
index 20402cde1..c4eedc84b 100644
--- a/Projects/UOContent/Engines/CannedEvil/DungeonChampionSpawn.cs
+++ b/Projects/UOContent/Engines/CannedEvil/DungeonChampionSpawn.cs
@@ -18,7 +18,7 @@ namespace Server.Engines.CannedEvil
public class DungeonChampionSpawn : ChampionSpawn
{
[Constructible]
- public DungeonChampionSpawn() : base()
+ public DungeonChampionSpawn()
{
CannedEvilTimer.AddSpawn(this);
}
diff --git a/Projects/UOContent/Engines/ConPVP/Arena.cs b/Projects/UOContent/Engines/ConPVP/Arena.cs
index bb8f56843..c22cffc22 100644
--- a/Projects/UOContent/Engines/ConPVP/Arena.cs
+++ b/Projects/UOContent/Engines/ConPVP/Arena.cs
@@ -772,11 +772,7 @@ namespace Server.Engines.ConPVP
{
var pe = prefs.Find(players[j]);
- if (pe.Disliked.Contains(ae.m_Arena.Name))
- {
- ++ae.m_VotesAgainst;
- }
- else
+ if (!pe.Disliked.Contains(ae.m_Arena.Name))
{
++ae.m_VotesFor;
}
@@ -827,7 +823,6 @@ namespace Server.Engines.ConPVP
private class ArenaEntry
{
public readonly Arena m_Arena;
- public int m_VotesAgainst;
public int m_VotesFor;
public ArenaEntry(Arena arena) => m_Arena = arena;
diff --git a/Projects/UOContent/Engines/ConPVP/DuelContext.cs b/Projects/UOContent/Engines/ConPVP/DuelContext.cs
index 6f40bfce3..27f72d4a6 100644
--- a/Projects/UOContent/Engines/ConPVP/DuelContext.cs
+++ b/Projects/UOContent/Engines/ConPVP/DuelContext.cs
@@ -1924,24 +1924,7 @@ namespace Server.Engines.ConPVP
var rx = dx - dy;
var ry = dx + dy;
- bool eastToWest;
-
- if (rx >= 0 && ry >= 0)
- {
- eastToWest = false;
- }
- else if (rx >= 0)
- {
- eastToWest = true;
- }
- else if (ry >= 0)
- {
- eastToWest = true;
- }
- else
- {
- eastToWest = false;
- }
+ bool eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
Effects.PlaySound(wall, Arena.Facet, 0x1F6);
diff --git a/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs b/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs
index 8adcfea1f..05a22aee0 100644
--- a/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs
+++ b/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs
@@ -456,8 +456,7 @@ namespace Server.Engines.ConPVP
var point = m_Path[i];
var landTile = Map.Tiles.GetLandTile(point.X, point.Y);
- int landZ = 0, landAvg = 0, landTop = 0;
- Map.GetAverageZ(point.X, point.Y, ref landZ, ref landAvg, ref landTop);
+ Map.GetAverageZ(point.X, point.Y, out var landZ, out _, out var landTop);
if (landZ <= point.Z && landTop >= point.Z && !landTile.Ignored)
{
diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs
index 5e7dfcddc..8da52acff 100644
--- a/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs
+++ b/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs
@@ -23,7 +23,6 @@ namespace Server.Engines.ConPVP
public class TournamentBracketGump : Gump
{
private const int BlackColor32 = 0x000008;
- private const int LabelColor32 = 0xFFFFFF;
private readonly Mobile m_From;
private List