diff --git a/Robust.Analyzers/Diagnostics.cs b/Robust.Analyzers/Diagnostics.cs index 46504a663..433a7e440 100644 --- a/Robust.Analyzers/Diagnostics.cs +++ b/Robust.Analyzers/Diagnostics.cs @@ -1,10 +1,14 @@ using Microsoft.CodeAnalysis; -namespace Robust.Generators +namespace Robust.Analyzers; + +public static class Diagnostics { - public static class Diagnostics - { - public static SuppressionDescriptor MeansImplicitAssignment => - new SuppressionDescriptor("RADC1000", "CS0649", "Marked as implicitly assigned."); - } + public const string IdExplicitInterface = "RA0000"; + public const string IdSerializable = "RA0001"; + public const string IdFriend = "RA0002"; + public const string IdExplicitVirtual = "RA0003"; + + public static SuppressionDescriptor MeansImplicitAssignment => + new SuppressionDescriptor("RADC1000", "CS0649", "Marked as implicitly assigned."); } diff --git a/Robust.Analyzers/ExplicitInterfaceAnalyzer.cs b/Robust.Analyzers/ExplicitInterfaceAnalyzer.cs index d1f5923c9..020d5bd56 100644 --- a/Robust.Analyzers/ExplicitInterfaceAnalyzer.cs +++ b/Robust.Analyzers/ExplicitInterfaceAnalyzer.cs @@ -24,14 +24,14 @@ namespace Robust.Analyzers SyntaxKind.OverrideKeyword }; - public const string DiagnosticId = "RA0000"; - - private const string Title = "No explicit interface specified"; - private const string MessageFormat = "No explicit interface specified"; - private const string Description = "Make sure to specify the interface in your method-declaration."; - private const string Category = "Usage"; - - [SuppressMessage("ReSharper", "RS2008")] private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description); + [SuppressMessage("ReSharper", "RS2008")] private static readonly DiagnosticDescriptor Rule = new( + Diagnostics.IdExplicitInterface, + "No explicit interface specified", + "No explicit interface specified", + "Usage", + DiagnosticSeverity.Warning, + isEnabledByDefault: true, + description: "Make sure to specify the interface in your method-declaration."); private const string RequiresExplicitImplementationAttributeMetadataName = "Robust.Shared.Analyzers.RequiresExplicitImplementationAttribute"; diff --git a/Robust.Analyzers/ExplicitVirtualAnalyzer.cs b/Robust.Analyzers/ExplicitVirtualAnalyzer.cs new file mode 100644 index 000000000..74a34e00c --- /dev/null +++ b/Robust.Analyzers/ExplicitVirtualAnalyzer.cs @@ -0,0 +1,176 @@ +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Diagnostics; + +namespace Robust.Analyzers; + +[DiagnosticAnalyzer(LanguageNames.CSharp)] +public sealed class ExplicitVirtualAnalyzer : DiagnosticAnalyzer +{ + internal const string Attribute = "Robust.Shared.Analyzers.VirtualAttribute"; + + [SuppressMessage("ReSharper", "RS2008")] + private static readonly DiagnosticDescriptor Rule = new( + Diagnostics.IdExplicitVirtual, + "Class must be explicitly marked as [Virtual], abstract, static or sealed", + "Class must be explicitly marked as [Virtual], abstract, static or sealed", + "Usage", + DiagnosticSeverity.Warning, + isEnabledByDefault: true, + description: "Class must be explicitly marked as [Virtual], abstract, static or sealed."); + + public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Rule); + + public override void Initialize(AnalysisContext context) + { + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); + context.EnableConcurrentExecution(); + context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.ClassDeclaration); + } + + private static bool HasAttribute(INamedTypeSymbol namedTypeSymbol, INamedTypeSymbol attrSymbol) + { + return namedTypeSymbol.GetAttributes() + .Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, attrSymbol)); + } + + private static void AnalyzeNode(SyntaxNodeAnalysisContext context) + { + var attrSymbol = context.Compilation.GetTypeByMetadataName(Attribute); + var classDecl = (ClassDeclarationSyntax)context.Node; + var classSymbol = context.SemanticModel.GetDeclaredSymbol(classDecl); + if (classSymbol == null) + return; + + if (classSymbol.IsSealed || classSymbol.IsAbstract || classSymbol.IsStatic) + return; + + if (HasAttribute(classSymbol, attrSymbol)) + return; + + var diag = Diagnostic.Create(Rule, classDecl.Keyword.GetLocation()); + context.ReportDiagnostic(diag); + } +} + +// Doesn't work as I'd hoped: Roslyn doesn't provide an API for global usings and I can't get batch changes to work. +/* +[ExportCodeFixProvider(LanguageNames.CSharp)] +public sealed class ExplicitVirtualCodeFixProvider : CodeFixProvider +{ + private const string TitleSealed = "Annotate class as sealed."; + private const string TitleVirtual = "Annotate class as [Virtual]."; + private const string TitleAbstract = "Annotate class as abstract."; + private const string TitleStatic = "Annotate class as static."; + + public override async Task RegisterCodeFixesAsync(CodeFixContext context) + { + var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken); + + foreach (var diagnostic in context.Diagnostics) + { + var span = diagnostic.Location.SourceSpan; + var classDecl = root.FindToken(span.Start).Parent.AncestorsAndSelf().OfType() + .First(); + + context.RegisterCodeFix( + CodeAction.Create( + TitleVirtual, + c => FixVirtualAsync(context.Document, classDecl, c), + TitleVirtual), + diagnostic); + + context.RegisterCodeFix( + CodeAction.Create( + TitleStatic, + c => FixStaticAsync(context.Document, classDecl, c), + TitleStatic), + diagnostic); + + context.RegisterCodeFix( + CodeAction.Create( + TitleSealed, + c => FixSealedAsync(context.Document, classDecl, c), + TitleSealed), + diagnostic); + + context.RegisterCodeFix( + CodeAction.Create( + TitleAbstract, + c => FixAbstractAsync(context.Document, classDecl, c), + TitleAbstract), + diagnostic); + } + } + + private async Task FixVirtualAsync( + Document document, + ClassDeclarationSyntax classDecl, + CancellationToken cancellationToken) + { + var ns = "Robust.Shared.Analyzers"; + var attrib = SyntaxFactory.Attribute(SyntaxFactory.ParseName("Virtual")); + + var newClassDecl = classDecl.AddAttributeLists( + SyntaxFactory.AttributeList(SyntaxFactory.SeparatedList(new[] { attrib }))); + + var root = (CompilationUnitSyntax)await document.GetSyntaxRootAsync(cancellationToken); + root = root.ReplaceNode(classDecl, newClassDecl); + + var options = await document.GetOptionsAsync(cancellationToken); + + if (root.Usings.All(u => u.Name.ToString() != ns)) + { + root = root.AddUsings(SyntaxFactory.UsingDirective(SyntaxFactory.ParseName(ns))); + } + + return document.WithSyntaxRoot(root); + } + + private async Task FixStaticAsync( + Document document, + ClassDeclarationSyntax classDecl, + CancellationToken cancellationToken) + { + var newClassDecl = classDecl.AddModifiers(SyntaxFactory.Token(SyntaxKind.StaticKeyword)); + + var root = (CompilationUnitSyntax)await document.GetSyntaxRootAsync(cancellationToken); + root = root.ReplaceNode(classDecl, newClassDecl); + + return document.WithSyntaxRoot(root); + } + + private async Task FixAbstractAsync( + Document document, + ClassDeclarationSyntax classDecl, + CancellationToken cancellationToken) + { + var newClassDecl = classDecl.AddModifiers(SyntaxFactory.Token(SyntaxKind.AbstractKeyword)); + + var root = (CompilationUnitSyntax)await document.GetSyntaxRootAsync(cancellationToken); + root = root.ReplaceNode(classDecl, newClassDecl); + + return document.WithSyntaxRoot(root); + } + + private async Task FixSealedAsync( + Document document, + ClassDeclarationSyntax classDecl, + CancellationToken cancellationToken) + { + var newClassDecl = classDecl.AddModifiers(SyntaxFactory.Token(SyntaxKind.SealedKeyword)); + + var root = (CompilationUnitSyntax)await document.GetSyntaxRootAsync(cancellationToken); + root = root.ReplaceNode(classDecl, newClassDecl); + + return document.WithSyntaxRoot(root); + } + + public override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer; + public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(Diagnostics.IdExplicitVirtual); +} +*/ diff --git a/Robust.Analyzers/FriendAnalyzer.cs b/Robust.Analyzers/FriendAnalyzer.cs index e8a32c3bd..5dcc6bca7 100644 --- a/Robust.Analyzers/FriendAnalyzer.cs +++ b/Robust.Analyzers/FriendAnalyzer.cs @@ -14,15 +14,15 @@ namespace Robust.Analyzers { const string FriendAttribute = "Robust.Shared.Analyzers.FriendAttribute"; - public const string DiagnosticId = "RA0002"; - - private const string Title = "Tried to access friend-only member"; - private const string MessageFormat = "Tried to access member \"{0}\" in class \"{1}\" which can only be accessed by friend classes"; - private const string Description = "Make sure to specify the accessing class in the friends attribute."; - private const string Category = "Usage"; - [SuppressMessage("ReSharper", "RS2008")] - private static readonly DiagnosticDescriptor Rule = new (DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Error, true, Description); + private static readonly DiagnosticDescriptor Rule = new ( + Diagnostics.IdFriend, + "Tried to access friend-only member", + "Tried to access member \"{0}\" in class \"{1}\" which can only be accessed by friend classes", + "Usage", + DiagnosticSeverity.Error, + true, + "Make sure to specify the accessing class in the friends attribute."); public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Rule); diff --git a/Robust.Analyzers/MeansImplicitAssigmentSuppressor.cs b/Robust.Analyzers/MeansImplicitAssigmentSuppressor.cs index 37936b9ce..c4a2039f8 100644 --- a/Robust.Analyzers/MeansImplicitAssigmentSuppressor.cs +++ b/Robust.Analyzers/MeansImplicitAssigmentSuppressor.cs @@ -1,9 +1,7 @@ -using System; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; -using Robust.Generators; namespace Robust.Analyzers { diff --git a/Robust.Analyzers/Robust.Analyzers.csproj b/Robust.Analyzers/Robust.Analyzers.csproj index 1a0e63e7a..20b77d621 100644 --- a/Robust.Analyzers/Robust.Analyzers.csproj +++ b/Robust.Analyzers/Robust.Analyzers.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 9 + 10 diff --git a/Robust.Analyzers/SerializableAnalyzer.cs b/Robust.Analyzers/SerializableAnalyzer.cs index 1114e1990..96ae34404 100644 --- a/Robust.Analyzers/SerializableAnalyzer.cs +++ b/Robust.Analyzers/SerializableAnalyzer.cs @@ -17,19 +17,21 @@ namespace Robust.Analyzers public class SerializableAnalyzer : DiagnosticAnalyzer { // Metadata of the analyzer - public const string DiagnosticId = "RA0001"; // You could use LocalizedString but it's a little more complicated for this sample - private const string Title = "Class not marked as (Net)Serializable"; - private const string MessageFormat = "Class not marked as (Net)Serializable"; - private const string Description = "The class should be marked as (Net)Serializable."; - private const string Category = "Usage"; private const string RequiresSerializableAttributeMetadataName = "Robust.Shared.Analyzers.RequiresSerializableAttribute"; private const string SerializableAttributeMetadataName = "System.SerializableAttribute"; private const string NetSerializableAttributeMetadataName = "Robust.Shared.Serialization.NetSerializableAttribute"; - [SuppressMessage("ReSharper", "RS2008")] private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description); + [SuppressMessage("ReSharper", "RS2008")] private static readonly DiagnosticDescriptor Rule = new( + Diagnostics.IdSerializable, + "Class not marked as (Net)Serializable", + "Class not marked as (Net)Serializable", + "Usage", + DiagnosticSeverity.Warning, + isEnabledByDefault: true, + description: "The class should be marked as (Net)Serializable."); public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Rule); @@ -139,7 +141,8 @@ namespace Robust.Analyzers return document.WithSyntaxRoot(root); } - public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(SerializableAnalyzer.DiagnosticId); + public sealed override ImmutableArray FixableDiagnosticIds + => ImmutableArray.Create(Diagnostics.IdSerializable); public override FixAllProvider GetFixAllProvider() { diff --git a/Robust.Benchmarks/NumericsHelpers/AddBenchmark.cs b/Robust.Benchmarks/NumericsHelpers/AddBenchmark.cs index e949fde9c..3cec3781d 100644 --- a/Robust.Benchmarks/NumericsHelpers/AddBenchmark.cs +++ b/Robust.Benchmarks/NumericsHelpers/AddBenchmark.cs @@ -1,7 +1,9 @@ using BenchmarkDotNet.Attributes; +using Robust.Shared.Analyzers; namespace Robust.Benchmarks.NumericsHelpers { + [Virtual] public class AddBenchmark { [Params(32, 128)] diff --git a/Robust.Benchmarks/Program.cs b/Robust.Benchmarks/Program.cs index b7ceaacca..fced03366 100644 --- a/Robust.Benchmarks/Program.cs +++ b/Robust.Benchmarks/Program.cs @@ -4,7 +4,7 @@ using System; namespace Robust.Benchmarks { - internal class Program + internal static class Program { // --allCategories=ctg1,ctg2 // --anyCategories=ctg1,ctg2 diff --git a/Robust.Benchmarks/Serialization/BenchmarkIntSerializer.cs b/Robust.Benchmarks/Serialization/BenchmarkIntSerializer.cs index 9d991d2ca..0ad39b9de 100644 --- a/Robust.Benchmarks/Serialization/BenchmarkIntSerializer.cs +++ b/Robust.Benchmarks/Serialization/BenchmarkIntSerializer.cs @@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Benchmarks.Serialization { - public class BenchmarkIntSerializer : ITypeSerializer + public sealed class BenchmarkIntSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Benchmarks/Serialization/Copy/SerializationCopyBenchmark.cs b/Robust.Benchmarks/Serialization/Copy/SerializationCopyBenchmark.cs index 5d0f2fcb3..e1aadd436 100644 --- a/Robust.Benchmarks/Serialization/Copy/SerializationCopyBenchmark.cs +++ b/Robust.Benchmarks/Serialization/Copy/SerializationCopyBenchmark.cs @@ -2,6 +2,7 @@ using System.Linq; using BenchmarkDotNet.Attributes; using Robust.Benchmarks.Serialization.Definitions; +using Robust.Shared.Analyzers; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; @@ -13,6 +14,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.Benchmarks.Serialization.Copy { [MemoryDiagnoser] + [Virtual] public class SerializationCopyBenchmark : SerializationBenchmark { public SerializationCopyBenchmark() diff --git a/Robust.Benchmarks/Serialization/Definitions/BenchmarkFlags.cs b/Robust.Benchmarks/Serialization/Definitions/BenchmarkFlags.cs index a053780d0..3af959c95 100644 --- a/Robust.Benchmarks/Serialization/Definitions/BenchmarkFlags.cs +++ b/Robust.Benchmarks/Serialization/Definitions/BenchmarkFlags.cs @@ -3,7 +3,7 @@ using Robust.Shared.Serialization; namespace Robust.Benchmarks.Serialization.Definitions { - public class BenchmarkFlags + public sealed class BenchmarkFlags { public const int Zero = 1 << 0; public const int ThirtyOne = 1 << 31; diff --git a/Robust.Benchmarks/Serialization/Definitions/DataDefinitionWithString.cs b/Robust.Benchmarks/Serialization/Definitions/DataDefinitionWithString.cs index 501415f3a..23ff96313 100644 --- a/Robust.Benchmarks/Serialization/Definitions/DataDefinitionWithString.cs +++ b/Robust.Benchmarks/Serialization/Definitions/DataDefinitionWithString.cs @@ -1,8 +1,10 @@ -using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Analyzers; +using Robust.Shared.Serialization.Manager.Attributes; namespace Robust.Benchmarks.Serialization.Definitions { [DataDefinition] + [Virtual] public class DataDefinitionWithString { [DataField("string")] diff --git a/Robust.Benchmarks/Serialization/Definitions/SeedDataDefinition.cs b/Robust.Benchmarks/Serialization/Definitions/SeedDataDefinition.cs index 80ed61167..cd650210c 100644 --- a/Robust.Benchmarks/Serialization/Definitions/SeedDataDefinition.cs +++ b/Robust.Benchmarks/Serialization/Definitions/SeedDataDefinition.cs @@ -11,7 +11,7 @@ namespace Robust.Benchmarks.Serialization.Definitions /// Taken from content. /// [Prototype("seed")] - public class SeedDataDefinition : IPrototype + public sealed class SeedDataDefinition : IPrototype { public const string Prototype = @" - type: seed diff --git a/Robust.Benchmarks/Serialization/Initialize/SerializationInitializeBenchmark.cs b/Robust.Benchmarks/Serialization/Initialize/SerializationInitializeBenchmark.cs index 0ac5cd74e..7b05cf196 100644 --- a/Robust.Benchmarks/Serialization/Initialize/SerializationInitializeBenchmark.cs +++ b/Robust.Benchmarks/Serialization/Initialize/SerializationInitializeBenchmark.cs @@ -1,9 +1,11 @@ using BenchmarkDotNet.Attributes; +using Robust.Shared.Analyzers; using Robust.Shared.Serialization.Manager; namespace Robust.Benchmarks.Serialization.Initialize { [MemoryDiagnoser] + [Virtual] public class SerializationInitializeBenchmark : SerializationBenchmark { [IterationCleanup] diff --git a/Robust.Benchmarks/Serialization/Read/SerializationReadBenchmark.cs b/Robust.Benchmarks/Serialization/Read/SerializationReadBenchmark.cs index bbc21f19f..d1ec7a942 100644 --- a/Robust.Benchmarks/Serialization/Read/SerializationReadBenchmark.cs +++ b/Robust.Benchmarks/Serialization/Read/SerializationReadBenchmark.cs @@ -1,6 +1,7 @@ using System.IO; using BenchmarkDotNet.Attributes; using Robust.Benchmarks.Serialization.Definitions; +using Robust.Shared.Analyzers; using Robust.Shared.Serialization.Manager.Result; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; @@ -12,6 +13,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.Benchmarks.Serialization.Read { [MemoryDiagnoser] + [Virtual] public class SerializationReadBenchmark : SerializationBenchmark { public SerializationReadBenchmark() diff --git a/Robust.Benchmarks/Serialization/SerializationArrayBenchmark.cs b/Robust.Benchmarks/Serialization/SerializationArrayBenchmark.cs index d16555deb..d497d6105 100644 --- a/Robust.Benchmarks/Serialization/SerializationArrayBenchmark.cs +++ b/Robust.Benchmarks/Serialization/SerializationArrayBenchmark.cs @@ -1,5 +1,6 @@ using BenchmarkDotNet.Attributes; using Robust.Benchmarks.Serialization.Definitions; +using Robust.Shared.Analyzers; using Robust.Shared.Serialization.Markdown.Mapping; using Robust.Shared.Serialization.Markdown.Sequence; using Robust.Shared.Serialization.Markdown.Value; @@ -7,6 +8,7 @@ using Robust.Shared.Serialization.Markdown.Value; namespace Robust.Benchmarks.Serialization { [MemoryDiagnoser] + [Virtual] public class SerializationArrayBenchmark : SerializationBenchmark { public SerializationArrayBenchmark() diff --git a/Robust.Benchmarks/Serialization/Write/SerializationWriteBenchmark.cs b/Robust.Benchmarks/Serialization/Write/SerializationWriteBenchmark.cs index 2e032dde4..70d562cf8 100644 --- a/Robust.Benchmarks/Serialization/Write/SerializationWriteBenchmark.cs +++ b/Robust.Benchmarks/Serialization/Write/SerializationWriteBenchmark.cs @@ -2,6 +2,7 @@ using System.IO; using BenchmarkDotNet.Attributes; using Robust.Benchmarks.Serialization.Definitions; +using Robust.Shared.Analyzers; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; @@ -13,6 +14,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.Benchmarks.Serialization.Write { [MemoryDiagnoser] + [Virtual] public class SerializationWriteBenchmark : SerializationBenchmark { public SerializationWriteBenchmark() diff --git a/Robust.Client/Animations/AnimationTrackControlProperty.cs b/Robust.Client/Animations/AnimationTrackControlProperty.cs index 32b9b073a..dfb8c501d 100644 --- a/Robust.Client/Animations/AnimationTrackControlProperty.cs +++ b/Robust.Client/Animations/AnimationTrackControlProperty.cs @@ -3,7 +3,7 @@ using Robust.Shared.Animations; namespace Robust.Client.Animations { - public class AnimationTrackControlProperty : AnimationTrackProperty + public sealed class AnimationTrackControlProperty : AnimationTrackProperty { public string? Property { get; set; } diff --git a/Robust.Client/Audio/Midi/MidiManager.cs b/Robust.Client/Audio/Midi/MidiManager.cs index 415bc7314..85304950a 100644 --- a/Robust.Client/Audio/Midi/MidiManager.cs +++ b/Robust.Client/Audio/Midi/MidiManager.cs @@ -58,7 +58,7 @@ namespace Robust.Client.Audio.Midi void Shutdown(); } - internal class MidiManager : IMidiManager + internal sealed class MidiManager : IMidiManager { [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IResourceManagerInternal _resourceManager = default!; @@ -392,7 +392,7 @@ namespace Robust.Client.Audio.Midi /// /// This class is used to load soundfonts. /// - private class ResourceLoaderCallbacks : SoundFontLoaderCallbacks + private sealed class ResourceLoaderCallbacks : SoundFontLoaderCallbacks { private readonly Dictionary _openStreams = new(); private int _nextStreamId = 1; diff --git a/Robust.Client/Audio/Midi/MidiRenderer.cs b/Robust.Client/Audio/Midi/MidiRenderer.cs index 6c7ce9511..dc1acad0b 100644 --- a/Robust.Client/Audio/Midi/MidiRenderer.cs +++ b/Robust.Client/Audio/Midi/MidiRenderer.cs @@ -180,7 +180,7 @@ namespace Robust.Client.Audio.Midi internal void InternalDispose(); } - internal class MidiRenderer : IMidiRenderer + internal sealed class MidiRenderer : IMidiRenderer { [Dependency] private readonly IClydeAudio _clydeAudio = default!; [Dependency] private readonly ITaskManager _taskManager = default!; diff --git a/Robust.Client/BaseClient.cs b/Robust.Client/BaseClient.cs index f7244359e..3232d9259 100644 --- a/Robust.Client/BaseClient.cs +++ b/Robust.Client/BaseClient.cs @@ -20,7 +20,7 @@ using Robust.Shared.Utility; namespace Robust.Client { /// - public class BaseClient : IBaseClient + public sealed class BaseClient : IBaseClient { [Dependency] private readonly IClientNetManager _net = default!; [Dependency] private readonly IPlayerManager _playMan = default!; @@ -291,7 +291,7 @@ namespace Robust.Client /// /// Event arguments for when something changed with the player. /// - public class PlayerEventArgs : EventArgs + public sealed class PlayerEventArgs : EventArgs { /// /// The session that triggered the event. @@ -310,7 +310,7 @@ namespace Robust.Client /// /// Event arguments for when the RunLevel has changed in the BaseClient. /// - public class RunLevelChangedEventArgs : EventArgs + public sealed class RunLevelChangedEventArgs : EventArgs { /// /// RunLevel that the BaseClient switched from. @@ -335,7 +335,7 @@ namespace Robust.Client /// /// Info about the server and player that is sent to the client while connecting. /// - public class ServerInfo + public sealed class ServerInfo { public ServerInfo(string serverName) { diff --git a/Robust.Client/Console/ClientConGroupController.cs b/Robust.Client/Console/ClientConGroupController.cs index c1c46ef40..6e8109cfd 100644 --- a/Robust.Client/Console/ClientConGroupController.cs +++ b/Robust.Client/Console/ClientConGroupController.cs @@ -2,7 +2,7 @@ namespace Robust.Client.Console { - public class ClientConGroupController : IClientConGroupController + public sealed class ClientConGroupController : IClientConGroupController { private IClientConGroupImplementation? _implementation; public event Action? ConGroupUpdated; diff --git a/Robust.Client/Console/ClientConsoleHost.cs b/Robust.Client/Console/ClientConsoleHost.cs index 71c753517..dcc5d4579 100644 --- a/Robust.Client/Console/ClientConsoleHost.cs +++ b/Robust.Client/Console/ClientConsoleHost.cs @@ -14,7 +14,7 @@ using Robust.Shared.Utility; namespace Robust.Client.Console { - public class AddStringArgs : EventArgs + public sealed class AddStringArgs : EventArgs { public string Text { get; } @@ -30,7 +30,7 @@ namespace Robust.Client.Console } } - public class AddFormattedMessageArgs : EventArgs + public sealed class AddFormattedMessageArgs : EventArgs { public readonly FormattedMessage Message; @@ -41,7 +41,7 @@ namespace Robust.Client.Console } /// - internal class ClientConsoleHost : ConsoleHost, IClientConsoleHost + internal sealed class ClientConsoleHost : ConsoleHost, IClientConsoleHost { [Dependency] private readonly IClientConGroupController _conGroup = default!; @@ -209,7 +209,7 @@ namespace Robust.Client.Console /// These dummies are made purely so list and help can list server-side commands. /// [Reflect(false)] - internal class ServerDummyCommand : IConsoleCommand + internal sealed class ServerDummyCommand : IConsoleCommand { internal ServerDummyCommand(string command, string help, string description) { diff --git a/Robust.Client/Console/Commands/ConfigurationCommands.cs b/Robust.Client/Console/Commands/ConfigurationCommands.cs index 42140c1ba..cf8c67735 100644 --- a/Robust.Client/Console/Commands/ConfigurationCommands.cs +++ b/Robust.Client/Console/Commands/ConfigurationCommands.cs @@ -59,7 +59,7 @@ namespace Robust.Client.Console.Commands } [UsedImplicitly] - public class SaveConfig : IConsoleCommand + public sealed class SaveConfig : IConsoleCommand { public string Command => "saveconfig"; public string Description => "Saves the client configuration to the config file"; diff --git a/Robust.Client/Console/Commands/ConsoleCommands.cs b/Robust.Client/Console/Commands/ConsoleCommands.cs index e41c145ac..82b47ca73 100644 --- a/Robust.Client/Console/Commands/ConsoleCommands.cs +++ b/Robust.Client/Console/Commands/ConsoleCommands.cs @@ -6,7 +6,7 @@ using Robust.Shared.Console; namespace Robust.Client.Console.Commands { - class ClearCommand : IConsoleCommand + sealed class ClearCommand : IConsoleCommand { public string Command => "cls"; public string Help => "Clears the debug console of all messages."; @@ -18,7 +18,7 @@ namespace Robust.Client.Console.Commands } } - class FillCommand : IConsoleCommand + sealed class FillCommand : IConsoleCommand { public string Command => "fill"; public string Help => "Fills the console with some nonsense for debugging."; diff --git a/Robust.Client/Console/Commands/Debug.cs b/Robust.Client/Console/Commands/Debug.cs index 000afbb14..f4abb92f7 100644 --- a/Robust.Client/Console/Commands/Debug.cs +++ b/Robust.Client/Console/Commands/Debug.cs @@ -30,7 +30,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.Console.Commands { - internal class DumpEntitiesCommand : IConsoleCommand + internal sealed class DumpEntitiesCommand : IConsoleCommand { public string Command => "dumpentities"; public string Help => "Dump entity list"; @@ -47,7 +47,7 @@ namespace Robust.Client.Console.Commands } } - internal class GetComponentRegistrationCommand : IConsoleCommand + internal sealed class GetComponentRegistrationCommand : IConsoleCommand { public string Command => "getcomponentregistration"; public string Help => "Usage: getcomponentregistration "; @@ -93,7 +93,7 @@ namespace Robust.Client.Console.Commands } } - internal class ToggleMonitorCommand : IConsoleCommand + internal sealed class ToggleMonitorCommand : IConsoleCommand { public string Command => "monitor"; @@ -148,7 +148,7 @@ namespace Robust.Client.Console.Commands } } - internal class ExceptionCommand : IConsoleCommand + internal sealed class ExceptionCommand : IConsoleCommand { public string Command => "fuck"; public string Help => "Throws an exception"; @@ -160,7 +160,7 @@ namespace Robust.Client.Console.Commands } } - internal class ShowPositionsCommand : IConsoleCommand + internal sealed class ShowPositionsCommand : IConsoleCommand { public string Command => "showpos"; public string Help => ""; @@ -173,7 +173,7 @@ namespace Robust.Client.Console.Commands } } - internal class ShowRayCommand : IConsoleCommand + internal sealed class ShowRayCommand : IConsoleCommand { public string Command => "showrays"; public string Help => "Usage: showrays "; @@ -200,7 +200,7 @@ namespace Robust.Client.Console.Commands } } - internal class DisconnectCommand : IConsoleCommand + internal sealed class DisconnectCommand : IConsoleCommand { public string Command => "disconnect"; public string Help => ""; @@ -212,7 +212,7 @@ namespace Robust.Client.Console.Commands } } - internal class EntityInfoCommand : IConsoleCommand + internal sealed class EntityInfoCommand : IConsoleCommand { public string Command => "entfo"; @@ -264,7 +264,7 @@ namespace Robust.Client.Console.Commands } } - internal class SnapGridGetCell : IConsoleCommand + internal sealed class SnapGridGetCell : IConsoleCommand { public string Command => "sggcell"; public string Help => "sggcell \nThat vector2i param is in the form x,y."; @@ -313,7 +313,7 @@ namespace Robust.Client.Console.Commands } } - internal class SetPlayerName : IConsoleCommand + internal sealed class SetPlayerName : IConsoleCommand { public string Command => "overrideplayername"; public string Description => "Changes the name used when attempting to connect to the server."; @@ -333,7 +333,7 @@ namespace Robust.Client.Console.Commands } } - internal class LoadResource : IConsoleCommand + internal sealed class LoadResource : IConsoleCommand { public string Command => "ldrsc"; public string Description => "Pre-caches a resource."; @@ -370,7 +370,7 @@ namespace Robust.Client.Console.Commands } } - internal class ReloadResource : IConsoleCommand + internal sealed class ReloadResource : IConsoleCommand { public string Command => "rldrsc"; public string Description => "Reloads a resource."; @@ -404,7 +404,7 @@ namespace Robust.Client.Console.Commands } } - internal class GridTileCount : IConsoleCommand + internal sealed class GridTileCount : IConsoleCommand { public string Command => "gridtc"; public string Description => "Gets the tile count of a grid"; @@ -438,7 +438,7 @@ namespace Robust.Client.Console.Commands } } - internal class GuiDumpCommand : IConsoleCommand + internal sealed class GuiDumpCommand : IConsoleCommand { public string Command => "guidump"; public string Description => "Dump GUI tree to /guidump.txt in user data."; @@ -512,7 +512,7 @@ namespace Robust.Client.Console.Commands } } - internal class UITestCommand : IConsoleCommand + internal sealed class UITestCommand : IConsoleCommand { public string Command => "uitest"; public string Description => "Open a dummy UI testing window"; @@ -644,7 +644,7 @@ namespace Robust.Client.Console.Commands } } - internal class SetClipboardCommand : IConsoleCommand + internal sealed class SetClipboardCommand : IConsoleCommand { public string Command => "setclipboard"; public string Description => "Sets the system clipboard"; @@ -657,7 +657,7 @@ namespace Robust.Client.Console.Commands } } - internal class GetClipboardCommand : IConsoleCommand + internal sealed class GetClipboardCommand : IConsoleCommand { public string Command => "getclipboard"; public string Description => "Gets the system clipboard"; @@ -670,7 +670,7 @@ namespace Robust.Client.Console.Commands } } - internal class ToggleLight : IConsoleCommand + internal sealed class ToggleLight : IConsoleCommand { public string Command => "togglelight"; public string Description => "Toggles light rendering."; @@ -684,7 +684,7 @@ namespace Robust.Client.Console.Commands } } - internal class ToggleFOV : IConsoleCommand + internal sealed class ToggleFOV : IConsoleCommand { public string Command => "togglefov"; public string Description => "Toggles fov for client."; @@ -698,7 +698,7 @@ namespace Robust.Client.Console.Commands } } - internal class ToggleHardFOV : IConsoleCommand + internal sealed class ToggleHardFOV : IConsoleCommand { public string Command => "togglehardfov"; public string Description => "Toggles hard fov for client (for debugging space-station-14#2353)."; @@ -712,7 +712,7 @@ namespace Robust.Client.Console.Commands } } - internal class ToggleShadows : IConsoleCommand + internal sealed class ToggleShadows : IConsoleCommand { public string Command => "toggleshadows"; public string Description => "Toggles shadow rendering."; @@ -725,7 +725,7 @@ namespace Robust.Client.Console.Commands mgr.DrawShadows = !mgr.DrawShadows; } } - internal class ToggleLightBuf : IConsoleCommand + internal sealed class ToggleLightBuf : IConsoleCommand { public string Command => "togglelightbuf"; public string Description => "Toggles lighting rendering. This includes shadows but not FOV."; @@ -739,7 +739,7 @@ namespace Robust.Client.Console.Commands } } - internal class GcCommand : IConsoleCommand + internal sealed class GcCommand : IConsoleCommand { public string Command => "gc"; public string Description => "Run the GC."; @@ -761,7 +761,7 @@ namespace Robust.Client.Console.Commands } } - internal class GcFullCommand : IConsoleCommand + internal sealed class GcFullCommand : IConsoleCommand { public string Command => "gcf"; public string Description => "Run the GC, fully, compacting LOH and everything."; @@ -774,7 +774,7 @@ namespace Robust.Client.Console.Commands } } - internal class GcModeCommand : IConsoleCommand + internal sealed class GcModeCommand : IConsoleCommand { public string Command => "gc_mode"; @@ -816,7 +816,7 @@ namespace Robust.Client.Console.Commands } - internal class SerializeStatsCommand : IConsoleCommand + internal sealed class SerializeStatsCommand : IConsoleCommand { public string Command => "szr_stats"; @@ -836,7 +836,7 @@ namespace Robust.Client.Console.Commands } - internal class ChunkInfoCommand : IConsoleCommand + internal sealed class ChunkInfoCommand : IConsoleCommand { public string Command => "chunkinfo"; public string Description => "Gets info about a chunk under your mouse cursor."; @@ -865,7 +865,7 @@ namespace Robust.Client.Console.Commands } } - internal class ReloadShadersCommand : IConsoleCommand + internal sealed class ReloadShadersCommand : IConsoleCommand { public string Command => "rldshader"; @@ -1036,7 +1036,7 @@ namespace Robust.Client.Console.Commands } - internal class ClydeDebugLayerCommand : IConsoleCommand + internal sealed class ClydeDebugLayerCommand : IConsoleCommand { public string Command => "cldbglyr"; public string Description => "Toggle fov and light debug layers"; @@ -1061,7 +1061,7 @@ namespace Robust.Client.Console.Commands } } - internal class GetKeyInfoCommand : IConsoleCommand + internal sealed class GetKeyInfoCommand : IConsoleCommand { public string Command => "keyinfo"; public string Description => "Keys key info for a key"; diff --git a/Robust.Client/Console/Commands/GridChunkBBCommand.cs b/Robust.Client/Console/Commands/GridChunkBBCommand.cs index f38ba38ba..f01a2289b 100644 --- a/Robust.Client/Console/Commands/GridChunkBBCommand.cs +++ b/Robust.Client/Console/Commands/GridChunkBBCommand.cs @@ -4,7 +4,7 @@ using Robust.Shared.GameObjects; namespace Robust.Client.Console.Commands { - public class GridChunkBBCommand : IConsoleCommand + public sealed class GridChunkBBCommand : IConsoleCommand { public string Command => "showchunkbb"; public string Description => "Displays chunk bounds for the purposes of rendering"; diff --git a/Robust.Client/Console/Commands/HelpCommands.cs b/Robust.Client/Console/Commands/HelpCommands.cs index 35f710114..a5e1f2935 100644 --- a/Robust.Client/Console/Commands/HelpCommands.cs +++ b/Robust.Client/Console/Commands/HelpCommands.cs @@ -5,7 +5,7 @@ using Robust.Shared.Network; namespace Robust.Client.Console.Commands { - class HelpCommand : IConsoleCommand + sealed class HelpCommand : IConsoleCommand { public string Command => "help"; public string Help => "When no arguments are provided, displays a generic help text. When an argument is passed, display the help text for the command with that name."; @@ -44,7 +44,7 @@ namespace Robust.Client.Console.Commands } } - class ListCommand : IConsoleCommand + sealed class ListCommand : IConsoleCommand { public string Command => "list"; public string Help => "Usage: list [filter]\n" + diff --git a/Robust.Client/Console/Commands/LogCommands.cs b/Robust.Client/Console/Commands/LogCommands.cs index 53952c873..dff620264 100644 --- a/Robust.Client/Console/Commands/LogCommands.cs +++ b/Robust.Client/Console/Commands/LogCommands.cs @@ -4,7 +4,7 @@ using Robust.Shared.Console; namespace Robust.Client.Console.Commands { - class LogSetLevelCommand : IConsoleCommand + sealed class LogSetLevelCommand : IConsoleCommand { public string Command => "loglevel"; public string Description => "Changes the log level for a provided sawmill."; @@ -40,7 +40,7 @@ namespace Robust.Client.Console.Commands } } - class TestLog : IConsoleCommand + sealed class TestLog : IConsoleCommand { public string Command => "testlog"; public string Description => "Writes a test log to a sawmill."; diff --git a/Robust.Client/Console/Commands/QuitCommand.cs b/Robust.Client/Console/Commands/QuitCommand.cs index 3740f0135..8b25d515b 100644 --- a/Robust.Client/Console/Commands/QuitCommand.cs +++ b/Robust.Client/Console/Commands/QuitCommand.cs @@ -4,7 +4,7 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { - class HardQuitCommand : IConsoleCommand + sealed class HardQuitCommand : IConsoleCommand { public string Command => "hardquit"; public string Description => "Kills the game client instantly."; @@ -16,7 +16,7 @@ namespace Robust.Client.Console.Commands } } - class QuitCommand : IConsoleCommand + sealed class QuitCommand : IConsoleCommand { public string Command => "quit"; public string Description => "Shuts down the game client gracefully."; diff --git a/Robust.Client/Console/Commands/SetInputContextCommand.cs b/Robust.Client/Console/Commands/SetInputContextCommand.cs index 01e2cfb73..49c586ae1 100644 --- a/Robust.Client/Console/Commands/SetInputContextCommand.cs +++ b/Robust.Client/Console/Commands/SetInputContextCommand.cs @@ -6,7 +6,7 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { [UsedImplicitly] - public class SetInputContextCommand : IConsoleCommand + public sealed class SetInputContextCommand : IConsoleCommand { public string Command => "setinputcontext"; public string Description => "Sets the active input context."; diff --git a/Robust.Client/Console/Commands/VelocitiesCommand.cs b/Robust.Client/Console/Commands/VelocitiesCommand.cs index 8d6b9454f..44f6fea49 100644 --- a/Robust.Client/Console/Commands/VelocitiesCommand.cs +++ b/Robust.Client/Console/Commands/VelocitiesCommand.cs @@ -4,7 +4,7 @@ using Robust.Shared.GameObjects; namespace Robust.Client.Console.Commands { - public class VelocitiesCommand : IConsoleCommand + public sealed class VelocitiesCommand : IConsoleCommand { public string Command => "showvelocities"; public string Description => "Displays your angular and linear velocities"; diff --git a/Robust.Client/Console/Completions.cs b/Robust.Client/Console/Completions.cs index 5d9742f22..11feb38cb 100644 --- a/Robust.Client/Console/Completions.cs +++ b/Robust.Client/Console/Completions.cs @@ -11,7 +11,7 @@ using static Robust.Shared.Network.Messages.MsgScriptCompletionResponse; namespace Robust.Client.Console { - public class Completions : DefaultWindow + public sealed class Completions : DefaultWindow { private HistoryLineEdit _textBar; private ScrollContainer _suggestPanel = new() @@ -75,7 +75,7 @@ namespace Robust.Client.Console } // Label and ghetto button. - public class Entry : RichTextLabel + public sealed class Entry : RichTextLabel { public readonly LiteResult Result; diff --git a/Robust.Client/Console/ScriptClient.cs b/Robust.Client/Console/ScriptClient.cs index 61aaaa5f1..6bdf16dbd 100644 --- a/Robust.Client/Console/ScriptClient.cs +++ b/Robust.Client/Console/ScriptClient.cs @@ -6,7 +6,7 @@ using Robust.Shared.Network.Messages; namespace Robust.Client.Console { - public partial class ScriptClient : IScriptClient + public sealed partial class ScriptClient : IScriptClient { [Dependency] private readonly IClientConGroupController _conGroupController = default!; [Dependency] private readonly IClientNetManager _netManager = default!; diff --git a/Robust.Client/Console/WatchWindow.cs b/Robust.Client/Console/WatchWindow.cs index 0042c2920..cfd71ca2f 100644 --- a/Robust.Client/Console/WatchWindow.cs +++ b/Robust.Client/Console/WatchWindow.cs @@ -15,7 +15,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.Console { - public class WatchWindow : DefaultWindow + public sealed class WatchWindow : DefaultWindow { private readonly IReflectionManager _reflectionManager; diff --git a/Robust.Client/Debugging/DebugDrawing.cs b/Robust.Client/Debugging/DebugDrawing.cs index 19feec564..8203ece58 100644 --- a/Robust.Client/Debugging/DebugDrawing.cs +++ b/Robust.Client/Debugging/DebugDrawing.cs @@ -7,7 +7,7 @@ using Robust.Shared.Maths; namespace Robust.Client.Debugging { /// - public class DebugDrawing : IDebugDrawing + public sealed class DebugDrawing : IDebugDrawing { [Dependency] private readonly IOverlayManager _overlayManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; diff --git a/Robust.Client/GameController/GameController.Loader.cs b/Robust.Client/GameController/GameController.Loader.cs index 403e45c34..2bfc65faf 100644 --- a/Robust.Client/GameController/GameController.Loader.cs +++ b/Robust.Client/GameController/GameController.Loader.cs @@ -7,7 +7,7 @@ namespace Robust.Client { internal partial class GameController { - internal class LoaderEntryPoint : ILoaderEntryPoint + internal sealed class LoaderEntryPoint : ILoaderEntryPoint { public void Main(IMainArgs args) { diff --git a/Robust.Client/GameControllerOptions.cs b/Robust.Client/GameControllerOptions.cs index ebfc3742c..40452285a 100644 --- a/Robust.Client/GameControllerOptions.cs +++ b/Robust.Client/GameControllerOptions.cs @@ -3,7 +3,7 @@ using Robust.Shared.Utility; namespace Robust.Client { - public class GameControllerOptions + public sealed class GameControllerOptions { /// /// Whether content sandboxing will be enabled & enforced. diff --git a/Robust.Client/GameObjects/ClientComponentFactory.cs b/Robust.Client/GameObjects/ClientComponentFactory.cs index 3c11aed29..b8c7fce82 100644 --- a/Robust.Client/GameObjects/ClientComponentFactory.cs +++ b/Robust.Client/GameObjects/ClientComponentFactory.cs @@ -6,7 +6,7 @@ using Robust.Shared.Reflection; namespace Robust.Client.GameObjects { - internal class ClientComponentFactory : ComponentFactory + internal sealed class ClientComponentFactory : ComponentFactory { public ClientComponentFactory(IDynamicTypeFactoryInternal typeFactory, IReflectionManager reflectionManager, IConsoleHost conHost) : base(typeFactory, reflectionManager, conHost) diff --git a/Robust.Client/GameObjects/ComponentStateApplyException.cs b/Robust.Client/GameObjects/ComponentStateApplyException.cs index 5d12ae876..532a9ef8c 100644 --- a/Robust.Client/GameObjects/ComponentStateApplyException.cs +++ b/Robust.Client/GameObjects/ComponentStateApplyException.cs @@ -4,6 +4,7 @@ using System.Runtime.Serialization; namespace Robust.Client.GameObjects { [Serializable] + [Virtual] public class ComponentStateApplyException : Exception { public ComponentStateApplyException() diff --git a/Robust.Client/GameObjects/Components/Eye/EyeComponent.cs b/Robust.Client/GameObjects/Components/Eye/EyeComponent.cs index 2894eb827..e9e7045ee 100644 --- a/Robust.Client/GameObjects/Components/Eye/EyeComponent.cs +++ b/Robust.Client/GameObjects/Components/Eye/EyeComponent.cs @@ -9,7 +9,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.GameObjects { [ComponentReference(typeof(SharedEyeComponent))] - public class EyeComponent : SharedEyeComponent + public sealed class EyeComponent : SharedEyeComponent { [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; diff --git a/Robust.Client/GameObjects/Components/Icon/IconComponent.cs b/Robust.Client/GameObjects/Components/Icon/IconComponent.cs index 0611cd3c4..fc53ac11e 100644 --- a/Robust.Client/GameObjects/Components/Icon/IconComponent.cs +++ b/Robust.Client/GameObjects/Components/Icon/IconComponent.cs @@ -12,7 +12,7 @@ using Robust.Shared.Utility; namespace Robust.Client.GameObjects { [RegisterComponent] - public class IconComponent : Component, ISerializationHooks + public sealed class IconComponent : Component, ISerializationHooks { public IDirectionalTextureProvider? Icon { get; private set; } diff --git a/Robust.Client/GameObjects/Components/Input/InputComponent.cs b/Robust.Client/GameObjects/Components/Input/InputComponent.cs index d156685a0..90133a5ab 100644 --- a/Robust.Client/GameObjects/Components/Input/InputComponent.cs +++ b/Robust.Client/GameObjects/Components/Input/InputComponent.cs @@ -8,7 +8,7 @@ namespace Robust.Client.GameObjects /// /// Defines data fields used in the . /// - public class InputComponent : Component + public sealed class InputComponent : Component { /// /// The context that will be made active for a client that attaches to this entity. diff --git a/Robust.Client/GameObjects/Components/Light/PointLightComponent.cs b/Robust.Client/GameObjects/Components/Light/PointLightComponent.cs index c590562c5..8689d4f89 100644 --- a/Robust.Client/GameObjects/Components/Light/PointLightComponent.cs +++ b/Robust.Client/GameObjects/Components/Light/PointLightComponent.cs @@ -11,7 +11,7 @@ namespace Robust.Client.GameObjects { [RegisterComponent] [ComponentReference(typeof(SharedPointLightComponent))] - public class PointLightComponent : SharedPointLightComponent, ISerializationHooks + public sealed class PointLightComponent : SharedPointLightComponent, ISerializationHooks { [Dependency] private readonly IEntityManager _entityManager = default!; @@ -139,7 +139,7 @@ namespace Robust.Client.GameObjects internal RenderingTreeComponent? RenderTree { get; set; } } - public class PointLightRadiusChangedEvent : EntityEventArgs + public sealed class PointLightRadiusChangedEvent : EntityEventArgs { public PointLightComponent PointLightComponent { get; } diff --git a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs index accd776ae..10ac769d2 100644 --- a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs +++ b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs @@ -57,7 +57,7 @@ namespace Robust.Client.GameObjects private bool _enabled; } - public class SpriteBoundsOverlay : Overlay + public sealed class SpriteBoundsOverlay : Overlay { public override OverlaySpace Space => OverlaySpace.WorldSpace; diff --git a/Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs b/Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs index e10be7c07..09ef588fc 100644 --- a/Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs +++ b/Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs @@ -1615,7 +1615,7 @@ namespace Robust.Client.GameObjects Flip = 3, } - public class Layer : ISpriteLayer + public sealed class Layer : ISpriteLayer { [ViewVariables] private readonly SpriteComponent _parent; diff --git a/Robust.Client/GameObjects/Components/UserInterface/ClientUserInterfaceComponent.cs b/Robust.Client/GameObjects/Components/UserInterface/ClientUserInterfaceComponent.cs index 3e9ead540..2b17af24e 100644 --- a/Robust.Client/GameObjects/Components/UserInterface/ClientUserInterfaceComponent.cs +++ b/Robust.Client/GameObjects/Components/UserInterface/ClientUserInterfaceComponent.cs @@ -11,7 +11,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.GameObjects { [ComponentReference(typeof(SharedUserInterfaceComponent))] - public class ClientUserInterfaceComponent : SharedUserInterfaceComponent, ISerializationHooks + public sealed class ClientUserInterfaceComponent : SharedUserInterfaceComponent, ISerializationHooks { [Dependency] private readonly IReflectionManager _reflectionManager = default!; [Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!; diff --git a/Robust.Client/GameObjects/EntitySystems/AudioSystem.cs b/Robust.Client/GameObjects/EntitySystems/AudioSystem.cs index f708846eb..b1b3eea66 100644 --- a/Robust.Client/GameObjects/EntitySystems/AudioSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/AudioSystem.cs @@ -17,7 +17,7 @@ using Robust.Shared.Utility; namespace Robust.Client.GameObjects { [UsedImplicitly] - public class AudioSystem : SharedAudioSystem, IAudioSystem + public sealed class AudioSystem : SharedAudioSystem, IAudioSystem { [Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IMapManager _mapManager = default!; @@ -420,7 +420,7 @@ namespace Robust.Client.GameObjects source.IsLooping = audioParams.Value.Loop; } - private class PlayingStream : IPlayingAudioStream + private sealed class PlayingStream : IPlayingAudioStream { public uint? NetIdentifier; public IClydeAudioSource Source = default!; diff --git a/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs b/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs index 0d96fa42d..7bf567ccb 100644 --- a/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs @@ -10,7 +10,7 @@ using static Robust.Shared.Containers.ContainerManagerComponent; namespace Robust.Client.GameObjects { - public class ContainerSystem : SharedContainerSystem + public sealed class ContainerSystem : SharedContainerSystem { [Dependency] private readonly IRobustSerializer _serializer = default!; [Dependency] private readonly IDynamicTypeFactoryInternal _dynFactory = default!; diff --git a/Robust.Client/GameObjects/EntitySystems/EffectSystem.cs b/Robust.Client/GameObjects/EntitySystems/EffectSystem.cs index a2707e3e9..ebfbefb23 100644 --- a/Robust.Client/GameObjects/EntitySystems/EffectSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/EffectSystem.cs @@ -15,7 +15,7 @@ using Robust.Shared.Enums; namespace Robust.Client.GameObjects { - public class EffectSystem : EntitySystem + public sealed class EffectSystem : EntitySystem { [Dependency] private readonly IGameTiming gameTiming = default!; [Dependency] private readonly IResourceCache resourceCache = default!; @@ -94,7 +94,7 @@ namespace Robust.Client.GameObjects } } - private class Effect + private sealed class Effect { /// /// Effect Sprite diff --git a/Robust.Client/GameObjects/EntitySystems/EyeUpdateSystem.cs b/Robust.Client/GameObjects/EntitySystems/EyeUpdateSystem.cs index 6468b97de..7e17d7473 100644 --- a/Robust.Client/GameObjects/EntitySystems/EyeUpdateSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/EyeUpdateSystem.cs @@ -20,7 +20,7 @@ namespace Robust.Client.GameObjects /// Updates the position of every Eye every frame, so that the camera follows the player around. /// [UsedImplicitly] - public class EyeUpdateSystem : EntitySystem + public sealed class EyeUpdateSystem : EntitySystem { /// public override void Initialize() diff --git a/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs b/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs index ac985e25a..13348642e 100644 --- a/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/GridChunkBoundsDebugSystem.cs @@ -10,7 +10,7 @@ using Robust.Shared.Utility; namespace Robust.Client.GameObjects { - public class GridChunkBoundsDebugSystem : EntitySystem + public sealed class GridChunkBoundsDebugSystem : EntitySystem { [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; diff --git a/Robust.Client/GameObjects/EntitySystems/InputSystem.cs b/Robust.Client/GameObjects/EntitySystems/InputSystem.cs index 2aa299251..a7e250436 100644 --- a/Robust.Client/GameObjects/EntitySystems/InputSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/InputSystem.cs @@ -16,7 +16,7 @@ namespace Robust.Client.GameObjects /// /// Client-side processing of all input commands through the simulation. /// - public class InputSystem : SharedInputSystem + public sealed class InputSystem : SharedInputSystem { [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; @@ -163,7 +163,7 @@ namespace Robust.Client.GameObjects /// /// Entity system message that is raised when the player changes attached entities. /// - public class PlayerAttachSysMessage : EntityEventArgs + public sealed class PlayerAttachSysMessage : EntityEventArgs { /// /// New entity the player is attached to. @@ -180,7 +180,7 @@ namespace Robust.Client.GameObjects } } - public class PlayerAttachedEvent : EntityEventArgs + public sealed class PlayerAttachedEvent : EntityEventArgs { public PlayerAttachedEvent(EntityUid entity) { @@ -190,7 +190,7 @@ namespace Robust.Client.GameObjects public EntityUid Entity { get; } } - public class PlayerDetachedEvent : EntityEventArgs + public sealed class PlayerDetachedEvent : EntityEventArgs { public PlayerDetachedEvent(EntityUid entity) { diff --git a/Robust.Client/GameObjects/EntitySystems/MidiSystem.cs b/Robust.Client/GameObjects/EntitySystems/MidiSystem.cs index 24f87bfb5..7bc16f141 100644 --- a/Robust.Client/GameObjects/EntitySystems/MidiSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/MidiSystem.cs @@ -4,7 +4,7 @@ using Robust.Shared.IoC; namespace Robust.Client.GameObjects { - public class MidiSystem : EntitySystem + public sealed class MidiSystem : EntitySystem { [Dependency] private readonly IMidiManager _midiManager = default!; diff --git a/Robust.Client/GameObjects/EntitySystems/SpriteSystem.cs b/Robust.Client/GameObjects/EntitySystems/SpriteSystem.cs index f422d30ab..67bbd136d 100644 --- a/Robust.Client/GameObjects/EntitySystems/SpriteSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/SpriteSystem.cs @@ -11,7 +11,7 @@ namespace Robust.Client.GameObjects /// Updates the layer animation for every visible sprite. /// [UsedImplicitly] - public class SpriteSystem : EntitySystem + public sealed class SpriteSystem : EntitySystem { [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly RenderingTreeSystem _treeSystem = default!; diff --git a/Robust.Client/GameObjects/EntitySystems/VelocityDebugSystem.cs b/Robust.Client/GameObjects/EntitySystems/VelocityDebugSystem.cs index 9817ee439..4e76d7d21 100644 --- a/Robust.Client/GameObjects/EntitySystems/VelocityDebugSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/VelocityDebugSystem.cs @@ -8,7 +8,7 @@ using Robust.Shared.Maths; namespace Robust.Client.GameObjects { - public class VelocityDebugSystem : EntitySystem + public sealed class VelocityDebugSystem : EntitySystem { [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; diff --git a/Robust.Client/GameStates/ClientGameStateManager.cs b/Robust.Client/GameStates/ClientGameStateManager.cs index 7456f40f3..8fcba13c2 100644 --- a/Robust.Client/GameStates/ClientGameStateManager.cs +++ b/Robust.Client/GameStates/ClientGameStateManager.cs @@ -28,7 +28,7 @@ namespace Robust.Client.GameStates { /// [UsedImplicitly] - public class ClientGameStateManager : IClientGameStateManager + public sealed class ClientGameStateManager : IClientGameStateManager { private GameStateProcessor _processor = default!; @@ -637,7 +637,7 @@ namespace Robust.Client.GameStates } } - public class GameStateAppliedArgs : EventArgs + public sealed class GameStateAppliedArgs : EventArgs { public GameState AppliedState { get; } diff --git a/Robust.Client/GameStates/GameStateProcessor.cs b/Robust.Client/GameStates/GameStateProcessor.cs index 8a1e97a9b..08f36367f 100644 --- a/Robust.Client/GameStates/GameStateProcessor.cs +++ b/Robust.Client/GameStates/GameStateProcessor.cs @@ -10,7 +10,7 @@ using Robust.Shared.Utility; namespace Robust.Client.GameStates { /// - internal class GameStateProcessor : IGameStateProcessor + internal sealed class GameStateProcessor : IGameStateProcessor { private readonly IGameTiming _timing; diff --git a/Robust.Client/GameStates/NetEntityOverlay.cs b/Robust.Client/GameStates/NetEntityOverlay.cs index b771b4268..8842392ea 100644 --- a/Robust.Client/GameStates/NetEntityOverlay.cs +++ b/Robust.Client/GameStates/NetEntityOverlay.cs @@ -19,7 +19,7 @@ namespace Robust.Client.GameStates /// A network entity report that lists all entities as they are updated through game states. /// https://developer.valvesoftware.com/wiki/Networking_Entities#cl_entityreport /// - class NetEntityOverlay : Overlay + sealed class NetEntityOverlay : Overlay { [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IClientNetManager _netManager = default!; @@ -244,7 +244,7 @@ namespace Robust.Client.GameStates } } - private class NetEntityReportCommand : IConsoleCommand + private sealed class NetEntityReportCommand : IConsoleCommand { public string Command => "net_entityreport"; public string Help => "net_entityreport <0|1>"; diff --git a/Robust.Client/GameStates/NetGraphOverlay.cs b/Robust.Client/GameStates/NetGraphOverlay.cs index e1652733c..f16dde3aa 100644 --- a/Robust.Client/GameStates/NetGraphOverlay.cs +++ b/Robust.Client/GameStates/NetGraphOverlay.cs @@ -16,7 +16,7 @@ namespace Robust.Client.GameStates /// /// Visual debug overlay for the network diagnostic graph. /// - internal class NetGraphOverlay : Overlay + internal sealed class NetGraphOverlay : Overlay { [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IClientNetManager _netManager = default!; @@ -239,7 +239,7 @@ namespace Robust.Client.GameStates base.DisposeBehavior(); } - private class NetShowGraphCommand : IConsoleCommand + private sealed class NetShowGraphCommand : IConsoleCommand { public string Command => "net_graph"; public string Help => "net_graph <0|1>"; @@ -275,7 +275,7 @@ namespace Robust.Client.GameStates } } - private class NetWatchEntCommand : IConsoleCommand + private sealed class NetWatchEntCommand : IConsoleCommand { public string Command => "net_watchent"; public string Help => "net_watchent <0|EntityUid>"; diff --git a/Robust.Client/GameStates/NetInterpOverlay.cs b/Robust.Client/GameStates/NetInterpOverlay.cs index 4611185c9..8d0263503 100644 --- a/Robust.Client/GameStates/NetInterpOverlay.cs +++ b/Robust.Client/GameStates/NetInterpOverlay.cs @@ -11,7 +11,7 @@ using Robust.Shared.Timing; namespace Robust.Client.GameStates { - internal class NetInterpOverlay : Overlay + internal sealed class NetInterpOverlay : Overlay { [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; @@ -65,7 +65,7 @@ namespace Robust.Client.GameStates } } - private class NetShowInterpCommand : IConsoleCommand + private sealed class NetShowInterpCommand : IConsoleCommand { public string Command => "net_draw_interp"; public string Help => "net_draw_interp <0|1>"; diff --git a/Robust.Client/Graphics/Audio/ClydeAudio.cs b/Robust.Client/Graphics/Audio/ClydeAudio.cs index abc19f750..55404ae37 100644 --- a/Robust.Client/Graphics/Audio/ClydeAudio.cs +++ b/Robust.Client/Graphics/Audio/ClydeAudio.cs @@ -18,7 +18,7 @@ using Vector2 = Robust.Shared.Maths.Vector2; namespace Robust.Client.Graphics.Audio { - internal partial class ClydeAudio : IClydeAudio, IClydeAudioInternal + internal sealed partial class ClydeAudio : IClydeAudio, IClydeAudioInternal { private ALDevice _openALDevice; private ALContext _openALContext; @@ -224,7 +224,7 @@ namespace Robust.Client.Graphics.Audio _openALSawmill.Error("Failed to generate source. Too many simultaneous audio streams?"); return null; } - + // ReSharper disable once PossibleInvalidOperationException // TODO: This really shouldn't be indexing based on the ClydeHandle... AL.Source(source, ALSourcei.Buffer, _audioSampleBuffers[(int) stream.ClydeHandle!.Value.Value].BufferHandle); diff --git a/Robust.Client/Graphics/Audio/DummyAudioSource.cs b/Robust.Client/Graphics/Audio/DummyAudioSource.cs index 39ef8a9ba..39d679972 100644 --- a/Robust.Client/Graphics/Audio/DummyAudioSource.cs +++ b/Robust.Client/Graphics/Audio/DummyAudioSource.cs @@ -18,6 +18,7 @@ namespace Robust.Client.Graphics.Audio /// /// Hey look, it's ClydeAudio.AudioSource's evil twin brother! /// + [Virtual] internal class DummyAudioSource : IClydeAudioSource { public static DummyAudioSource Instance { get; } = new(); diff --git a/Robust.Client/Graphics/ClientEye/Eye.cs b/Robust.Client/Graphics/ClientEye/Eye.cs index 23d995f06..f1549d45e 100644 --- a/Robust.Client/Graphics/ClientEye/Eye.cs +++ b/Robust.Client/Graphics/ClientEye/Eye.cs @@ -7,6 +7,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.Graphics { /// + [Virtual] public class Eye : IEye { private Vector2 _scale = Vector2.One/2f; diff --git a/Robust.Client/Graphics/ClientEye/EyeManager.cs b/Robust.Client/Graphics/ClientEye/EyeManager.cs index 72a1a1603..b9dbbf5b3 100644 --- a/Robust.Client/Graphics/ClientEye/EyeManager.cs +++ b/Robust.Client/Graphics/ClientEye/EyeManager.cs @@ -153,7 +153,7 @@ namespace Robust.Client.Graphics } } - public class CurrentEyeChangedEvent : EntityEventArgs + public sealed class CurrentEyeChangedEvent : EntityEventArgs { public IEye? Old { get; } public IEye New { get; } diff --git a/Robust.Client/Graphics/ClientEye/FixedEye.cs b/Robust.Client/Graphics/ClientEye/FixedEye.cs index e3c92fbe5..d5564f5e8 100644 --- a/Robust.Client/Graphics/ClientEye/FixedEye.cs +++ b/Robust.Client/Graphics/ClientEye/FixedEye.cs @@ -3,7 +3,7 @@ /// /// A fixed eye is an eye which is fixed to one point, its position. /// - public class FixedEye : Eye + public sealed class FixedEye : Eye { } } diff --git a/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs b/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs index 80393973e..4cf6c1d37 100644 --- a/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs +++ b/Robust.Client/Graphics/Clyde/Clyde.GridRendering.cs @@ -214,7 +214,7 @@ namespace Robust.Client.Graphics.Clyde _mapChunkData.Remove(gridId); } - private class MapChunkData + private sealed class MapChunkData { public bool Dirty; public readonly uint VAO; diff --git a/Robust.Client/Graphics/Clyde/Clyde.Shaders.cs b/Robust.Client/Graphics/Clyde/Clyde.Shaders.cs index 4feae23a2..854c0cea7 100644 --- a/Robust.Client/Graphics/Clyde/Clyde.Shaders.cs +++ b/Robust.Client/Graphics/Clyde/Clyde.Shaders.cs @@ -34,7 +34,7 @@ namespace Robust.Client.Graphics.Clyde private readonly ConcurrentQueue _deadShaderInstances = new(); - private class LoadedShader + private sealed class LoadedShader { public GLShaderProgram Program = default!; public bool HasLighting = true; @@ -42,7 +42,7 @@ namespace Robust.Client.Graphics.Clyde public string? Name; } - private class LoadedShaderInstance + private sealed class LoadedShaderInstance { public ClydeHandle ShaderHandle; diff --git a/Robust.Client/Graphics/Clyde/ClydeHeadless.cs b/Robust.Client/Graphics/Clyde/ClydeHeadless.cs index 4896f7bd1..976668475 100644 --- a/Robust.Client/Graphics/Clyde/ClydeHeadless.cs +++ b/Robust.Client/Graphics/Clyde/ClydeHeadless.cs @@ -246,7 +246,7 @@ namespace Robust.Client.Graphics.Clyde // Nada. } - private class DummyCursor : ICursor + private sealed class DummyCursor : ICursor { public void Dispose() { @@ -254,6 +254,7 @@ namespace Robust.Client.Graphics.Clyde } } + [Virtual] private class DummyAudioSource : IClydeAudioSource { public static DummyAudioSource Instance { get; } = new(); diff --git a/Robust.Client/Graphics/Clyde/GLObjects/Clyde.Buffer.cs b/Robust.Client/Graphics/Clyde/GLObjects/Clyde.Buffer.cs index f8031d962..a57045aa9 100644 --- a/Robust.Client/Graphics/Clyde/GLObjects/Clyde.Buffer.cs +++ b/Robust.Client/Graphics/Clyde/GLObjects/Clyde.Buffer.cs @@ -11,6 +11,7 @@ namespace Robust.Client.Graphics.Clyde /// /// Represents an OpenGL buffer object. /// + [Virtual] private class GLBuffer { private readonly Clyde _clyde; @@ -178,7 +179,7 @@ namespace Robust.Client.Graphics.Clyde /// Subtype of buffers so that we can have a generic constructor. /// Functionally equivalent to otherwise. /// - private class GLBuffer : GLBuffer where T : unmanaged + private sealed class GLBuffer : GLBuffer where T : unmanaged { public GLBuffer(Clyde clyde, BufferTarget type, BufferUsageHint usage, Span initialize, string? name = null) diff --git a/Robust.Client/Graphics/Clyde/GLObjects/Clyde.Shader.cs b/Robust.Client/Graphics/Clyde/GLObjects/Clyde.Shader.cs index 375ec5b47..49108a5f0 100644 --- a/Robust.Client/Graphics/Clyde/GLObjects/Clyde.Shader.cs +++ b/Robust.Client/Graphics/Clyde/GLObjects/Clyde.Shader.cs @@ -4,7 +4,7 @@ namespace Robust.Client.Graphics.Clyde { internal partial class Clyde { - private class GLShader + private sealed class GLShader { private readonly Clyde _clyde; diff --git a/Robust.Client/Graphics/Clyde/GLObjects/Clyde.ShaderProgram.cs b/Robust.Client/Graphics/Clyde/GLObjects/Clyde.ShaderProgram.cs index 94217596c..e50ce1565 100644 --- a/Robust.Client/Graphics/Clyde/GLObjects/Clyde.ShaderProgram.cs +++ b/Robust.Client/Graphics/Clyde/GLObjects/Clyde.ShaderProgram.cs @@ -14,7 +14,7 @@ namespace Robust.Client.Graphics.Clyde /// You've been warned: /// using things like if this buffer isn't bound WILL mess things up! /// - private class GLShaderProgram + private sealed class GLShaderProgram { private readonly sbyte?[] _uniformIntCache = new sbyte?[UniCount]; private readonly Dictionary _uniformCache = new(); diff --git a/Robust.Client/Graphics/Clyde/GLObjects/Clyde.UniformBuffer.cs b/Robust.Client/Graphics/Clyde/GLObjects/Clyde.UniformBuffer.cs index 010a6efeb..a0d949232 100644 --- a/Robust.Client/Graphics/Clyde/GLObjects/Clyde.UniformBuffer.cs +++ b/Robust.Client/Graphics/Clyde/GLObjects/Clyde.UniformBuffer.cs @@ -20,7 +20,7 @@ namespace Robust.Client.Graphics.Clyde /// /// Represents some set of uniforms that can be backed by a uniform buffer or by regular uniforms. /// - private class GLUniformBuffer where T : unmanaged, IAppliableUniformSet + private sealed class GLUniformBuffer where T : unmanaged, IAppliableUniformSet { private readonly Clyde _clyde; private readonly int _index; diff --git a/Robust.Client/Graphics/Clyde/ShaderCompilationException.cs b/Robust.Client/Graphics/Clyde/ShaderCompilationException.cs index cba7f57c4..7a7cf97cf 100644 --- a/Robust.Client/Graphics/Clyde/ShaderCompilationException.cs +++ b/Robust.Client/Graphics/Clyde/ShaderCompilationException.cs @@ -6,6 +6,7 @@ namespace Robust.Client.Graphics.Clyde { [Serializable] [PublicAPI] + [Virtual] internal class ShaderCompilationException : Exception { public ShaderCompilationException() diff --git a/Robust.Client/Graphics/Clyde/Windowing/Glfw.cs b/Robust.Client/Graphics/Clyde/Windowing/Glfw.cs index 9fddd054b..73e297773 100644 --- a/Robust.Client/Graphics/Clyde/Windowing/Glfw.cs +++ b/Robust.Client/Graphics/Clyde/Windowing/Glfw.cs @@ -104,6 +104,7 @@ namespace Robust.Client.Graphics.Clyde } [Serializable] + [Virtual] public class GlfwException : Exception { public GlfwException() diff --git a/Robust.Client/Graphics/Drawing/StyleBoxEmpty.cs b/Robust.Client/Graphics/Drawing/StyleBoxEmpty.cs index 17b3cf067..4a67e6ccb 100644 --- a/Robust.Client/Graphics/Drawing/StyleBoxEmpty.cs +++ b/Robust.Client/Graphics/Drawing/StyleBoxEmpty.cs @@ -2,7 +2,7 @@ using Robust.Shared.Maths; namespace Robust.Client.Graphics { - public class StyleBoxEmpty : StyleBox + public sealed class StyleBoxEmpty : StyleBox { protected override void DoDraw(DrawingHandleScreen handle, UIBox2 box) { diff --git a/Robust.Client/Graphics/Drawing/StyleBoxFlat.cs b/Robust.Client/Graphics/Drawing/StyleBoxFlat.cs index 37f3e0d9b..7473ce880 100644 --- a/Robust.Client/Graphics/Drawing/StyleBoxFlat.cs +++ b/Robust.Client/Graphics/Drawing/StyleBoxFlat.cs @@ -3,7 +3,7 @@ using Robust.Shared.Maths; namespace Robust.Client.Graphics { - public class StyleBoxFlat : StyleBox + public sealed class StyleBoxFlat : StyleBox { public Color BackgroundColor { get; set; } public Color BorderColor { get; set; } diff --git a/Robust.Client/Graphics/Drawing/StyleBoxTexture.cs b/Robust.Client/Graphics/Drawing/StyleBoxTexture.cs index ff84632ed..5a3ad06a3 100644 --- a/Robust.Client/Graphics/Drawing/StyleBoxTexture.cs +++ b/Robust.Client/Graphics/Drawing/StyleBoxTexture.cs @@ -7,7 +7,7 @@ namespace Robust.Client.Graphics /// /// Style box based on a 9-patch texture. /// - public class StyleBoxTexture : StyleBox + public sealed class StyleBoxTexture : StyleBox { public StyleBoxTexture() { diff --git a/Robust.Client/Graphics/FontManager.cs b/Robust.Client/Graphics/FontManager.cs index ad10a7b02..f0ef3cd9a 100644 --- a/Robust.Client/Graphics/FontManager.cs +++ b/Robust.Client/Graphics/FontManager.cs @@ -219,7 +219,7 @@ namespace Robust.Client.Graphics return bitmapImage; } - private class FontFaceHandle : IFontFaceHandle + private sealed class FontFaceHandle : IFontFaceHandle { public Face Face { get; } @@ -230,7 +230,7 @@ namespace Robust.Client.Graphics } [PublicAPI] - private class FontInstanceHandle : IFontInstanceHandle + private sealed class FontInstanceHandle : IFontInstanceHandle { public FontFaceHandle FaceHandle { get; } public int Size { get; } @@ -325,7 +325,7 @@ namespace Robust.Client.Graphics } } - private class ScaledFontData + private sealed class ScaledFontData { public ScaledFontData(int ascent, int descent, int height, int lineHeight) { diff --git a/Robust.Client/Graphics/Overlays/OverlayManager.cs b/Robust.Client/Graphics/Overlays/OverlayManager.cs index 508588d9d..4da83c0cc 100644 --- a/Robust.Client/Graphics/Overlays/OverlayManager.cs +++ b/Robust.Client/Graphics/Overlays/OverlayManager.cs @@ -6,7 +6,7 @@ using Robust.Shared.Timing; namespace Robust.Client.Graphics { - internal class OverlayManager : IOverlayManagerInternal + internal sealed class OverlayManager : IOverlayManagerInternal { private readonly Dictionary _overlays = new Dictionary(); public IEnumerable AllOverlays => _overlays.Values; diff --git a/Robust.Client/Graphics/Shaders/ShaderPrototype.cs b/Robust.Client/Graphics/Shaders/ShaderPrototype.cs index 0185939fb..1674838e7 100644 --- a/Robust.Client/Graphics/Shaders/ShaderPrototype.cs +++ b/Robust.Client/Graphics/Shaders/ShaderPrototype.cs @@ -192,7 +192,7 @@ namespace Robust.Client.Graphics } [DataDefinition] - public class StencilData + public sealed class StencilData { [DataField("ref")] public int StencilRef; diff --git a/Robust.Client/Input/Events.cs b/Robust.Client/Input/Events.cs index 0f3b443d8..234312102 100644 --- a/Robust.Client/Input/Events.cs +++ b/Robust.Client/Input/Events.cs @@ -53,6 +53,7 @@ namespace Robust.Client.Input } } + [Virtual] public class TextEventArgs : EventArgs { public TextEventArgs(uint codePoint) @@ -64,6 +65,7 @@ namespace Robust.Client.Input public Rune AsRune => new Rune(CodePoint); } + [Virtual] public class KeyEventArgs : ModifierInputEventArgs { /// @@ -104,7 +106,7 @@ namespace Robust.Client.Input } } - public class MouseButtonEventArgs : MouseEventArgs + public sealed class MouseButtonEventArgs : MouseEventArgs { /// /// The mouse button that has been pressed or released. @@ -119,7 +121,7 @@ namespace Robust.Client.Input } } - public class MouseWheelEventArgs : MouseEventArgs + public sealed class MouseWheelEventArgs : MouseEventArgs { /// /// The direction the mouse wheel was moved in. @@ -134,7 +136,7 @@ namespace Robust.Client.Input } } - public class MouseMoveEventArgs : MouseEventArgs + public sealed class MouseMoveEventArgs : MouseEventArgs { /// /// The new position relative to the previous position. @@ -149,7 +151,7 @@ namespace Robust.Client.Input } } - public class MouseEnterLeaveEventArgs : EventArgs + public sealed class MouseEnterLeaveEventArgs : EventArgs { public IClydeWindow Window { get; } diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 435966d17..e4fe17f06 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -31,6 +31,7 @@ using static Robust.Client.Input.Keyboard; namespace Robust.Client.Input { + [Virtual] internal class InputManager : IInputManager { // This is for both userdata and resources. @@ -698,7 +699,7 @@ namespace Robust.Client.Input } [DebuggerDisplay("KeyBinding {" + nameof(Function) + "}")] - private class KeyBinding : IKeyBinding + private sealed class KeyBinding : IKeyBinding { private readonly InputManager _inputManager; @@ -906,7 +907,7 @@ namespace Robust.Client.Input } [UsedImplicitly] - internal class BindCommand : IConsoleCommand + internal sealed class BindCommand : IConsoleCommand { public string Command => "bind"; public string Description => "Binds an input key to an input command."; @@ -960,7 +961,7 @@ namespace Robust.Client.Input } [UsedImplicitly] - internal class SaveBindCommand : IConsoleCommand + internal sealed class SaveBindCommand : IConsoleCommand { public string Command => "svbind"; public string Description => ""; diff --git a/Robust.Client/Input/KeyBindingRegistration.cs b/Robust.Client/Input/KeyBindingRegistration.cs index ce0e115b6..2b9e7ed7e 100644 --- a/Robust.Client/Input/KeyBindingRegistration.cs +++ b/Robust.Client/Input/KeyBindingRegistration.cs @@ -4,7 +4,7 @@ using Robust.Shared.Serialization.Manager.Attributes; namespace Robust.Client.Input { [DataDefinition] - public class KeyBindingRegistration + public sealed class KeyBindingRegistration { [DataField("function")] public BoundKeyFunction Function; diff --git a/Robust.Client/Log/DebugConsoleLogHandler.cs b/Robust.Client/Log/DebugConsoleLogHandler.cs index 060c47de7..bcd26417b 100644 --- a/Robust.Client/Log/DebugConsoleLogHandler.cs +++ b/Robust.Client/Log/DebugConsoleLogHandler.cs @@ -9,7 +9,7 @@ namespace Robust.Client.Log /// /// Writes logs to the in-game debug console. /// - class DebugConsoleLogHandler : ILogHandler + sealed class DebugConsoleLogHandler : ILogHandler { readonly IClientConsoleHost Console; diff --git a/Robust.Client/Physics/PhysicsSystem.cs b/Robust.Client/Physics/PhysicsSystem.cs index 5f4ee18f1..c5fcec27d 100644 --- a/Robust.Client/Physics/PhysicsSystem.cs +++ b/Robust.Client/Physics/PhysicsSystem.cs @@ -9,7 +9,7 @@ using Robust.Shared.Timing; namespace Robust.Client.Physics { [UsedImplicitly] - public class PhysicsSystem : SharedPhysicsSystem + public sealed class PhysicsSystem : SharedPhysicsSystem { [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IClientGameStateManager _gameState = default!; diff --git a/Robust.Client/Placement/Modes/AlignSimilar.cs b/Robust.Client/Placement/Modes/AlignSimilar.cs index dc9059ec5..08af02dbb 100644 --- a/Robust.Client/Placement/Modes/AlignSimilar.cs +++ b/Robust.Client/Placement/Modes/AlignSimilar.cs @@ -8,7 +8,7 @@ using Robust.Shared.Prototypes; namespace Robust.Client.Placement.Modes { - public class AlignSimilar : PlacementMode + public sealed class AlignSimilar : PlacementMode { private const uint SnapToRange = 50; diff --git a/Robust.Client/Placement/Modes/AlignSnapgridBorder.cs b/Robust.Client/Placement/Modes/AlignSnapgridBorder.cs index 170bc45ec..ed2fd446c 100644 --- a/Robust.Client/Placement/Modes/AlignSnapgridBorder.cs +++ b/Robust.Client/Placement/Modes/AlignSnapgridBorder.cs @@ -4,7 +4,7 @@ using Robust.Shared.Maths; namespace Robust.Client.Placement.Modes { - public class SnapgridBorder : SnapgridCenter + public sealed class SnapgridBorder : SnapgridCenter { public override bool HasLineMode => true; public override bool HasGridMode => true; diff --git a/Robust.Client/Placement/Modes/AlignSnapgridCenter.cs b/Robust.Client/Placement/Modes/AlignSnapgridCenter.cs index dbcc7ca27..83c8f465b 100644 --- a/Robust.Client/Placement/Modes/AlignSnapgridCenter.cs +++ b/Robust.Client/Placement/Modes/AlignSnapgridCenter.cs @@ -7,6 +7,7 @@ using Robust.Shared.Maths; namespace Robust.Client.Placement.Modes { + [Virtual] public class SnapgridCenter : PlacementMode { protected IMapGrid? Grid; diff --git a/Robust.Client/Placement/Modes/AlignTileAny.cs b/Robust.Client/Placement/Modes/AlignTileAny.cs index 3e78b76d5..3568b2b41 100644 --- a/Robust.Client/Placement/Modes/AlignTileAny.cs +++ b/Robust.Client/Placement/Modes/AlignTileAny.cs @@ -2,7 +2,7 @@ namespace Robust.Client.Placement.Modes { - public class AlignTileAny : PlacementMode + public sealed class AlignTileAny : PlacementMode { public override bool HasLineMode => true; public override bool HasGridMode => true; diff --git a/Robust.Client/Placement/Modes/AlignTileDense.cs b/Robust.Client/Placement/Modes/AlignTileDense.cs index 9429f73cf..afa35e144 100644 --- a/Robust.Client/Placement/Modes/AlignTileDense.cs +++ b/Robust.Client/Placement/Modes/AlignTileDense.cs @@ -2,7 +2,7 @@ namespace Robust.Client.Placement.Modes { - public class AlignTileDense : PlacementMode + public sealed class AlignTileDense : PlacementMode { public override bool HasLineMode => true; public override bool HasGridMode => true; diff --git a/Robust.Client/Placement/Modes/AlignTileEmpty.cs b/Robust.Client/Placement/Modes/AlignTileEmpty.cs index d1a3761f3..b8b18c59e 100644 --- a/Robust.Client/Placement/Modes/AlignTileEmpty.cs +++ b/Robust.Client/Placement/Modes/AlignTileEmpty.cs @@ -5,7 +5,7 @@ using Robust.Shared.Maths; namespace Robust.Client.Placement.Modes { - public class AlignTileEmpty : PlacementMode + public sealed class AlignTileEmpty : PlacementMode { public override bool HasLineMode => true; public override bool HasGridMode => true; diff --git a/Robust.Client/Placement/Modes/AlignTileNonDense.cs b/Robust.Client/Placement/Modes/AlignTileNonDense.cs index 12264340e..598480dfd 100644 --- a/Robust.Client/Placement/Modes/AlignTileNonDense.cs +++ b/Robust.Client/Placement/Modes/AlignTileNonDense.cs @@ -2,7 +2,7 @@ namespace Robust.Client.Placement.Modes { - public class AlignTileNonDense : PlacementMode + public sealed class AlignTileNonDense : PlacementMode { public override bool HasLineMode => true; public override bool HasGridMode => true; diff --git a/Robust.Client/Placement/Modes/AlignWall.cs b/Robust.Client/Placement/Modes/AlignWall.cs index 9a7b68820..1521e21d0 100644 --- a/Robust.Client/Placement/Modes/AlignWall.cs +++ b/Robust.Client/Placement/Modes/AlignWall.cs @@ -5,7 +5,7 @@ using Vector2 = Robust.Shared.Maths.Vector2; namespace Robust.Client.Placement.Modes { - public class AlignWall : PlacementMode + public sealed class AlignWall : PlacementMode { public AlignWall(PlacementManager pMan) : base(pMan) { } diff --git a/Robust.Client/Placement/Modes/AlignWallProper.cs b/Robust.Client/Placement/Modes/AlignWallProper.cs index 7e40df8a4..854bd0b1b 100644 --- a/Robust.Client/Placement/Modes/AlignWallProper.cs +++ b/Robust.Client/Placement/Modes/AlignWallProper.cs @@ -7,7 +7,7 @@ namespace Robust.Client.Placement.Modes /// /// Snaps in edge on one axis, center in the other. /// - public class AlignWallProper : PlacementMode + public sealed class AlignWallProper : PlacementMode { public AlignWallProper(PlacementManager pMan) : base(pMan) { diff --git a/Robust.Client/Placement/Modes/PlaceFree.cs b/Robust.Client/Placement/Modes/PlaceFree.cs index e2a0f225a..c069af514 100644 --- a/Robust.Client/Placement/Modes/PlaceFree.cs +++ b/Robust.Client/Placement/Modes/PlaceFree.cs @@ -2,7 +2,7 @@ namespace Robust.Client.Placement.Modes { - public class PlaceFree : PlacementMode + public sealed class PlaceFree : PlacementMode { public PlaceFree(PlacementManager pMan) : base(pMan) { } diff --git a/Robust.Client/Placement/Modes/PlaceNearby.cs b/Robust.Client/Placement/Modes/PlaceNearby.cs index c9f34a29d..1ff686faa 100644 --- a/Robust.Client/Placement/Modes/PlaceNearby.cs +++ b/Robust.Client/Placement/Modes/PlaceNearby.cs @@ -2,7 +2,7 @@ namespace Robust.Client.Placement.Modes { - public class PlaceNearby : PlacementMode + public sealed class PlaceNearby : PlacementMode { public PlaceNearby(PlacementManager pMan) : base(pMan) { } diff --git a/Robust.Client/Placement/PlacementHijack.cs b/Robust.Client/Placement/PlacementHijack.cs index bdb75f196..c2883bdae 100644 --- a/Robust.Client/Placement/PlacementHijack.cs +++ b/Robust.Client/Placement/PlacementHijack.cs @@ -3,7 +3,7 @@ using Robust.Shared.Map; namespace Robust.Client.Placement { - public class PlacementHijack + public abstract class PlacementHijack { public PlacementManager Manager { get; internal set; } = default!; public virtual bool CanRotate { get; } = true; diff --git a/Robust.Client/Placement/PlacementManager.cs b/Robust.Client/Placement/PlacementManager.cs index cb5b21a7f..faf7c6ee4 100644 --- a/Robust.Client/Placement/PlacementManager.cs +++ b/Robust.Client/Placement/PlacementManager.cs @@ -22,7 +22,7 @@ using Robust.Shared.Utility; namespace Robust.Client.Placement { - public partial class PlacementManager : IPlacementManager, IDisposable + public sealed partial class PlacementManager : IPlacementManager, IDisposable { [Dependency] private readonly IClientNetManager NetworkManager = default!; [Dependency] public readonly IPlayerManager PlayerManager = default!; diff --git a/Robust.Client/Placement/PlacementOverlay.cs b/Robust.Client/Placement/PlacementOverlay.cs index 3b961dc0d..058c7a207 100644 --- a/Robust.Client/Placement/PlacementOverlay.cs +++ b/Robust.Client/Placement/PlacementOverlay.cs @@ -6,7 +6,7 @@ namespace Robust.Client.Placement { public partial class PlacementManager { - internal class PlacementOverlay : Overlay + internal sealed class PlacementOverlay : Overlay { private readonly PlacementManager _manager; public override OverlaySpace Space => OverlaySpace.WorldSpace; diff --git a/Robust.Client/Player/FilterSystem.cs b/Robust.Client/Player/FilterSystem.cs index bd6bf9f9c..193d797fc 100644 --- a/Robust.Client/Player/FilterSystem.cs +++ b/Robust.Client/Player/FilterSystem.cs @@ -4,7 +4,7 @@ using Robust.Shared.Player; namespace Robust.Client.Player { - internal class FilterSystem : SharedFilterSystem + internal sealed class FilterSystem : SharedFilterSystem { [Dependency] private readonly IPlayerManager _playerManager = default!; diff --git a/Robust.Client/Player/IPlayerManager.cs b/Robust.Client/Player/IPlayerManager.cs index 0b7b2eccc..d65c0e2ca 100644 --- a/Robust.Client/Player/IPlayerManager.cs +++ b/Robust.Client/Player/IPlayerManager.cs @@ -27,7 +27,7 @@ namespace Robust.Client.Player void ApplyPlayerStates(IReadOnlyCollection list); } - public class LocalPlayerChangedEventArgs : EventArgs + public sealed class LocalPlayerChangedEventArgs : EventArgs { public readonly LocalPlayer? OldPlayer; public readonly LocalPlayer? NewPlayer; diff --git a/Robust.Client/Player/LocalPlayer.cs b/Robust.Client/Player/LocalPlayer.cs index 8eaa11f2d..31e84309b 100644 --- a/Robust.Client/Player/LocalPlayer.cs +++ b/Robust.Client/Player/LocalPlayer.cs @@ -12,7 +12,7 @@ namespace Robust.Client.Player /// /// Variables and functions that deal with the local client's session. /// - public class LocalPlayer + public sealed class LocalPlayer { /// /// An entity has been attached to the local player. @@ -127,7 +127,7 @@ namespace Robust.Client.Player /// /// Event arguments for when the status of a session changes. /// - public class StatusEventArgs : EventArgs + public sealed class StatusEventArgs : EventArgs { /// /// Status that the session switched from. @@ -149,7 +149,7 @@ namespace Robust.Client.Player } } - public class EntityDetachedEventArgs : EventArgs + public sealed class EntityDetachedEventArgs : EventArgs { public EntityDetachedEventArgs(EntityUid oldEntity) { @@ -159,7 +159,7 @@ namespace Robust.Client.Player public EntityUid OldEntity { get; } } - public class EntityAttachedEventArgs : EventArgs + public sealed class EntityAttachedEventArgs : EventArgs { public EntityAttachedEventArgs(EntityUid newEntity) { diff --git a/Robust.Client/Player/PlayerManager.cs b/Robust.Client/Player/PlayerManager.cs index 34e97e7e9..707f5980b 100644 --- a/Robust.Client/Player/PlayerManager.cs +++ b/Robust.Client/Player/PlayerManager.cs @@ -18,7 +18,7 @@ namespace Robust.Client.Player /// Why not just attach the inputs directly? It's messy! This makes the whole thing nicely encapsulated. /// This class also communicates with the server to let the server control what entity it is attached to. /// - public class PlayerManager : IPlayerManager + public sealed class PlayerManager : IPlayerManager { [Dependency] private readonly IClientNetManager _network = default!; [Dependency] private readonly IBaseClient _client = default!; diff --git a/Robust.Client/ResourceManagement/ResourceCache.cs b/Robust.Client/ResourceManagement/ResourceCache.cs index fa43e968e..f9b51fc12 100644 --- a/Robust.Client/ResourceManagement/ResourceCache.cs +++ b/Robust.Client/ResourceManagement/ResourceCache.cs @@ -10,7 +10,7 @@ using Robust.LoaderApi; namespace Robust.Client.ResourceManagement { - internal partial class ResourceCache : ResourceManager, IResourceCacheInternal, IDisposable + internal sealed partial class ResourceCache : ResourceManager, IResourceCacheInternal, IDisposable { private readonly Dictionary> CachedResources = new(); @@ -164,7 +164,7 @@ namespace Robust.Client.ResourceManagement GC.SuppressFinalize(this); } - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (disposed) { diff --git a/Robust.Client/ResourceManagement/ResourceTypes/AudioResource.cs b/Robust.Client/ResourceManagement/ResourceTypes/AudioResource.cs index ae30c7c80..4afc1b50e 100644 --- a/Robust.Client/ResourceManagement/ResourceTypes/AudioResource.cs +++ b/Robust.Client/ResourceManagement/ResourceTypes/AudioResource.cs @@ -7,7 +7,7 @@ using Robust.Shared.IoC; namespace Robust.Client.ResourceManagement { - public class AudioResource : BaseResource + public sealed class AudioResource : BaseResource { public AudioStream AudioStream { get; private set; } = default!; diff --git a/Robust.Client/ResourceManagement/ResourceTypes/FontResource.cs b/Robust.Client/ResourceManagement/ResourceTypes/FontResource.cs index 9f3b17794..0955b55f0 100644 --- a/Robust.Client/ResourceManagement/ResourceTypes/FontResource.cs +++ b/Robust.Client/ResourceManagement/ResourceTypes/FontResource.cs @@ -5,7 +5,7 @@ using Robust.Shared.Utility; namespace Robust.Client.ResourceManagement { - public class FontResource : BaseResource + public sealed class FontResource : BaseResource { internal IFontFaceHandle FontFaceHandle { get; private set; } = default!; diff --git a/Robust.Client/ResourceManagement/ResourceTypes/RSIResource.cs b/Robust.Client/ResourceManagement/ResourceTypes/RSIResource.cs index 940bf91ea..ec9cecf7a 100644 --- a/Robust.Client/ResourceManagement/ResourceTypes/RSIResource.cs +++ b/Robust.Client/ResourceManagement/ResourceTypes/RSIResource.cs @@ -542,6 +542,7 @@ namespace Robust.Client.ResourceManagement } [Serializable] + [Virtual] public class RSILoadException : Exception { public RSILoadException() diff --git a/Robust.Client/ResourceManagement/ResourceTypes/ShaderSourceResource.cs b/Robust.Client/ResourceManagement/ResourceTypes/ShaderSourceResource.cs index 86d77ee8d..a9396eb79 100644 --- a/Robust.Client/ResourceManagement/ResourceTypes/ShaderSourceResource.cs +++ b/Robust.Client/ResourceManagement/ResourceTypes/ShaderSourceResource.cs @@ -10,7 +10,7 @@ namespace Robust.Client.ResourceManagement /// /// Loads the **source code** of a shader. /// - internal class ShaderSourceResource : BaseResource + internal sealed class ShaderSourceResource : BaseResource { internal ClydeHandle ClydeHandle { get; private set; } internal ParsedShader ParsedShader { get; private set; } = default!; diff --git a/Robust.Client/Serialization/AppearanceVisualizerSerializer.cs b/Robust.Client/Serialization/AppearanceVisualizerSerializer.cs index 861b52ba3..8bf975233 100644 --- a/Robust.Client/Serialization/AppearanceVisualizerSerializer.cs +++ b/Robust.Client/Serialization/AppearanceVisualizerSerializer.cs @@ -14,7 +14,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Client.Serialization { [TypeSerializer] - public class AppearanceVisualizerSerializer : ITypeSerializer + public sealed class AppearanceVisualizerSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, MappingDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Client/State/DefaultState.cs b/Robust.Client/State/DefaultState.cs index e3d032a43..672a92a26 100644 --- a/Robust.Client/State/DefaultState.cs +++ b/Robust.Client/State/DefaultState.cs @@ -1,7 +1,7 @@ namespace Robust.Client.State { // Dummy state that is only used to make sure there always is *a* state. - public class DefaultState : State + public sealed class DefaultState : State { public override void Startup() { diff --git a/Robust.Client/Timing/ClientGameTiming.cs b/Robust.Client/Timing/ClientGameTiming.cs index aed07caf3..6b56e4422 100644 --- a/Robust.Client/Timing/ClientGameTiming.cs +++ b/Robust.Client/Timing/ClientGameTiming.cs @@ -6,7 +6,7 @@ using Robust.Shared.Utility; namespace Robust.Client.Timing { - public class ClientGameTiming : GameTiming, IClientGameTiming + public sealed class ClientGameTiming : GameTiming, IClientGameTiming { [Dependency] private readonly IClientNetManager _netManager = default!; diff --git a/Robust.Client/UserInterface/AttachedProperty.cs b/Robust.Client/UserInterface/AttachedProperty.cs index f9fa2e06c..09dd443b9 100644 --- a/Robust.Client/UserInterface/AttachedProperty.cs +++ b/Robust.Client/UserInterface/AttachedProperty.cs @@ -15,6 +15,7 @@ namespace Robust.Client.UserInterface /// without having to modify the base class to add it. /// This is useful for storing data for specific controls like /// + [Virtual] public class AttachedProperty { /// diff --git a/Robust.Client/UserInterface/Control.Input.cs b/Robust.Client/UserInterface/Control.Input.cs index 62b5d9319..e63d81b75 100644 --- a/Robust.Client/UserInterface/Control.Input.cs +++ b/Robust.Client/UserInterface/Control.Input.cs @@ -58,7 +58,7 @@ namespace Robust.Client.UserInterface } } - public class GUIMouseHoverEventArgs : EventArgs + public sealed class GUIMouseHoverEventArgs : EventArgs { /// /// The control this event originated from. @@ -71,7 +71,7 @@ namespace Robust.Client.UserInterface } } - public class GUIBoundKeyEventArgs : BoundKeyEventArgs + public sealed class GUIBoundKeyEventArgs : BoundKeyEventArgs { /// /// Position of the mouse, relative to the current control. @@ -89,7 +89,7 @@ namespace Robust.Client.UserInterface } } - public class GUIKeyEventArgs : KeyEventArgs + public sealed class GUIKeyEventArgs : KeyEventArgs { /// /// The control spawning this event. @@ -110,7 +110,7 @@ namespace Robust.Client.UserInterface } } - public class GUITextEventArgs : TextEventArgs + public sealed class GUITextEventArgs : TextEventArgs { /// /// The control spawning this event. @@ -160,7 +160,7 @@ namespace Robust.Client.UserInterface } } - public class GUIMouseMoveEventArgs : GUIMouseEventArgs + public sealed class GUIMouseMoveEventArgs : GUIMouseEventArgs { /// /// The new position relative to the previous position. @@ -180,7 +180,7 @@ namespace Robust.Client.UserInterface } } - public class GUIMouseWheelEventArgs : GUIMouseEventArgs + public sealed class GUIMouseWheelEventArgs : GUIMouseEventArgs { public Vector2 Delta { get; } diff --git a/Robust.Client/UserInterface/Control.cs b/Robust.Client/UserInterface/Control.cs index d573698c1..17a6c3850 100644 --- a/Robust.Client/UserInterface/Control.cs +++ b/Robust.Client/UserInterface/Control.cs @@ -20,6 +20,7 @@ namespace Robust.Client.UserInterface /// See https://docs.spacestation14.io/en/engine/user-interface for some basic concepts. /// [PublicAPI] + [Virtual] public partial class Control : IDisposable { private readonly List _orderedChildren = new(); @@ -896,7 +897,7 @@ namespace Robust.Client.UserInterface Ignore = 2, } - public class OrderedChildCollection : ICollection, IReadOnlyCollection + public sealed class OrderedChildCollection : ICollection, IReadOnlyCollection { private readonly Control Owner; diff --git a/Robust.Client/UserInterface/Controls/BaseButton.cs b/Robust.Client/UserInterface/Controls/BaseButton.cs index 6a4833ff4..b48664d7f 100644 --- a/Robust.Client/UserInterface/Controls/BaseButton.cs +++ b/Robust.Client/UserInterface/Controls/BaseButton.cs @@ -343,6 +343,7 @@ namespace Robust.Client.UserInterface.Controls Disabled = 3 } + [Virtual] public class ButtonEventArgs : EventArgs { /// @@ -362,7 +363,7 @@ namespace Robust.Client.UserInterface.Controls /// /// Fired when a is toggled. /// - public class ButtonToggledEventArgs : ButtonEventArgs + public sealed class ButtonToggledEventArgs : ButtonEventArgs { /// /// The new pressed state of the button. diff --git a/Robust.Client/UserInterface/Controls/BoxContainer.cs b/Robust.Client/UserInterface/Controls/BoxContainer.cs index ed27f61ab..930bb12c7 100644 --- a/Robust.Client/UserInterface/Controls/BoxContainer.cs +++ b/Robust.Client/UserInterface/Controls/BoxContainer.cs @@ -7,6 +7,7 @@ namespace Robust.Client.UserInterface.Controls /// /// A container that lays out its children sequentially. /// + [Virtual] public class BoxContainer : Container { private LayoutOrientation _orientation; diff --git a/Robust.Client/UserInterface/Controls/Button.cs b/Robust.Client/UserInterface/Controls/Button.cs index 371cbd5a0..dd44b7f15 100644 --- a/Robust.Client/UserInterface/Controls/Button.cs +++ b/Robust.Client/UserInterface/Controls/Button.cs @@ -6,6 +6,7 @@ namespace Robust.Client.UserInterface.Controls /// /// Most common button type that draws text in a fancy box. /// + [Virtual] public class Button : ContainerButton { public Label Label { get; } diff --git a/Robust.Client/UserInterface/Controls/CenterContainer.cs b/Robust.Client/UserInterface/Controls/CenterContainer.cs index 56252e86c..99e6aa861 100644 --- a/Robust.Client/UserInterface/Controls/CenterContainer.cs +++ b/Robust.Client/UserInterface/Controls/CenterContainer.cs @@ -5,6 +5,7 @@ namespace Robust.Client.UserInterface.Controls /// /// Container type that centers its children inside itself. /// + [Virtual] public class CenterContainer : Container { protected override Vector2 ArrangeOverride(Vector2 finalSize) diff --git a/Robust.Client/UserInterface/Controls/CheckBox.cs b/Robust.Client/UserInterface/Controls/CheckBox.cs index 6d39cad76..d7b93b7e7 100644 --- a/Robust.Client/UserInterface/Controls/CheckBox.cs +++ b/Robust.Client/UserInterface/Controls/CheckBox.cs @@ -6,6 +6,7 @@ namespace Robust.Client.UserInterface.Controls /// /// A type of toggleable button that also has a checkbox. /// + [Virtual] public class CheckBox : ContainerButton { public const string StyleClassCheckBox = "checkBox"; diff --git a/Robust.Client/UserInterface/Controls/CheckButton.cs b/Robust.Client/UserInterface/Controls/CheckButton.cs index 93c0821b5..d2797df73 100644 --- a/Robust.Client/UserInterface/Controls/CheckButton.cs +++ b/Robust.Client/UserInterface/Controls/CheckButton.cs @@ -1,5 +1,6 @@ namespace Robust.Client.UserInterface.Controls { + [Virtual] public class CheckButton : Button { } diff --git a/Robust.Client/UserInterface/Controls/Collapsible.cs b/Robust.Client/UserInterface/Controls/Collapsible.cs index 0f6f68e88..e95d8cf95 100644 --- a/Robust.Client/UserInterface/Controls/Collapsible.cs +++ b/Robust.Client/UserInterface/Controls/Collapsible.cs @@ -4,6 +4,7 @@ using Robust.Shared.Maths; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class Collapsible : BoxContainer { public BaseButton? Heading { get; private set; } @@ -81,6 +82,7 @@ namespace Robust.Client.UserInterface.Controls } } + [Virtual] public class CollapsibleHeading : ContainerButton { private TextureRect _chevron = new TextureRect @@ -126,6 +128,7 @@ namespace Robust.Client.UserInterface.Controls } } + [Virtual] public class CollapsibleBody : Container { public CollapsibleBody() diff --git a/Robust.Client/UserInterface/Controls/ContainerButton.cs b/Robust.Client/UserInterface/Controls/ContainerButton.cs index bc3b0cc67..6bc6a0f30 100644 --- a/Robust.Client/UserInterface/Controls/ContainerButton.cs +++ b/Robust.Client/UserInterface/Controls/ContainerButton.cs @@ -4,6 +4,7 @@ using Robust.Shared.Maths; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class ContainerButton : BaseButton { public const string StylePropertyStyleBox = "stylebox"; diff --git a/Robust.Client/UserInterface/Controls/FloatSpinBox.cs b/Robust.Client/UserInterface/Controls/FloatSpinBox.cs index 26a035b4b..4a04bbc7c 100644 --- a/Robust.Client/UserInterface/Controls/FloatSpinBox.cs +++ b/Robust.Client/UserInterface/Controls/FloatSpinBox.cs @@ -7,6 +7,7 @@ namespace Robust.Client.UserInterface.Controls /// /// Number input LineEdit with increment buttons. /// + [Virtual] public class FloatSpinBox : BoxContainer { private readonly float _stepSize; @@ -129,7 +130,7 @@ namespace Robust.Client.UserInterface.Controls Value += _stepSize * (args.Delta.Y > 0 ? 1 : -1); } - public class FloatSpinBoxEventArgs : EventArgs + public sealed class FloatSpinBoxEventArgs : EventArgs { public FloatSpinBox Control { get; } public float Value { get; } diff --git a/Robust.Client/UserInterface/Controls/GridContainer.cs b/Robust.Client/UserInterface/Controls/GridContainer.cs index 25b603b90..466c4db74 100644 --- a/Robust.Client/UserInterface/Controls/GridContainer.cs +++ b/Robust.Client/UserInterface/Controls/GridContainer.cs @@ -10,6 +10,7 @@ namespace Robust.Client.UserInterface.Controls /// that limit. Alternatively, can define a maximum width or height, and grid will /// lay out elements (aligned in a grid pattern, not floated) within the defined limit. /// + [Virtual] public class GridContainer : Container { // limit - depending on mode, this is either rows or columns diff --git a/Robust.Client/UserInterface/Controls/HScrollBar.cs b/Robust.Client/UserInterface/Controls/HScrollBar.cs index 8f8538006..52aac34c8 100644 --- a/Robust.Client/UserInterface/Controls/HScrollBar.cs +++ b/Robust.Client/UserInterface/Controls/HScrollBar.cs @@ -1,5 +1,6 @@ namespace Robust.Client.UserInterface.Controls { + [Virtual] public class HScrollBar : ScrollBar { public HScrollBar() : base(OrientationMode.Horizontal) diff --git a/Robust.Client/UserInterface/Controls/HistoryLineEdit.cs b/Robust.Client/UserInterface/Controls/HistoryLineEdit.cs index a3e6c2738..4e90009df 100644 --- a/Robust.Client/UserInterface/Controls/HistoryLineEdit.cs +++ b/Robust.Client/UserInterface/Controls/HistoryLineEdit.cs @@ -4,6 +4,7 @@ using Robust.Shared.Input; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class HistoryLineEdit : LineEdit { private const int MaxHistorySize = 100; diff --git a/Robust.Client/UserInterface/Controls/ItemList.cs b/Robust.Client/UserInterface/Controls/ItemList.cs index 5f445bef8..946380c7b 100644 --- a/Robust.Client/UserInterface/Controls/ItemList.cs +++ b/Robust.Client/UserInterface/Controls/ItemList.cs @@ -9,6 +9,7 @@ using Timer = Robust.Shared.Timing.Timer; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class ItemList : Control, IList { private bool _isAtBottom = true; @@ -523,20 +524,20 @@ namespace Robust.Client.UserInterface.Controls _scrollBar.Visible = _totalContentHeight + ActualBackground.MinimumSize.Y > PixelHeight; } - public class ItemListEventArgs : EventArgs + public abstract class ItemListEventArgs : EventArgs { /// /// The ItemList this event originated from. /// public ItemList ItemList { get; } - public ItemListEventArgs(ItemList list) + protected ItemListEventArgs(ItemList list) { ItemList = list; } } - public class ItemListSelectedEventArgs : ItemListEventArgs + public sealed class ItemListSelectedEventArgs : ItemListEventArgs { /// /// The index of the item that was selected. @@ -549,7 +550,7 @@ namespace Robust.Client.UserInterface.Controls } } - public class ItemListDeselectedEventArgs : ItemListEventArgs + public sealed class ItemListDeselectedEventArgs : ItemListEventArgs { /// /// The index of the item that was selected. @@ -562,7 +563,7 @@ namespace Robust.Client.UserInterface.Controls } } - public class ItemListHoverEventArgs : ItemListEventArgs + public sealed class ItemListHoverEventArgs : ItemListEventArgs { /// /// The index of the item that was selected. diff --git a/Robust.Client/UserInterface/Controls/Label.cs b/Robust.Client/UserInterface/Controls/Label.cs index 1c38520a0..898991f5e 100644 --- a/Robust.Client/UserInterface/Controls/Label.cs +++ b/Robust.Client/UserInterface/Controls/Label.cs @@ -12,6 +12,7 @@ namespace Robust.Client.UserInterface.Controls /// /// A label is a GUI control that displays simple text. /// + [Virtual] public class Label : Control { public const string StylePropertyFontColor = "font-color"; diff --git a/Robust.Client/UserInterface/Controls/LayeredTextureRect.cs b/Robust.Client/UserInterface/Controls/LayeredTextureRect.cs index 5d2609c7c..568e911f1 100644 --- a/Robust.Client/UserInterface/Controls/LayeredTextureRect.cs +++ b/Robust.Client/UserInterface/Controls/LayeredTextureRect.cs @@ -8,6 +8,7 @@ namespace Robust.Client.UserInterface.Controls /// /// Like a TextureRect... but layered /// + [Virtual] public class LayeredTextureRect : Control { public const string StylePropertyShader = "shader"; diff --git a/Robust.Client/UserInterface/Controls/LayoutContainer.cs b/Robust.Client/UserInterface/Controls/LayoutContainer.cs index c248755f1..be674e256 100644 --- a/Robust.Client/UserInterface/Controls/LayoutContainer.cs +++ b/Robust.Client/UserInterface/Controls/LayoutContainer.cs @@ -7,6 +7,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.UserInterface.Controls { [PublicAPI] + [Virtual] public class LayoutContainer : Container { /// diff --git a/Robust.Client/UserInterface/Controls/LineEdit.cs b/Robust.Client/UserInterface/Controls/LineEdit.cs index b6dc54856..4b54c0406 100644 --- a/Robust.Client/UserInterface/Controls/LineEdit.cs +++ b/Robust.Client/UserInterface/Controls/LineEdit.cs @@ -15,6 +15,7 @@ namespace Robust.Client.UserInterface.Controls /// /// Allows the user to input and modify a line of text. /// + [Virtual] public class LineEdit : Control { private const float BlinkTime = 0.5f; @@ -805,7 +806,7 @@ namespace Robust.Client.UserInterface.Controls Whitespace } - public class LineEditEventArgs : EventArgs + public sealed class LineEditEventArgs : EventArgs { public LineEdit Control { get; } public string Text { get; } diff --git a/Robust.Client/UserInterface/Controls/MenuBar.cs b/Robust.Client/UserInterface/Controls/MenuBar.cs index 1b41de1cf..3357f1dee 100644 --- a/Robust.Client/UserInterface/Controls/MenuBar.cs +++ b/Robust.Client/UserInterface/Controls/MenuBar.cs @@ -10,6 +10,7 @@ namespace Robust.Client.UserInterface.Controls /// /// A good simple menu bar control, like the one at the top of your IDE! /// + [Virtual] public class MenuBar : PanelContainer { private readonly List _menus = new(); diff --git a/Robust.Client/UserInterface/Controls/MultiselectOptionButton.cs b/Robust.Client/UserInterface/Controls/MultiselectOptionButton.cs index c4a82eed8..8ea545099 100644 --- a/Robust.Client/UserInterface/Controls/MultiselectOptionButton.cs +++ b/Robust.Client/UserInterface/Controls/MultiselectOptionButton.cs @@ -12,6 +12,7 @@ namespace Robust.Client.UserInterface.Controls /// /// type to use as the unique key for each option. Functions similarly /// to dictionary key, so the type should make sure to respect dictionary key semantics. + [Virtual] public class MultiselectOptionButton : ContainerButton where TKey : notnull { public const string StyleClassOptionButton = "optionButton"; @@ -289,7 +290,7 @@ namespace Robust.Client.UserInterface.Controls TogglePopup(false); } - public class ItemPressedEventArgs : EventArgs + public sealed class ItemPressedEventArgs : EventArgs { public readonly MultiselectOptionButton Button; /// diff --git a/Robust.Client/UserInterface/Controls/OSWindow.cs b/Robust.Client/UserInterface/Controls/OSWindow.cs index adc17fc73..ce4df0a91 100644 --- a/Robust.Client/UserInterface/Controls/OSWindow.cs +++ b/Robust.Client/UserInterface/Controls/OSWindow.cs @@ -11,6 +11,7 @@ namespace Robust.Client.UserInterface.Controls /// Represents an operating system-based UI window. /// /// + [Virtual] public class OSWindow : Control { [Dependency] private readonly IClyde _clyde = default!; diff --git a/Robust.Client/UserInterface/Controls/OptionButton.cs b/Robust.Client/UserInterface/Controls/OptionButton.cs index 47594fddb..3cc32bc32 100644 --- a/Robust.Client/UserInterface/Controls/OptionButton.cs +++ b/Robust.Client/UserInterface/Controls/OptionButton.cs @@ -6,6 +6,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class OptionButton : ContainerButton { public const string StyleClassOptionButton = "optionButton"; @@ -296,7 +297,7 @@ namespace Robust.Client.UserInterface.Controls TogglePopup(false); } - public class ItemSelectedEventArgs : EventArgs + public sealed class ItemSelectedEventArgs : EventArgs { public OptionButton Button { get; } diff --git a/Robust.Client/UserInterface/Controls/OutputPanel.cs b/Robust.Client/UserInterface/Controls/OutputPanel.cs index 0fc5d4ddd..2a57a4c0a 100644 --- a/Robust.Client/UserInterface/Controls/OutputPanel.cs +++ b/Robust.Client/UserInterface/Controls/OutputPanel.cs @@ -9,6 +9,7 @@ namespace Robust.Client.UserInterface.Controls /// /// A control to handle output of message-by-message output panels, like the debug console and chat panel. /// + [Virtual] public class OutputPanel : Control { public const string StylePropertyStyleBox = "stylebox"; diff --git a/Robust.Client/UserInterface/Controls/PanelContainer.cs b/Robust.Client/UserInterface/Controls/PanelContainer.cs index c230f31c3..cb6233aa4 100644 --- a/Robust.Client/UserInterface/Controls/PanelContainer.cs +++ b/Robust.Client/UserInterface/Controls/PanelContainer.cs @@ -3,6 +3,7 @@ using Robust.Shared.Maths; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class PanelContainer : Container { public const string StylePropertyPanel = "panel"; diff --git a/Robust.Client/UserInterface/Controls/Popup.cs b/Robust.Client/UserInterface/Controls/Popup.cs index cf68ac988..d9f2a9c5c 100644 --- a/Robust.Client/UserInterface/Controls/Popup.cs +++ b/Robust.Client/UserInterface/Controls/Popup.cs @@ -3,6 +3,7 @@ using Robust.Shared.Maths; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class Popup : Control { public Popup() diff --git a/Robust.Client/UserInterface/Controls/PopupContainer.cs b/Robust.Client/UserInterface/Controls/PopupContainer.cs index 309dd96ef..3abb126f3 100644 --- a/Robust.Client/UserInterface/Controls/PopupContainer.cs +++ b/Robust.Client/UserInterface/Controls/PopupContainer.cs @@ -6,6 +6,7 @@ namespace Robust.Client.UserInterface.Controls /// Container that tries to put controls at their specified origin, /// moving them around if necessary to avoid them going outside of the bounds of the container. /// + [Virtual] public sealed class PopupContainer : Control { /// diff --git a/Robust.Client/UserInterface/Controls/ProgressBar.cs b/Robust.Client/UserInterface/Controls/ProgressBar.cs index ef863f6fd..de7feeb34 100644 --- a/Robust.Client/UserInterface/Controls/ProgressBar.cs +++ b/Robust.Client/UserInterface/Controls/ProgressBar.cs @@ -4,6 +4,7 @@ using Robust.Shared.Maths; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class ProgressBar : Range { public const string StylePropertyBackground = "background"; diff --git a/Robust.Client/UserInterface/Controls/RadioOptions.cs b/Robust.Client/UserInterface/Controls/RadioOptions.cs index 516ca18cb..57764b73c 100644 --- a/Robust.Client/UserInterface/Controls/RadioOptions.cs +++ b/Robust.Client/UserInterface/Controls/RadioOptions.cs @@ -8,6 +8,7 @@ namespace Robust.Client.UserInterface.Controls { public enum RadioOptionsLayout { Horizontal, Vertical } + [Virtual] public class RadioOptions : Control { private int internalIdCount = 0; @@ -228,7 +229,7 @@ namespace Robust.Client.UserInterface.Controls } } } - public class RadioOptionItemSelectedEventArgs : EventArgs + public sealed class RadioOptionItemSelectedEventArgs : EventArgs { public RadioOptions Button { get; } diff --git a/Robust.Client/UserInterface/Controls/Range.cs b/Robust.Client/UserInterface/Controls/Range.cs index bbae39b1a..5bf9ea844 100644 --- a/Robust.Client/UserInterface/Controls/Range.cs +++ b/Robust.Client/UserInterface/Controls/Range.cs @@ -5,6 +5,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.UserInterface.Controls { + [Virtual] public abstract class Range : Control { private float _maxValue = 100; diff --git a/Robust.Client/UserInterface/Controls/RichTextLabel.cs b/Robust.Client/UserInterface/Controls/RichTextLabel.cs index cb05077b5..3c0a39fab 100644 --- a/Robust.Client/UserInterface/Controls/RichTextLabel.cs +++ b/Robust.Client/UserInterface/Controls/RichTextLabel.cs @@ -6,6 +6,7 @@ using Robust.Shared.Utility; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class RichTextLabel : Control { private FormattedMessage? _message; diff --git a/Robust.Client/UserInterface/Controls/ScrollBar.cs b/Robust.Client/UserInterface/Controls/ScrollBar.cs index 48959f230..b0b34e908 100644 --- a/Robust.Client/UserInterface/Controls/ScrollBar.cs +++ b/Robust.Client/UserInterface/Controls/ScrollBar.cs @@ -6,6 +6,7 @@ using Robust.Shared.Timing; namespace Robust.Client.UserInterface.Controls { + [Virtual] public abstract class ScrollBar : Range { public const string StylePropertyGrabber = "grabber"; diff --git a/Robust.Client/UserInterface/Controls/ScrollContainer.cs b/Robust.Client/UserInterface/Controls/ScrollContainer.cs index dea00357e..a980fdf6e 100644 --- a/Robust.Client/UserInterface/Controls/ScrollContainer.cs +++ b/Robust.Client/UserInterface/Controls/ScrollContainer.cs @@ -4,6 +4,7 @@ using Robust.Shared.Maths; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class ScrollContainer : Container { private bool _vScrollEnabled = true; diff --git a/Robust.Client/UserInterface/Controls/Slider.cs b/Robust.Client/UserInterface/Controls/Slider.cs index bb405ae22..27952a196 100644 --- a/Robust.Client/UserInterface/Controls/Slider.cs +++ b/Robust.Client/UserInterface/Controls/Slider.cs @@ -5,6 +5,7 @@ using static Robust.Client.UserInterface.Controls.LayoutContainer; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class Slider : Range { public const string StylePropertyBackground = "background"; diff --git a/Robust.Client/UserInterface/Controls/SliderIntInput.cs b/Robust.Client/UserInterface/Controls/SliderIntInput.cs index 71a0444a2..21abac097 100644 --- a/Robust.Client/UserInterface/Controls/SliderIntInput.cs +++ b/Robust.Client/UserInterface/Controls/SliderIntInput.cs @@ -2,6 +2,7 @@ using System; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class SliderIntInput : Control { private Slider _slider; diff --git a/Robust.Client/UserInterface/Controls/SpinBox.cs b/Robust.Client/UserInterface/Controls/SpinBox.cs index 0e0001a3a..d3102f478 100644 --- a/Robust.Client/UserInterface/Controls/SpinBox.cs +++ b/Robust.Client/UserInterface/Controls/SpinBox.cs @@ -7,6 +7,7 @@ namespace Robust.Client.UserInterface.Controls /// /// Number input LineEdit with increment buttons. /// + [Virtual] public class SpinBox : BoxContainer { public const string LeftButtonStyle = "spinbox-left"; @@ -194,7 +195,7 @@ namespace Robust.Client.UserInterface.Controls } } - public class ValueChangedEventArgs : EventArgs + public sealed class ValueChangedEventArgs : EventArgs { public readonly int Value; diff --git a/Robust.Client/UserInterface/Controls/SplitContainer.cs b/Robust.Client/UserInterface/Controls/SplitContainer.cs index 0400220af..9fefa0e47 100644 --- a/Robust.Client/UserInterface/Controls/SplitContainer.cs +++ b/Robust.Client/UserInterface/Controls/SplitContainer.cs @@ -5,6 +5,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class SplitContainer : Container { /// diff --git a/Robust.Client/UserInterface/Controls/SpriteView.cs b/Robust.Client/UserInterface/Controls/SpriteView.cs index 2303cf203..00cb2b54c 100644 --- a/Robust.Client/UserInterface/Controls/SpriteView.cs +++ b/Robust.Client/UserInterface/Controls/SpriteView.cs @@ -7,6 +7,7 @@ using Robust.Shared.Timing; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class SpriteView : Control { private Vector2 _scale = (1, 1); diff --git a/Robust.Client/UserInterface/Controls/TabContainer.cs b/Robust.Client/UserInterface/Controls/TabContainer.cs index 3f5c5e08d..08b9ef7d6 100644 --- a/Robust.Client/UserInterface/Controls/TabContainer.cs +++ b/Robust.Client/UserInterface/Controls/TabContainer.cs @@ -6,6 +6,7 @@ using Robust.Shared.Maths; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class TabContainer : Container { public static readonly AttachedProperty TabVisibleProperty = AttachedProperty.Create("TabVisible", typeof(TabContainer), true); diff --git a/Robust.Client/UserInterface/Controls/TextureButton.cs b/Robust.Client/UserInterface/Controls/TextureButton.cs index c81266f4f..38547eb47 100644 --- a/Robust.Client/UserInterface/Controls/TextureButton.cs +++ b/Robust.Client/UserInterface/Controls/TextureButton.cs @@ -5,6 +5,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class TextureButton : BaseButton { private Vector2 _scale = (1, 1); diff --git a/Robust.Client/UserInterface/Controls/TextureRect.cs b/Robust.Client/UserInterface/Controls/TextureRect.cs index f262923e1..0a18d2176 100644 --- a/Robust.Client/UserInterface/Controls/TextureRect.cs +++ b/Robust.Client/UserInterface/Controls/TextureRect.cs @@ -8,6 +8,7 @@ namespace Robust.Client.UserInterface.Controls /// Simple control that draws a single texture using a variety of possible stretching modes. /// /// + [Virtual] public class TextureRect : Control { public const string StylePropertyTexture = "texture"; diff --git a/Robust.Client/UserInterface/Controls/Tree.cs b/Robust.Client/UserInterface/Controls/Tree.cs index c10166aca..9e13c216c 100644 --- a/Robust.Client/UserInterface/Controls/Tree.cs +++ b/Robust.Client/UserInterface/Controls/Tree.cs @@ -6,6 +6,7 @@ using Robust.Shared.Maths; namespace Robust.Client.UserInterface.Controls { + [Virtual] public class Tree : Control { public const string StylePropertyItemBoxSelected = "item-selected"; diff --git a/Robust.Client/UserInterface/Controls/VScrollBar.cs b/Robust.Client/UserInterface/Controls/VScrollBar.cs index 533916684..47dd7bea6 100644 --- a/Robust.Client/UserInterface/Controls/VScrollBar.cs +++ b/Robust.Client/UserInterface/Controls/VScrollBar.cs @@ -1,5 +1,6 @@ namespace Robust.Client.UserInterface.Controls { + [Virtual] public class VScrollBar : ScrollBar { public VScrollBar() : base(OrientationMode.Vertical) diff --git a/Robust.Client/UserInterface/CustomControls/DebugCoordsPanel.cs b/Robust.Client/UserInterface/CustomControls/DebugCoordsPanel.cs index 72d03b4df..4ac50ef25 100644 --- a/Robust.Client/UserInterface/CustomControls/DebugCoordsPanel.cs +++ b/Robust.Client/UserInterface/CustomControls/DebugCoordsPanel.cs @@ -11,7 +11,7 @@ using Robust.Shared.Timing; namespace Robust.Client.UserInterface.CustomControls { - internal class DebugCoordsPanel : PanelContainer + internal sealed class DebugCoordsPanel : PanelContainer { [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; diff --git a/Robust.Client/UserInterface/CustomControls/DebugInputPanel.cs b/Robust.Client/UserInterface/CustomControls/DebugInputPanel.cs index 5b2e34785..edbcd5eaa 100644 --- a/Robust.Client/UserInterface/CustomControls/DebugInputPanel.cs +++ b/Robust.Client/UserInterface/CustomControls/DebugInputPanel.cs @@ -7,7 +7,7 @@ using Robust.Shared.Timing; namespace Robust.Client.UserInterface.CustomControls { - internal class DebugInputPanel : PanelContainer + internal sealed class DebugInputPanel : PanelContainer { [Dependency] private readonly IInputManager _inputManager = default!; diff --git a/Robust.Client/UserInterface/CustomControls/DebugNetBandwidthPanel.cs b/Robust.Client/UserInterface/CustomControls/DebugNetBandwidthPanel.cs index 3678ab51f..6efa673ed 100644 --- a/Robust.Client/UserInterface/CustomControls/DebugNetBandwidthPanel.cs +++ b/Robust.Client/UserInterface/CustomControls/DebugNetBandwidthPanel.cs @@ -9,7 +9,7 @@ using Robust.Shared.Utility; namespace Robust.Client.UserInterface.CustomControls { - public class DebugNetBandwidthPanel : PanelContainer + public sealed class DebugNetBandwidthPanel : PanelContainer { private const int OneKibibyte = 1024; diff --git a/Robust.Client/UserInterface/CustomControls/DebugNetPanel.cs b/Robust.Client/UserInterface/CustomControls/DebugNetPanel.cs index 2cb316fc4..cf7e6591f 100644 --- a/Robust.Client/UserInterface/CustomControls/DebugNetPanel.cs +++ b/Robust.Client/UserInterface/CustomControls/DebugNetPanel.cs @@ -7,7 +7,7 @@ using Robust.Shared.Timing; namespace Robust.Client.UserInterface.CustomControls { - public class DebugNetPanel : PanelContainer + public sealed class DebugNetPanel : PanelContainer { // Float so I don't have to cast it to prevent integer division down below. const float ONE_KIBIBYTE = 1024; diff --git a/Robust.Client/UserInterface/CustomControls/DebugTimePanel.cs b/Robust.Client/UserInterface/CustomControls/DebugTimePanel.cs index 2d6bc2c2c..725db01a8 100644 --- a/Robust.Client/UserInterface/CustomControls/DebugTimePanel.cs +++ b/Robust.Client/UserInterface/CustomControls/DebugTimePanel.cs @@ -6,7 +6,7 @@ using Robust.Shared.Timing; namespace Robust.Client.UserInterface.CustomControls { - public class DebugTimePanel : PanelContainer + public sealed class DebugTimePanel : PanelContainer { private readonly IGameTiming _gameTiming; private readonly IClientGameStateManager _gameState; diff --git a/Robust.Client/UserInterface/CustomControls/DefaultWindow.xaml.cs b/Robust.Client/UserInterface/CustomControls/DefaultWindow.xaml.cs index 347c9f336..721872429 100644 --- a/Robust.Client/UserInterface/CustomControls/DefaultWindow.xaml.cs +++ b/Robust.Client/UserInterface/CustomControls/DefaultWindow.xaml.cs @@ -16,6 +16,7 @@ namespace Robust.Client.UserInterface.CustomControls /// Warning: ugly. /// [GenerateTypedNameReferences] + [Virtual] // ReSharper disable once InconsistentNaming public partial class DefaultWindow : BaseWindow { @@ -175,7 +176,7 @@ namespace Robust.Client.UserInterface.CustomControls return mode; } - public class SS14ContentCollection : ICollection, IReadOnlyCollection + public sealed class SS14ContentCollection : ICollection, IReadOnlyCollection { private readonly DefaultWindow Owner; diff --git a/Robust.Client/UserInterface/CustomControls/EntitySpawnWindow.cs b/Robust.Client/UserInterface/CustomControls/EntitySpawnWindow.cs index 304418129..9d27b2bdb 100644 --- a/Robust.Client/UserInterface/CustomControls/EntitySpawnWindow.cs +++ b/Robust.Client/UserInterface/CustomControls/EntitySpawnWindow.cs @@ -406,7 +406,7 @@ namespace Robust.Client.UserInterface.CustomControls UpdateVisiblePrototypes(); } - private class PrototypeListContainer : Container + private sealed class PrototypeListContainer : Container { // Quick and dirty container to do virtualization of the list. // Basically, get total item count and offset to put the current buttons at. @@ -474,7 +474,7 @@ namespace Robust.Client.UserInterface.CustomControls } [DebuggerDisplay("spawnbutton {" + nameof(Index) + "}")] - private class EntitySpawnButton : Control + private sealed class EntitySpawnButton : Control { public string PrototypeID => Prototype.ID; public EntityPrototype Prototype { get; set; } = default!; @@ -547,7 +547,7 @@ namespace Robust.Client.UserInterface.CustomControls RotationLabel.Text = placementManager.Direction.ToString(); } - private class DoNotMeasure : Control + private sealed class DoNotMeasure : Control { protected override Vector2 MeasureOverride(Vector2 availableSize) { diff --git a/Robust.Client/UserInterface/CustomControls/MainViewportContainer.cs b/Robust.Client/UserInterface/CustomControls/MainViewportContainer.cs index 67a3b83d8..828a4522e 100644 --- a/Robust.Client/UserInterface/CustomControls/MainViewportContainer.cs +++ b/Robust.Client/UserInterface/CustomControls/MainViewportContainer.cs @@ -7,7 +7,7 @@ namespace Robust.Client.UserInterface.CustomControls /// A viewport container shows a viewport. /// This one is particularly gnarly because it has the code for the main viewport stuff. /// - public class MainViewportContainer : ViewportContainer + public sealed class MainViewportContainer : ViewportContainer { private readonly IEyeManager _eyeManager; diff --git a/Robust.Client/UserInterface/CustomControls/SS14Window.cs b/Robust.Client/UserInterface/CustomControls/SS14Window.cs index b3061d3f0..f5483cfbf 100644 --- a/Robust.Client/UserInterface/CustomControls/SS14Window.cs +++ b/Robust.Client/UserInterface/CustomControls/SS14Window.cs @@ -3,6 +3,7 @@ namespace Robust.Client.UserInterface.CustomControls; [Obsolete("Use DefaultWindow instead")] +[Virtual] public class SS14Window : DefaultWindow { diff --git a/Robust.Client/UserInterface/CustomControls/ViewportContainer.cs b/Robust.Client/UserInterface/CustomControls/ViewportContainer.cs index 3b77f6171..20439c830 100644 --- a/Robust.Client/UserInterface/CustomControls/ViewportContainer.cs +++ b/Robust.Client/UserInterface/CustomControls/ViewportContainer.cs @@ -9,6 +9,7 @@ namespace Robust.Client.UserInterface.CustomControls /// /// A viewport container shows a viewport. /// + [Virtual] public class ViewportContainer : Control, IViewportControl { private readonly IClyde _displayManager; diff --git a/Robust.Client/UserInterface/FileDialogFilters.cs b/Robust.Client/UserInterface/FileDialogFilters.cs index 8927de014..664e2bbce 100644 --- a/Robust.Client/UserInterface/FileDialogFilters.cs +++ b/Robust.Client/UserInterface/FileDialogFilters.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; namespace Robust.Client.UserInterface { - public class FileDialogFilters + public sealed class FileDialogFilters { public FileDialogFilters(IReadOnlyList groups) { @@ -15,7 +15,7 @@ namespace Robust.Client.UserInterface public IReadOnlyList Groups { get; } - public class Group + public sealed class Group { public Group(IReadOnlyList extensions) { diff --git a/Robust.Client/UserInterface/LocExtension.cs b/Robust.Client/UserInterface/LocExtension.cs index 86b64b7d5..c23c26ad9 100644 --- a/Robust.Client/UserInterface/LocExtension.cs +++ b/Robust.Client/UserInterface/LocExtension.cs @@ -6,7 +6,7 @@ namespace Robust.Client.UserInterface // TODO: Code a XAML compiler transformer to remove references to this type at compile time. // And just replace them with the Loc.GetString() call. [PublicAPI] - public class LocExtension + public sealed class LocExtension { public string Key { get; } diff --git a/Robust.Client/UserInterface/UiCommands.cs b/Robust.Client/UserInterface/UiCommands.cs index 87d8fecce..90eb6f5c5 100644 --- a/Robust.Client/UserInterface/UiCommands.cs +++ b/Robust.Client/UserInterface/UiCommands.cs @@ -5,7 +5,7 @@ using Robust.Shared.Reflection; namespace Robust.Client.UserInterface { - class ChangeSceneCommpand : IConsoleCommand + sealed class ChangeSceneCommpand : IConsoleCommand { public string Command => "scene"; public string Help => "scene "; diff --git a/Robust.Client/UserInterface/UserInterfaceManager.cs b/Robust.Client/UserInterface/UserInterfaceManager.cs index 791bb0a00..b519df0ce 100644 --- a/Robust.Client/UserInterface/UserInterfaceManager.cs +++ b/Robust.Client/UserInterface/UserInterfaceManager.cs @@ -838,9 +838,11 @@ namespace Robust.Client.UserInterface } } - private static void _doGuiInput(Control? control, T guiEvent, Action action, + private static void _doGuiInput( + Control? control, + GUIBoundKeyEventArgs guiEvent, + Action action, bool ignoreStop = false) - where T : GUIBoundKeyEventArgs { while (control != null) { diff --git a/Robust.Client/UserInterface/XAML/Attributes.cs b/Robust.Client/UserInterface/XAML/Attributes.cs index a191dcfae..5f2601ba1 100644 --- a/Robust.Client/UserInterface/XAML/Attributes.cs +++ b/Robust.Client/UserInterface/XAML/Attributes.cs @@ -2,18 +2,18 @@ namespace Robust.Client.UserInterface.XAML { - public class ContentAttribute : Attribute + public sealed class ContentAttribute : Attribute { } - public class UsableDuringInitializationAttribute : Attribute + public sealed class UsableDuringInitializationAttribute : Attribute { public UsableDuringInitializationAttribute(bool usable) { } } - public class DeferredContentAttribute : Attribute + public sealed class DeferredContentAttribute : Attribute { } diff --git a/Robust.Client/UserInterface/XAML/Binding.cs b/Robust.Client/UserInterface/XAML/Binding.cs index 9cc8bdc55..85e4875b3 100644 --- a/Robust.Client/UserInterface/XAML/Binding.cs +++ b/Robust.Client/UserInterface/XAML/Binding.cs @@ -5,7 +5,7 @@ using JetBrains.Annotations; namespace Avalonia.Data { [UsedImplicitly] - public class Binding + public sealed class Binding { public Binding() { diff --git a/Robust.Client/UserInterface/XAML/NameScope.cs b/Robust.Client/UserInterface/XAML/NameScope.cs index 389ed36a6..a332fb1a9 100644 --- a/Robust.Client/UserInterface/XAML/NameScope.cs +++ b/Robust.Client/UserInterface/XAML/NameScope.cs @@ -6,7 +6,7 @@ namespace Robust.Client.UserInterface.XAML /// /// Implements a name scope. /// - public class NameScope + public sealed class NameScope { public bool IsCompleted { get; private set; } diff --git a/Robust.Client/UserInterface/XAML/RobustXamlLoader.cs b/Robust.Client/UserInterface/XAML/RobustXamlLoader.cs index d7a5fad25..4692e404e 100644 --- a/Robust.Client/UserInterface/XAML/RobustXamlLoader.cs +++ b/Robust.Client/UserInterface/XAML/RobustXamlLoader.cs @@ -2,7 +2,7 @@ namespace Robust.Client.UserInterface.XAML { - public class RobustXamlLoader + public static class RobustXamlLoader { public static void Load(object obj) { diff --git a/Robust.Client/Usings.cs b/Robust.Client/Usings.cs new file mode 100644 index 000000000..daaa0a738 --- /dev/null +++ b/Robust.Client/Usings.cs @@ -0,0 +1 @@ +global using Robust.Shared.Analyzers; diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorAngle.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorAngle.cs index feb7b32da..06d6773da 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorAngle.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorAngle.cs @@ -6,7 +6,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables.Editors { - public class VVPropEditorAngle : VVPropEditor + public sealed class VVPropEditorAngle : VVPropEditor { protected override Control MakeUI(object? value) { diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorColor.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorColor.cs index 569739009..a3b52d757 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorColor.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorColor.cs @@ -4,7 +4,7 @@ using Robust.Shared.Maths; namespace Robust.Client.ViewVariables.Editors { - public class VVPropEditorColor : VVPropEditor + public sealed class VVPropEditorColor : VVPropEditor { protected override Control MakeUI(object? value) { diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs index ab84fe7e2..319e406f0 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorEntityCoordinates.cs @@ -9,7 +9,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables.Editors { - public class VVPropEditorEntityCoordinates : VVPropEditor + public sealed class VVPropEditorEntityCoordinates : VVPropEditor { protected override Control MakeUI(object? value) { diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorEntityUid.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorEntityUid.cs index 2a78188dc..f872d6204 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorEntityUid.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorEntityUid.cs @@ -8,7 +8,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables.Editors { - public class VVPropEditorEntityUid : VVPropEditor + public sealed class VVPropEditorEntityUid : VVPropEditor { protected override Control MakeUI(object? value) { diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorEnum.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorEnum.cs index ed3ef9f66..d9d5f6d38 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorEnum.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorEnum.cs @@ -5,7 +5,7 @@ using Robust.Shared.Utility; namespace Robust.Client.ViewVariables.Editors { - class VVPropEditorEnum : VVPropEditor + sealed class VVPropEditorEnum : VVPropEditor { protected override Control MakeUI(object? value) { diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorIPrototype.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorIPrototype.cs index d08ee35d7..97ea7f4f7 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorIPrototype.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorIPrototype.cs @@ -9,7 +9,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables.Editors { - public class VVPropEditorIPrototype : VVPropEditor + public sealed class VVPropEditorIPrototype : VVPropEditor { private object? _localValue; private ViewVariablesObjectSelector? _selector; diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorKeyValuePair.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorKeyValuePair.cs index a4ceed20a..9d87b1f49 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorKeyValuePair.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorKeyValuePair.cs @@ -7,7 +7,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables.Editors { - public class VVPropEditorKeyValuePair : VVPropEditor + public sealed class VVPropEditorKeyValuePair : VVPropEditor { [Dependency] private readonly IViewVariablesManagerInternal _viewVariables = default!; diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorTimeSpan.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorTimeSpan.cs index b0ef89f33..3764e9a98 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorTimeSpan.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorTimeSpan.cs @@ -4,7 +4,7 @@ using Robust.Client.UserInterface.Controls; namespace Robust.Client.ViewVariables.Editors { - public class VVPropEditorTimeSpan : VVPropEditor + public sealed class VVPropEditorTimeSpan : VVPropEditor { protected override Control MakeUI(object? value) { diff --git a/Robust.Client/ViewVariables/Editors/VVPropEditorUIBox2.cs b/Robust.Client/ViewVariables/Editors/VVPropEditorUIBox2.cs index ccf24e5ba..bc8e675f9 100644 --- a/Robust.Client/ViewVariables/Editors/VVPropEditorUIBox2.cs +++ b/Robust.Client/ViewVariables/Editors/VVPropEditorUIBox2.cs @@ -7,7 +7,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables.Editors { - public class VVPropEditorUIBox2 : VVPropEditor + public sealed class VVPropEditorUIBox2 : VVPropEditor { private readonly BoxType _type; diff --git a/Robust.Client/ViewVariables/Instances/ViewVariablesInstanceEntity.cs b/Robust.Client/ViewVariables/Instances/ViewVariablesInstanceEntity.cs index 748aa1d5c..044090054 100644 --- a/Robust.Client/ViewVariables/Instances/ViewVariablesInstanceEntity.cs +++ b/Robust.Client/ViewVariables/Instances/ViewVariablesInstanceEntity.cs @@ -30,7 +30,7 @@ namespace Robust.Client.ViewVariables.Instances // Anyways, the different tabs in the entity view need to be moved to traits, // and this class basically made a child of InstanceObject for the code that doesn't fit in a trait. - internal class ViewVariablesInstanceEntity : ViewVariablesInstance + internal sealed class ViewVariablesInstanceEntity : ViewVariablesInstance { private readonly IEntityManager _entityManager; diff --git a/Robust.Client/ViewVariables/Instances/ViewVariablesInstanceObject.cs b/Robust.Client/ViewVariables/Instances/ViewVariablesInstanceObject.cs index 43a202d2f..be198a382 100644 --- a/Robust.Client/ViewVariables/Instances/ViewVariablesInstanceObject.cs +++ b/Robust.Client/ViewVariables/Instances/ViewVariablesInstanceObject.cs @@ -13,7 +13,7 @@ using Timer = Robust.Shared.Timing.Timer; namespace Robust.Client.ViewVariables.Instances { - internal class ViewVariablesInstanceObject : ViewVariablesInstance + internal sealed class ViewVariablesInstanceObject : ViewVariablesInstance { private TabContainer _tabs = default!; private Button _refreshButton = default!; diff --git a/Robust.Client/ViewVariables/Traits/ViewVariablesTraitEnumerable.cs b/Robust.Client/ViewVariables/Traits/ViewVariablesTraitEnumerable.cs index cd6b65955..8544bc8fb 100644 --- a/Robust.Client/ViewVariables/Traits/ViewVariablesTraitEnumerable.cs +++ b/Robust.Client/ViewVariables/Traits/ViewVariablesTraitEnumerable.cs @@ -14,7 +14,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables.Traits { - internal class ViewVariablesTraitEnumerable : ViewVariablesTrait + internal sealed class ViewVariablesTraitEnumerable : ViewVariablesTrait { private const int ElementsPerPage = 25; private readonly List _cache = new(); diff --git a/Robust.Client/ViewVariables/Traits/ViewVariablesTraitMembers.cs b/Robust.Client/ViewVariables/Traits/ViewVariablesTraitMembers.cs index 12a8c71a5..650dec643 100644 --- a/Robust.Client/ViewVariables/Traits/ViewVariablesTraitMembers.cs +++ b/Robust.Client/ViewVariables/Traits/ViewVariablesTraitMembers.cs @@ -9,7 +9,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables.Traits { - internal class ViewVariablesTraitMembers : ViewVariablesTrait + internal sealed class ViewVariablesTraitMembers : ViewVariablesTrait { private readonly IViewVariablesManagerInternal _vvm; private readonly IRobustSerializer _robustSerializer; diff --git a/Robust.Client/ViewVariables/ViewVariablesAddWindow.xaml.cs b/Robust.Client/ViewVariables/ViewVariablesAddWindow.xaml.cs index 4133a5c6a..42911fc14 100644 --- a/Robust.Client/ViewVariables/ViewVariablesAddWindow.xaml.cs +++ b/Robust.Client/ViewVariables/ViewVariablesAddWindow.xaml.cs @@ -10,7 +10,7 @@ using Robust.Shared.Localization; namespace Robust.Client.ViewVariables { [GenerateTypedNameReferences] - public partial class ViewVariablesAddWindow : DefaultWindow + public sealed partial class ViewVariablesAddWindow : DefaultWindow { private string? _lastSearch; private string[] _entries = Array.Empty(); @@ -83,7 +83,7 @@ namespace Robust.Client.ViewVariables AddButtonPressed?.Invoke(new AddButtonPressedEventArgs(comp.Text)); } - public class AddButtonPressedEventArgs : EventArgs + public sealed class AddButtonPressedEventArgs : EventArgs { public string Entry { get; } diff --git a/Robust.Client/ViewVariables/ViewVariablesCommand.cs b/Robust.Client/ViewVariables/ViewVariablesCommand.cs index d050e6f3b..b4eb3cc2d 100644 --- a/Robust.Client/ViewVariables/ViewVariablesCommand.cs +++ b/Robust.Client/ViewVariables/ViewVariablesCommand.cs @@ -13,7 +13,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.ViewVariables { [UsedImplicitly] - public class ViewVariablesCommand : IConsoleCommand + public sealed class ViewVariablesCommand : IConsoleCommand { public string Command => "vv"; public string Description => "Opens View Variables."; @@ -126,7 +126,7 @@ namespace Robust.Client.ViewVariables /// /// Test class to test local VV easily without connecting to the server. /// - private class VVTest : IEnumerable + private sealed class VVTest : IEnumerable { [ViewVariables(VVAccess.ReadWrite)] private int x = 10; diff --git a/Robust.Client/ViewVariables/ViewVariablesManager.cs b/Robust.Client/ViewVariables/ViewVariablesManager.cs index 0e5bc5671..3790060ef 100644 --- a/Robust.Client/ViewVariables/ViewVariablesManager.cs +++ b/Robust.Client/ViewVariables/ViewVariablesManager.cs @@ -20,7 +20,7 @@ using static Robust.Client.ViewVariables.Editors.VVPropEditorNumeric; namespace Robust.Client.ViewVariables { - internal class ViewVariablesManager : ViewVariablesManagerShared, IViewVariablesManagerInternal + internal sealed class ViewVariablesManager : ViewVariablesManagerShared, IViewVariablesManagerInternal { [Dependency] private readonly IClientNetManager _netManager = default!; [Dependency] private readonly IRobustSerializer _robustSerializer = default!; @@ -408,6 +408,7 @@ namespace Robust.Client.ViewVariables } } + [Virtual] public class SessionDenyException : Exception { public SessionDenyException(MsgViewVariablesDenySession.DenyReason reason) diff --git a/Robust.Client/ViewVariables/ViewVariablesPropertyControl.cs b/Robust.Client/ViewVariables/ViewVariablesPropertyControl.cs index 3defe5de6..478a59878 100644 --- a/Robust.Client/ViewVariables/ViewVariablesPropertyControl.cs +++ b/Robust.Client/ViewVariables/ViewVariablesPropertyControl.cs @@ -12,7 +12,7 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.ViewVariables { - internal class ViewVariablesPropertyControl : PanelContainer + internal sealed class ViewVariablesPropertyControl : PanelContainer { public BoxContainer VBox { get; } public BoxContainer TopContainer { get; } diff --git a/Robust.Client/ViewVariables/ViewVariablesRemoteSession.cs b/Robust.Client/ViewVariables/ViewVariablesRemoteSession.cs index b4640b932..d9d94f403 100644 --- a/Robust.Client/ViewVariables/ViewVariablesRemoteSession.cs +++ b/Robust.Client/ViewVariables/ViewVariablesRemoteSession.cs @@ -3,7 +3,7 @@ namespace Robust.Client.ViewVariables /// /// A session allowing the client to read & write on an object on the server. /// - public class ViewVariablesRemoteSession + public sealed class ViewVariablesRemoteSession { internal uint SessionId { get; } public bool Closed { get; internal set; } diff --git a/Robust.Server/Bql/BqlQueryManager.cs b/Robust.Server/Bql/BqlQueryManager.cs index c25e05c7b..8bbe1ba28 100644 --- a/Robust.Server/Bql/BqlQueryManager.cs +++ b/Robust.Server/Bql/BqlQueryManager.cs @@ -7,7 +7,7 @@ using Robust.Shared.Utility; namespace Robust.Server.Bql { - public partial class BqlQueryManager : IBqlQueryManager + public sealed partial class BqlQueryManager : IBqlQueryManager { private readonly IReflectionManager _reflectionManager; private readonly IComponentFactory _componentFactory; diff --git a/Robust.Server/Bql/BqlQuerySelector.Builtin.cs b/Robust.Server/Bql/BqlQuerySelector.Builtin.cs index baafb9db2..f6c0f1699 100644 --- a/Robust.Server/Bql/BqlQuerySelector.Builtin.cs +++ b/Robust.Server/Bql/BqlQuerySelector.Builtin.cs @@ -9,7 +9,7 @@ using Robust.Shared.Map; namespace Robust.Server.Bql { [RegisterBqlQuerySelector] - public class WithQuerySelector : BqlQuerySelector + public sealed class WithQuerySelector : BqlQuerySelector { public override string Token => "with"; @@ -34,7 +34,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class NamedQuerySelector : BqlQuerySelector + public sealed class NamedQuerySelector : BqlQuerySelector { public override string Token => "named"; @@ -53,7 +53,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class ParentedToQuerySelector : BqlQuerySelector + public sealed class ParentedToQuerySelector : BqlQuerySelector { public override string Token => "parentedto"; @@ -68,7 +68,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class RecursiveParentedToQuerySelector : BqlQuerySelector + public sealed class RecursiveParentedToQuerySelector : BqlQuerySelector { public override string Token => "rparentedto"; @@ -97,7 +97,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class ChildrenQuerySelector : BqlQuerySelector + public sealed class ChildrenQuerySelector : BqlQuerySelector { public override string Token => "children"; @@ -118,7 +118,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class RecursiveChildrenQuerySelector : BqlQuerySelector + public sealed class RecursiveChildrenQuerySelector : BqlQuerySelector { public override string Token => "rchildren"; @@ -152,7 +152,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class ParentQuerySelector : BqlQuerySelector + public sealed class ParentQuerySelector : BqlQuerySelector { public override string Token => "parent"; @@ -172,7 +172,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class AboveQuerySelector : BqlQuerySelector + public sealed class AboveQuerySelector : BqlQuerySelector { public override string Token => "above"; @@ -207,7 +207,7 @@ namespace Robust.Server.Bql [RegisterBqlQuerySelector] // ReSharper disable once InconsistentNaming the name is correct shut up - public class OnGridQuerySelector : BqlQuerySelector + public sealed class OnGridQuerySelector : BqlQuerySelector { public override string Token => "ongrid"; @@ -223,7 +223,7 @@ namespace Robust.Server.Bql [RegisterBqlQuerySelector] // ReSharper disable once InconsistentNaming the name is correct shut up - public class OnMapQuerySelector : BqlQuerySelector + public sealed class OnMapQuerySelector : BqlQuerySelector { public override string Token => "onmap"; @@ -238,7 +238,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class PrototypedQuerySelector : BqlQuerySelector + public sealed class PrototypedQuerySelector : BqlQuerySelector { public override string Token => "prototyped"; @@ -252,7 +252,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class RecursivePrototypedQuerySelector : BqlQuerySelector + public sealed class RecursivePrototypedQuerySelector : BqlQuerySelector { public override string Token => "rprototyped"; @@ -274,7 +274,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class SelectQuerySelector : BqlQuerySelector + public sealed class SelectQuerySelector : BqlQuerySelector { public override string Token => "select"; @@ -302,7 +302,7 @@ namespace Robust.Server.Bql } [RegisterBqlQuerySelector] - public class NearQuerySelector : BqlQuerySelector + public sealed class NearQuerySelector : BqlQuerySelector { public override string Token => "near"; @@ -326,7 +326,7 @@ namespace Robust.Server.Bql [RegisterBqlQuerySelector] // ReSharper disable once InconsistentNaming the name is correct shut up - public class AnchoredQuerySelector : BqlQuerySelector + public sealed class AnchoredQuerySelector : BqlQuerySelector { public override string Token => "anchored"; diff --git a/Robust.Server/Bql/ForAllCommand.cs b/Robust.Server/Bql/ForAllCommand.cs index b386f6cb8..18daa4601 100644 --- a/Robust.Server/Bql/ForAllCommand.cs +++ b/Robust.Server/Bql/ForAllCommand.cs @@ -7,7 +7,7 @@ using Robust.Shared.IoC; namespace Robust.Server.Bql { - public class ForAllCommand : IConsoleCommand + public sealed class ForAllCommand : IConsoleCommand { public string Command => "forall"; public string Description => "Runs a command over all entities with a given component"; diff --git a/Robust.Server/Bql/RegisterBqlQuerySelectorAttribute.cs b/Robust.Server/Bql/RegisterBqlQuerySelectorAttribute.cs index 9daf30877..5c6fd068a 100644 --- a/Robust.Server/Bql/RegisterBqlQuerySelectorAttribute.cs +++ b/Robust.Server/Bql/RegisterBqlQuerySelectorAttribute.cs @@ -7,7 +7,7 @@ namespace Robust.Server.Bql [BaseTypeRequired(typeof(BqlQuerySelector))] [MeansImplicitUse] [PublicAPI] - public class RegisterBqlQuerySelectorAttribute : Attribute + public sealed class RegisterBqlQuerySelectorAttribute : Attribute { } diff --git a/Robust.Server/Console/Commands/ListAssembliesCommand.cs b/Robust.Server/Console/Commands/ListAssembliesCommand.cs index 8ace8164b..922cc7fac 100644 --- a/Robust.Server/Console/Commands/ListAssembliesCommand.cs +++ b/Robust.Server/Console/Commands/ListAssembliesCommand.cs @@ -6,7 +6,7 @@ using Robust.Shared.Console; namespace Robust.Server.Console.Commands { [UsedImplicitly] - internal class ListAssembliesCommand : IConsoleCommand + internal sealed class ListAssembliesCommand : IConsoleCommand { public string Command => "lsasm"; public string Description => "Lists loaded assemblies by load context."; diff --git a/Robust.Server/Console/Commands/ListCommands.cs b/Robust.Server/Console/Commands/ListCommands.cs index 21744e3eb..75c25d035 100644 --- a/Robust.Server/Console/Commands/ListCommands.cs +++ b/Robust.Server/Console/Commands/ListCommands.cs @@ -4,7 +4,7 @@ using Robust.Shared.Console; namespace Robust.Server.Console.Commands { - public class ListCommands : IConsoleCommand + public sealed class ListCommands : IConsoleCommand { public string Command => "list"; diff --git a/Robust.Server/Console/Commands/LogCommands.cs b/Robust.Server/Console/Commands/LogCommands.cs index e9118acd4..060753982 100644 --- a/Robust.Server/Console/Commands/LogCommands.cs +++ b/Robust.Server/Console/Commands/LogCommands.cs @@ -4,7 +4,7 @@ using Robust.Shared.Log; namespace Robust.Server.Console.Commands { - class LogSetLevelCommand : IConsoleCommand + sealed class LogSetLevelCommand : IConsoleCommand { public string Command => "loglevel"; public string Description => "Changes the log level for a provided sawmill."; @@ -40,7 +40,7 @@ namespace Robust.Server.Console.Commands } } - class TestLog : IConsoleCommand + sealed class TestLog : IConsoleCommand { public string Command => "testlog"; public string Description => "Writes a test log to a sawmill."; diff --git a/Robust.Server/Console/Commands/MapCommands.cs b/Robust.Server/Console/Commands/MapCommands.cs index 94a6077ab..1045def1b 100644 --- a/Robust.Server/Console/Commands/MapCommands.cs +++ b/Robust.Server/Console/Commands/MapCommands.cs @@ -12,7 +12,7 @@ using Robust.Shared.Timing; namespace Robust.Server.Console.Commands { - class AddMapCommand : IConsoleCommand + sealed class AddMapCommand : IConsoleCommand { public string Command => "addmap"; @@ -47,7 +47,7 @@ namespace Robust.Server.Console.Commands } } - class RemoveMapCommand : IConsoleCommand + sealed class RemoveMapCommand : IConsoleCommand { public string Command => "rmmap"; public string Description => "Removes a map from the world. You cannot remove nullspace."; @@ -75,7 +75,7 @@ namespace Robust.Server.Console.Commands } } - public class SaveBp : IConsoleCommand + public sealed class SaveBp : IConsoleCommand { public string Command => "savebp"; public string Description => "Serializes a grid to disk."; @@ -111,7 +111,7 @@ namespace Robust.Server.Console.Commands } } - public class LoadBp : IConsoleCommand + public sealed class LoadBp : IConsoleCommand { public string Command => "loadbp"; public string Description => "Loads a blueprint from disk into the game."; @@ -156,7 +156,7 @@ namespace Robust.Server.Console.Commands } } - public class SaveMap : IConsoleCommand + public sealed class SaveMap : IConsoleCommand { public string Command => "savemap"; public string Description => "Serializes a map to disk."; @@ -188,7 +188,7 @@ namespace Robust.Server.Console.Commands } } - public class LoadMap : IConsoleCommand + public sealed class LoadMap : IConsoleCommand { public string Command => "loadmap"; public string Description => "Loads a map from disk into the game."; @@ -223,7 +223,7 @@ namespace Robust.Server.Console.Commands } } - class LocationCommand : IConsoleCommand + sealed class LocationCommand : IConsoleCommand { public string Command => "loc"; public string Description => "Prints the absolute location of the player's entity to console."; @@ -244,7 +244,7 @@ namespace Robust.Server.Console.Commands } } - class TpGridCommand : IConsoleCommand + sealed class TpGridCommand : IConsoleCommand { public string Command => "tpgrid"; public string Description => "Teleports a grid to a new location."; @@ -275,7 +275,7 @@ namespace Robust.Server.Console.Commands } } - class RemoveGridCommand : IConsoleCommand + sealed class RemoveGridCommand : IConsoleCommand { public string Command => "rmgrid"; public string Description => "Removes a grid from a map. You cannot remove the default grid."; diff --git a/Robust.Server/Console/Commands/PlayerCommands.cs b/Robust.Server/Console/Commands/PlayerCommands.cs index 2d2d9ba2d..4256f2520 100644 --- a/Robust.Server/Console/Commands/PlayerCommands.cs +++ b/Robust.Server/Console/Commands/PlayerCommands.cs @@ -13,7 +13,7 @@ using Robust.Shared.Network; namespace Robust.Server.Console.Commands { - internal class TeleportCommand : IConsoleCommand + internal sealed class TeleportCommand : IConsoleCommand { public string Command => "tp"; public string Description => "Teleports a player to any location in the round."; @@ -70,7 +70,7 @@ namespace Robust.Server.Console.Commands } } - public class TeleportToCommand : IConsoleCommand + public sealed class TeleportToCommand : IConsoleCommand { public string Command => "tpto"; public string Description => "Teleports the current player or the specified players/entities to the location of last player/entity specified."; @@ -143,7 +143,7 @@ namespace Robust.Server.Console.Commands } } - public class ListPlayers : IConsoleCommand + public sealed class ListPlayers : IConsoleCommand { public string Command => "listplayers"; public string Description => "Lists all players currently connected"; @@ -175,7 +175,7 @@ namespace Robust.Server.Console.Commands } } - internal class KickCommand : IConsoleCommand + internal sealed class KickCommand : IConsoleCommand { public string Command => "kick"; public string Description => "Kicks a connected player out of the server, disconnecting them."; diff --git a/Robust.Server/Console/Commands/SpawnCommand.cs b/Robust.Server/Console/Commands/SpawnCommand.cs index d36bf53e1..f15b0aa66 100644 --- a/Robust.Server/Console/Commands/SpawnCommand.cs +++ b/Robust.Server/Console/Commands/SpawnCommand.cs @@ -8,7 +8,7 @@ using Robust.Shared.Map; namespace Robust.Server.Console.Commands { - public class SpawnCommand : IConsoleCommand + public sealed class SpawnCommand : IConsoleCommand { public string Command => "spawn"; public string Description => "Spawns an entity with specific type."; diff --git a/Robust.Server/Console/Commands/SysCommands.cs b/Robust.Server/Console/Commands/SysCommands.cs index ed56a2f2c..3396156df 100644 --- a/Robust.Server/Console/Commands/SysCommands.cs +++ b/Robust.Server/Console/Commands/SysCommands.cs @@ -10,7 +10,7 @@ using Robust.Shared.Timing; namespace Robust.Server.Console.Commands { - class RestartCommand : IConsoleCommand + sealed class RestartCommand : IConsoleCommand { public string Command => "restart"; public string Description => "Gracefully restarts the server (not just the round)."; @@ -22,7 +22,7 @@ namespace Robust.Server.Console.Commands } } - class ShutdownCommand : IConsoleCommand + sealed class ShutdownCommand : IConsoleCommand { public string Command => "shutdown"; public string Description => "Gracefully shuts down the server."; @@ -34,7 +34,7 @@ namespace Robust.Server.Console.Commands } } - public class SaveConfig : IConsoleCommand + public sealed class SaveConfig : IConsoleCommand { public string Command => "saveconfig"; public string Description => "Saves the server configuration to the config file"; @@ -46,7 +46,7 @@ namespace Robust.Server.Console.Commands } } - class NetworkAuditCommand : IConsoleCommand + sealed class NetworkAuditCommand : IConsoleCommand { public string Command => "netaudit"; public string Description => "Prints into about NetMsg security."; @@ -72,7 +72,7 @@ namespace Robust.Server.Console.Commands } } - class HelpCommand : IConsoleCommand + sealed class HelpCommand : IConsoleCommand { public string Command => "help"; @@ -107,7 +107,7 @@ namespace Robust.Server.Console.Commands } } - class ShowTimeCommand : IConsoleCommand + sealed class ShowTimeCommand : IConsoleCommand { public string Command => "showtime"; public string Description => "Shows the server time."; @@ -120,7 +120,7 @@ namespace Robust.Server.Console.Commands } } - internal class GcCommand : IConsoleCommand + internal sealed class GcCommand : IConsoleCommand { public string Command => "gc"; public string Description => "Run the GC."; @@ -142,7 +142,7 @@ namespace Robust.Server.Console.Commands } } - internal class GcModeCommand : IConsoleCommand + internal sealed class GcModeCommand : IConsoleCommand { public string Command => "gc_mode"; @@ -186,7 +186,7 @@ namespace Robust.Server.Console.Commands } - internal class SerializeStatsCommand : IConsoleCommand + internal sealed class SerializeStatsCommand : IConsoleCommand { public string Command => "szr_stats"; diff --git a/Robust.Server/Console/Commands/TestbedCommand.cs b/Robust.Server/Console/Commands/TestbedCommand.cs index affadbf6b..b5a0e074b 100644 --- a/Robust.Server/Console/Commands/TestbedCommand.cs +++ b/Robust.Server/Console/Commands/TestbedCommand.cs @@ -44,7 +44,7 @@ namespace Robust.Server.Console.Commands /// /// Copies of Box2D's physics testbed for debugging. /// - public class TestbedCommand : IConsoleCommand + public sealed class TestbedCommand : IConsoleCommand { public string Command => "testbed"; public string Description => "Loads a physics testbed on the specified map."; diff --git a/Robust.Server/Console/ServerConsoleHost.cs b/Robust.Server/Console/ServerConsoleHost.cs index 68388179e..78bf5a502 100644 --- a/Robust.Server/Console/ServerConsoleHost.cs +++ b/Robust.Server/Console/ServerConsoleHost.cs @@ -12,7 +12,7 @@ using Robust.Shared.Utility; namespace Robust.Server.Console { /// - internal class ServerConsoleHost : ConsoleHost, IServerConsoleHost + internal sealed class ServerConsoleHost : ConsoleHost, IServerConsoleHost { [Dependency] private readonly IConGroupController _groupController = default!; [Dependency] private readonly IPlayerManager _players = default!; diff --git a/Robust.Server/Containers/ContainerSystem.cs b/Robust.Server/Containers/ContainerSystem.cs index 64b6318b9..4f853718d 100644 --- a/Robust.Server/Containers/ContainerSystem.cs +++ b/Robust.Server/Containers/ContainerSystem.cs @@ -2,7 +2,7 @@ using Robust.Shared.Containers; namespace Robust.Server.Containers { - public class ContainerSystem : SharedContainerSystem + public sealed class ContainerSystem : SharedContainerSystem { // Seems like shared EntitySystems aren't registered, so this is here to register it on the server. // Registering the SharedContainerSystem causes conflicts on client where two entity systems are registered. diff --git a/Robust.Server/Debugging/DebugDrawingManager.cs b/Robust.Server/Debugging/DebugDrawingManager.cs index b86250729..ab9ee504a 100644 --- a/Robust.Server/Debugging/DebugDrawingManager.cs +++ b/Robust.Server/Debugging/DebugDrawingManager.cs @@ -7,7 +7,7 @@ using Robust.Shared.Physics; namespace Robust.Server.Debugging { [UsedImplicitly] - internal class DebugDrawingManager : IDebugDrawingManager, IEntityEventSubscriber + internal sealed class DebugDrawingManager : IDebugDrawingManager, IEntityEventSubscriber { [Dependency] private readonly IEntityManager _entManager = default!; diff --git a/Robust.Server/GameObjects/Components/Actor/ActorComponent.cs b/Robust.Server/GameObjects/Components/Actor/ActorComponent.cs index 9a6af57cd..652cfd460 100644 --- a/Robust.Server/GameObjects/Components/Actor/ActorComponent.cs +++ b/Robust.Server/GameObjects/Components/Actor/ActorComponent.cs @@ -4,7 +4,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Server.GameObjects { - public class ActorComponent : Component + public sealed class ActorComponent : Component { [ViewVariables] public IPlayerSession PlayerSession { get; internal set; } = default!; diff --git a/Robust.Server/GameObjects/Components/Eye/EyeComponent.cs b/Robust.Server/GameObjects/Components/Eye/EyeComponent.cs index 041ee1b2f..6f67756b4 100644 --- a/Robust.Server/GameObjects/Components/Eye/EyeComponent.cs +++ b/Robust.Server/GameObjects/Components/Eye/EyeComponent.cs @@ -10,7 +10,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Server.GameObjects { [ComponentReference(typeof(SharedEyeComponent))] - public class EyeComponent : SharedEyeComponent + public sealed class EyeComponent : SharedEyeComponent { public const int DefaultVisibilityMask = 1; diff --git a/Robust.Server/GameObjects/Components/Eye/ViewSubscriberComponent.cs b/Robust.Server/GameObjects/Components/Eye/ViewSubscriberComponent.cs index 2c6ca1a7a..532e3b4de 100644 --- a/Robust.Server/GameObjects/Components/Eye/ViewSubscriberComponent.cs +++ b/Robust.Server/GameObjects/Components/Eye/ViewSubscriberComponent.cs @@ -5,7 +5,7 @@ using Robust.Shared.GameObjects; namespace Robust.Server.GameObjects { [RegisterComponent] - internal class ViewSubscriberComponent : Component + internal sealed class ViewSubscriberComponent : Component { internal readonly HashSet SubscribedSessions = new(); } diff --git a/Robust.Server/GameObjects/Components/Light/PointLightComponent.cs b/Robust.Server/GameObjects/Components/Light/PointLightComponent.cs index 12d8b2a20..6e6094706 100644 --- a/Robust.Server/GameObjects/Components/Light/PointLightComponent.cs +++ b/Robust.Server/GameObjects/Components/Light/PointLightComponent.cs @@ -4,5 +4,5 @@ namespace Robust.Server.GameObjects { [RegisterComponent] [ComponentReference(typeof(SharedPointLightComponent))] - public class PointLightComponent : SharedPointLightComponent {} + public sealed class PointLightComponent : SharedPointLightComponent {} } diff --git a/Robust.Server/GameObjects/Components/Renderable/SpriteComponent.cs b/Robust.Server/GameObjects/Components/Renderable/SpriteComponent.cs index 5fe139eff..83f6142e2 100644 --- a/Robust.Server/GameObjects/Components/Renderable/SpriteComponent.cs +++ b/Robust.Server/GameObjects/Components/Renderable/SpriteComponent.cs @@ -13,7 +13,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Server.GameObjects { [ComponentReference(typeof(SharedSpriteComponent))] - public class SpriteComponent : SharedSpriteComponent, ISerializationHooks + public sealed class SpriteComponent : SharedSpriteComponent, ISerializationHooks { const string LayerSerializationCache = "spritelayersrv"; diff --git a/Robust.Server/GameObjects/Components/UserInterface/ServerUserInterfaceComponent.cs b/Robust.Server/GameObjects/Components/UserInterface/ServerUserInterfaceComponent.cs index 359d6e7aa..c2c99b1bc 100644 --- a/Robust.Server/GameObjects/Components/UserInterface/ServerUserInterfaceComponent.cs +++ b/Robust.Server/GameObjects/Components/UserInterface/ServerUserInterfaceComponent.cs @@ -347,7 +347,7 @@ namespace Robust.Server.GameObjects } [PublicAPI] - public class ServerBoundUserInterfaceMessage + public sealed class ServerBoundUserInterfaceMessage { public BoundUserInterfaceMessage Message { get; } public IPlayerSession Session { get; } diff --git a/Robust.Server/GameObjects/Components/VisibilityComponent.cs b/Robust.Server/GameObjects/Components/VisibilityComponent.cs index df2599c1b..2838862ca 100644 --- a/Robust.Server/GameObjects/Components/VisibilityComponent.cs +++ b/Robust.Server/GameObjects/Components/VisibilityComponent.cs @@ -7,7 +7,7 @@ namespace Robust.Server.GameObjects { [RegisterComponent] [Friend(typeof(VisibilitySystem))] - public class VisibilityComponent : Component + public sealed class VisibilityComponent : Component { /// /// The visibility layer for the entity. diff --git a/Robust.Server/GameObjects/EntitySystems/AudioSystem.cs b/Robust.Server/GameObjects/EntitySystems/AudioSystem.cs index 9164ffa91..74a7df557 100644 --- a/Robust.Server/GameObjects/EntitySystems/AudioSystem.cs +++ b/Robust.Server/GameObjects/EntitySystems/AudioSystem.cs @@ -11,13 +11,13 @@ using Robust.Shared.Players; namespace Robust.Server.GameObjects { [UsedImplicitly] - public class AudioSystem : SharedAudioSystem, IAudioSystem + public sealed class AudioSystem : SharedAudioSystem, IAudioSystem { [Dependency] private readonly IEntityManager _entityManager = default!; private uint _streamIndex; - private class AudioSourceServer : IPlayingAudioStream + private sealed class AudioSourceServer : IPlayingAudioStream { private readonly uint _id; private readonly AudioSystem _audioSystem; diff --git a/Robust.Server/GameObjects/EntitySystems/EffectSystem.cs b/Robust.Server/GameObjects/EntitySystems/EffectSystem.cs index a4f9ca15b..84336face 100644 --- a/Robust.Server/GameObjects/EntitySystems/EffectSystem.cs +++ b/Robust.Server/GameObjects/EntitySystems/EffectSystem.cs @@ -12,7 +12,7 @@ namespace Robust.Server.GameObjects /// /// An entity system that displays temporary effects to the user /// - public class EffectSystem : EntitySystem + public sealed class EffectSystem : EntitySystem { [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; @@ -37,7 +37,7 @@ namespace Robust.Server.GameObjects { if (player.Status != SessionStatus.InGame || player == excludedSession) continue; - + RaiseNetworkEvent(effect, player.ConnectedClient); } } @@ -54,7 +54,7 @@ namespace Robust.Server.GameObjects /// /// Comparer that keeps the device dictionary sorted by powernet priority /// - public class EffectMessageComparer : IComparer + public sealed class EffectMessageComparer : IComparer { public int Compare(EffectSystemMessage? x, EffectSystemMessage? y) { diff --git a/Robust.Server/GameObjects/EntitySystems/InputSystem.cs b/Robust.Server/GameObjects/EntitySystems/InputSystem.cs index 8a38f0535..87b169b18 100644 --- a/Robust.Server/GameObjects/EntitySystems/InputSystem.cs +++ b/Robust.Server/GameObjects/EntitySystems/InputSystem.cs @@ -11,7 +11,7 @@ namespace Robust.Server.GameObjects /// /// Server side processing of incoming user commands. /// - public class InputSystem : SharedInputSystem + public sealed class InputSystem : SharedInputSystem { [Dependency] private readonly IPlayerManager _playerManager = default!; diff --git a/Robust.Server/GameObjects/EntitySystems/PhysicsSystem.cs b/Robust.Server/GameObjects/EntitySystems/PhysicsSystem.cs index 3884980af..4dd5805be 100644 --- a/Robust.Server/GameObjects/EntitySystems/PhysicsSystem.cs +++ b/Robust.Server/GameObjects/EntitySystems/PhysicsSystem.cs @@ -10,7 +10,7 @@ using Robust.Shared.Physics; namespace Robust.Server.GameObjects { [UsedImplicitly] - public class PhysicsSystem : SharedPhysicsSystem + public sealed class PhysicsSystem : SharedPhysicsSystem { [Dependency] private readonly IConfigurationManager _configurationManager = default!; diff --git a/Robust.Server/GameObjects/EntitySystems/UserInterfaceSystem.cs b/Robust.Server/GameObjects/EntitySystems/UserInterfaceSystem.cs index d8475795f..8feb3145a 100644 --- a/Robust.Server/GameObjects/EntitySystems/UserInterfaceSystem.cs +++ b/Robust.Server/GameObjects/EntitySystems/UserInterfaceSystem.cs @@ -13,7 +13,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Server.GameObjects { [UsedImplicitly] - public class UserInterfaceSystem : SharedUserInterfaceSystem + public sealed class UserInterfaceSystem : SharedUserInterfaceSystem { private const float MaxWindowRange = 2; private const float MaxWindowRangeSquared = MaxWindowRange * MaxWindowRange; diff --git a/Robust.Server/GameObjects/EntitySystems/ViewSubscriberSystem.cs b/Robust.Server/GameObjects/EntitySystems/ViewSubscriberSystem.cs index 71f682870..f7dcfd770 100644 --- a/Robust.Server/GameObjects/EntitySystems/ViewSubscriberSystem.cs +++ b/Robust.Server/GameObjects/EntitySystems/ViewSubscriberSystem.cs @@ -6,7 +6,7 @@ namespace Robust.Server.GameObjects /// /// Entity System that handles subscribing and unsubscribing to PVS views. /// - public class ViewSubscriberSystem : EntitySystem + public sealed class ViewSubscriberSystem : EntitySystem { public override void Initialize() { @@ -59,7 +59,7 @@ namespace Robust.Server.GameObjects /// /// Raised when a session subscribes to an entity's PVS view. /// - public class ViewSubscriberAddedEvent : EntityEventArgs + public sealed class ViewSubscriberAddedEvent : EntityEventArgs { public EntityUid View { get; } public IPlayerSession Subscriber { get; } @@ -75,7 +75,7 @@ namespace Robust.Server.GameObjects /// Raised when a session is unsubscribed from an entity's PVS view. /// Not raised when sessions are unsubscribed due to the component being removed. /// - public class ViewSubscriberRemovedEvent : EntityEventArgs + public sealed class ViewSubscriberRemovedEvent : EntityEventArgs { public EntityUid View { get; } public IPlayerSession Subscriber { get; } diff --git a/Robust.Server/GameObjects/EntitySystems/VisibilitySystem.cs b/Robust.Server/GameObjects/EntitySystems/VisibilitySystem.cs index 385bb2574..0bfdc1af4 100644 --- a/Robust.Server/GameObjects/EntitySystems/VisibilitySystem.cs +++ b/Robust.Server/GameObjects/EntitySystems/VisibilitySystem.cs @@ -2,7 +2,7 @@ using Robust.Shared.GameObjects; namespace Robust.Server.GameObjects { - public class VisibilitySystem : EntitySystem + public sealed class VisibilitySystem : EntitySystem { public override void Initialize() { diff --git a/Robust.Server/GameObjects/ServerComponentFactory.cs b/Robust.Server/GameObjects/ServerComponentFactory.cs index 8ce7f2479..20a089616 100644 --- a/Robust.Server/GameObjects/ServerComponentFactory.cs +++ b/Robust.Server/GameObjects/ServerComponentFactory.cs @@ -6,7 +6,7 @@ using Robust.Shared.Reflection; namespace Robust.Server.GameObjects { - internal class ServerComponentFactory : ComponentFactory + internal sealed class ServerComponentFactory : ComponentFactory { public ServerComponentFactory(IDynamicTypeFactoryInternal typeFactory, IReflectionManager reflectionManager, IConsoleHost conHost) : base(typeFactory, reflectionManager, conHost) diff --git a/Robust.Server/GameStates/PVSCollection.cs b/Robust.Server/GameStates/PVSCollection.cs index 4ccce5706..8cb151cbc 100644 --- a/Robust.Server/GameStates/PVSCollection.cs +++ b/Robust.Server/GameStates/PVSCollection.cs @@ -34,7 +34,7 @@ public interface IPVSCollection public void CullDeletionHistoryUntil(GameTick tick); } -public class PVSCollection : IPVSCollection where TIndex : IComparable, IEquatable +public sealed class PVSCollection : IPVSCollection where TIndex : IComparable, IEquatable { [Shared.IoC.Dependency] private readonly IEntityManager _entityManager = default!; [Shared.IoC.Dependency] private readonly IMapManager _mapManager = default!; diff --git a/Robust.Server/GameStates/PVSSystem.Dirty.cs b/Robust.Server/GameStates/PVSSystem.Dirty.cs index cde9d3430..14207cc19 100644 --- a/Robust.Server/GameStates/PVSSystem.Dirty.cs +++ b/Robust.Server/GameStates/PVSSystem.Dirty.cs @@ -12,7 +12,7 @@ namespace Robust.Server.GameStates /// /// Caching for dirty bodies /// - internal partial class PVSSystem + internal sealed partial class PVSSystem { [Dependency] private readonly IGameTiming _gameTiming = default!; diff --git a/Robust.Server/GameStates/PVSSystem.cs b/Robust.Server/GameStates/PVSSystem.cs index 48d819e09..8e3609952 100644 --- a/Robust.Server/GameStates/PVSSystem.cs +++ b/Robust.Server/GameStates/PVSSystem.cs @@ -18,7 +18,7 @@ using Robust.Shared.Utility; namespace Robust.Server.GameStates; -internal partial class PVSSystem : EntitySystem +internal sealed partial class PVSSystem : EntitySystem { [Shared.IoC.Dependency] private readonly IMapManager _mapManager = default!; [Shared.IoC.Dependency] private readonly IPlayerManager _playerManager = default!; diff --git a/Robust.Server/GameStates/ServerGameStateManager.cs b/Robust.Server/GameStates/ServerGameStateManager.cs index df1b654f9..056599d88 100644 --- a/Robust.Server/GameStates/ServerGameStateManager.cs +++ b/Robust.Server/GameStates/ServerGameStateManager.cs @@ -21,7 +21,7 @@ namespace Robust.Server.GameStates { /// [UsedImplicitly] - public class ServerGameStateManager : IServerGameStateManager, IPostInjectInit + public sealed class ServerGameStateManager : IServerGameStateManager, IPostInjectInit { // Mapping of net UID of clients -> last known acked state. private readonly Dictionary _ackedStates = new(); diff --git a/Robust.Server/Log/LokiLogHandler.cs b/Robust.Server/Log/LokiLogHandler.cs index 3d3f6e109..cdb23cdff 100644 --- a/Robust.Server/Log/LokiLogHandler.cs +++ b/Robust.Server/Log/LokiLogHandler.cs @@ -9,7 +9,7 @@ using SLogger = Serilog.Core.Logger; namespace Robust.Server.Log { - public class LokiLogHandler : ILogHandler, IDisposable + public sealed class LokiLogHandler : ILogHandler, IDisposable { private readonly SLogger _sLogger; diff --git a/Robust.Server/Maps/MapLoader.cs b/Robust.Server/Maps/MapLoader.cs index 3ddc36efa..617777207 100644 --- a/Robust.Server/Maps/MapLoader.cs +++ b/Robust.Server/Maps/MapLoader.cs @@ -34,7 +34,7 @@ namespace Robust.Server.Maps /// /// Saves and loads maps to the disk. /// - public class MapLoader : IMapLoader + public sealed class MapLoader : IMapLoader { private static readonly MapLoadOptions DefaultLoadOptions = new(); @@ -218,7 +218,7 @@ namespace Robust.Server.Maps /// /// Handles the primary bulk of state during the map serialization process. /// - private class MapContext : ISerializationContext, IEntityLoadContext, + private sealed class MapContext : ISerializationContext, IEntityLoadContext, ITypeSerializer, ITypeSerializer, ITypeReaderWriter @@ -1059,7 +1059,7 @@ namespace Robust.Server.Maps /// Does basic pre-deserialization checks on map file load. /// For example, let's not try to use maps with multiple grids as blueprints, shall we? /// - private class MapData + private sealed class MapData { public YamlStream Stream { get; } diff --git a/Robust.Server/Placement/PlacementManager.cs b/Robust.Server/Placement/PlacementManager.cs index 2cdbd7a12..fa99976fa 100644 --- a/Robust.Server/Placement/PlacementManager.cs +++ b/Robust.Server/Placement/PlacementManager.cs @@ -14,7 +14,7 @@ using Robust.Shared.Network.Messages; namespace Robust.Server.Placement { - public class PlacementManager : IPlacementManager + public sealed class PlacementManager : IPlacementManager { [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly IServerNetManager _networkManager = default!; diff --git a/Robust.Server/Player/FilterSystem.cs b/Robust.Server/Player/FilterSystem.cs index da9596149..b4f442627 100644 --- a/Robust.Server/Player/FilterSystem.cs +++ b/Robust.Server/Player/FilterSystem.cs @@ -4,7 +4,7 @@ using Robust.Shared.Player; namespace Robust.Server.Player { - internal class FilterSystem : SharedFilterSystem + internal sealed class FilterSystem : SharedFilterSystem { public override Filter FromEntities(Filter filter, params EntityUid[] entities) { diff --git a/Robust.Server/Player/PlayerData.cs b/Robust.Server/Player/PlayerData.cs index 46431c76d..160fbdda2 100644 --- a/Robust.Server/Player/PlayerData.cs +++ b/Robust.Server/Player/PlayerData.cs @@ -3,7 +3,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Server.Player { - class PlayerData : IPlayerData + sealed class PlayerData : IPlayerData { public PlayerData(NetUserId userId) { diff --git a/Robust.Server/Player/PlayerManager.cs b/Robust.Server/Player/PlayerManager.cs index 9272183d2..8e2deefe5 100644 --- a/Robust.Server/Player/PlayerManager.cs +++ b/Robust.Server/Player/PlayerManager.cs @@ -26,7 +26,7 @@ namespace Robust.Server.Player /// /// This class will manage connected player sessions. /// - public class PlayerManager : IPlayerManager + public sealed class PlayerManager : IPlayerManager { private static readonly Gauge PlayerCountMetric = Metrics .CreateGauge("robust_player_count", "Number of players on the server."); @@ -511,7 +511,7 @@ namespace Robust.Server.Player } } - public class SessionStatusEventArgs : EventArgs + public sealed class SessionStatusEventArgs : EventArgs { public SessionStatusEventArgs(IPlayerSession session, SessionStatus oldStatus, SessionStatus newStatus) { diff --git a/Robust.Server/Player/PlayerSession.cs b/Robust.Server/Player/PlayerSession.cs index 4c463c6a4..a16252a0e 100644 --- a/Robust.Server/Player/PlayerSession.cs +++ b/Robust.Server/Player/PlayerSession.cs @@ -15,7 +15,7 @@ namespace Robust.Server.Player /// /// This is the session of a connected client. /// - internal class PlayerSession : IPlayerSession + internal sealed class PlayerSession : IPlayerSession { private readonly PlayerManager _playerManager; public readonly PlayerState PlayerState; diff --git a/Robust.Server/ServerOptions.cs b/Robust.Server/ServerOptions.cs index a35964bbb..c6bc7ad92 100644 --- a/Robust.Server/ServerOptions.cs +++ b/Robust.Server/ServerOptions.cs @@ -3,7 +3,7 @@ using Robust.Shared.Utility; namespace Robust.Server { - public class ServerOptions + public sealed class ServerOptions { /// /// Whether content sandboxing will be enabled & enforced. diff --git a/Robust.Server/ServerStatus/WatchdogApi.cs b/Robust.Server/ServerStatus/WatchdogApi.cs index aca9bf356..7ea06ec59 100644 --- a/Robust.Server/ServerStatus/WatchdogApi.cs +++ b/Robust.Server/ServerStatus/WatchdogApi.cs @@ -17,7 +17,7 @@ using Robust.Shared.Timing; namespace Robust.Server.ServerStatus { - public class WatchdogApi : IWatchdogApi, IPostInjectInit + public sealed class WatchdogApi : IWatchdogApi, IPostInjectInit { [Dependency] private readonly IStatusHost _statusHost = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; diff --git a/Robust.Server/Usings.cs b/Robust.Server/Usings.cs new file mode 100644 index 000000000..daaa0a738 --- /dev/null +++ b/Robust.Server/Usings.cs @@ -0,0 +1 @@ +global using Robust.Shared.Analyzers; diff --git a/Robust.Server/ViewVariables/ViewVariablesHost.cs b/Robust.Server/ViewVariables/ViewVariablesHost.cs index b3fb40a1d..8be548129 100644 --- a/Robust.Server/ViewVariables/ViewVariablesHost.cs +++ b/Robust.Server/ViewVariables/ViewVariablesHost.cs @@ -17,7 +17,7 @@ using static Robust.Shared.Network.Messages.MsgViewVariablesDenySession; namespace Robust.Server.ViewVariables { - internal class ViewVariablesHost : ViewVariablesManagerShared, IViewVariablesHost + internal sealed class ViewVariablesHost : ViewVariablesManagerShared, IViewVariablesHost { [Dependency] private readonly INetManager _netManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; diff --git a/Robust.Shared/Analyzers/FriendAttribute.cs b/Robust.Shared/Analyzers/FriendAttribute.cs index 63a949f28..1b2c36787 100644 --- a/Robust.Shared/Analyzers/FriendAttribute.cs +++ b/Robust.Shared/Analyzers/FriendAttribute.cs @@ -3,7 +3,7 @@ using System; namespace Robust.Shared.Analyzers { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct)] - public class FriendAttribute : Attribute + public sealed class FriendAttribute : Attribute { public readonly Type[] Friends; diff --git a/Robust.Shared/Analyzers/RequiresExplicitImplementationAttribute.cs b/Robust.Shared/Analyzers/RequiresExplicitImplementationAttribute.cs index 4db6c5045..3d2e7c4ce 100644 --- a/Robust.Shared/Analyzers/RequiresExplicitImplementationAttribute.cs +++ b/Robust.Shared/Analyzers/RequiresExplicitImplementationAttribute.cs @@ -3,5 +3,5 @@ using System; namespace Robust.Shared.Analyzers { [AttributeUsage(AttributeTargets.Interface)] - public class RequiresExplicitImplementationAttribute : Attribute { } + public sealed class RequiresExplicitImplementationAttribute : Attribute { } } diff --git a/Robust.Shared/Analyzers/RequiresSerializableAttribute.cs b/Robust.Shared/Analyzers/RequiresSerializableAttribute.cs index b705dcb36..5d3df655c 100644 --- a/Robust.Shared/Analyzers/RequiresSerializableAttribute.cs +++ b/Robust.Shared/Analyzers/RequiresSerializableAttribute.cs @@ -3,5 +3,5 @@ using System; namespace Robust.Shared.Analyzers { [AttributeUsage(AttributeTargets.Class)] - public class RequiresSerializableAttribute : Attribute { } + public sealed class RequiresSerializableAttribute : Attribute { } } diff --git a/Robust.Shared/Analyzers/VirtualAttribute.cs b/Robust.Shared/Analyzers/VirtualAttribute.cs new file mode 100644 index 000000000..849c4103b --- /dev/null +++ b/Robust.Shared/Analyzers/VirtualAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace Robust.Shared.Analyzers; + +/// +/// Specify that this class is allowed to be inherited. +/// +/// +/// Robust uses analyzers to prevent accidental usage of non-sealed classes: +/// a class must be either marked [Virtual], abstract, or sealed. +/// +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +public sealed class VirtualAttribute : Attribute +{ +} diff --git a/Robust.Shared/Asynchronous/RobustSynchronizationContext.cs b/Robust.Shared/Asynchronous/RobustSynchronizationContext.cs index 5009bf408..af0ad90d1 100644 --- a/Robust.Shared/Asynchronous/RobustSynchronizationContext.cs +++ b/Robust.Shared/Asynchronous/RobustSynchronizationContext.cs @@ -5,7 +5,7 @@ using Robust.Shared.Exceptions; namespace Robust.Shared.Asynchronous { - internal class RobustSynchronizationContext : SynchronizationContext + internal sealed class RobustSynchronizationContext : SynchronizationContext { // Used only on release. // ReSharper disable once NotAccessedField.Local diff --git a/Robust.Shared/Audio/SoundSystem.cs b/Robust.Shared/Audio/SoundSystem.cs index 21656aebb..54c90ccf8 100644 --- a/Robust.Shared/Audio/SoundSystem.cs +++ b/Robust.Shared/Audio/SoundSystem.cs @@ -69,7 +69,7 @@ namespace Robust.Shared.Audio return GetAudio()?.Play(playerFilter, filename, coordinates, audioParams); } - internal class QueryAudioSystem : EntityEventArgs + internal sealed class QueryAudioSystem : EntityEventArgs { public IAudioSystem? Audio { get; set; } } diff --git a/Robust.Shared/Configuration/ConfigurationManager.cs b/Robust.Shared/Configuration/ConfigurationManager.cs index dc15f6e91..6361c91bc 100644 --- a/Robust.Shared/Configuration/ConfigurationManager.cs +++ b/Robust.Shared/Configuration/ConfigurationManager.cs @@ -13,6 +13,7 @@ namespace Robust.Shared.Configuration /// /// Stores and manages global configuration variables. /// + [Virtual] internal class ConfigurationManager : IConfigurationManagerInternal { private const char TABLE_DELIMITER = '.'; @@ -468,7 +469,7 @@ namespace Robust.Shared.Configuration /// /// Holds the data for a single configuration variable. /// - protected class ConfigVar + protected sealed class ConfigVar { /// /// Constructs a CVar. @@ -532,6 +533,7 @@ namespace Robust.Shared.Configuration } [Serializable] + [Virtual] public class InvalidConfigurationException : Exception { public InvalidConfigurationException() diff --git a/Robust.Shared/Configuration/NetConfigurationManager.cs b/Robust.Shared/Configuration/NetConfigurationManager.cs index 138badf9e..38ffb3505 100644 --- a/Robust.Shared/Configuration/NetConfigurationManager.cs +++ b/Robust.Shared/Configuration/NetConfigurationManager.cs @@ -62,7 +62,7 @@ namespace Robust.Shared.Configuration } /// - internal class NetConfigurationManager : ConfigurationManager, INetConfigurationManager + internal sealed class NetConfigurationManager : ConfigurationManager, INetConfigurationManager { [Dependency] private readonly INetManager _netManager = null!; [Dependency] private readonly IGameTiming _timing = null!; diff --git a/Robust.Shared/Console/ConsoleHost.cs b/Robust.Shared/Console/ConsoleHost.cs index d0206b223..a62d29f89 100644 --- a/Robust.Shared/Console/ConsoleHost.cs +++ b/Robust.Shared/Console/ConsoleHost.cs @@ -120,7 +120,7 @@ namespace Robust.Shared.Console /// A console command that was registered inline through . /// [Reflect(false)] - public class RegisteredCommand : IConsoleCommand + public sealed class RegisteredCommand : IConsoleCommand { public ConCommandCallback Callback { get; } diff --git a/Robust.Shared/Console/ConsoleShell.cs b/Robust.Shared/Console/ConsoleShell.cs index f69df2fc1..76392fe6c 100644 --- a/Robust.Shared/Console/ConsoleShell.cs +++ b/Robust.Shared/Console/ConsoleShell.cs @@ -3,7 +3,7 @@ using Robust.Shared.Players; namespace Robust.Shared.Console { /// - public class ConsoleShell : IConsoleShell + public sealed class ConsoleShell : IConsoleShell { /// /// Constructs a new instance of . diff --git a/Robust.Shared/Containers/ContainerManagerComponent.cs b/Robust.Shared/Containers/ContainerManagerComponent.cs index 01be1d5a8..7c61e7b48 100644 --- a/Robust.Shared/Containers/ContainerManagerComponent.cs +++ b/Robust.Shared/Containers/ContainerManagerComponent.cs @@ -19,7 +19,7 @@ namespace Robust.Shared.Containers [ComponentReference(typeof(IContainerManager))] [NetworkedComponent] [ComponentProtoName("ContainerContainer")] - public class ContainerManagerComponent : Component, IContainerManager, ISerializationHooks + public sealed class ContainerManagerComponent : Component, IContainerManager, ISerializationHooks { [Dependency] private readonly IDynamicTypeFactoryInternal _dynFactory = default!; @@ -201,7 +201,7 @@ namespace Robust.Shared.Containers } [Serializable, NetSerializable] - internal class ContainerManagerComponentState : ComponentState + internal sealed class ContainerManagerComponentState : ComponentState { public List ContainerSet; diff --git a/Robust.Shared/Containers/ContainerSlot.cs b/Robust.Shared/Containers/ContainerSlot.cs index de69c6ec2..3d84c66fd 100644 --- a/Robust.Shared/Containers/ContainerSlot.cs +++ b/Robust.Shared/Containers/ContainerSlot.cs @@ -11,7 +11,7 @@ namespace Robust.Shared.Containers { [UsedImplicitly] [SerializedType(ClassName)] - public class ContainerSlot : BaseContainer + public sealed class ContainerSlot : BaseContainer { private const string ClassName = "ContainerSlot"; diff --git a/Robust.Shared/Containers/Events/ContainerAttemptEvents.cs b/Robust.Shared/Containers/Events/ContainerAttemptEvents.cs index 384d39ff3..aa6107702 100644 --- a/Robust.Shared/Containers/Events/ContainerAttemptEvents.cs +++ b/Robust.Shared/Containers/Events/ContainerAttemptEvents.cs @@ -4,7 +4,7 @@ using Robust.Shared.GameObjects; namespace Robust.Shared.Containers; -public class ContainerAttemptEventBase : CancellableEntityEventArgs +public abstract class ContainerAttemptEventBase : CancellableEntityEventArgs { public readonly IContainer Container; public readonly EntityUid EntityUid; @@ -16,28 +16,28 @@ public class ContainerAttemptEventBase : CancellableEntityEventArgs } } -public class ContainerIsInsertingAttemptEvent : ContainerAttemptEventBase +public sealed class ContainerIsInsertingAttemptEvent : ContainerAttemptEventBase { public ContainerIsInsertingAttemptEvent(IContainer container, EntityUid entityUid) : base(container, entityUid) { } } -public class ContainerGettingInsertedAttemptEvent : ContainerAttemptEventBase +public sealed class ContainerGettingInsertedAttemptEvent : ContainerAttemptEventBase { public ContainerGettingInsertedAttemptEvent(IContainer container, EntityUid entityUid) : base(container, entityUid) { } } -public class ContainerIsRemovingAttemptEvent : ContainerAttemptEventBase +public sealed class ContainerIsRemovingAttemptEvent : ContainerAttemptEventBase { public ContainerIsRemovingAttemptEvent(IContainer container, EntityUid entityUid) : base(container, entityUid) { } } -public class ContainerGettingRemovedAttemptEvent : ContainerAttemptEventBase +public sealed class ContainerGettingRemovedAttemptEvent : ContainerAttemptEventBase { public ContainerGettingRemovedAttemptEvent(IContainer container, EntityUid entityUid) : base(container, entityUid) { diff --git a/Robust.Shared/ContentPack/DirLoader.cs b/Robust.Shared/ContentPack/DirLoader.cs index 74a295116..1cb8dc2e0 100644 --- a/Robust.Shared/ContentPack/DirLoader.cs +++ b/Robust.Shared/ContentPack/DirLoader.cs @@ -9,12 +9,13 @@ using Robust.Shared.Utility; namespace Robust.Shared.ContentPack { + [Virtual] internal partial class ResourceManager { /// /// Holds info about a directory that is mounted in the VFS. /// - class DirLoader : IContentRoot + sealed class DirLoader : IContentRoot { private readonly DirectoryInfo _directory; private readonly ISawmill _sawmill; diff --git a/Robust.Shared/ContentPack/PackLoader.cs b/Robust.Shared/ContentPack/PackLoader.cs index c52db5f20..07eaad476 100644 --- a/Robust.Shared/ContentPack/PackLoader.cs +++ b/Robust.Shared/ContentPack/PackLoader.cs @@ -12,7 +12,7 @@ namespace Robust.Shared.ContentPack /// /// Loads a zipped content pack into the VFS. /// - class PackLoader : IContentRoot + sealed class PackLoader : IContentRoot { private readonly FileInfo? _pack; private readonly Stream? _stream; diff --git a/Robust.Shared/ContentPack/ResourceManager.SingleStreamLoader.cs b/Robust.Shared/ContentPack/ResourceManager.SingleStreamLoader.cs index 004133255..b0ec6a7af 100644 --- a/Robust.Shared/ContentPack/ResourceManager.SingleStreamLoader.cs +++ b/Robust.Shared/ContentPack/ResourceManager.SingleStreamLoader.cs @@ -7,7 +7,7 @@ namespace Robust.Shared.ContentPack { internal partial class ResourceManager { - private class SingleStreamLoader : IContentRoot + private sealed class SingleStreamLoader : IContentRoot { private readonly MemoryStream _stream; private readonly ResourcePath _resourcePath; diff --git a/Robust.Shared/ContentPack/TypeCheckFailedException.cs b/Robust.Shared/ContentPack/TypeCheckFailedException.cs index ac709a143..64af4f84f 100644 --- a/Robust.Shared/ContentPack/TypeCheckFailedException.cs +++ b/Robust.Shared/ContentPack/TypeCheckFailedException.cs @@ -4,6 +4,7 @@ using System.Runtime.Serialization; namespace Robust.Shared.ContentPack { [Serializable] + [Virtual] public class TypeCheckFailedException : Exception { public TypeCheckFailedException() diff --git a/Robust.Shared/ContentPack/WritableDirProvider.cs b/Robust.Shared/ContentPack/WritableDirProvider.cs index 463bf716d..cd1e4669c 100644 --- a/Robust.Shared/ContentPack/WritableDirProvider.cs +++ b/Robust.Shared/ContentPack/WritableDirProvider.cs @@ -6,7 +6,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.ContentPack { /// - internal class WritableDirProvider : IWritableDirProvider + internal sealed class WritableDirProvider : IWritableDirProvider { /// public string RootDir { get; } diff --git a/Robust.Shared/Enums/PlacementInformation.cs b/Robust.Shared/Enums/PlacementInformation.cs index 5d51a70b6..b288c14cc 100644 --- a/Robust.Shared/Enums/PlacementInformation.cs +++ b/Robust.Shared/Enums/PlacementInformation.cs @@ -2,7 +2,7 @@ namespace Robust.Shared.Enums { - public class PlacementInformation + public sealed class PlacementInformation { public string? EntityType { get; set; } public bool IsTile { get; set; } diff --git a/Robust.Shared/ErrorMessages.cs b/Robust.Shared/ErrorMessages.cs index 23766b659..4b96954a6 100644 --- a/Robust.Shared/ErrorMessages.cs +++ b/Robust.Shared/ErrorMessages.cs @@ -1,6 +1,6 @@ namespace Robust.Shared { - public class ErrorMessages + public static class ErrorMessages { public const string InvalidStringFormat = "Invalid string format. Expected a string in the format \"{0}\"."; diff --git a/Robust.Shared/Exceptions/RuntimeLog.cs b/Robust.Shared/Exceptions/RuntimeLog.cs index 4d6a81a20..172c3b45b 100644 --- a/Robust.Shared/Exceptions/RuntimeLog.cs +++ b/Robust.Shared/Exceptions/RuntimeLog.cs @@ -64,7 +64,7 @@ namespace Robust.Shared.Exceptions return ret.ToString(); } - private class LoggedException + private sealed class LoggedException { public Exception Exception { get; } public DateTime Time { get; } diff --git a/Robust.Shared/GameObjects/ByRefEventAttribute.cs b/Robust.Shared/GameObjects/ByRefEventAttribute.cs index d85d40b7f..cea99ee25 100644 --- a/Robust.Shared/GameObjects/ByRefEventAttribute.cs +++ b/Robust.Shared/GameObjects/ByRefEventAttribute.cs @@ -3,6 +3,6 @@ using System; namespace Robust.Shared.GameObjects; [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] -public class ByRefEventAttribute : Attribute +public sealed class ByRefEventAttribute : Attribute { } diff --git a/Robust.Shared/GameObjects/Component.cs b/Robust.Shared/GameObjects/Component.cs index 93747bf27..0bf96584d 100644 --- a/Robust.Shared/GameObjects/Component.cs +++ b/Robust.Shared/GameObjects/Component.cs @@ -348,29 +348,29 @@ namespace Robust.Shared.GameObjects /// The component has been added to the entity. This is the first function /// to be called after the component has been allocated and (optionally) deserialized. /// - public class ComponentAdd : EntityEventArgs { } + public sealed class ComponentAdd : EntityEventArgs { } /// /// Raised when all of the entity's other components have been added and are available, /// But are not necessarily initialized yet. DO NOT depend on the values of other components to be correct. /// - public class ComponentInit : EntityEventArgs { } + public sealed class ComponentInit : EntityEventArgs { } /// /// Starts up a component. This is called automatically after all components are Initialized and the entity is Initialized. /// This can be called multiple times during the component's life, and at any time. /// - public class ComponentStartup : EntityEventArgs { } + public sealed class ComponentStartup : EntityEventArgs { } /// /// Shuts down the component. The is called Automatically by OnRemove. This can be called multiple times during /// the component's life, and at any time. /// - public class ComponentShutdown : EntityEventArgs { } + public sealed class ComponentShutdown : EntityEventArgs { } /// /// The component has been removed from the entity. This is the last function /// that is called before the component is freed. /// - public class ComponentRemove : EntityEventArgs { } + public sealed class ComponentRemove : EntityEventArgs { } } diff --git a/Robust.Shared/GameObjects/ComponentFactory.cs b/Robust.Shared/GameObjects/ComponentFactory.cs index 0ca00d4c1..75296567f 100644 --- a/Robust.Shared/GameObjects/ComponentFactory.cs +++ b/Robust.Shared/GameObjects/ComponentFactory.cs @@ -13,12 +13,13 @@ using Robust.Shared.Utility; namespace Robust.Shared.GameObjects { + [Virtual] internal class ComponentFactory : IComponentFactory { private readonly IDynamicTypeFactoryInternal _typeFactory; private readonly IReflectionManager _reflectionManager; - private class ComponentRegistration : IComponentRegistration + private sealed class ComponentRegistration : IComponentRegistration { public string Name { get; } public ushort? NetID { get; set; } @@ -496,6 +497,7 @@ namespace Robust.Shared.GameObjects } [Serializable] + [Virtual] public class UnknownComponentException : Exception { public UnknownComponentException() @@ -512,7 +514,9 @@ namespace Robust.Shared.GameObjects StreamingContext context) : base(info, context) { } } + [Virtual] public class ComponentRegistrationLockException : Exception { } + [Virtual] public class InvalidComponentNameException : Exception { public InvalidComponentNameException(string message) : base(message) { } } } diff --git a/Robust.Shared/GameObjects/ComponentProtoNameAttribute.cs b/Robust.Shared/GameObjects/ComponentProtoNameAttribute.cs index f99dbdc00..e1fa90d39 100644 --- a/Robust.Shared/GameObjects/ComponentProtoNameAttribute.cs +++ b/Robust.Shared/GameObjects/ComponentProtoNameAttribute.cs @@ -6,7 +6,7 @@ namespace Robust.Shared.GameObjects /// Defines Name that this component is represented with in prototypes. /// [AttributeUsage(AttributeTargets.Class)] - public class ComponentProtoNameAttribute : Attribute + public sealed class ComponentProtoNameAttribute : Attribute { public string PrototypeName { get; } diff --git a/Robust.Shared/GameObjects/ComponentState.cs b/Robust.Shared/GameObjects/ComponentState.cs index 158e692c5..91ea39dd3 100644 --- a/Robust.Shared/GameObjects/ComponentState.cs +++ b/Robust.Shared/GameObjects/ComponentState.cs @@ -6,5 +6,6 @@ namespace Robust.Shared.GameObjects { [RequiresSerializable] [Serializable, NetSerializable] + [Virtual] public class ComponentState { } } diff --git a/Robust.Shared/GameObjects/Components/Appearance/AppearanceComponent.cs b/Robust.Shared/GameObjects/Components/Appearance/AppearanceComponent.cs index ccfa458c0..5450d6d59 100644 --- a/Robust.Shared/GameObjects/Components/Appearance/AppearanceComponent.cs +++ b/Robust.Shared/GameObjects/Components/Appearance/AppearanceComponent.cs @@ -110,7 +110,7 @@ public abstract class AppearanceComponent : Component } [Serializable, NetSerializable] - protected class AppearanceComponentState : ComponentState + protected sealed class AppearanceComponentState : ComponentState { public readonly Dictionary Data; diff --git a/Robust.Shared/GameObjects/Components/ClickableComponentState.cs b/Robust.Shared/GameObjects/Components/ClickableComponentState.cs index fa56cbbaf..8b1fccc74 100644 --- a/Robust.Shared/GameObjects/Components/ClickableComponentState.cs +++ b/Robust.Shared/GameObjects/Components/ClickableComponentState.cs @@ -5,7 +5,7 @@ using Robust.Shared.Serialization; namespace Robust.Shared.GameObjects { [Serializable, NetSerializable] - class ClickableComponentState : ComponentState + sealed class ClickableComponentState : ComponentState { public Box2? LocalBounds { get; } diff --git a/Robust.Shared/GameObjects/Components/Collidable/CollisionChangeMessage.cs b/Robust.Shared/GameObjects/Components/Collidable/CollisionChangeMessage.cs index a7e044255..c2f41a6e3 100644 --- a/Robust.Shared/GameObjects/Components/Collidable/CollisionChangeMessage.cs +++ b/Robust.Shared/GameObjects/Components/Collidable/CollisionChangeMessage.cs @@ -1,6 +1,6 @@ namespace Robust.Shared.GameObjects { - public class CollisionChangeMessage : EntityEventArgs + public sealed class CollisionChangeMessage : EntityEventArgs { public PhysicsComponent Body { get; } diff --git a/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponent.Physics.cs b/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponent.Physics.cs index d55b125cc..b6ea80cf7 100644 --- a/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponent.Physics.cs +++ b/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponent.Physics.cs @@ -984,7 +984,7 @@ namespace Robust.Shared.GameObjects /// /// Directed event raised when an entity's physics BodyType changes. /// - public class PhysicsBodyTypeChangedEvent : EntityEventArgs + public sealed class PhysicsBodyTypeChangedEvent : EntityEventArgs { /// /// New BodyType of the entity. diff --git a/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponentState.cs b/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponentState.cs index 5a68004ad..4c7e3da37 100644 --- a/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponentState.cs +++ b/Robust.Shared/GameObjects/Components/Collidable/PhysicsComponentState.cs @@ -9,7 +9,7 @@ using Robust.Shared.Serialization; namespace Robust.Shared.GameObjects { [Serializable, NetSerializable] - public class PhysicsComponentState : ComponentState + public sealed class PhysicsComponentState : ComponentState { public readonly bool CanCollide; public readonly bool SleepingAllowed; diff --git a/Robust.Shared/GameObjects/Components/CollisionWakeComponent.cs b/Robust.Shared/GameObjects/Components/CollisionWakeComponent.cs index ca13aae83..4e9918b8e 100644 --- a/Robust.Shared/GameObjects/Components/CollisionWakeComponent.cs +++ b/Robust.Shared/GameObjects/Components/CollisionWakeComponent.cs @@ -50,7 +50,7 @@ namespace Robust.Shared.GameObjects } [Serializable, NetSerializable] - public class CollisionWakeState : ComponentState + public sealed class CollisionWakeState : ComponentState { public bool Enabled { get; } diff --git a/Robust.Shared/GameObjects/Components/Eye/SharedEyeComponent.cs b/Robust.Shared/GameObjects/Components/Eye/SharedEyeComponent.cs index a16296290..bcbf99ce5 100644 --- a/Robust.Shared/GameObjects/Components/Eye/SharedEyeComponent.cs +++ b/Robust.Shared/GameObjects/Components/Eye/SharedEyeComponent.cs @@ -7,7 +7,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Shared.GameObjects { [NetworkedComponent()] - public class SharedEyeComponent : Component + public abstract class SharedEyeComponent : Component { [ViewVariables(VVAccess.ReadWrite)] public virtual bool DrawFov { get; set; } @@ -20,7 +20,7 @@ namespace Robust.Shared.GameObjects [ViewVariables(VVAccess.ReadWrite)] public virtual Angle Rotation { get; set; } - + /// /// The visibility mask for this eye. /// The player will be able to get updates for entities whose layers match the mask. @@ -30,7 +30,7 @@ namespace Robust.Shared.GameObjects } [NetSerializable, Serializable] - public class EyeComponentState : ComponentState + public sealed class EyeComponentState : ComponentState { public bool DrawFov { get; } public Vector2 Zoom { get; } diff --git a/Robust.Shared/GameObjects/Components/IgnorePauseComponent.cs b/Robust.Shared/GameObjects/Components/IgnorePauseComponent.cs index f21d935c8..f1f2ffc24 100644 --- a/Robust.Shared/GameObjects/Components/IgnorePauseComponent.cs +++ b/Robust.Shared/GameObjects/Components/IgnorePauseComponent.cs @@ -4,7 +4,7 @@ using Robust.Shared.Timing; namespace Robust.Shared.GameObjects { [RegisterComponent] - public class IgnorePauseComponent : Component + public sealed class IgnorePauseComponent : Component { [Dependency] private readonly IEntityManager _entMan = default!; diff --git a/Robust.Shared/GameObjects/Components/Light/OccluderComponent.cs b/Robust.Shared/GameObjects/Components/Light/OccluderComponent.cs index 0661c7c14..447b0de61 100644 --- a/Robust.Shared/GameObjects/Components/Light/OccluderComponent.cs +++ b/Robust.Shared/GameObjects/Components/Light/OccluderComponent.cs @@ -10,6 +10,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Shared.GameObjects { [NetworkedComponent()] + [Virtual] public class OccluderComponent : Component { [Dependency] private readonly IEntityManager _entMan = default!; diff --git a/Robust.Shared/GameObjects/Components/Localization/GrammarComponent.cs b/Robust.Shared/GameObjects/Components/Localization/GrammarComponent.cs index 3bfa8069f..e4deafa83 100644 --- a/Robust.Shared/GameObjects/Components/Localization/GrammarComponent.cs +++ b/Robust.Shared/GameObjects/Components/Localization/GrammarComponent.cs @@ -12,7 +12,7 @@ namespace Robust.Shared.GameObjects.Components.Localization /// [RegisterComponent] [NetworkedComponent()] - public class GrammarComponent : Component + public sealed class GrammarComponent : Component { [ViewVariables] [DataField("attributes")] diff --git a/Robust.Shared/GameObjects/Components/Map/MapComponent.cs b/Robust.Shared/GameObjects/Components/Map/MapComponent.cs index 66ccef63f..3ff390f9d 100644 --- a/Robust.Shared/GameObjects/Components/Map/MapComponent.cs +++ b/Robust.Shared/GameObjects/Components/Map/MapComponent.cs @@ -21,7 +21,7 @@ namespace Robust.Shared.GameObjects /// [ComponentReference(typeof(IMapComponent))] [NetworkedComponent()] - public class MapComponent : Component, IMapComponent + public sealed class MapComponent : Component, IMapComponent { [Dependency] private readonly IEntityManager _entMan = default!; @@ -71,7 +71,7 @@ namespace Robust.Shared.GameObjects /// Serialized state of a . /// [Serializable, NetSerializable] - internal class MapComponentState : ComponentState + internal sealed class MapComponentState : ComponentState { public MapId MapId { get; } public bool LightingEnabled { get; } diff --git a/Robust.Shared/GameObjects/Components/Map/MapGridComponent.cs b/Robust.Shared/GameObjects/Components/Map/MapGridComponent.cs index da0c73381..ea574dae6 100644 --- a/Robust.Shared/GameObjects/Components/Map/MapGridComponent.cs +++ b/Robust.Shared/GameObjects/Components/Map/MapGridComponent.cs @@ -24,7 +24,7 @@ namespace Robust.Shared.GameObjects /// [ComponentReference(typeof(IMapGridComponent))] [NetworkedComponent] - internal class MapGridComponent : Component, IMapGridComponent + internal sealed class MapGridComponent : Component, IMapGridComponent { [Dependency] private readonly IMapManagerInternal _mapManager = default!; [Dependency] private readonly IEntityManager _entMan = default!; @@ -134,7 +134,7 @@ namespace Robust.Shared.GameObjects /// Serialized state of a . /// [Serializable, NetSerializable] - internal class MapGridComponentState : ComponentState + internal sealed class MapGridComponentState : ComponentState { /// /// Index of the grid this component is linked to. diff --git a/Robust.Shared/GameObjects/Components/MetaDataComponent.cs b/Robust.Shared/GameObjects/Components/MetaDataComponent.cs index 37114d999..09a213bc2 100644 --- a/Robust.Shared/GameObjects/Components/MetaDataComponent.cs +++ b/Robust.Shared/GameObjects/Components/MetaDataComponent.cs @@ -14,7 +14,7 @@ namespace Robust.Shared.GameObjects /// Serialized state of a . /// [Serializable, NetSerializable] - public class MetaDataComponentState : ComponentState + public sealed class MetaDataComponentState : ComponentState { /// /// The in-game name of this entity. @@ -48,7 +48,7 @@ namespace Robust.Shared.GameObjects /// Contains meta data about this entity that isn't component specific. /// [NetworkedComponent] - public class MetaDataComponent : Component + public sealed class MetaDataComponent : Component { [DataField("name")] private string? _entityName; diff --git a/Robust.Shared/GameObjects/Components/Renderable/SharedSpriteComponent.cs b/Robust.Shared/GameObjects/Components/Renderable/SharedSpriteComponent.cs index 6b2820fb8..6806d398a 100644 --- a/Robust.Shared/GameObjects/Components/Renderable/SharedSpriteComponent.cs +++ b/Robust.Shared/GameObjects/Components/Renderable/SharedSpriteComponent.cs @@ -19,7 +19,7 @@ namespace Robust.Shared.GameObjects public static readonly ResourcePath TextureRoot = new("/Textures"); [Serializable, NetSerializable] - protected class SpriteComponentState : ComponentState + protected sealed class SpriteComponentState : ComponentState { public readonly bool Visible; public readonly int DrawDepth; @@ -56,7 +56,7 @@ namespace Robust.Shared.GameObjects [Serializable, NetSerializable] [DataDefinition] - public class PrototypeLayerData + public sealed class PrototypeLayerData { [DataField("shader")] public string? Shader; diff --git a/Robust.Shared/GameObjects/Components/Timers/TimerComponent.cs b/Robust.Shared/GameObjects/Components/Timers/TimerComponent.cs index 4198dbb9a..b347944e9 100644 --- a/Robust.Shared/GameObjects/Components/Timers/TimerComponent.cs +++ b/Robust.Shared/GameObjects/Components/Timers/TimerComponent.cs @@ -9,7 +9,7 @@ using Timer = Robust.Shared.Timing.Timer; namespace Robust.Shared.GameObjects { - public class TimerComponent : Component + public sealed class TimerComponent : Component { [Dependency] private readonly IRuntimeLog _runtimeLog = default!; diff --git a/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs b/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs index ab698d341..cb4cfbb1c 100644 --- a/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs +++ b/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs @@ -1048,7 +1048,7 @@ namespace Robust.Shared.GameObjects /// Serialized state of a TransformComponent. /// [Serializable, NetSerializable] - internal class TransformComponentState : ComponentState + internal sealed class TransformComponentState : ComponentState { /// /// Current parent entity of this entity. diff --git a/Robust.Shared/GameObjects/Components/UserInterface/SharedUserInterfaceComponent.cs b/Robust.Shared/GameObjects/Components/UserInterface/SharedUserInterfaceComponent.cs index cb5895010..0da4719a8 100644 --- a/Robust.Shared/GameObjects/Components/UserInterface/SharedUserInterfaceComponent.cs +++ b/Robust.Shared/GameObjects/Components/UserInterface/SharedUserInterfaceComponent.cs @@ -52,7 +52,7 @@ namespace Robust.Shared.GameObjects /// Raised whenever the server receives a BUI message from a client relating to a UI that requires input /// validation. /// - public class BoundUserInterfaceMessageAttempt : CancellableEntityEventArgs + public sealed class BoundUserInterfaceMessageAttempt : CancellableEntityEventArgs { public readonly ICommonSession Sender; public readonly EntityUid Target; @@ -73,7 +73,7 @@ namespace Robust.Shared.GameObjects [NetSerializable, Serializable] - public class BoundUserInterfaceMessage : EntityEventArgs + public abstract class BoundUserInterfaceMessage : EntityEventArgs { /// /// The UI of this message. @@ -135,7 +135,7 @@ namespace Robust.Shared.GameObjects } } - public class BoundUIClosedEvent : BoundUserInterfaceMessage + public sealed class BoundUIClosedEvent : BoundUserInterfaceMessage { public BoundUIClosedEvent(object uiKey, EntityUid uid, ICommonSession session) { diff --git a/Robust.Shared/GameObjects/EntityCreationException.cs b/Robust.Shared/GameObjects/EntityCreationException.cs index b48ca58ff..fba61e08a 100644 --- a/Robust.Shared/GameObjects/EntityCreationException.cs +++ b/Robust.Shared/GameObjects/EntityCreationException.cs @@ -10,6 +10,7 @@ namespace Robust.Shared.GameObjects /// See the for the actual exception. /// [Serializable] + [Virtual] public class EntityCreationException : Exception { public EntityCreationException() diff --git a/Robust.Shared/GameObjects/EntityEventBus.Broadcast.cs b/Robust.Shared/GameObjects/EntityEventBus.Broadcast.cs index 253ce832c..c6683a0ae 100644 --- a/Robust.Shared/GameObjects/EntityEventBus.Broadcast.cs +++ b/Robust.Shared/GameObjects/EntityEventBus.Broadcast.cs @@ -120,7 +120,7 @@ namespace Robust.Shared.GameObjects /// /// Implements the event broadcast functions. /// - internal partial class EntityEventBus : IBroadcastEventBusInternal + internal sealed partial class EntityEventBus : IBroadcastEventBusInternal { // Inside this class we pass a lot of things around as "ref Unit unitRef". // The idea behind this is to avoid using type arguments in core dispatch that only needs to pass around a ref* @@ -469,7 +469,7 @@ namespace Robust.Shared.GameObjects } [StructLayout(LayoutKind.Sequential)] - private class UnitBox + private sealed class UnitBox { [UsedImplicitly] public Unit Value; } diff --git a/Robust.Shared/GameObjects/EntityEventBus.Directed.cs b/Robust.Shared/GameObjects/EntityEventBus.Directed.cs index adabe619e..6c51a7093 100644 --- a/Robust.Shared/GameObjects/EntityEventBus.Directed.cs +++ b/Robust.Shared/GameObjects/EntityEventBus.Directed.cs @@ -222,7 +222,7 @@ namespace Robust.Shared.GameObjects _eventTables.Unsubscribe(typeof(TComp), typeof(TEvent)); } - private class EventTables : IDisposable + private sealed class EventTables : IDisposable { private const string ValueDispatchError = "Tried to dispatch a value event to a by-reference subscription."; private const string RefDispatchError = "Tried to dispatch a ref event to a by-value subscription."; diff --git a/Robust.Shared/GameObjects/EntityManager.cs b/Robust.Shared/GameObjects/EntityManager.cs index 0a1ddbcaf..34e7a501d 100644 --- a/Robust.Shared/GameObjects/EntityManager.cs +++ b/Robust.Shared/GameObjects/EntityManager.cs @@ -11,6 +11,7 @@ namespace Robust.Shared.GameObjects public delegate void EntityUidQueryCallback(EntityUid uid); /// + [Virtual] public partial class EntityManager : IEntityManager { #region Dependencies diff --git a/Robust.Shared/GameObjects/EntitySystemManager.cs b/Robust.Shared/GameObjects/EntitySystemManager.cs index 04e3a673e..61e6739a0 100644 --- a/Robust.Shared/GameObjects/EntitySystemManager.cs +++ b/Robust.Shared/GameObjects/EntitySystemManager.cs @@ -19,7 +19,7 @@ using Robust.Shared.Exceptions; namespace Robust.Shared.GameObjects { - public class EntitySystemManager : IEntitySystemManager + public sealed class EntitySystemManager : IEntitySystemManager { [Dependency] private readonly IReflectionManager _reflectionManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; @@ -366,7 +366,7 @@ namespace Robust.Shared.GameObjects } } - public class SystemChangedArgs : EventArgs + public sealed class SystemChangedArgs : EventArgs { public IEntitySystem System { get; } diff --git a/Robust.Shared/GameObjects/EntitySystemMessages/AudioMessages.cs b/Robust.Shared/GameObjects/EntitySystemMessages/AudioMessages.cs index 3f2e809be..3894b87ea 100644 --- a/Robust.Shared/GameObjects/EntitySystemMessages/AudioMessages.cs +++ b/Robust.Shared/GameObjects/EntitySystemMessages/AudioMessages.cs @@ -19,25 +19,25 @@ namespace Robust.Shared.GameObjects } [Serializable, NetSerializable] - public class StopAudioMessageClient : EntityEventArgs + public sealed class StopAudioMessageClient : EntityEventArgs { public uint Identifier {get; set;} } [Serializable, NetSerializable] - public class PlayAudioGlobalMessage : AudioMessage + public sealed class PlayAudioGlobalMessage : AudioMessage { } [Serializable, NetSerializable] - public class PlayAudioPositionalMessage : AudioMessage + public sealed class PlayAudioPositionalMessage : AudioMessage { public EntityCoordinates Coordinates { get; set; } public EntityCoordinates FallbackCoordinates { get; set; } } [Serializable, NetSerializable] - public class PlayAudioEntityMessage : AudioMessage + public sealed class PlayAudioEntityMessage : AudioMessage { public EntityUid EntityUid { get; set; } public EntityCoordinates Coordinates { get; set; } diff --git a/Robust.Shared/GameObjects/EntitySystemMessages/EffectMessage.cs b/Robust.Shared/GameObjects/EntitySystemMessages/EffectMessage.cs index ad18b7728..6551cb223 100644 --- a/Robust.Shared/GameObjects/EntitySystemMessages/EffectMessage.cs +++ b/Robust.Shared/GameObjects/EntitySystemMessages/EffectMessage.cs @@ -6,7 +6,7 @@ using Robust.Shared.Serialization; namespace Robust.Shared.GameObjects { [Serializable, NetSerializable] - public class EffectSystemMessage : EntityEventArgs + public sealed class EffectSystemMessage : EntityEventArgs { /// /// Path to the texture used for the effect. @@ -28,12 +28,12 @@ namespace Robust.Shared.GameObjects /// Effect position attached to an entity /// public EntityUid? AttachedEntityUid { get; set; } - + /// /// Effect offset relative to the parent /// public Vector2 AttachedOffset { get; set; } = Vector2.Zero; - + /// /// Effect position relative to the emit position /// diff --git a/Robust.Shared/GameObjects/EntitySystemMessages/EntMapIdChangedMessage.cs b/Robust.Shared/GameObjects/EntitySystemMessages/EntMapIdChangedMessage.cs index dd81894f8..3a194df87 100644 --- a/Robust.Shared/GameObjects/EntitySystemMessages/EntMapIdChangedMessage.cs +++ b/Robust.Shared/GameObjects/EntitySystemMessages/EntMapIdChangedMessage.cs @@ -2,7 +2,7 @@ using Robust.Shared.Map; namespace Robust.Shared.GameObjects { - public class EntMapIdChangedMessage : EntityEventArgs + public sealed class EntMapIdChangedMessage : EntityEventArgs { public EntMapIdChangedMessage(EntityUid entity, MapId oldMapId) { diff --git a/Robust.Shared/GameObjects/EntitySystemMessages/EntParentChangedMessage.cs b/Robust.Shared/GameObjects/EntitySystemMessages/EntParentChangedMessage.cs index 3aa632eae..bf3beca5d 100644 --- a/Robust.Shared/GameObjects/EntitySystemMessages/EntParentChangedMessage.cs +++ b/Robust.Shared/GameObjects/EntitySystemMessages/EntParentChangedMessage.cs @@ -4,7 +4,7 @@ /// Raised when an entity parent is changed. /// [ByRefEvent] - public class EntParentChangedMessage : EntityEventArgs + public sealed class EntParentChangedMessage : EntityEventArgs { /// /// Entity that was adopted. The transform component has a property with the new parent. diff --git a/Robust.Shared/GameObjects/EntitySystemMessages/EntityTerminatingEvent.cs b/Robust.Shared/GameObjects/EntitySystemMessages/EntityTerminatingEvent.cs index 1c97fb763..67e7779a8 100644 --- a/Robust.Shared/GameObjects/EntitySystemMessages/EntityTerminatingEvent.cs +++ b/Robust.Shared/GameObjects/EntitySystemMessages/EntityTerminatingEvent.cs @@ -3,5 +3,5 @@ namespace Robust.Shared.GameObjects /// /// The children of this entity are about to be deleted. /// - public class EntityTerminatingEvent : EntityEventArgs { } -} \ No newline at end of file + public sealed class EntityTerminatingEvent : EntityEventArgs { } +} diff --git a/Robust.Shared/GameObjects/IMapInit.cs b/Robust.Shared/GameObjects/IMapInit.cs index 2772a198f..4be5c0334 100644 --- a/Robust.Shared/GameObjects/IMapInit.cs +++ b/Robust.Shared/GameObjects/IMapInit.cs @@ -6,7 +6,7 @@ namespace Robust.Shared.GameObjects /// /// Raised directed on an entity when the map is initialized. /// - public class MapInitEvent : EntityEventArgs + public sealed class MapInitEvent : EntityEventArgs { } diff --git a/Robust.Shared/GameObjects/Systems/SharedAudioSystem.cs b/Robust.Shared/GameObjects/Systems/SharedAudioSystem.cs index 9ee22eefd..82ed3aa87 100644 --- a/Robust.Shared/GameObjects/Systems/SharedAudioSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedAudioSystem.cs @@ -3,7 +3,7 @@ using Robust.Shared.Map; namespace Robust.Shared.GameObjects { - public class SharedAudioSystem : EntitySystem + public abstract class SharedAudioSystem : EntitySystem { [Dependency] private readonly IMapManager _mapManager = default!; diff --git a/Robust.Shared/GameObjects/Systems/TimerSystem.cs b/Robust.Shared/GameObjects/Systems/TimerSystem.cs index 393da568e..a2b528385 100644 --- a/Robust.Shared/GameObjects/Systems/TimerSystem.cs +++ b/Robust.Shared/GameObjects/Systems/TimerSystem.cs @@ -3,7 +3,7 @@ using Robust.Shared.IoC; namespace Robust.Shared.GameObjects { - public class TimerSystem : EntitySystem + public sealed class TimerSystem : EntitySystem { public override void Update(float frameTime) { diff --git a/Robust.Shared/GameStates/NetworkedComponentAttribute.cs b/Robust.Shared/GameStates/NetworkedComponentAttribute.cs index 5481798cc..164d779de 100644 --- a/Robust.Shared/GameStates/NetworkedComponentAttribute.cs +++ b/Robust.Shared/GameStates/NetworkedComponentAttribute.cs @@ -6,5 +6,5 @@ namespace Robust.Shared.GameStates /// This attribute marks a component as networked, so that it is replicated to clients. /// [AttributeUsage(AttributeTargets.Class)] - public class NetworkedComponentAttribute : Attribute { } + public sealed class NetworkedComponentAttribute : Attribute { } } diff --git a/Robust.Shared/IgnoreAccessChecksToAttribute.cs b/Robust.Shared/IgnoreAccessChecksToAttribute.cs index da8719c50..f44a05fff 100644 --- a/Robust.Shared/IgnoreAccessChecksToAttribute.cs +++ b/Robust.Shared/IgnoreAccessChecksToAttribute.cs @@ -2,7 +2,7 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] - internal class IgnoresAccessChecksToAttribute : Attribute { + internal sealed class IgnoresAccessChecksToAttribute : Attribute { // ReSharper disable once InconsistentNaming private readonly string assemblyName; diff --git a/Robust.Shared/Input/Binding/CommandBind.cs b/Robust.Shared/Input/Binding/CommandBind.cs index 3c51fa5c8..9c4b010df 100644 --- a/Robust.Shared/Input/Binding/CommandBind.cs +++ b/Robust.Shared/Input/Binding/CommandBind.cs @@ -8,7 +8,7 @@ namespace Robust.Shared.Input.Binding /// An individual binding of a given handler to a given key function, with associated /// dependency information to resolve handlers bound to the same key function from different types. /// - public class CommandBind + public sealed class CommandBind { private readonly BoundKeyFunction _boundKeyFunction; private readonly IEnumerable _after; diff --git a/Robust.Shared/Input/Binding/CommandBindRegistry.cs b/Robust.Shared/Input/Binding/CommandBindRegistry.cs index 8ebe4bd41..53c8c6be1 100644 --- a/Robust.Shared/Input/Binding/CommandBindRegistry.cs +++ b/Robust.Shared/Input/Binding/CommandBindRegistry.cs @@ -7,7 +7,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Input.Binding { /// - public class CommandBindRegistry : ICommandBindRegistry + public sealed class CommandBindRegistry : ICommandBindRegistry { // all registered bindings private List _bindings = new(); @@ -166,7 +166,7 @@ namespace Robust.Shared.Input.Binding /// The only time a client should need to think about the type for a binding is when they are /// registering a set of bindings, so we don't include this information in CommandBind /// - private class TypedCommandBind + private sealed class TypedCommandBind { public readonly Type ForType; public readonly CommandBind CommandBind; diff --git a/Robust.Shared/Input/Binding/CommandBinds.cs b/Robust.Shared/Input/Binding/CommandBinds.cs index 881128645..a450068b8 100644 --- a/Robust.Shared/Input/Binding/CommandBinds.cs +++ b/Robust.Shared/Input/Binding/CommandBinds.cs @@ -9,7 +9,7 @@ namespace Robust.Shared.Input.Binding /// /// Immutable. Use Bindings.Builder() to create. /// - public class CommandBinds + public sealed class CommandBinds { private readonly List _bindings; @@ -56,7 +56,7 @@ namespace Robust.Shared.Input.Binding /// /// For creating Bindings. /// - public class BindingsBuilder + public sealed class BindingsBuilder { private readonly List _bindings = new(); diff --git a/Robust.Shared/Input/Binding/InputCmdHandler.cs b/Robust.Shared/Input/Binding/InputCmdHandler.cs index bdeb54fe9..45493515f 100644 --- a/Robust.Shared/Input/Binding/InputCmdHandler.cs +++ b/Robust.Shared/Input/Binding/InputCmdHandler.cs @@ -38,7 +38,7 @@ namespace Robust.Shared.Input.Binding }; } - private class StateInputCmdHandler : InputCmdHandler + private sealed class StateInputCmdHandler : InputCmdHandler { public StateInputCmdDelegate? EnabledDelegate; public StateInputCmdDelegate? DisabledDelegate; @@ -81,7 +81,7 @@ namespace Robust.Shared.Input.Binding public delegate bool PointerInputCmdDelegate2(in PointerInputCmdHandler.PointerInputCmdArgs args); - public class PointerInputCmdHandler : InputCmdHandler + public sealed class PointerInputCmdHandler : InputCmdHandler { private PointerInputCmdDelegate2 _callback; private bool _ignoreUp; @@ -144,7 +144,7 @@ namespace Robust.Shared.Input.Binding } } - public class PointerStateInputCmdHandler : InputCmdHandler + public sealed class PointerStateInputCmdHandler : InputCmdHandler { private PointerInputCmdDelegate _enabled; private PointerInputCmdDelegate _disabled; @@ -180,7 +180,7 @@ namespace Robust.Shared.Input.Binding /// Consumes both up and down states without calling any handler delegates. Primarily used on the client to /// prevent an input message from being sent to the server. /// - public class NullInputCmdHandler : InputCmdHandler + public sealed class NullInputCmdHandler : InputCmdHandler { /// public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message) diff --git a/Robust.Shared/Input/BoundKeyEventArgs.cs b/Robust.Shared/Input/BoundKeyEventArgs.cs index 9cbc927c8..6f427dc58 100644 --- a/Robust.Shared/Input/BoundKeyEventArgs.cs +++ b/Robust.Shared/Input/BoundKeyEventArgs.cs @@ -6,6 +6,7 @@ namespace Robust.Shared.Input /// /// Event data values for a bound key state change. /// + [Virtual] public class BoundKeyEventArgs : EventArgs { /// diff --git a/Robust.Shared/Input/BoundKeyMap.cs b/Robust.Shared/Input/BoundKeyMap.cs index 557cf3069..d25332640 100644 --- a/Robust.Shared/Input/BoundKeyMap.cs +++ b/Robust.Shared/Input/BoundKeyMap.cs @@ -58,7 +58,7 @@ namespace Robust.Shared.Input /// /// Sets up a mapping of to for network messages. /// - public class BoundKeyMap + public sealed class BoundKeyMap { private readonly IReflectionManager reflectionManager; diff --git a/Robust.Shared/Input/InputCmdContext.cs b/Robust.Shared/Input/InputCmdContext.cs index 413ffcb6f..d164698dd 100644 --- a/Robust.Shared/Input/InputCmdContext.cs +++ b/Robust.Shared/Input/InputCmdContext.cs @@ -38,7 +38,7 @@ namespace Robust.Shared.Input } /// - internal class InputCmdContext : IInputCmdContext + internal sealed class InputCmdContext : IInputCmdContext { private readonly List _commands = new(); private readonly IInputCmdContext? _parent; diff --git a/Robust.Shared/Input/InputCmdMessage.cs b/Robust.Shared/Input/InputCmdMessage.cs index 1f4b4ca20..56dd8cc4e 100644 --- a/Robust.Shared/Input/InputCmdMessage.cs +++ b/Robust.Shared/Input/InputCmdMessage.cs @@ -68,7 +68,7 @@ namespace Robust.Shared.Input /// An Input Command for a function that has a state. /// [Serializable, NetSerializable] - public class StateInputCmdMessage : InputCmdMessage + public sealed class StateInputCmdMessage : InputCmdMessage { /// /// New state of the Input Function. @@ -92,6 +92,7 @@ namespace Robust.Shared.Input /// A OneShot Input Command that does not have a state. /// [Serializable, NetSerializable] + [Virtual] public class EventInputCmdMessage : InputCmdMessage { /// @@ -107,7 +108,7 @@ namespace Robust.Shared.Input /// A OneShot Input Command that also contains pointer info. /// [Serializable, NetSerializable] - public class PointerInputCmdMessage : EventInputCmdMessage + public sealed class PointerInputCmdMessage : EventInputCmdMessage { /// /// Local Coordinates of the pointer when the command was created. @@ -147,7 +148,7 @@ namespace Robust.Shared.Input /// An input command that has both state and pointer info. /// [Serializable, NetSerializable] - public class FullInputCmdMessage : InputCmdMessage + public sealed class FullInputCmdMessage : InputCmdMessage { /// /// New state of the Input Function. diff --git a/Robust.Shared/Input/InputContextContainer.cs b/Robust.Shared/Input/InputContextContainer.cs index 365a3e79a..892d2e7c0 100644 --- a/Robust.Shared/Input/InputContextContainer.cs +++ b/Robust.Shared/Input/InputContextContainer.cs @@ -77,7 +77,7 @@ namespace Robust.Shared.Input } /// - internal class InputContextContainer : IInputContextContainer + internal sealed class InputContextContainer : IInputContextContainer { /// /// Default 'root' context unique name that always exists in the set. @@ -231,7 +231,7 @@ namespace Robust.Shared.Input /// /// Event arguments for an input context change. /// - public class ContextChangedEventArgs : EventArgs + public sealed class ContextChangedEventArgs : EventArgs { /// /// The new context that became active. diff --git a/Robust.Shared/Input/KeyFunctions.cs b/Robust.Shared/Input/KeyFunctions.cs index 1f99da4c9..45c9db61f 100644 --- a/Robust.Shared/Input/KeyFunctions.cs +++ b/Robust.Shared/Input/KeyFunctions.cs @@ -151,5 +151,5 @@ namespace Robust.Shared.Input /// Makes all constant strings on this static class be added as input functions. /// [AttributeUsage(AttributeTargets.Class)] - public class KeyFunctionsAttribute : Attribute { } + public sealed class KeyFunctionsAttribute : Attribute { } } diff --git a/Robust.Shared/Input/PlayerCommandStates.cs b/Robust.Shared/Input/PlayerCommandStates.cs index b6679d911..eb849a3d3 100644 --- a/Robust.Shared/Input/PlayerCommandStates.cs +++ b/Robust.Shared/Input/PlayerCommandStates.cs @@ -28,7 +28,7 @@ namespace Robust.Shared.Input } /// - public class PlayerCommandStates : IPlayerCommandStates + public sealed class PlayerCommandStates : IPlayerCommandStates { private readonly Dictionary _functionStates = new(); diff --git a/Robust.Shared/IoC/DependencyAttribute.cs b/Robust.Shared/IoC/DependencyAttribute.cs index 5fce001e0..c19382b76 100644 --- a/Robust.Shared/IoC/DependencyAttribute.cs +++ b/Robust.Shared/IoC/DependencyAttribute.cs @@ -20,7 +20,7 @@ namespace Robust.Shared.IoC /// /// [AttributeUsage(AttributeTargets.Field)] - public class DependencyAttribute : Attribute + public sealed class DependencyAttribute : Attribute { } } diff --git a/Robust.Shared/IoC/DependencyCollection.cs b/Robust.Shared/IoC/DependencyCollection.cs index f7ea65153..f4094f941 100644 --- a/Robust.Shared/IoC/DependencyCollection.cs +++ b/Robust.Shared/IoC/DependencyCollection.cs @@ -16,7 +16,7 @@ namespace Robust.Shared.IoC where T : class; /// - internal class DependencyCollection : IDependencyCollection + internal sealed class DependencyCollection : IDependencyCollection { private delegate void InjectorDelegate(object target, object[] services); private static readonly Type[] InjectorParameters = {typeof(object), typeof(object[])}; diff --git a/Robust.Shared/IoC/Exceptions/ImplementationConstructorException.cs b/Robust.Shared/IoC/Exceptions/ImplementationConstructorException.cs index cb5e1f7f3..29279826e 100644 --- a/Robust.Shared/IoC/Exceptions/ImplementationConstructorException.cs +++ b/Robust.Shared/IoC/Exceptions/ImplementationConstructorException.cs @@ -7,6 +7,7 @@ namespace Robust.Shared.IoC.Exceptions /// Signifies that a type threw an exception from its constructor while IoC was trying to build it. /// [Serializable] + [Virtual] public class ImplementationConstructorException : Exception { /// diff --git a/Robust.Shared/IoC/Exceptions/InvalidImplementationException.cs b/Robust.Shared/IoC/Exceptions/InvalidImplementationException.cs index f6bd3d1f4..e34552c67 100644 --- a/Robust.Shared/IoC/Exceptions/InvalidImplementationException.cs +++ b/Robust.Shared/IoC/Exceptions/InvalidImplementationException.cs @@ -9,6 +9,7 @@ namespace Robust.Shared.IoC.Exceptions /// /// /// + [Virtual] public class InvalidImplementationException : Exception { private readonly string message; diff --git a/Robust.Shared/IoC/Exceptions/UnregisteredDependencyException.cs b/Robust.Shared/IoC/Exceptions/UnregisteredDependencyException.cs index d57ebd565..e784df2f5 100644 --- a/Robust.Shared/IoC/Exceptions/UnregisteredDependencyException.cs +++ b/Robust.Shared/IoC/Exceptions/UnregisteredDependencyException.cs @@ -8,6 +8,7 @@ namespace Robust.Shared.IoC.Exceptions /// except that this is thrown when using field injection via and includes extra metadata. /// [Serializable] + [Virtual] public class UnregisteredDependencyException : Exception { /// diff --git a/Robust.Shared/IoC/Exceptions/UnregisteredTypeException.cs b/Robust.Shared/IoC/Exceptions/UnregisteredTypeException.cs index 03b5e0f5b..63f5f4ea5 100644 --- a/Robust.Shared/IoC/Exceptions/UnregisteredTypeException.cs +++ b/Robust.Shared/IoC/Exceptions/UnregisteredTypeException.cs @@ -7,6 +7,7 @@ namespace Robust.Shared.IoC.Exceptions /// Thrown by if one attempts to resolve an interface that isn't registered. /// [Serializable] + [Virtual] public class UnregisteredTypeException : Exception { /// diff --git a/Robust.Shared/Map/MapChunk.cs b/Robust.Shared/Map/MapChunk.cs index 8df6564c2..4cd606e09 100644 --- a/Robust.Shared/Map/MapChunk.cs +++ b/Robust.Shared/Map/MapChunk.cs @@ -11,7 +11,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Map { /// - internal class MapChunk : IMapChunkInternal + internal sealed class MapChunk : IMapChunkInternal { /// /// New SnapGrid cells are allocated with this capacity. diff --git a/Robust.Shared/Map/MapGrid.cs b/Robust.Shared/Map/MapGrid.cs index 73706e39a..f0b596a08 100644 --- a/Robust.Shared/Map/MapGrid.cs +++ b/Robust.Shared/Map/MapGrid.cs @@ -13,7 +13,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Shared.Map { /// - internal class MapGrid : IMapGridInternal + internal sealed class MapGrid : IMapGridInternal { /// /// Game tick that the map was created. diff --git a/Robust.Shared/Map/MapManager.GridCollection.cs b/Robust.Shared/Map/MapManager.GridCollection.cs index d969cffcc..d3592e355 100644 --- a/Robust.Shared/Map/MapManager.GridCollection.cs +++ b/Robust.Shared/Map/MapManager.GridCollection.cs @@ -13,7 +13,7 @@ namespace Robust.Shared.Map; /// /// Arguments for when a one or more tiles on a grid is changed at once. /// -public class GridChangedEventArgs : EventArgs +public sealed class GridChangedEventArgs : EventArgs { /// /// Creates a new instance of this class. @@ -35,7 +35,7 @@ public class GridChangedEventArgs : EventArgs /// /// Arguments for when a single tile on a grid is changed locally or remotely. /// -public class TileChangedEventArgs : EventArgs +public sealed class TileChangedEventArgs : EventArgs { /// /// Creates a new instance of this class. diff --git a/Robust.Shared/Map/MapManager.MapCollection.cs b/Robust.Shared/Map/MapManager.MapCollection.cs index 30e3f44eb..f9be154d3 100644 --- a/Robust.Shared/Map/MapManager.MapCollection.cs +++ b/Robust.Shared/Map/MapManager.MapCollection.cs @@ -11,7 +11,7 @@ namespace Robust.Shared.Map; /// /// Arguments for when a map is created or deleted locally ore remotely. /// -public class MapEventArgs : EventArgs +public sealed class MapEventArgs : EventArgs { /// /// Creates a new instance of this class. diff --git a/Robust.Shared/Map/MapManager.cs b/Robust.Shared/Map/MapManager.cs index a0a613bde..756094c4d 100644 --- a/Robust.Shared/Map/MapManager.cs +++ b/Robust.Shared/Map/MapManager.cs @@ -56,6 +56,10 @@ internal partial class MapManager : IMapManagerInternal, IEntityEventSubscriber #endif } + /// + /// Old tile that was replaced. + /// + public Tile OldTile { get; } /// public void Restart() { diff --git a/Robust.Shared/Map/TileDefinitionManager.cs b/Robust.Shared/Map/TileDefinitionManager.cs index 332a4ceb8..774739046 100644 --- a/Robust.Shared/Map/TileDefinitionManager.cs +++ b/Robust.Shared/Map/TileDefinitionManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; namespace Robust.Shared.Map { + [Virtual] internal class TileDefinitionManager : ITileDefinitionManager { protected readonly List TileDefs; diff --git a/Robust.Shared/MeansImplicitAssignmentAttribute.cs b/Robust.Shared/MeansImplicitAssignmentAttribute.cs index ec47d6ee8..e77d7f3a7 100644 --- a/Robust.Shared/MeansImplicitAssignmentAttribute.cs +++ b/Robust.Shared/MeansImplicitAssignmentAttribute.cs @@ -2,5 +2,5 @@ using System; namespace Robust.Shared { - public class MeansImplicitAssignmentAttribute : Attribute { } + public sealed class MeansImplicitAssignmentAttribute : Attribute { } } diff --git a/Robust.Shared/Network/Messages/MsgConCmd.cs b/Robust.Shared/Network/Messages/MsgConCmd.cs index b0d710816..cfb065ea9 100644 --- a/Robust.Shared/Network/Messages/MsgConCmd.cs +++ b/Robust.Shared/Network/Messages/MsgConCmd.cs @@ -4,7 +4,7 @@ namespace Robust.Shared.Network.Messages { - public class MsgConCmd : NetMessage + public sealed class MsgConCmd : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Core; diff --git a/Robust.Shared/Network/Messages/MsgConCmdAck.cs b/Robust.Shared/Network/Messages/MsgConCmdAck.cs index c06285518..76faf81c6 100644 --- a/Robust.Shared/Network/Messages/MsgConCmdAck.cs +++ b/Robust.Shared/Network/Messages/MsgConCmdAck.cs @@ -4,7 +4,7 @@ using Lidgren.Network; namespace Robust.Shared.Network.Messages { - public class MsgConCmdAck : NetMessage + public sealed class MsgConCmdAck : NetMessage { public override MsgGroups MsgGroup => MsgGroups.String; diff --git a/Robust.Shared/Network/Messages/MsgConCmdReg.cs b/Robust.Shared/Network/Messages/MsgConCmdReg.cs index 9dfc986a3..765c88570 100644 --- a/Robust.Shared/Network/Messages/MsgConCmdReg.cs +++ b/Robust.Shared/Network/Messages/MsgConCmdReg.cs @@ -5,13 +5,13 @@ using Lidgren.Network; namespace Robust.Shared.Network.Messages { - public class MsgConCmdReg : NetMessage + public sealed class MsgConCmdReg : NetMessage { public override MsgGroups MsgGroup => MsgGroups.String; public Command[] Commands { get; set; } - public class Command + public sealed class Command { public string Name { get; set; } public string Description { get; set; } diff --git a/Robust.Shared/Network/Messages/MsgConVars.cs b/Robust.Shared/Network/Messages/MsgConVars.cs index 1115fb857..46e371e6f 100644 --- a/Robust.Shared/Network/Messages/MsgConVars.cs +++ b/Robust.Shared/Network/Messages/MsgConVars.cs @@ -6,7 +6,7 @@ using Robust.Shared.Timing; namespace Robust.Shared.Network.Messages { - internal class MsgConVars : NetMessage + internal sealed class MsgConVars : NetMessage { // Max buffer could potentially be 255 * 128 * 1024 = ~33MB, so if MaxMessageSize starts being a problem it can be increased. private const int MaxMessageSize = 0x4000; // Arbitrarily chosen as a 'sane' value as the maximum size of the entire message. diff --git a/Robust.Shared/Network/Messages/MsgEntity.cs b/Robust.Shared/Network/Messages/MsgEntity.cs index 861eadf4b..f16a549d3 100644 --- a/Robust.Shared/Network/Messages/MsgEntity.cs +++ b/Robust.Shared/Network/Messages/MsgEntity.cs @@ -12,7 +12,7 @@ using Robust.Shared.Timing; namespace Robust.Shared.Network.Messages { - public class MsgEntity : NetMessage + public sealed class MsgEntity : NetMessage { public override MsgGroups MsgGroup => MsgGroups.EntityEvent; diff --git a/Robust.Shared/Network/Messages/MsgMapStrClientHandshake.cs b/Robust.Shared/Network/Messages/MsgMapStrClientHandshake.cs index ea598cc22..b3ecc3920 100644 --- a/Robust.Shared/Network/Messages/MsgMapStrClientHandshake.cs +++ b/Robust.Shared/Network/Messages/MsgMapStrClientHandshake.cs @@ -18,7 +18,7 @@ namespace Robust.Shared.Network.Messages /// /// [UsedImplicitly] - internal class MsgMapStrClientHandshake : NetMessage + internal sealed class MsgMapStrClientHandshake : NetMessage { public override MsgGroups MsgGroup => MsgGroups.String; diff --git a/Robust.Shared/Network/Messages/MsgMapStrServerHandshake.cs b/Robust.Shared/Network/Messages/MsgMapStrServerHandshake.cs index 13fb9941a..a5799de84 100644 --- a/Robust.Shared/Network/Messages/MsgMapStrServerHandshake.cs +++ b/Robust.Shared/Network/Messages/MsgMapStrServerHandshake.cs @@ -13,7 +13,7 @@ namespace Robust.Shared.Network.Messages /// /// [UsedImplicitly] - internal class MsgMapStrServerHandshake : NetMessage + internal sealed class MsgMapStrServerHandshake : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Core; diff --git a/Robust.Shared/Network/Messages/MsgMapStrStrings.cs b/Robust.Shared/Network/Messages/MsgMapStrStrings.cs index 3beb54f50..51ce76c8a 100644 --- a/Robust.Shared/Network/Messages/MsgMapStrStrings.cs +++ b/Robust.Shared/Network/Messages/MsgMapStrStrings.cs @@ -13,7 +13,7 @@ namespace Robust.Shared.Network.Messages /// /// [UsedImplicitly] - internal class MsgMapStrStrings : NetMessage + internal sealed class MsgMapStrStrings : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Core; diff --git a/Robust.Shared/Network/Messages/MsgPlacement.cs b/Robust.Shared/Network/Messages/MsgPlacement.cs index 7576aaae5..ae1f44710 100644 --- a/Robust.Shared/Network/Messages/MsgPlacement.cs +++ b/Robust.Shared/Network/Messages/MsgPlacement.cs @@ -9,7 +9,7 @@ using Robust.Shared.Maths; namespace Robust.Shared.Network.Messages { - public class MsgPlacement : NetMessage + public sealed class MsgPlacement : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgPlayerList.cs b/Robust.Shared/Network/Messages/MsgPlayerList.cs index 459a14f2e..afbc5952c 100644 --- a/Robust.Shared/Network/Messages/MsgPlayerList.cs +++ b/Robust.Shared/Network/Messages/MsgPlayerList.cs @@ -7,7 +7,7 @@ using Robust.Shared.GameStates; namespace Robust.Shared.Network.Messages { - public class MsgPlayerList : NetMessage + public sealed class MsgPlayerList : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Core; diff --git a/Robust.Shared/Network/Messages/MsgPlayerListReq.cs b/Robust.Shared/Network/Messages/MsgPlayerListReq.cs index 4dfe24ff7..fcfb2e91b 100644 --- a/Robust.Shared/Network/Messages/MsgPlayerListReq.cs +++ b/Robust.Shared/Network/Messages/MsgPlayerListReq.cs @@ -2,7 +2,7 @@ namespace Robust.Shared.Network.Messages { - public class MsgPlayerListReq : NetMessage + public sealed class MsgPlayerListReq : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Core; diff --git a/Robust.Shared/Network/Messages/MsgRay.cs b/Robust.Shared/Network/Messages/MsgRay.cs index 0d448be93..e0714a881 100644 --- a/Robust.Shared/Network/Messages/MsgRay.cs +++ b/Robust.Shared/Network/Messages/MsgRay.cs @@ -6,7 +6,7 @@ using Robust.Shared.Maths; namespace Robust.Shared.Network.Messages { - public class MsgRay : EntityEventArgs + public sealed class MsgRay : EntityEventArgs { public Vector2 RayOrigin { get; set; } public Vector2 RayHit { get; set; } diff --git a/Robust.Shared/Network/Messages/MsgReloadPrototypes.cs b/Robust.Shared/Network/Messages/MsgReloadPrototypes.cs index b4eb6e51f..c67d0fc67 100644 --- a/Robust.Shared/Network/Messages/MsgReloadPrototypes.cs +++ b/Robust.Shared/Network/Messages/MsgReloadPrototypes.cs @@ -3,7 +3,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Network.Messages { - public class MsgReloadPrototypes : NetMessage + public sealed class MsgReloadPrototypes : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgScriptCompletion.cs b/Robust.Shared/Network/Messages/MsgScriptCompletion.cs index 27f9ba23c..aed971fe1 100644 --- a/Robust.Shared/Network/Messages/MsgScriptCompletion.cs +++ b/Robust.Shared/Network/Messages/MsgScriptCompletion.cs @@ -4,7 +4,7 @@ using Lidgren.Network; namespace Robust.Shared.Network.Messages { - public class MsgScriptCompletion : NetMessage + public sealed class MsgScriptCompletion : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgScriptCompletionResponse.cs b/Robust.Shared/Network/Messages/MsgScriptCompletionResponse.cs index 621f8900e..d362f4284 100644 --- a/Robust.Shared/Network/Messages/MsgScriptCompletionResponse.cs +++ b/Robust.Shared/Network/Messages/MsgScriptCompletionResponse.cs @@ -3,7 +3,7 @@ using Lidgren.Network; namespace Robust.Shared.Network.Messages { - public class MsgScriptCompletionResponse : NetMessage + public sealed class MsgScriptCompletionResponse : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; @@ -33,7 +33,7 @@ namespace Robust.Shared.Network.Messages res.WriteToBuffer(buffer); } - public class LiteResult { + public sealed class LiteResult { public string DisplayText; public string DisplayTextPrefix; public string DisplayTextSuffix; diff --git a/Robust.Shared/Network/Messages/MsgScriptEval.cs b/Robust.Shared/Network/Messages/MsgScriptEval.cs index c3a6b7c82..46d4c69ea 100644 --- a/Robust.Shared/Network/Messages/MsgScriptEval.cs +++ b/Robust.Shared/Network/Messages/MsgScriptEval.cs @@ -4,7 +4,7 @@ using Lidgren.Network; namespace Robust.Shared.Network.Messages { - public class MsgScriptEval : NetMessage + public sealed class MsgScriptEval : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgScriptResponse.cs b/Robust.Shared/Network/Messages/MsgScriptResponse.cs index 30bf411e5..d5e9a4ed1 100644 --- a/Robust.Shared/Network/Messages/MsgScriptResponse.cs +++ b/Robust.Shared/Network/Messages/MsgScriptResponse.cs @@ -8,7 +8,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Network.Messages { - public class MsgScriptResponse : NetMessage + public sealed class MsgScriptResponse : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgScriptStart.cs b/Robust.Shared/Network/Messages/MsgScriptStart.cs index adb831c37..0abfa80b2 100644 --- a/Robust.Shared/Network/Messages/MsgScriptStart.cs +++ b/Robust.Shared/Network/Messages/MsgScriptStart.cs @@ -4,7 +4,7 @@ using Lidgren.Network; namespace Robust.Shared.Network.Messages { - public class MsgScriptStart : NetMessage + public sealed class MsgScriptStart : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgScriptStartAck.cs b/Robust.Shared/Network/Messages/MsgScriptStartAck.cs index e4cd9c8c9..ef4f8bc17 100644 --- a/Robust.Shared/Network/Messages/MsgScriptStartAck.cs +++ b/Robust.Shared/Network/Messages/MsgScriptStartAck.cs @@ -4,7 +4,7 @@ using Lidgren.Network; namespace Robust.Shared.Network.Messages { - public class MsgScriptStartAck : NetMessage + public sealed class MsgScriptStartAck : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgScriptStop.cs b/Robust.Shared/Network/Messages/MsgScriptStop.cs index 36a69ffc3..0a11a9687 100644 --- a/Robust.Shared/Network/Messages/MsgScriptStop.cs +++ b/Robust.Shared/Network/Messages/MsgScriptStop.cs @@ -4,7 +4,7 @@ using Lidgren.Network; namespace Robust.Shared.Network.Messages { - public class MsgScriptStop : NetMessage + public sealed class MsgScriptStop : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgState.cs b/Robust.Shared/Network/Messages/MsgState.cs index f2d633827..5501fd42c 100644 --- a/Robust.Shared/Network/Messages/MsgState.cs +++ b/Robust.Shared/Network/Messages/MsgState.cs @@ -12,7 +12,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Network.Messages { - public class MsgState : NetMessage + public sealed class MsgState : NetMessage { // If a state is large enough we send it ReliableUnordered instead. // This is to avoid states being so large that they consistently fail to reach the other end diff --git a/Robust.Shared/Network/Messages/MsgStateAck.cs b/Robust.Shared/Network/Messages/MsgStateAck.cs index 6adf19d99..72a2c1fac 100644 --- a/Robust.Shared/Network/Messages/MsgStateAck.cs +++ b/Robust.Shared/Network/Messages/MsgStateAck.cs @@ -5,7 +5,7 @@ using Robust.Shared.Timing; namespace Robust.Shared.Network.Messages { - public class MsgStateAck : NetMessage + public sealed class MsgStateAck : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Entity; diff --git a/Robust.Shared/Network/Messages/MsgViewVariablesCloseSession.cs b/Robust.Shared/Network/Messages/MsgViewVariablesCloseSession.cs index 6097d2b9a..5ead770db 100644 --- a/Robust.Shared/Network/Messages/MsgViewVariablesCloseSession.cs +++ b/Robust.Shared/Network/Messages/MsgViewVariablesCloseSession.cs @@ -7,7 +7,7 @@ namespace Robust.Shared.Network.Messages /// /// Sent from client to server or server to client to notify to close a session. /// - public class MsgViewVariablesCloseSession : NetMessage + public sealed class MsgViewVariablesCloseSession : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgViewVariablesDenySession.cs b/Robust.Shared/Network/Messages/MsgViewVariablesDenySession.cs index 61eb27725..580d83224 100644 --- a/Robust.Shared/Network/Messages/MsgViewVariablesDenySession.cs +++ b/Robust.Shared/Network/Messages/MsgViewVariablesDenySession.cs @@ -7,7 +7,7 @@ namespace Robust.Shared.Network.Messages /// /// Sent server to client to deny a . /// - public class MsgViewVariablesDenySession : NetMessage + public sealed class MsgViewVariablesDenySession : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgViewVariablesModifyRemote.cs b/Robust.Shared/Network/Messages/MsgViewVariablesModifyRemote.cs index 38f1a15c5..2538c98ea 100644 --- a/Robust.Shared/Network/Messages/MsgViewVariablesModifyRemote.cs +++ b/Robust.Shared/Network/Messages/MsgViewVariablesModifyRemote.cs @@ -8,7 +8,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Shared.Network.Messages { - public class MsgViewVariablesModifyRemote : NetMessage + public sealed class MsgViewVariablesModifyRemote : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgViewVariablesOpenSession.cs b/Robust.Shared/Network/Messages/MsgViewVariablesOpenSession.cs index 97ddabce4..002b9ce50 100644 --- a/Robust.Shared/Network/Messages/MsgViewVariablesOpenSession.cs +++ b/Robust.Shared/Network/Messages/MsgViewVariablesOpenSession.cs @@ -7,7 +7,7 @@ namespace Robust.Shared.Network.Messages /// /// Sent server to client to notify that a session was accepted and its new ID. /// - public class MsgViewVariablesOpenSession : NetMessage + public sealed class MsgViewVariablesOpenSession : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgViewVariablesRemoteData.cs b/Robust.Shared/Network/Messages/MsgViewVariablesRemoteData.cs index af061c2f5..b6b0fca7b 100644 --- a/Robust.Shared/Network/Messages/MsgViewVariablesRemoteData.cs +++ b/Robust.Shared/Network/Messages/MsgViewVariablesRemoteData.cs @@ -11,7 +11,7 @@ namespace Robust.Shared.Network.Messages /// /// Sent server to client to contain object data read by VV. /// - public class MsgViewVariablesRemoteData : NetMessage + public sealed class MsgViewVariablesRemoteData : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgViewVariablesReqData.cs b/Robust.Shared/Network/Messages/MsgViewVariablesReqData.cs index ee916c850..9a51d48b2 100644 --- a/Robust.Shared/Network/Messages/MsgViewVariablesReqData.cs +++ b/Robust.Shared/Network/Messages/MsgViewVariablesReqData.cs @@ -11,7 +11,7 @@ namespace Robust.Shared.Network.Messages /// /// Sent client to server to request data from the server. /// - public class MsgViewVariablesReqData : NetMessage + public sealed class MsgViewVariablesReqData : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/Messages/MsgViewVariablesReqSession.cs b/Robust.Shared/Network/Messages/MsgViewVariablesReqSession.cs index 656a5678a..97e154328 100644 --- a/Robust.Shared/Network/Messages/MsgViewVariablesReqSession.cs +++ b/Robust.Shared/Network/Messages/MsgViewVariablesReqSession.cs @@ -11,7 +11,7 @@ namespace Robust.Shared.Network.Messages /// /// Sent from client to server to request to open a session. /// - public class MsgViewVariablesReqSession : NetMessage + public sealed class MsgViewVariablesReqSession : NetMessage { public override MsgGroups MsgGroup => MsgGroups.Command; diff --git a/Robust.Shared/Network/NetChannelArgs.cs b/Robust.Shared/Network/NetChannelArgs.cs index f751550e5..28a432c5d 100644 --- a/Robust.Shared/Network/NetChannelArgs.cs +++ b/Robust.Shared/Network/NetChannelArgs.cs @@ -6,6 +6,7 @@ namespace Robust.Shared.Network /// /// Arguments for NetChannel events. /// + [Virtual] public class NetChannelArgs : EventArgs { /// @@ -26,7 +27,7 @@ namespace Robust.Shared.Network /// /// Arguments for incoming connection event. /// - public class NetConnectingArgs : EventArgs + public sealed class NetConnectingArgs : EventArgs { public bool IsDenied => DenyReason != null; @@ -65,7 +66,7 @@ namespace Robust.Shared.Network /// /// Arguments for a failed connection attempt. /// - public class NetConnectFailArgs : EventArgs + public sealed class NetConnectFailArgs : EventArgs { public NetConnectFailArgs(string reason) { @@ -75,7 +76,7 @@ namespace Robust.Shared.Network public string Reason { get; } } - public class NetDisconnectedArgs : NetChannelArgs + public sealed class NetDisconnectedArgs : NetChannelArgs { public NetDisconnectedArgs(INetChannel channel, string reason) : base(channel) { diff --git a/Robust.Shared/Network/NetManager.NetChannel.cs b/Robust.Shared/Network/NetManager.NetChannel.cs index 5d7d677ca..d8bb535aa 100644 --- a/Robust.Shared/Network/NetManager.NetChannel.cs +++ b/Robust.Shared/Network/NetManager.NetChannel.cs @@ -8,7 +8,7 @@ namespace Robust.Shared.Network { public partial class NetManager { - private class NetChannel : INetChannel + private sealed class NetChannel : INetChannel { private readonly NetManager _manager; private readonly NetConnection _connection; diff --git a/Robust.Shared/Network/NetManager.cs b/Robust.Shared/Network/NetManager.cs index f0708e486..aaf84da63 100644 --- a/Robust.Shared/Network/NetManager.cs +++ b/Robust.Shared/Network/NetManager.cs @@ -36,7 +36,7 @@ namespace Robust.Shared.Network /// /// Manages all network connections and packet IO. /// - public partial class NetManager : IClientNetManager, IServerNetManager + public sealed partial class NetManager : IClientNetManager, IServerNetManager { internal const int AesKeyLength = 32; @@ -1172,6 +1172,7 @@ namespace Robust.Shared.Network #endregion Events [Serializable] + [Virtual] public class ClientDisconnectedException : Exception { public ClientDisconnectedException() @@ -1193,7 +1194,7 @@ namespace Robust.Shared.Network } } - private class NetPeerData + private sealed class NetPeerData { public readonly NetPeer Peer; @@ -1231,6 +1232,7 @@ namespace Robust.Shared.Network /// /// Generic exception thrown by the NetManager class. /// + [Virtual] public class NetManagerException : Exception { public NetManagerException(string message) diff --git a/Robust.Shared/Network/NetMessageArgs.cs b/Robust.Shared/Network/NetMessageArgs.cs index 40de26531..d9e8e51cd 100644 --- a/Robust.Shared/Network/NetMessageArgs.cs +++ b/Robust.Shared/Network/NetMessageArgs.cs @@ -6,7 +6,7 @@ namespace Robust.Shared.Network /// /// Arguments for the MessageArrived event. This will be removed in the future. /// - public class NetMessageArgs : EventArgs + public sealed class NetMessageArgs : EventArgs { public NetMessage Message { get; } public NetIncomingMessage RawMessage { get; } diff --git a/Robust.Shared/Network/StringTable.cs b/Robust.Shared/Network/StringTable.cs index 240e1f0c1..849ffce0b 100644 --- a/Robust.Shared/Network/StringTable.cs +++ b/Robust.Shared/Network/StringTable.cs @@ -22,7 +22,7 @@ namespace Robust.Shared.Network /// /// Contains a networked mapping of IDs -> Strings. /// - public class StringTable + public sealed class StringTable { /// /// The ID of the packet. @@ -276,7 +276,7 @@ namespace Robust.Shared.Network /// /// A net message for transmitting a string table entry to clients. /// - public class MsgStringTableEntries : NetMessage + public sealed class MsgStringTableEntries : NetMessage { public override MsgGroups MsgGroup => MsgGroups.String; diff --git a/Robust.Shared/Noise/FastNoise.cs b/Robust.Shared/Noise/FastNoise.cs index f2cd3bd4c..088fa0676 100644 --- a/Robust.Shared/Noise/FastNoise.cs +++ b/Robust.Shared/Noise/FastNoise.cs @@ -41,7 +41,9 @@ using System.Runtime.CompilerServices; namespace Robust.Shared.Noise { +#pragma warning disable RA0003 internal class FastNoise +#pragma warning restore RA0003 { private const MethodImplOptions FN_INLINE = MethodImplOptions.AggressiveInlining; private const int FN_CELLULAR_INDEX_MAX = 3; diff --git a/Robust.Shared/Physics/BroadPhase/DynamicTreeBroadPhase.cs b/Robust.Shared/Physics/BroadPhase/DynamicTreeBroadPhase.cs index 3faeb09fa..891231420 100644 --- a/Robust.Shared/Physics/BroadPhase/DynamicTreeBroadPhase.cs +++ b/Robust.Shared/Physics/BroadPhase/DynamicTreeBroadPhase.cs @@ -4,7 +4,7 @@ using Robust.Shared.Physics.Dynamics; namespace Robust.Shared.Physics.Broadphase { - public class DynamicTreeBroadPhase : IBroadPhase + public sealed class DynamicTreeBroadPhase : IBroadPhase { private readonly B2DynamicTree _tree; diff --git a/Robust.Shared/Physics/Collision/DistanceProxy.cs b/Robust.Shared/Physics/Collision/DistanceProxy.cs index d60520a23..d4fb2bbf9 100644 --- a/Robust.Shared/Physics/Collision/DistanceProxy.cs +++ b/Robust.Shared/Physics/Collision/DistanceProxy.cs @@ -209,7 +209,7 @@ namespace Robust.Shared.Physics.Collision public Vector2 WB; } - internal class Simplex + internal sealed class Simplex { // Made it a class from a struct as it seemed silly to be a struct considering it's being mutated constantly. diff --git a/Robust.Shared/Physics/Collision/Shapes/PhysShapeAabb.cs b/Robust.Shared/Physics/Collision/Shapes/PhysShapeAabb.cs index d25c35e87..a5dee9a0d 100644 --- a/Robust.Shared/Physics/Collision/Shapes/PhysShapeAabb.cs +++ b/Robust.Shared/Physics/Collision/Shapes/PhysShapeAabb.cs @@ -17,7 +17,7 @@ namespace Robust.Shared.Physics.Collision.Shapes /// [Serializable, NetSerializable] [DataDefinition] - public class PhysShapeAabb : IPhysShape + public sealed class PhysShapeAabb : IPhysShape { public int ChildCount => 1; diff --git a/Robust.Shared/Physics/Collision/Shapes/PhysShapeCircle.cs b/Robust.Shared/Physics/Collision/Shapes/PhysShapeCircle.cs index baa7504fc..9f6c2f829 100644 --- a/Robust.Shared/Physics/Collision/Shapes/PhysShapeCircle.cs +++ b/Robust.Shared/Physics/Collision/Shapes/PhysShapeCircle.cs @@ -13,7 +13,7 @@ namespace Robust.Shared.Physics.Collision.Shapes /// [Serializable, NetSerializable] [DataDefinition] - public class PhysShapeCircle : IPhysShape + public sealed class PhysShapeCircle : IPhysShape { public int ChildCount => 1; diff --git a/Robust.Shared/Physics/Collision/Shapes/PolygonShape.cs b/Robust.Shared/Physics/Collision/Shapes/PolygonShape.cs index 463ce3720..1b0e3c422 100644 --- a/Robust.Shared/Physics/Collision/Shapes/PolygonShape.cs +++ b/Robust.Shared/Physics/Collision/Shapes/PolygonShape.cs @@ -35,7 +35,7 @@ namespace Robust.Shared.Physics.Collision.Shapes { [Serializable, NetSerializable] [DataDefinition] - public class PolygonShape : IPhysShape, ISerializationHooks, IApproxEquatable + public sealed class PolygonShape : IPhysShape, ISerializationHooks, IApproxEquatable { [ViewVariables] public int VertexCount => Vertices.Length; diff --git a/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs b/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs index 417b86555..1092c8bd3 100644 --- a/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs +++ b/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs @@ -40,6 +40,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Physics.Dynamics.Contacts { + [Virtual] public class Contact : IEquatable { [Dependency] private readonly IManifoldManager _manifoldManager = default!; diff --git a/Robust.Shared/Physics/Dynamics/Contacts/ContactHead.cs b/Robust.Shared/Physics/Dynamics/Contacts/ContactHead.cs index d28bc3930..8d11b80e1 100644 --- a/Robust.Shared/Physics/Dynamics/Contacts/ContactHead.cs +++ b/Robust.Shared/Physics/Dynamics/Contacts/ContactHead.cs @@ -24,7 +24,7 @@ namespace Robust.Shared.Physics.Dynamics.Contacts { // So Farseer uses List but box2d and aether both use a linkedlist for world contacts presumably because you need to frequently // and remove in the middle of enumeration so this is probably more brrrrrt - public class ContactHead : Contact, IEnumerable + public sealed class ContactHead : Contact, IEnumerable { internal ContactHead(): base(null, 0, null, 0) { diff --git a/Robust.Shared/Physics/Dynamics/FixtureProxy.cs b/Robust.Shared/Physics/Dynamics/FixtureProxy.cs index 863dd8c1b..fc36f119e 100644 --- a/Robust.Shared/Physics/Dynamics/FixtureProxy.cs +++ b/Robust.Shared/Physics/Dynamics/FixtureProxy.cs @@ -25,7 +25,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Shared.Physics.Dynamics { - public class FixtureProxy + public sealed class FixtureProxy { /// /// Grid-based AABB of this proxy. diff --git a/Robust.Shared/Physics/Dynamics/Joints/RevoluteJoint.cs b/Robust.Shared/Physics/Dynamics/Joints/RevoluteJoint.cs index 8a003e5eb..627ed7400 100644 --- a/Robust.Shared/Physics/Dynamics/Joints/RevoluteJoint.cs +++ b/Robust.Shared/Physics/Dynamics/Joints/RevoluteJoint.cs @@ -62,7 +62,7 @@ namespace Robust.Shared.Physics.Dynamics.Joints } } - public class RevoluteJoint : Joint, IEquatable + public sealed class RevoluteJoint : Joint, IEquatable { // Temporary private Vector2 _impulse; diff --git a/Robust.Shared/Physics/IslandSolveMessage.cs b/Robust.Shared/Physics/IslandSolveMessage.cs index e156ab81e..79fc551f4 100644 --- a/Robust.Shared/Physics/IslandSolveMessage.cs +++ b/Robust.Shared/Physics/IslandSolveMessage.cs @@ -3,7 +3,7 @@ using Robust.Shared.GameObjects; namespace Robust.Shared.Physics { - internal class IslandSolveMessage : EntityEventArgs + internal sealed class IslandSolveMessage : EntityEventArgs { public List Bodies { get; } diff --git a/Robust.Shared/Player/Filter.cs b/Robust.Shared/Player/Filter.cs index acb458ba6..4fa8f17ff 100644 --- a/Robust.Shared/Player/Filter.cs +++ b/Robust.Shared/Player/Filter.cs @@ -13,7 +13,7 @@ namespace Robust.Shared.Player /// Contains a set of recipients for a networked method call. /// [PublicAPI] - public class Filter + public sealed class Filter { private HashSet _recipients = new(); diff --git a/Robust.Shared/Prototypes/EntityPrototype.cs b/Robust.Shared/Prototypes/EntityPrototype.cs index b33984126..908319dd7 100644 --- a/Robust.Shared/Prototypes/EntityPrototype.cs +++ b/Robust.Shared/Prototypes/EntityPrototype.cs @@ -19,7 +19,7 @@ namespace Robust.Shared.Prototypes /// Prototype that represents game entities. /// [Prototype("entity", -1)] - public class EntityPrototype : IPrototype, IInheritingPrototype, ISerializationHooks + public sealed class EntityPrototype : IPrototype, IInheritingPrototype, ISerializationHooks { private ILocalizationManager _loc = default!; @@ -132,7 +132,7 @@ namespace Robust.Shared.Prototypes /// [ViewVariables] [DataField("save")] - public bool MapSavable { get; protected set; } = true; + public bool MapSavable { get; set; } = true; /// /// The prototype we inherit from. @@ -294,7 +294,7 @@ namespace Robust.Shared.Prototypes return $"EntityPrototype({ID})"; } - public class ComponentRegistry : Dictionary + public sealed class ComponentRegistry : Dictionary { public ComponentRegistry() { @@ -306,7 +306,7 @@ namespace Robust.Shared.Prototypes } [DataDefinition] - public class EntityPlacementProperties + public sealed class EntityPlacementProperties { public bool PlacementOverriden { get; private set; } public bool SnapOverriden { get; private set; } diff --git a/Robust.Shared/Prototypes/PrototypeInheritanceTree.cs b/Robust.Shared/Prototypes/PrototypeInheritanceTree.cs index 44a53e8c9..5ec2ef162 100644 --- a/Robust.Shared/Prototypes/PrototypeInheritanceTree.cs +++ b/Robust.Shared/Prototypes/PrototypeInheritanceTree.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace Robust.Shared.Prototypes { - public class PrototypeInheritanceTree + public sealed class PrototypeInheritanceTree { private Dictionary> _nodes = new(); diff --git a/Robust.Shared/Prototypes/PrototypeManager.cs b/Robust.Shared/Prototypes/PrototypeManager.cs index 43244e18e..d21fb2939 100644 --- a/Robust.Shared/Prototypes/PrototypeManager.cs +++ b/Robust.Shared/Prototypes/PrototypeManager.cs @@ -182,7 +182,7 @@ namespace Robust.Shared.Prototypes [BaseTypeRequired(typeof(IPrototype))] [MeansImplicitUse] [MeansDataDefinition] - public class PrototypeAttribute : Attribute + public sealed class PrototypeAttribute : Attribute { private readonly string type; public string Type => type; @@ -195,6 +195,7 @@ namespace Robust.Shared.Prototypes } } + [Virtual] public class PrototypeManager : IPrototypeManager { [Dependency] private readonly IReflectionManager _reflectionManager = default!; @@ -816,6 +817,7 @@ namespace Robust.Shared.Prototypes } [Serializable] + [Virtual] public class PrototypeLoadException : Exception { public PrototypeLoadException() @@ -836,6 +838,7 @@ namespace Robust.Shared.Prototypes } [Serializable] + [Virtual] public class UnknownPrototypeException : Exception { public override string Message => "Unknown prototype: " + Prototype; diff --git a/Robust.Shared/Random/RobustRandom.cs b/Robust.Shared/Random/RobustRandom.cs index 4d876da35..d8625927b 100644 --- a/Robust.Shared/Random/RobustRandom.cs +++ b/Robust.Shared/Random/RobustRandom.cs @@ -1,6 +1,6 @@ namespace Robust.Shared.Random { - public class RobustRandom : IRobustRandom + public sealed class RobustRandom : IRobustRandom { private readonly System.Random _random = new(); diff --git a/Robust.Shared/Reflection/ReflectionUpdateEventArgs.cs b/Robust.Shared/Reflection/ReflectionUpdateEventArgs.cs index d3b5e6dac..4c4d552c9 100644 --- a/Robust.Shared/Reflection/ReflectionUpdateEventArgs.cs +++ b/Robust.Shared/Reflection/ReflectionUpdateEventArgs.cs @@ -2,7 +2,7 @@ namespace Robust.Shared.Reflection { - public class ReflectionUpdateEventArgs : EventArgs + public sealed class ReflectionUpdateEventArgs : EventArgs { public readonly IReflectionManager ReflectionManager; public ReflectionUpdateEventArgs(IReflectionManager reflectionManager) diff --git a/Robust.Shared/SandboxArgumentException.cs b/Robust.Shared/SandboxArgumentException.cs index 1169172ee..08bbd9ac1 100644 --- a/Robust.Shared/SandboxArgumentException.cs +++ b/Robust.Shared/SandboxArgumentException.cs @@ -4,6 +4,7 @@ using System.Runtime.Serialization; namespace Robust.Shared { [Serializable] + [Virtual] public class SandboxArgumentException : Exception { public SandboxArgumentException() diff --git a/Robust.Shared/Serialization/ConstantsForAttribute.cs b/Robust.Shared/Serialization/ConstantsForAttribute.cs index 3969c0528..974fb75bd 100644 --- a/Robust.Shared/Serialization/ConstantsForAttribute.cs +++ b/Robust.Shared/Serialization/ConstantsForAttribute.cs @@ -12,7 +12,7 @@ namespace Robust.Shared.Serialization /// be reused between multiple fields. /// [AttributeUsage(AttributeTargets.Enum, AllowMultiple = true)] - public class ConstantsForAttribute : Attribute + public sealed class ConstantsForAttribute : Attribute { public Type Tag { get; } diff --git a/Robust.Shared/Serialization/FlagsForAttribute.cs b/Robust.Shared/Serialization/FlagsForAttribute.cs index 98a5bbbaf..969e82d7e 100644 --- a/Robust.Shared/Serialization/FlagsForAttribute.cs +++ b/Robust.Shared/Serialization/FlagsForAttribute.cs @@ -14,7 +14,7 @@ namespace Robust.Shared.Serialization /// be reused between multiple fields. /// [AttributeUsage(AttributeTargets.Enum, AllowMultiple = true, Inherited = false)] - public class FlagsForAttribute : Attribute + public sealed class FlagsForAttribute : Attribute { private readonly Type _tag; public Type Tag => _tag; diff --git a/Robust.Shared/Serialization/InvalidMappingException.cs b/Robust.Shared/Serialization/InvalidMappingException.cs index c958d9f5a..329fe7ba5 100644 --- a/Robust.Shared/Serialization/InvalidMappingException.cs +++ b/Robust.Shared/Serialization/InvalidMappingException.cs @@ -2,6 +2,7 @@ using System; namespace Robust.Shared.Serialization { + [Virtual] public class InvalidMappingException : Exception { diff --git a/Robust.Shared/Serialization/Manager/Attributes/AlwaysPushInheritanceAttribute.cs b/Robust.Shared/Serialization/Manager/Attributes/AlwaysPushInheritanceAttribute.cs index 84e9e8141..b75abf69b 100644 --- a/Robust.Shared/Serialization/Manager/Attributes/AlwaysPushInheritanceAttribute.cs +++ b/Robust.Shared/Serialization/Manager/Attributes/AlwaysPushInheritanceAttribute.cs @@ -4,7 +4,7 @@ namespace Robust.Shared.Serialization.Manager.Attributes { // TODO Serialization: find a way to constrain this to DataFields only & make exclusive w/ NeverPush [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class AlwaysPushInheritanceAttribute : Attribute + public sealed class AlwaysPushInheritanceAttribute : Attribute { } } diff --git a/Robust.Shared/Serialization/Manager/Attributes/CopyByRefAttribute.cs b/Robust.Shared/Serialization/Manager/Attributes/CopyByRefAttribute.cs index 12fa0486e..f85d26831 100644 --- a/Robust.Shared/Serialization/Manager/Attributes/CopyByRefAttribute.cs +++ b/Robust.Shared/Serialization/Manager/Attributes/CopyByRefAttribute.cs @@ -8,7 +8,7 @@ namespace Robust.Shared.Serialization.Manager.Attributes AttributeTargets.Enum | AttributeTargets.Interface, Inherited = false)] - public class CopyByRefAttribute : Attribute + public sealed class CopyByRefAttribute : Attribute { } } diff --git a/Robust.Shared/Serialization/Manager/Attributes/DataDefinitionAttribute.cs b/Robust.Shared/Serialization/Manager/Attributes/DataDefinitionAttribute.cs index f08663e20..0be603e5d 100644 --- a/Robust.Shared/Serialization/Manager/Attributes/DataDefinitionAttribute.cs +++ b/Robust.Shared/Serialization/Manager/Attributes/DataDefinitionAttribute.cs @@ -6,7 +6,7 @@ namespace Robust.Shared.Serialization.Manager.Attributes [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)] [MeansDataDefinition] [MeansImplicitUse] - public class DataDefinitionAttribute : Attribute + public sealed class DataDefinitionAttribute : Attribute { } } diff --git a/Robust.Shared/Serialization/Manager/Attributes/DataFieldAttribute.cs b/Robust.Shared/Serialization/Manager/Attributes/DataFieldAttribute.cs index e7f9e7d23..3da4f07d9 100644 --- a/Robust.Shared/Serialization/Manager/Attributes/DataFieldAttribute.cs +++ b/Robust.Shared/Serialization/Manager/Attributes/DataFieldAttribute.cs @@ -6,7 +6,7 @@ namespace Robust.Shared.Serialization.Manager.Attributes [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] [MeansImplicitAssignment] [MeansImplicitUse(ImplicitUseKindFlags.Assign)] - public class DataFieldAttribute : Attribute + public sealed class DataFieldAttribute : Attribute { public readonly string Tag; public readonly int Priority; diff --git a/Robust.Shared/Serialization/Manager/Attributes/ImplicitDataDefinitionForInheritorsAttribute.cs b/Robust.Shared/Serialization/Manager/Attributes/ImplicitDataDefinitionForInheritorsAttribute.cs index a307b5880..482fa97c1 100644 --- a/Robust.Shared/Serialization/Manager/Attributes/ImplicitDataDefinitionForInheritorsAttribute.cs +++ b/Robust.Shared/Serialization/Manager/Attributes/ImplicitDataDefinitionForInheritorsAttribute.cs @@ -3,7 +3,7 @@ using System; namespace Robust.Shared.Serialization.Manager.Attributes { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] - public class ImplicitDataDefinitionForInheritorsAttribute : Attribute + public sealed class ImplicitDataDefinitionForInheritorsAttribute : Attribute { } } diff --git a/Robust.Shared/Serialization/Manager/Attributes/MeansDataDefinitionAttribute.cs b/Robust.Shared/Serialization/Manager/Attributes/MeansDataDefinitionAttribute.cs index 85c1b8515..f73d772ab 100644 --- a/Robust.Shared/Serialization/Manager/Attributes/MeansDataDefinitionAttribute.cs +++ b/Robust.Shared/Serialization/Manager/Attributes/MeansDataDefinitionAttribute.cs @@ -5,7 +5,7 @@ namespace Robust.Shared.Serialization.Manager.Attributes { [BaseTypeRequired(typeof(Attribute))] [AttributeUsage(AttributeTargets.Class, Inherited = false)] - public class MeansDataDefinitionAttribute : Attribute + public sealed class MeansDataDefinitionAttribute : Attribute { } } diff --git a/Robust.Shared/Serialization/Manager/Attributes/NeverPushInheritanceAttribute.cs b/Robust.Shared/Serialization/Manager/Attributes/NeverPushInheritanceAttribute.cs index c57f809da..7c714865e 100644 --- a/Robust.Shared/Serialization/Manager/Attributes/NeverPushInheritanceAttribute.cs +++ b/Robust.Shared/Serialization/Manager/Attributes/NeverPushInheritanceAttribute.cs @@ -4,7 +4,7 @@ namespace Robust.Shared.Serialization.Manager.Attributes { // TODO Serialization: find a way to constrain this to DataField only & make exclusive w/ AlwaysPush [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class NeverPushInheritanceAttribute : Attribute + public sealed class NeverPushInheritanceAttribute : Attribute { } } diff --git a/Robust.Shared/Serialization/Manager/Attributes/TypeSerializerAttribute.cs b/Robust.Shared/Serialization/Manager/Attributes/TypeSerializerAttribute.cs index 75c970f9c..5222f630f 100644 --- a/Robust.Shared/Serialization/Manager/Attributes/TypeSerializerAttribute.cs +++ b/Robust.Shared/Serialization/Manager/Attributes/TypeSerializerAttribute.cs @@ -5,7 +5,7 @@ namespace Robust.Shared.Serialization.Manager.Attributes { [AttributeUsage(AttributeTargets.Class, Inherited = false)] [MeansImplicitUse] - public class TypeSerializerAttribute : Attribute + public sealed class TypeSerializerAttribute : Attribute { } } diff --git a/Robust.Shared/Serialization/Manager/Definition/DataDefinition.cs b/Robust.Shared/Serialization/Manager/Definition/DataDefinition.cs index 3a9e14eea..2cdcb926c 100644 --- a/Robust.Shared/Serialization/Manager/Definition/DataDefinition.cs +++ b/Robust.Shared/Serialization/Manager/Definition/DataDefinition.cs @@ -14,7 +14,7 @@ using static Robust.Shared.Serialization.Manager.SerializationManager; namespace Robust.Shared.Serialization.Manager.Definition { - public partial class DataDefinition + public sealed partial class DataDefinition { private readonly DeserializeDelegate _deserialize; private readonly PopulateDelegateSignature _populate; diff --git a/Robust.Shared/Serialization/Manager/Definition/FieldDefinition.cs b/Robust.Shared/Serialization/Manager/Definition/FieldDefinition.cs index fcb012158..99f5eeea0 100644 --- a/Robust.Shared/Serialization/Manager/Definition/FieldDefinition.cs +++ b/Robust.Shared/Serialization/Manager/Definition/FieldDefinition.cs @@ -4,7 +4,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.Manager.Definition { - internal class FieldDefinition + internal sealed class FieldDefinition { public FieldDefinition( DataFieldAttribute attr, diff --git a/Robust.Shared/Serialization/Manager/InvalidNodeTypeException.cs b/Robust.Shared/Serialization/Manager/InvalidNodeTypeException.cs index 183feda7a..ce5101873 100644 --- a/Robust.Shared/Serialization/Manager/InvalidNodeTypeException.cs +++ b/Robust.Shared/Serialization/Manager/InvalidNodeTypeException.cs @@ -2,6 +2,7 @@ using System; namespace Robust.Shared.Serialization.Manager { + [Virtual] public class InvalidNodeTypeException : Exception { public InvalidNodeTypeException() diff --git a/Robust.Shared/Serialization/Manager/RequiredDataFieldNotProvidedException.cs b/Robust.Shared/Serialization/Manager/RequiredDataFieldNotProvidedException.cs index c5b33cbff..68894ef00 100644 --- a/Robust.Shared/Serialization/Manager/RequiredDataFieldNotProvidedException.cs +++ b/Robust.Shared/Serialization/Manager/RequiredDataFieldNotProvidedException.cs @@ -2,6 +2,7 @@ using System; namespace Robust.Shared.Serialization.Manager { + [Virtual] public class RequiredDataFieldNotProvidedException : Exception { } diff --git a/Robust.Shared/Serialization/Manager/Result/DeserializedArray.cs b/Robust.Shared/Serialization/Manager/Result/DeserializedArray.cs index ec24af49e..504c7a881 100644 --- a/Robust.Shared/Serialization/Manager/Result/DeserializedArray.cs +++ b/Robust.Shared/Serialization/Manager/Result/DeserializedArray.cs @@ -2,7 +2,7 @@ namespace Robust.Shared.Serialization.Manager.Result { - public class DeserializedArray : DeserializationResult + public sealed class DeserializedArray : DeserializationResult { public DeserializedArray(Array array, DeserializationResult[] mappings) { diff --git a/Robust.Shared/Serialization/Manager/Result/DeserializedCollection.cs b/Robust.Shared/Serialization/Manager/Result/DeserializedCollection.cs index 121ba2883..cbed6d0e8 100644 --- a/Robust.Shared/Serialization/Manager/Result/DeserializedCollection.cs +++ b/Robust.Shared/Serialization/Manager/Result/DeserializedCollection.cs @@ -2,7 +2,7 @@ namespace Robust.Shared.Serialization.Manager.Result { - public class DeserializedCollection : DeserializationResult where TCollection : IReadOnlyCollection + public sealed class DeserializedCollection : DeserializationResult where TCollection : IReadOnlyCollection { public delegate TCollection Create(List elements); diff --git a/Robust.Shared/Serialization/Manager/Result/DeserializedComponentRegistry.cs b/Robust.Shared/Serialization/Manager/Result/DeserializedComponentRegistry.cs index 1be65c57b..87323aa76 100644 --- a/Robust.Shared/Serialization/Manager/Result/DeserializedComponentRegistry.cs +++ b/Robust.Shared/Serialization/Manager/Result/DeserializedComponentRegistry.cs @@ -7,7 +7,7 @@ using static Robust.Shared.Prototypes.EntityPrototype; namespace Robust.Shared.Serialization.Manager.Result { - public class DeserializedComponentRegistry : DeserializationResult + public sealed class DeserializedComponentRegistry : DeserializationResult { public DeserializedComponentRegistry( ComponentRegistry value, diff --git a/Robust.Shared/Serialization/Manager/Result/DeserializedDefinition.cs b/Robust.Shared/Serialization/Manager/Result/DeserializedDefinition.cs index 324cb024b..f125bb289 100644 --- a/Robust.Shared/Serialization/Manager/Result/DeserializedDefinition.cs +++ b/Robust.Shared/Serialization/Manager/Result/DeserializedDefinition.cs @@ -3,7 +3,7 @@ using Robust.Shared.IoC; namespace Robust.Shared.Serialization.Manager.Result { - public class DeserializedDefinition : DeserializationResult, IDeserializedDefinition where T : notnull, new() + public sealed class DeserializedDefinition : DeserializationResult, IDeserializedDefinition where T : notnull, new() { public DeserializedDefinition(T value, DeserializedFieldEntry[] mapping) { diff --git a/Robust.Shared/Serialization/Manager/Result/DeserializedDictionary.cs b/Robust.Shared/Serialization/Manager/Result/DeserializedDictionary.cs index 303366981..0376c3f6d 100644 --- a/Robust.Shared/Serialization/Manager/Result/DeserializedDictionary.cs +++ b/Robust.Shared/Serialization/Manager/Result/DeserializedDictionary.cs @@ -2,7 +2,7 @@ namespace Robust.Shared.Serialization.Manager.Result { - public class DeserializedDictionary : + public sealed class DeserializedDictionary : DeserializationResult where TKey : notnull where TDict : IReadOnlyDictionary diff --git a/Robust.Shared/Serialization/Manager/Result/DeserializedFieldEntry.cs b/Robust.Shared/Serialization/Manager/Result/DeserializedFieldEntry.cs index 8a007ee29..554900e92 100644 --- a/Robust.Shared/Serialization/Manager/Result/DeserializedFieldEntry.cs +++ b/Robust.Shared/Serialization/Manager/Result/DeserializedFieldEntry.cs @@ -2,7 +2,7 @@ namespace Robust.Shared.Serialization.Manager.Result { - public class DeserializedFieldEntry + public sealed class DeserializedFieldEntry { public DeserializedFieldEntry(bool mapped, InheritanceBehavior inheritanceBehavior, DeserializationResult? result = null) { diff --git a/Robust.Shared/Serialization/Manager/Result/DeserializedValue.cs b/Robust.Shared/Serialization/Manager/Result/DeserializedValue.cs index 2b604160e..349b6d156 100644 --- a/Robust.Shared/Serialization/Manager/Result/DeserializedValue.cs +++ b/Robust.Shared/Serialization/Manager/Result/DeserializedValue.cs @@ -1,6 +1,6 @@ namespace Robust.Shared.Serialization.Manager.Result { - public class DeserializedValue : DeserializationResult + public sealed class DeserializedValue : DeserializationResult { public DeserializedValue(object? value) { @@ -26,7 +26,7 @@ } } - public class DeserializedValue : DeserializationResult + public sealed class DeserializedValue : DeserializationResult { public DeserializedValue(T value) { diff --git a/Robust.Shared/Serialization/Manager/Result/InvalidDeserializedResultTypeException.cs b/Robust.Shared/Serialization/Manager/Result/InvalidDeserializedResultTypeException.cs index 09226a8e0..082ab7a7a 100644 --- a/Robust.Shared/Serialization/Manager/Result/InvalidDeserializedResultTypeException.cs +++ b/Robust.Shared/Serialization/Manager/Result/InvalidDeserializedResultTypeException.cs @@ -4,6 +4,7 @@ using JetBrains.Annotations; namespace Robust.Shared.Serialization.Manager.Result { + [Virtual] public class InvalidDeserializedResultTypeException : Exception { public readonly Type ReceivedType; diff --git a/Robust.Shared/Serialization/Manager/SerializationManager.cs b/Robust.Shared/Serialization/Manager/SerializationManager.cs index 6d0a6bb97..a8f86c1bf 100644 --- a/Robust.Shared/Serialization/Manager/SerializationManager.cs +++ b/Robust.Shared/Serialization/Manager/SerializationManager.cs @@ -25,7 +25,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.Manager { - public partial class SerializationManager : ISerializationManager + public sealed partial class SerializationManager : ISerializationManager { [IoC.Dependency] private readonly IReflectionManager _reflectionManager = default!; diff --git a/Robust.Shared/Serialization/Markdown/Mapping/MappingDataNode.cs b/Robust.Shared/Serialization/Markdown/Mapping/MappingDataNode.cs index d4681f5fd..9e3714363 100644 --- a/Robust.Shared/Serialization/Markdown/Mapping/MappingDataNode.cs +++ b/Robust.Shared/Serialization/Markdown/Mapping/MappingDataNode.cs @@ -9,7 +9,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.Shared.Serialization.Markdown.Mapping { - public class MappingDataNode : DataNode + public sealed class MappingDataNode : DataNode { // To fetch nodes by key name with YAML, we NEED a YamlScalarNode. // We use a thread local one to avoid allocating one every fetch, since we just replace the inner value. diff --git a/Robust.Shared/Serialization/Markdown/Sequence/SequenceDataNode.cs b/Robust.Shared/Serialization/Markdown/Sequence/SequenceDataNode.cs index aab42621d..853d08846 100644 --- a/Robust.Shared/Serialization/Markdown/Sequence/SequenceDataNode.cs +++ b/Robust.Shared/Serialization/Markdown/Sequence/SequenceDataNode.cs @@ -5,7 +5,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.Shared.Serialization.Markdown.Sequence { - public class SequenceDataNode : DataNode + public sealed class SequenceDataNode : DataNode { private readonly List _nodes = new(); diff --git a/Robust.Shared/Serialization/Markdown/Validation/ErrorNode.cs b/Robust.Shared/Serialization/Markdown/Validation/ErrorNode.cs index c0b288fc1..916b7059a 100644 --- a/Robust.Shared/Serialization/Markdown/Validation/ErrorNode.cs +++ b/Robust.Shared/Serialization/Markdown/Validation/ErrorNode.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace Robust.Shared.Serialization.Markdown.Validation { - public class ErrorNode : ValidationNode, IEquatable + public sealed class ErrorNode : ValidationNode, IEquatable { public ErrorNode(DataNode node, string errorReason, bool alwaysRelevant = true) { diff --git a/Robust.Shared/Serialization/Markdown/Validation/InconclusiveNode.cs b/Robust.Shared/Serialization/Markdown/Validation/InconclusiveNode.cs index 9b6411533..312d27cac 100644 --- a/Robust.Shared/Serialization/Markdown/Validation/InconclusiveNode.cs +++ b/Robust.Shared/Serialization/Markdown/Validation/InconclusiveNode.cs @@ -3,7 +3,7 @@ using System.Linq; namespace Robust.Shared.Serialization.Markdown.Validation { - public class InconclusiveNode : ValidationNode + public sealed class InconclusiveNode : ValidationNode { public InconclusiveNode(DataNode dataNode) { diff --git a/Robust.Shared/Serialization/Markdown/Validation/ValidatedMappingNode.cs b/Robust.Shared/Serialization/Markdown/Validation/ValidatedMappingNode.cs index e10049eb5..1eee90da3 100644 --- a/Robust.Shared/Serialization/Markdown/Validation/ValidatedMappingNode.cs +++ b/Robust.Shared/Serialization/Markdown/Validation/ValidatedMappingNode.cs @@ -3,7 +3,7 @@ using System.Linq; namespace Robust.Shared.Serialization.Markdown.Validation { - public class ValidatedMappingNode : ValidationNode + public sealed class ValidatedMappingNode : ValidationNode { public ValidatedMappingNode(Dictionary mapping) { diff --git a/Robust.Shared/Serialization/Markdown/Validation/ValidatedSequenceNode.cs b/Robust.Shared/Serialization/Markdown/Validation/ValidatedSequenceNode.cs index f4e83cccb..c99c44bc9 100644 --- a/Robust.Shared/Serialization/Markdown/Validation/ValidatedSequenceNode.cs +++ b/Robust.Shared/Serialization/Markdown/Validation/ValidatedSequenceNode.cs @@ -3,7 +3,7 @@ using System.Linq; namespace Robust.Shared.Serialization.Markdown.Validation { - public class ValidatedSequenceNode : ValidationNode + public sealed class ValidatedSequenceNode : ValidationNode { public ValidatedSequenceNode(List sequence) { diff --git a/Robust.Shared/Serialization/Markdown/Validation/ValidatedValueNode.cs b/Robust.Shared/Serialization/Markdown/Validation/ValidatedValueNode.cs index 3c7c75569..c2a1832e0 100644 --- a/Robust.Shared/Serialization/Markdown/Validation/ValidatedValueNode.cs +++ b/Robust.Shared/Serialization/Markdown/Validation/ValidatedValueNode.cs @@ -3,7 +3,7 @@ using System.Linq; namespace Robust.Shared.Serialization.Markdown.Validation { - public class ValidatedValueNode : ValidationNode + public sealed class ValidatedValueNode : ValidationNode { public ValidatedValueNode(DataNode dataNode) { diff --git a/Robust.Shared/Serialization/Markdown/Value/ValueDataNode.cs b/Robust.Shared/Serialization/Markdown/Value/ValueDataNode.cs index 494da715c..be87606ae 100644 --- a/Robust.Shared/Serialization/Markdown/Value/ValueDataNode.cs +++ b/Robust.Shared/Serialization/Markdown/Value/ValueDataNode.cs @@ -2,7 +2,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.Shared.Serialization.Markdown.Value { - public class ValueDataNode : DataNode + public sealed class ValueDataNode : DataNode { public ValueDataNode(string value) : base(NodeMark.Invalid, NodeMark.Invalid) { diff --git a/Robust.Shared/Serialization/NetSerializableAttribute.cs b/Robust.Shared/Serialization/NetSerializableAttribute.cs index 0d43cebff..ef4622275 100644 --- a/Robust.Shared/Serialization/NetSerializableAttribute.cs +++ b/Robust.Shared/Serialization/NetSerializableAttribute.cs @@ -10,7 +10,7 @@ namespace Robust.Shared.Serialization /// for more info. /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = false, Inherited = false)] - public class NetSerializableAttribute : Attribute + public sealed class NetSerializableAttribute : Attribute { } } diff --git a/Robust.Shared/Serialization/RobustSerializer.cs b/Robust.Shared/Serialization/RobustSerializer.cs index c51ce1452..6cfa70330 100644 --- a/Robust.Shared/Serialization/RobustSerializer.cs +++ b/Robust.Shared/Serialization/RobustSerializer.cs @@ -14,7 +14,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization { - public partial class RobustSerializer : IRobustSerializer + public sealed partial class RobustSerializer : IRobustSerializer { [Dependency] private readonly IReflectionManager _reflectionManager = default!; [Dependency] private readonly IRobustMappedStringSerializer _mappedStringSerializer = default!; diff --git a/Robust.Shared/Serialization/SerializedTypeAttribute.cs b/Robust.Shared/Serialization/SerializedTypeAttribute.cs index cc5f3945e..dbfcf1ad8 100644 --- a/Robust.Shared/Serialization/SerializedTypeAttribute.cs +++ b/Robust.Shared/Serialization/SerializedTypeAttribute.cs @@ -3,7 +3,7 @@ namespace Robust.Shared.Serialization { [AttributeUsage(AttributeTargets.Class, Inherited = false)] - public class SerializedTypeAttribute : Attribute + public sealed class SerializedTypeAttribute : Attribute { /// /// Name of this type in serialized files. diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/AngleSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/AngleSerializer.cs index b10df1cce..0482c9aca 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/AngleSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/AngleSerializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class AngleSerializer : ITypeSerializer + public sealed class AngleSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Box2Serializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Box2Serializer.cs index 48b77b69b..8cda51875 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Box2Serializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Box2Serializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class Box2Serializer : ITypeSerializer + public sealed class Box2Serializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/ColorSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/ColorSerializer.cs index 9e8040ace..3ef586aa2 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/ColorSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/ColorSerializer.cs @@ -12,7 +12,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class ColorSerializer : ITypeSerializer + public sealed class ColorSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/ComponentRegistrySerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/ComponentRegistrySerializer.cs index bcf413812..12c9ee903 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/ComponentRegistrySerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/ComponentRegistrySerializer.cs @@ -19,7 +19,7 @@ using static Robust.Shared.Prototypes.EntityPrototype; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class ComponentRegistrySerializer : ITypeSerializer + public sealed class ComponentRegistrySerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, SequenceDataNode node, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/ConstantSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/ConstantSerializer.cs index cc7fdeb7b..8d03209e1 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/ConstantSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/ConstantSerializer.cs @@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom { - public class ConstantSerializer : ITypeSerializer + public sealed class ConstantSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/FlagSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/FlagSerializer.cs index c1f13d7e4..69d1a98e8 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/FlagSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/FlagSerializer.cs @@ -10,7 +10,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom { - public class FlagSerializer : ITypeSerializer, ITypeReader + public sealed class FlagSerializer : ITypeSerializer, ITypeReader { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/Dictionary/PrototypeIdDictionarySerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/Dictionary/PrototypeIdDictionarySerializer.cs index 6aa28c174..70f2c9be5 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/Dictionary/PrototypeIdDictionarySerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/Dictionary/PrototypeIdDictionarySerializer.cs @@ -14,7 +14,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary { // [TypeSerializer] - public class PrototypeIdDictionarySerializer : + public sealed class PrototypeIdDictionarySerializer : ITypeSerializer, MappingDataNode>, ITypeSerializer, MappingDataNode>, ITypeSerializer, MappingDataNode> diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ImmutableList.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ImmutableList.cs index b8ffdc4d5..bbcd046e4 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ImmutableList.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ImmutableList.cs @@ -12,7 +12,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List { - public partial class PrototypeIdListSerializer : + public sealed partial class PrototypeIdListSerializer : ITypeSerializer, SequenceDataNode> where T : class, IPrototype { diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ReadOnlyCollection.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ReadOnlyCollection.cs index 1f9c4d15a..aa169f7ac 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ReadOnlyCollection.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ReadOnlyCollection.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List { - public partial class PrototypeIdListSerializer : + public sealed partial class PrototypeIdListSerializer : ITypeSerializer, SequenceDataNode> where T : class, IPrototype { diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ReadOnlyList.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ReadOnlyList.cs index e9e49ef7d..1443fbe83 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ReadOnlyList.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.ReadOnlyList.cs @@ -12,7 +12,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List { - public partial class PrototypeIdListSerializer : ITypeSerializer, SequenceDataNode> + public sealed partial class PrototypeIdListSerializer : ITypeSerializer, SequenceDataNode> where T : class, IPrototype { DataNode ITypeWriter>.Write( diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.cs index f43f81501..8036d2da7 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/List/PrototypeIdListSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List { - public partial class PrototypeIdListSerializer : ITypeSerializer, SequenceDataNode> where T : class, IPrototype + public sealed partial class PrototypeIdListSerializer : ITypeSerializer, SequenceDataNode> where T : class, IPrototype { private readonly PrototypeIdSerializer _prototypeSerializer = new(); diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/PrototypeFlagsTypeSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/PrototypeFlagsTypeSerializer.cs index 462221ac9..c661163a6 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/PrototypeFlagsTypeSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/PrototypeFlagsTypeSerializer.cs @@ -15,7 +15,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype { [TypeSerializer] - public class PrototypeFlagsTypeSerializer + public sealed class PrototypeFlagsTypeSerializer : ITypeSerializer, SequenceDataNode>, ITypeSerializer, ValueDataNode> where T : class, IPrototype { diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/PrototypeIdSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/PrototypeIdSerializer.cs index a91a38cf3..722b0c066 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/PrototypeIdSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/PrototypeIdSerializer.cs @@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype { - public class PrototypeIdSerializer : ITypeSerializer where TPrototype : class, IPrototype + public sealed class PrototypeIdSerializer : ITypeSerializer where TPrototype : class, IPrototype { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/Set/PrototypeIdHashSetSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/Set/PrototypeIdHashSetSerializer.cs index a317f23a2..9bc9b2e35 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/Set/PrototypeIdHashSetSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Custom/Prototype/Set/PrototypeIdHashSetSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set { - public class PrototypeIdHashSetSerializer : ITypeSerializer, SequenceDataNode> where TPrototype : class, IPrototype + public sealed class PrototypeIdHashSetSerializer : ITypeSerializer, SequenceDataNode> where TPrototype : class, IPrototype { private readonly PrototypeIdSerializer _prototypeSerializer = new(); diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/FormattedMessageSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/FormattedMessageSerializer.cs index 70f11b495..124bc837c 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/FormattedMessageSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/FormattedMessageSerializer.cs @@ -12,7 +12,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class FormattedMessageSerializer : ITypeSerializer + public sealed class FormattedMessageSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, bool skipHook, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/DictionarySerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/DictionarySerializer.cs index 3574b1ca7..4f62ee230 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/DictionarySerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/DictionarySerializer.cs @@ -14,7 +14,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Generic { [TypeSerializer] - public class DictionarySerializer : + public sealed class DictionarySerializer : ITypeSerializer, MappingDataNode>, ITypeSerializer, MappingDataNode>, ITypeSerializer, MappingDataNode> where TKey : notnull diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/HashSetSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/HashSetSerializer.cs index 4ada84dec..7b56e4800 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/HashSetSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/HashSetSerializer.cs @@ -15,7 +15,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Generic { [TypeSerializer] - public class HashSetSerializer : + public sealed class HashSetSerializer : ITypeSerializer, SequenceDataNode>, ITypeSerializer, SequenceDataNode> { diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/ListSerializers.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/ListSerializers.cs index 5310461cf..3dfcce0fe 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/ListSerializers.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/ListSerializers.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Generic { [TypeSerializer] - public class ListSerializers : + public sealed class ListSerializers : ITypeSerializer, SequenceDataNode>, ITypeSerializer, SequenceDataNode>, ITypeSerializer, SequenceDataNode>, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/ValueTupleSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/ValueTupleSerializer.cs index a860cb9e3..e67735648 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/ValueTupleSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Generic/ValueTupleSerializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Generic { [TypeSerializer] - public class ValueTupleSerializer : ITypeSerializer, MappingDataNode> + public sealed class ValueTupleSerializer : ITypeSerializer, MappingDataNode> { public DeserializationResult Read(ISerializationManager serializationManager, MappingDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/MapIdSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/MapIdSerializer.cs index b8cb4f344..7e0a66650 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/MapIdSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/MapIdSerializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class MapIdSerializer : ITypeSerializer + public sealed class MapIdSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/BooleanSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/BooleanSerializer.cs index 1818acd42..99a3d769e 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/BooleanSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/BooleanSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class BooleanSerializer : ITypeSerializer + public sealed class BooleanSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ByteSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ByteSerializer.cs index ea49b59b2..2c921e9c1 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ByteSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ByteSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class ByteSerializer : ITypeSerializer + public sealed class ByteSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/CharSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/CharSerializer.cs index 0f2d5fcd0..bc282594d 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/CharSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/CharSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class CharSerializer : ITypeSerializer + public sealed class CharSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/DecimalSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/DecimalSerializer.cs index 873a54404..9baa1567b 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/DecimalSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/DecimalSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class DecimalSerializer : ITypeSerializer + public sealed class DecimalSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/DoubleSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/DoubleSerializer.cs index b7b4398b7..a01d9e549 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/DoubleSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/DoubleSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class DoubleSerializer : ITypeSerializer + public sealed class DoubleSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/FloatSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/FloatSerializer.cs index ee1088ac0..f51f420cc 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/FloatSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/FloatSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class FloatSerializer : ITypeSerializer + public sealed class FloatSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/IntSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/IntSerializer.cs index 320d0a7f2..a0a1bbd60 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/IntSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/IntSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class IntSerializer : ITypeSerializer + public sealed class IntSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/LongSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/LongSerializer.cs index 8e93883e0..bfde65b28 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/LongSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/LongSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class LongSerializer : ITypeSerializer + public sealed class LongSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/SByteSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/SByteSerializer.cs index e49d1b183..01fd5bbaf 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/SByteSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/SByteSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class SByteSerializer : ITypeSerializer + public sealed class SByteSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ShortSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ShortSerializer.cs index 1ced1c416..121027fd5 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ShortSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ShortSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class ShortSerializer : ITypeSerializer + public sealed class ShortSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/UIntSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/UIntSerializer.cs index 51924db2c..0a14b0022 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/UIntSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/UIntSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class UIntSerializer : ITypeSerializer + public sealed class UIntSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ULongSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ULongSerializer.cs index ceec5daa5..04b429fc0 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ULongSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/ULongSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class ULongSerializer : ITypeSerializer + public sealed class ULongSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/UShortSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/UShortSerializer.cs index a62465b6f..4a4065ecf 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/UShortSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Primitive/UShortSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations.Primitive { [TypeSerializer] - public class UShortSerializer : ITypeSerializer + public sealed class UShortSerializer : ITypeSerializer { public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, ISerializationContext? context = null) diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/RegexSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/RegexSerializer.cs index b1012bfef..ede651afa 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/RegexSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/RegexSerializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class RegexSerializer : ITypeSerializer + public sealed class RegexSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/ResourcePathSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/ResourcePathSerializer.cs index c22311286..9402e85aa 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/ResourcePathSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/ResourcePathSerializer.cs @@ -16,7 +16,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class ResourcePathSerializer : ITypeSerializer + public sealed class ResourcePathSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/SpriteSpecifierSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/SpriteSpecifierSerializer.cs index e2add3e14..9c025fe84 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/SpriteSpecifierSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/SpriteSpecifierSerializer.cs @@ -15,7 +15,7 @@ using static Robust.Shared.Utility.SpriteSpecifier; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class SpriteSpecifierSerializer : + public sealed class SpriteSpecifierSerializer : ITypeSerializer, ITypeSerializer, ITypeSerializer, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/StringSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/StringSerializer.cs index 14fd730c1..9fa8f27cf 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/StringSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/StringSerializer.cs @@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class StringSerializer : ITypeSerializer + public sealed class StringSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/TimespanSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/TimespanSerializer.cs index 10fa2ca49..5a568d4e0 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/TimespanSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/TimespanSerializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class TimespanSerializer : ITypeSerializer + public sealed class TimespanSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/TypeSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/TypeSerializer.cs index 8c117c04a..56b98baf6 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/TypeSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/TypeSerializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class TypeSerializer : ITypeSerializer + public sealed class TypeSerializer : ITypeSerializer { private static readonly Dictionary Shortcuts = new () { diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/UIBox2Serializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/UIBox2Serializer.cs index 2a55a5e13..012ba430b 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/UIBox2Serializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/UIBox2Serializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class UIBox2Serializer : ITypeSerializer + public sealed class UIBox2Serializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector2Serializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector2Serializer.cs index 3605add28..57b76b2a9 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector2Serializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector2Serializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class Vector2Serializer : ITypeSerializer + public sealed class Vector2Serializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector2iSerializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector2iSerializer.cs index ffd0b276d..926631bbe 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector2iSerializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector2iSerializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class Vector2iSerializer : ITypeSerializer + public sealed class Vector2iSerializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector3Serializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector3Serializer.cs index 59c6fa28e..ac90660b3 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector3Serializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector3Serializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class Vector3Serializer : ITypeSerializer + public sealed class Vector3Serializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector4Serializer.cs b/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector4Serializer.cs index 031df5b0f..bb5b5f91f 100644 --- a/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector4Serializer.cs +++ b/Robust.Shared/Serialization/TypeSerializers/Implementations/Vector4Serializer.cs @@ -13,7 +13,7 @@ using Robust.Shared.Utility; namespace Robust.Shared.Serialization.TypeSerializers.Implementations { [TypeSerializer] - public class Vector4Serializer : ITypeSerializer + public sealed class Vector4Serializer : ITypeSerializer { public DeserializationResult Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, diff --git a/Robust.Shared/Serialization/YamlMappingFix.cs b/Robust.Shared/Serialization/YamlMappingFix.cs index 188fa436c..2ee879fa8 100644 --- a/Robust.Shared/Serialization/YamlMappingFix.cs +++ b/Robust.Shared/Serialization/YamlMappingFix.cs @@ -7,7 +7,7 @@ namespace Robust.Shared.Serialization /// TODO: This fix exists because of https://github.com/aaubry/YamlDotNet/issues/409. /// Credit: https://stackoverflow.com/a/56452440 /// - public class YamlMappingFix : IEmitter + public sealed class YamlMappingFix : IEmitter { private readonly IEmitter _next; diff --git a/Robust.Shared/Timing/GameLoop.cs b/Robust.Shared/Timing/GameLoop.cs index 62c40ca9e..612e3adf6 100644 --- a/Robust.Shared/Timing/GameLoop.cs +++ b/Robust.Shared/Timing/GameLoop.cs @@ -46,7 +46,7 @@ namespace Robust.Shared.Timing /// /// Manages the main game loop for a GameContainer. /// - public class GameLoop : IGameLoop + public sealed class GameLoop : IGameLoop { private static readonly Histogram _frameTimeHistogram = Metrics.CreateHistogram( "robust_game_loop_frametime", diff --git a/Robust.Shared/Timing/GameTiming.cs b/Robust.Shared/Timing/GameTiming.cs index 9f4092f0d..097888257 100644 --- a/Robust.Shared/Timing/GameTiming.cs +++ b/Robust.Shared/Timing/GameTiming.cs @@ -7,6 +7,7 @@ namespace Robust.Shared.Timing /// /// This holds main loop timing information and helper functions. /// + [Virtual] public class GameTiming : IGameTiming { // number of sample frames to store for profiling diff --git a/Robust.Shared/Timing/Stopwatch.cs b/Robust.Shared/Timing/Stopwatch.cs index 96387a51a..0e97d22e0 100644 --- a/Robust.Shared/Timing/Stopwatch.cs +++ b/Robust.Shared/Timing/Stopwatch.cs @@ -6,7 +6,7 @@ namespace Robust.Shared.Timing /// Provides a set of methods and properties that you can use to accurately /// measure elapsed time. /// - public class Stopwatch : IStopwatch + public sealed class Stopwatch : IStopwatch { private readonly System.Diagnostics.Stopwatch _stopwatch; diff --git a/Robust.Shared/Timing/Timer.cs b/Robust.Shared/Timing/Timer.cs index e537cc3dd..d024559b2 100644 --- a/Robust.Shared/Timing/Timer.cs +++ b/Robust.Shared/Timing/Timer.cs @@ -6,7 +6,7 @@ using Robust.Shared.IoC; namespace Robust.Shared.Timing { - public class Timer + public sealed class Timer { /// /// Counts the time (in milliseconds) before firing again. diff --git a/Robust.Shared/Using.cs b/Robust.Shared/Using.cs new file mode 100644 index 000000000..daaa0a738 --- /dev/null +++ b/Robust.Shared/Using.cs @@ -0,0 +1 @@ +global using Robust.Shared.Analyzers; diff --git a/Robust.Shared/Utility/DebugTools.cs b/Robust.Shared/Utility/DebugTools.cs index d6ffe7dd0..d6af16480 100644 --- a/Robust.Shared/Utility/DebugTools.cs +++ b/Robust.Shared/Utility/DebugTools.cs @@ -88,6 +88,7 @@ namespace Robust.Shared.Utility } } + [Virtual] public class DebugAssertException : Exception { public DebugAssertException() diff --git a/Robust.Shared/Utility/ILGeneratorExt.cs b/Robust.Shared/Utility/ILGeneratorExt.cs index fb70d39f9..fac3ed6a1 100644 --- a/Robust.Shared/Utility/ILGeneratorExt.cs +++ b/Robust.Shared/Utility/ILGeneratorExt.cs @@ -15,7 +15,7 @@ namespace Robust.Shared.Utility } - public class RobustILGenerator + public sealed class RobustILGenerator { private ILGenerator _generator; private List<(object, object?)> _log = new(); @@ -39,44 +39,44 @@ namespace Robust.Shared.Utility _log.Add((opcode, arg)); } - public virtual LocalBuilder DeclareLocal(Type localType) + public LocalBuilder DeclareLocal(Type localType) { return DeclareLocal(localType, false); } - public virtual LocalBuilder DeclareLocal(Type localType, bool pinned) + public LocalBuilder DeclareLocal(Type localType, bool pinned) { var loc = _generator.DeclareLocal(localType, pinned); _locals.Add((localType, loc.LocalIndex)); return loc; } - public virtual void ThrowException([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type excType) + public void ThrowException([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type excType) { //this just calls emit _generator.ThrowException(excType); } - public virtual Label DefineLabel() + public Label DefineLabel() { var label = _generator.DefineLabel(); //Log("DefineLabel", label); return label; } - public virtual void MarkLabel(Label loc) + public void MarkLabel(Label loc) { _generator.MarkLabel(loc); Log("MarkLabel", loc.GetHashCode()); } - public virtual void Emit(OpCode opcode) + public void Emit(OpCode opcode) { _generator.Emit(opcode); Log(opcode); } - public virtual void Emit(OpCode opcode, byte arg) + public void Emit(OpCode opcode, byte arg) { _generator.Emit(opcode, arg); Log(opcode, arg); @@ -88,19 +88,19 @@ namespace Robust.Shared.Utility Log(opcode, arg); } - public virtual void Emit(OpCode opcode, short arg) + public void Emit(OpCode opcode, short arg) { _generator.Emit(opcode, arg); Log(opcode, arg); } - public virtual void Emit(OpCode opcode, int arg) + public void Emit(OpCode opcode, int arg) { _generator.Emit(opcode, arg); Log(opcode, arg); } - public virtual void Emit(OpCode opcode, MethodInfo meth) + public void Emit(OpCode opcode, MethodInfo meth) { _generator.Emit(opcode, meth); Log(opcode, meth); @@ -116,73 +116,73 @@ namespace Robust.Shared.Utility // } // - public virtual void EmitCall(OpCode opcode, MethodInfo methodInfo, params Type[]? optionalParameterTypes) + public void EmitCall(OpCode opcode, MethodInfo methodInfo, params Type[]? optionalParameterTypes) { _generator.EmitCall(opcode, methodInfo, optionalParameterTypes); Log(opcode, methodInfo); } - public virtual void Emit(OpCode opcode, SignatureHelper signature) + public void Emit(OpCode opcode, SignatureHelper signature) { _generator.Emit(opcode, signature); Log(opcode, signature); } - public virtual void Emit(OpCode opcode, ConstructorInfo con) + public void Emit(OpCode opcode, ConstructorInfo con) { _generator.Emit(opcode, con); Log(opcode, con); } - public virtual void Emit(OpCode opcode, Type cls) + public void Emit(OpCode opcode, Type cls) { _generator.Emit(opcode, cls); Log(opcode, cls); } - public virtual void Emit(OpCode opcode, long arg) + public void Emit(OpCode opcode, long arg) { _generator.Emit(opcode, arg); Log(opcode, arg); } - public virtual void Emit(OpCode opcode, float arg) + public void Emit(OpCode opcode, float arg) { _generator.Emit(opcode, arg); Log(opcode, arg); } - public virtual void Emit(OpCode opcode, double arg) + public void Emit(OpCode opcode, double arg) { _generator.Emit(opcode, arg); Log(opcode, arg); } - public virtual void Emit(OpCode opcode, Label label) + public void Emit(OpCode opcode, Label label) { _generator.Emit(opcode, label); Log(opcode, label.GetHashCode()); } - public virtual void Emit(OpCode opcode, Label[] labels) + public void Emit(OpCode opcode, Label[] labels) { _generator.Emit(opcode, labels); Log(opcode, labels); } - public virtual void Emit(OpCode opcode, FieldInfo field) + public void Emit(OpCode opcode, FieldInfo field) { _generator.Emit(opcode, field); Log(opcode, field); } - public virtual void Emit(OpCode opcode, string str) + public void Emit(OpCode opcode, string str) { _generator.Emit(opcode, str); Log(opcode, str); } - public virtual void Emit(OpCode opcode, LocalBuilder local) + public void Emit(OpCode opcode, LocalBuilder local) { _generator.Emit(opcode, local); Log(opcode, local); diff --git a/Robust.Shared/Utility/QuadTree.cs b/Robust.Shared/Utility/QuadTree.cs index 0571b9136..1f7aabbfa 100644 --- a/Robust.Shared/Utility/QuadTree.cs +++ b/Robust.Shared/Utility/QuadTree.cs @@ -9,7 +9,7 @@ using Robust.Shared.Maths; namespace Robust.Shared.Utility { - public class QuadTree where T : class, IQuadObject + public sealed class QuadTree where T : class, IQuadObject { private readonly bool sort; private readonly Vector2 minLeafSizeF; @@ -439,7 +439,7 @@ namespace Robust.Shared.Utility } } - public class QuadNode + public sealed class QuadNode { private static int _id = 0; public readonly int ID = _id++; diff --git a/Robust.Shared/Utility/RefList.cs b/Robust.Shared/Utility/RefList.cs index 7aa3e4bcb..fda09de8f 100644 --- a/Robust.Shared/Utility/RefList.cs +++ b/Robust.Shared/Utility/RefList.cs @@ -15,7 +15,7 @@ namespace Robust.Shared.Utility /// Don't do it. /// /// The type of the contents of the list. This must be an unmanaged type. - public class RefList : IList + public sealed class RefList : IList { private T[] _array; private int _size; diff --git a/Robust.Shared/Utility/TextParser.cs b/Robust.Shared/Utility/TextParser.cs index 0e57b1ef7..2b89e2b66 100644 --- a/Robust.Shared/Utility/TextParser.cs +++ b/Robust.Shared/Utility/TextParser.cs @@ -6,7 +6,7 @@ namespace Robust.Shared.Utility /// /// Helper class for parsing text. /// - internal class TextParser + internal sealed class TextParser { private readonly TextReader _reader; @@ -178,6 +178,7 @@ namespace Robust.Shared.Utility return char.IsDigit(_currentLine!, CurrentIndex); } + [Virtual] public class ParserException : Exception { public ParserException(string message) : base(message) diff --git a/Robust.Shared/Utility/TopologicalSort.cs b/Robust.Shared/Utility/TopologicalSort.cs index 33ede15bc..fb7ce6679 100644 --- a/Robust.Shared/Utility/TopologicalSort.cs +++ b/Robust.Shared/Utility/TopologicalSort.cs @@ -108,7 +108,7 @@ namespace Robust.Shared.Utility } [DebuggerDisplay("GraphNode: {" + nameof(Value) + "}")] - public class GraphNode + public sealed class GraphNode { public readonly T Value; public readonly List> Dependant = new(); diff --git a/Robust.Shared/Utility/VectorSerializerUtility.cs b/Robust.Shared/Utility/VectorSerializerUtility.cs index 1bedbeb22..373551692 100644 --- a/Robust.Shared/Utility/VectorSerializerUtility.cs +++ b/Robust.Shared/Utility/VectorSerializerUtility.cs @@ -3,7 +3,7 @@ using Robust.Shared.Serialization; namespace Robust.Shared.Utility { - public class VectorSerializerUtility + public sealed class VectorSerializerUtility { private static char[] _separators = {',', 'x'}; diff --git a/Robust.Shared/ViewVariables/ViewVariablesAttribute.cs b/Robust.Shared/ViewVariables/ViewVariablesAttribute.cs index 4de1dec51..de0053848 100644 --- a/Robust.Shared/ViewVariables/ViewVariablesAttribute.cs +++ b/Robust.Shared/ViewVariables/ViewVariablesAttribute.cs @@ -6,7 +6,7 @@ namespace Robust.Shared.ViewVariables /// Attribute to make a property or field accessible to VV. /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class ViewVariablesAttribute : Attribute + public sealed class ViewVariablesAttribute : Attribute { public readonly VVAccess Access = VVAccess.ReadOnly; diff --git a/Robust.Shared/ViewVariables/ViewVariablesBlob.cs b/Robust.Shared/ViewVariables/ViewVariablesBlob.cs index 98cddad57..95273edf0 100644 --- a/Robust.Shared/ViewVariables/ViewVariablesBlob.cs +++ b/Robust.Shared/ViewVariables/ViewVariablesBlob.cs @@ -22,7 +22,7 @@ namespace Robust.Shared.ViewVariables /// Contains the fundamental metadata for an object, such as type, output, and the list of "traits". /// [Serializable, NetSerializable] - public class ViewVariablesBlobMetadata : ViewVariablesBlob + public sealed class ViewVariablesBlobMetadata : ViewVariablesBlob { /// /// A list of traits for this remote object. @@ -56,7 +56,7 @@ namespace Robust.Shared.ViewVariables /// Requested by . /// [Serializable, NetSerializable] - public class ViewVariablesBlobMembers : ViewVariablesBlob + public sealed class ViewVariablesBlobMembers : ViewVariablesBlob { /// /// A list of VV-accessible the remote object has. @@ -68,6 +68,7 @@ namespace Robust.Shared.ViewVariables /// Token used to indicate "this is a reference, but I can't send the actual reference over". /// [Serializable, NetSerializable] + [Virtual] public class ReferenceToken { /// @@ -86,7 +87,7 @@ namespace Robust.Shared.ViewVariables /// Token used to indicate "this is a prototype reference, but I can't send the actual reference over". /// [Serializable, NetSerializable] - public class PrototypeReferenceToken : ReferenceToken + public sealed class PrototypeReferenceToken : ReferenceToken { /// /// The ID of the prototype. @@ -110,7 +111,7 @@ namespace Robust.Shared.ViewVariables /// Sent if the value is a server-side only value type. /// [Serializable, NetSerializable] - public class ServerValueTypeToken + public sealed class ServerValueTypeToken { /// /// The output of the remote object. @@ -125,7 +126,7 @@ namespace Robust.Shared.ViewVariables } [Serializable, NetSerializable] - public class ServerKeyValuePairToken + public sealed class ServerKeyValuePairToken { public object Key { get; set; } public object Value { get; set; } @@ -135,7 +136,7 @@ namespace Robust.Shared.ViewVariables /// Data for a specific property. /// [Serializable, NetSerializable] - public class MemberData + public sealed class MemberData { /// /// Whether the property can be edited by this client. @@ -176,13 +177,13 @@ namespace Robust.Shared.ViewVariables /// Requested by . /// [Serializable, NetSerializable] - public class ViewVariablesBlobEntityComponents : ViewVariablesBlob + public sealed class ViewVariablesBlobEntityComponents : ViewVariablesBlob { public List ComponentTypes { get; set; } = new(); // This might as well be a ValueTuple but I couldn't get that to work. [Serializable, NetSerializable] - public class Entry : IComparable + public sealed class Entry : IComparable { public int CompareTo(Entry other) { @@ -202,7 +203,7 @@ namespace Robust.Shared.ViewVariables /// Requested by . /// [Serializable, NetSerializable] - public class ViewVariablesBlobAllValidComponents : ViewVariablesBlob + public sealed class ViewVariablesBlobAllValidComponents : ViewVariablesBlob { public List ComponentTypes { get; set; } = new(); } @@ -212,7 +213,7 @@ namespace Robust.Shared.ViewVariables /// Requested by . /// [Serializable, NetSerializable] - public class ViewVariablesBlobAllPrototypes : ViewVariablesBlob + public sealed class ViewVariablesBlobAllPrototypes : ViewVariablesBlob { public List Prototypes { get; set; } = new(); public string Variant { get; set; } = string.Empty; @@ -223,7 +224,7 @@ namespace Robust.Shared.ViewVariables /// Requested by /// [Serializable, NetSerializable] - public class ViewVariablesBlobEnumerable : ViewVariablesBlob + public sealed class ViewVariablesBlobEnumerable : ViewVariablesBlob { /// /// The list of objects inside the range specified by the @@ -245,7 +246,7 @@ namespace Robust.Shared.ViewVariables /// Requests the server to send us a . /// [Serializable, NetSerializable] - public class ViewVariablesRequestMetadata : ViewVariablesRequest + public sealed class ViewVariablesRequestMetadata : ViewVariablesRequest { } @@ -253,7 +254,7 @@ namespace Robust.Shared.ViewVariables /// Requests the server to send us a . /// [Serializable, NetSerializable] - public class ViewVariablesRequestMembers : ViewVariablesRequest + public sealed class ViewVariablesRequestMembers : ViewVariablesRequest { } @@ -261,7 +262,7 @@ namespace Robust.Shared.ViewVariables /// Requests the server to send us a . /// [Serializable, NetSerializable] - public class ViewVariablesRequestEntityComponents : ViewVariablesRequest + public sealed class ViewVariablesRequestEntityComponents : ViewVariablesRequest { } @@ -270,7 +271,7 @@ namespace Robust.Shared.ViewVariables /// Requests the server to send us a . /// [Serializable, NetSerializable] - public class ViewVariablesRequestAllValidComponents : ViewVariablesRequest + public sealed class ViewVariablesRequestAllValidComponents : ViewVariablesRequest { } @@ -278,7 +279,7 @@ namespace Robust.Shared.ViewVariables /// Requests the server to send us a . /// [Serializable, NetSerializable] - public class ViewVariablesRequestAllPrototypes : ViewVariablesRequest + public sealed class ViewVariablesRequestAllPrototypes : ViewVariablesRequest { public string Variant { get; } @@ -292,7 +293,7 @@ namespace Robust.Shared.ViewVariables /// Requests the server to send us a containing data in the specified range. /// [Serializable, NetSerializable] - public class ViewVariablesRequestEnumerable : ViewVariablesRequest + public sealed class ViewVariablesRequestEnumerable : ViewVariablesRequest { public ViewVariablesRequestEnumerable(int fromIndex, int toIndex, bool refresh) { diff --git a/Robust.Shared/ViewVariables/ViewVariablesManagerShared.cs b/Robust.Shared/ViewVariables/ViewVariablesManagerShared.cs index 2f28663e1..c73c56b09 100644 --- a/Robust.Shared/ViewVariables/ViewVariablesManagerShared.cs +++ b/Robust.Shared/ViewVariables/ViewVariablesManagerShared.cs @@ -5,7 +5,7 @@ using Robust.Shared.GameObjects; namespace Robust.Shared.ViewVariables { - internal class ViewVariablesManagerShared + internal abstract class ViewVariablesManagerShared { private readonly Dictionary> _cachedTraits = new(); diff --git a/Robust.Shared/ViewVariables/ViewVariablesMemberSelector.cs b/Robust.Shared/ViewVariables/ViewVariablesMemberSelector.cs index 663c6d43c..19818b5fd 100644 --- a/Robust.Shared/ViewVariables/ViewVariablesMemberSelector.cs +++ b/Robust.Shared/ViewVariables/ViewVariablesMemberSelector.cs @@ -9,7 +9,7 @@ namespace Robust.Shared.ViewVariables /// refers to a member (field or property) on the object of the session. /// [Serializable, NetSerializable] - public class ViewVariablesMemberSelector + public sealed class ViewVariablesMemberSelector { public ViewVariablesMemberSelector(int index) { @@ -28,7 +28,7 @@ namespace Robust.Shared.ViewVariables /// refers to an index in the results of a . /// [Serializable, NetSerializable] - public class ViewVariablesEnumerableIndexSelector + public sealed class ViewVariablesEnumerableIndexSelector { public ViewVariablesEnumerableIndexSelector(int index) { @@ -39,7 +39,7 @@ namespace Robust.Shared.ViewVariables } [Serializable, NetSerializable] - public class ViewVariablesSelectorKeyValuePair + public sealed class ViewVariablesSelectorKeyValuePair { // If false it's the value instead. public bool Key { get; set; } diff --git a/Robust.Shared/ViewVariables/ViewVariablesObjectSelector.cs b/Robust.Shared/ViewVariables/ViewVariablesObjectSelector.cs index 09a2af621..11765fe1b 100644 --- a/Robust.Shared/ViewVariables/ViewVariablesObjectSelector.cs +++ b/Robust.Shared/ViewVariables/ViewVariablesObjectSelector.cs @@ -17,6 +17,7 @@ namespace Robust.Shared.ViewVariables /// Specifies an entity with a certain entity UID. /// [Serializable, NetSerializable] + [Virtual] public class ViewVariablesEntitySelector : ViewVariablesObjectSelector { public ViewVariablesEntitySelector(EntityUid entity) @@ -32,7 +33,7 @@ namespace Robust.Shared.ViewVariables /// Specifies a component of a specified entity. /// [Serializable, NetSerializable] - public class ViewVariablesComponentSelector : ViewVariablesEntitySelector + public sealed class ViewVariablesComponentSelector : ViewVariablesEntitySelector { public ViewVariablesComponentSelector(EntityUid uid, string componentType) : base(uid) { @@ -47,7 +48,7 @@ namespace Robust.Shared.ViewVariables /// Specifies a specific property of an object currently opened in a remote VV session. /// [Serializable, NetSerializable] - public class ViewVariablesSessionRelativeSelector : ViewVariablesObjectSelector + public sealed class ViewVariablesSessionRelativeSelector : ViewVariablesObjectSelector { public ViewVariablesSessionRelativeSelector(uint sessionId, object[] propertyIndex) { @@ -75,7 +76,7 @@ namespace Robust.Shared.ViewVariables } [Serializable, NetSerializable] - public class ViewVariablesIoCSelector : ViewVariablesObjectSelector + public sealed class ViewVariablesIoCSelector : ViewVariablesObjectSelector { public ViewVariablesIoCSelector(string typeName) { @@ -86,7 +87,7 @@ namespace Robust.Shared.ViewVariables } [Serializable, NetSerializable] - public class ViewVariablesEntitySystemSelector : ViewVariablesObjectSelector + public sealed class ViewVariablesEntitySystemSelector : ViewVariablesObjectSelector { public ViewVariablesEntitySystemSelector(string typeName) { diff --git a/Robust.UnitTesting/ApproxEqualityConstraint.cs b/Robust.UnitTesting/ApproxEqualityConstraint.cs index 6d0c57fc4..850341450 100644 --- a/Robust.UnitTesting/ApproxEqualityConstraint.cs +++ b/Robust.UnitTesting/ApproxEqualityConstraint.cs @@ -3,7 +3,7 @@ using Robust.Shared.Maths; namespace Robust.UnitTesting { - public class ApproxEqualityConstraint : Constraint + public sealed class ApproxEqualityConstraint : Constraint { public object Expected { get; } public double? Tolerance { get; } diff --git a/Robust.UnitTesting/Client/GameObjects/Components/TransformComponentTests.cs b/Robust.UnitTesting/Client/GameObjects/Components/TransformComponentTests.cs index ece61d2ce..ce22a7e51 100644 --- a/Robust.UnitTesting/Client/GameObjects/Components/TransformComponentTests.cs +++ b/Robust.UnitTesting/Client/GameObjects/Components/TransformComponentTests.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Client.GameObjects.Components { [TestFixture] [TestOf(typeof(TransformComponent))] - public class TransformComponentTests + public sealed class TransformComponentTests { private static readonly MapId TestMapId = new(1); private static readonly GridId TestGridAId = new(1); diff --git a/Robust.UnitTesting/Client/GameStates/GameStateProcessor_Tests.cs b/Robust.UnitTesting/Client/GameStates/GameStateProcessor_Tests.cs index b8ed0f7d3..e575618db 100644 --- a/Robust.UnitTesting/Client/GameStates/GameStateProcessor_Tests.cs +++ b/Robust.UnitTesting/Client/GameStates/GameStateProcessor_Tests.cs @@ -7,7 +7,7 @@ using Robust.Shared.Timing; namespace Robust.UnitTesting.Client.GameStates { [TestFixture, Parallelizable, TestOf(typeof(GameStateProcessor))] - class GameStateProcessor_Tests + sealed class GameStateProcessor_Tests { [Test] public void FillBufferBlocksProcessing() diff --git a/Robust.UnitTesting/Client/Graphics/EyeTest.cs b/Robust.UnitTesting/Client/Graphics/EyeTest.cs index 329821515..33a4cbfdd 100644 --- a/Robust.UnitTesting/Client/Graphics/EyeTest.cs +++ b/Robust.UnitTesting/Client/Graphics/EyeTest.cs @@ -7,7 +7,7 @@ using Robust.Shared.Maths; namespace Robust.UnitTesting.Client.Graphics { [TestFixture, Parallelizable, TestOf(typeof(Eye))] - class EyeTest + sealed class EyeTest { [Test] public void Constructor_DefaultZoom_isTwo() diff --git a/Robust.UnitTesting/Client/Graphics/StyleBoxTest.cs b/Robust.UnitTesting/Client/Graphics/StyleBoxTest.cs index 0d2c31c58..bcf46bcd1 100644 --- a/Robust.UnitTesting/Client/Graphics/StyleBoxTest.cs +++ b/Robust.UnitTesting/Client/Graphics/StyleBoxTest.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Client.Graphics [TestFixture] [Parallelizable(ParallelScope.All)] [TestOf(typeof(StyleBox))] - public class StyleBoxTest + public sealed class StyleBoxTest { [Test] public void TestGetEnvelopBox() diff --git a/Robust.UnitTesting/Client/Graphics/TextureLoadParametersTest.cs b/Robust.UnitTesting/Client/Graphics/TextureLoadParametersTest.cs index 8832bbc83..e72ac330f 100644 --- a/Robust.UnitTesting/Client/Graphics/TextureLoadParametersTest.cs +++ b/Robust.UnitTesting/Client/Graphics/TextureLoadParametersTest.cs @@ -6,7 +6,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.UnitTesting.Client.Graphics { [TestFixture] - public class TextureLoadParametersTest + public sealed class TextureLoadParametersTest { [Test] public void TestLoadEmptyYaml() diff --git a/Robust.UnitTesting/Client/Input/KeyboardTest.cs b/Robust.UnitTesting/Client/Input/KeyboardTest.cs index 86248893e..77be60742 100644 --- a/Robust.UnitTesting/Client/Input/KeyboardTest.cs +++ b/Robust.UnitTesting/Client/Input/KeyboardTest.cs @@ -7,7 +7,7 @@ using Robust.Client.Input; namespace Robust.UnitTesting.Client.Input { [Parallelizable(ParallelScope.All)] - public class KeyboardTest + public sealed class KeyboardTest { public static IEnumerable TestCases => ((Keyboard.Key[]) Enum.GetValues(typeof(Keyboard.Key))) diff --git a/Robust.UnitTesting/Client/ResourceManagement/RsiResourceTest.cs b/Robust.UnitTesting/Client/ResourceManagement/RsiResourceTest.cs index 7b55c5056..f87123f99 100644 --- a/Robust.UnitTesting/Client/ResourceManagement/RsiResourceTest.cs +++ b/Robust.UnitTesting/Client/ResourceManagement/RsiResourceTest.cs @@ -6,7 +6,7 @@ namespace Robust.UnitTesting.Client.ResourceManagement [TestOf(typeof(RSIResource))] [Parallelizable(ParallelScope.All)] [TestFixture] - public class RsiResourceTest + public sealed class RsiResourceTest { /// /// Simple test in which the delays are already identical so nothing should change much. diff --git a/Robust.UnitTesting/Client/UserInterface/ControlTest.cs b/Robust.UnitTesting/Client/UserInterface/ControlTest.cs index acdab9d04..9d3a7592e 100644 --- a/Robust.UnitTesting/Client/UserInterface/ControlTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/ControlTest.cs @@ -10,7 +10,7 @@ namespace Robust.UnitTesting.Client.UserInterface { [TestFixture] [TestOf(typeof(Control))] - public class ControlTest : RobustUnitTest + public sealed class ControlTest : RobustUnitTest { private static readonly AttachedProperty _refTypeAttachedProperty = AttachedProperty.Create("_refType", typeof(ControlTest), typeof(string), "foo", v => (string?) v != "bar"); diff --git a/Robust.UnitTesting/Client/UserInterface/Controls/BoxContainerTest.cs b/Robust.UnitTesting/Client/UserInterface/Controls/BoxContainerTest.cs index 8d3114276..0ab347d9c 100644 --- a/Robust.UnitTesting/Client/UserInterface/Controls/BoxContainerTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/Controls/BoxContainerTest.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Client.UserInterface.Controls { [TestFixture] [TestOf(typeof(BoxContainer))] - public class BoxContainerTest : RobustUnitTest + public sealed class BoxContainerTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Client/UserInterface/Controls/CenterContainerTest.cs b/Robust.UnitTesting/Client/UserInterface/Controls/CenterContainerTest.cs index 2ee929c23..3e376b15d 100644 --- a/Robust.UnitTesting/Client/UserInterface/Controls/CenterContainerTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/Controls/CenterContainerTest.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Client.UserInterface.Controls { [TestFixture] [TestOf(typeof(CenterContainer))] - public class CenterContainerTest : RobustUnitTest + public sealed class CenterContainerTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Client/UserInterface/Controls/GridContainerTest.cs b/Robust.UnitTesting/Client/UserInterface/Controls/GridContainerTest.cs index 804aa7e44..33842a1af 100644 --- a/Robust.UnitTesting/Client/UserInterface/Controls/GridContainerTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/Controls/GridContainerTest.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Client.UserInterface.Controls { [TestFixture] [TestOf(typeof(GridContainer))] - public class GridContainerTest : RobustUnitTest + public sealed class GridContainerTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Client/UserInterface/Controls/LayoutContainerTest.cs b/Robust.UnitTesting/Client/UserInterface/Controls/LayoutContainerTest.cs index 1edeae8cd..caa9ed3b8 100644 --- a/Robust.UnitTesting/Client/UserInterface/Controls/LayoutContainerTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/Controls/LayoutContainerTest.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Client.UserInterface.Controls { [TestFixture] [TestOf(typeof(LayoutContainer))] - public class LayoutContainerTest : RobustUnitTest + public sealed class LayoutContainerTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Client/UserInterface/Controls/MultiselectOptionButtonTest.cs b/Robust.UnitTesting/Client/UserInterface/Controls/MultiselectOptionButtonTest.cs index 3b7f16407..ee48a631b 100644 --- a/Robust.UnitTesting/Client/UserInterface/Controls/MultiselectOptionButtonTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/Controls/MultiselectOptionButtonTest.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Client.UserInterface.Controls { [TestFixture] [TestOf(typeof(MultiselectOptionButton<>))] - public class MultiselectOptionButtonTest : RobustUnitTest + public sealed class MultiselectOptionButtonTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Client/UserInterface/Controls/PopupContainerTest.cs b/Robust.UnitTesting/Client/UserInterface/Controls/PopupContainerTest.cs index 1df9d753a..3758dd62c 100644 --- a/Robust.UnitTesting/Client/UserInterface/Controls/PopupContainerTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/Controls/PopupContainerTest.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Client.UserInterface.Controls { [TestFixture] [TestOf(typeof(PopupContainer))] - public class PopupContainerTest : RobustUnitTest + public sealed class PopupContainerTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Client/UserInterface/Controls/RadioOptionsTest.cs b/Robust.UnitTesting/Client/UserInterface/Controls/RadioOptionsTest.cs index 5d4e89fdf..43e3ae431 100644 --- a/Robust.UnitTesting/Client/UserInterface/Controls/RadioOptionsTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/Controls/RadioOptionsTest.cs @@ -5,7 +5,7 @@ namespace Robust.UnitTesting.Client.UserInterface.Controls { [TestFixture] [TestOf(typeof(RadioOptions))] - public class RadioOptionsTest : RobustUnitTest + public sealed class RadioOptionsTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Client/UserInterface/StylesheetTest.cs b/Robust.UnitTesting/Client/UserInterface/StylesheetTest.cs index 45f9696a4..ab51fc3f0 100644 --- a/Robust.UnitTesting/Client/UserInterface/StylesheetTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/StylesheetTest.cs @@ -6,7 +6,7 @@ using Robust.Shared.IoC; namespace Robust.UnitTesting.Client.UserInterface { [TestFixture] - public class StylesheetTest : RobustUnitTest + public sealed class StylesheetTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Client/UserInterface/UserInterfaceManagerTest.cs b/Robust.UnitTesting/Client/UserInterface/UserInterfaceManagerTest.cs index 5767652bb..3a9523828 100644 --- a/Robust.UnitTesting/Client/UserInterface/UserInterfaceManagerTest.cs +++ b/Robust.UnitTesting/Client/UserInterface/UserInterfaceManagerTest.cs @@ -10,7 +10,7 @@ using Robust.Shared.Maths; namespace Robust.UnitTesting.Client.UserInterface { [TestFixture] - public class UserInterfaceManagerTest : RobustUnitTest + public sealed class UserInterfaceManagerTest : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Client; diff --git a/Robust.UnitTesting/Is.cs b/Robust.UnitTesting/Is.cs index 73b491e79..6f64c15d3 100644 --- a/Robust.UnitTesting/Is.cs +++ b/Robust.UnitTesting/Is.cs @@ -1,6 +1,6 @@ namespace Robust.UnitTesting { - class Is : NUnit.Framework.Is + sealed class Is : NUnit.Framework.Is { public static ApproxEqualityConstraint Approximately(object expected, double? tolerance = null) { diff --git a/Robust.UnitTesting/LogCatcher.cs b/Robust.UnitTesting/LogCatcher.cs index b34a329f1..b1917c6f2 100644 --- a/Robust.UnitTesting/LogCatcher.cs +++ b/Robust.UnitTesting/LogCatcher.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting /// /// Utility class for testing that logs are indeed being thrown. /// - public class LogCatcher : ILogHandler + public sealed class LogCatcher : ILogHandler { /// /// Read only list of every log message that was caught since the last flush. diff --git a/Robust.UnitTesting/RobustIntegrationTest.cs b/Robust.UnitTesting/RobustIntegrationTest.cs index 370e305c2..2b5f0b349 100644 --- a/Robust.UnitTesting/RobustIntegrationTest.cs +++ b/Robust.UnitTesting/RobustIntegrationTest.cs @@ -15,6 +15,7 @@ using Robust.Server; using Robust.Server.Console; using Robust.Server.ServerStatus; using Robust.Shared; +using Robust.Shared.Analyzers; using Robust.Shared.Asynchronous; using Robust.Shared.Configuration; using Robust.Shared.ContentPack; @@ -896,6 +897,7 @@ namespace Robust.UnitTesting } } + [Virtual] public class ServerIntegrationOptions : IntegrationOptions { public virtual ServerOptions Options { get; set; } = new() @@ -905,6 +907,7 @@ namespace Robust.UnitTesting }; } + [Virtual] public class ClientIntegrationOptions : IntegrationOptions { public virtual GameControllerOptions Options { get; set; } = new() diff --git a/Robust.UnitTesting/RobustIntegrationTestSetup.cs b/Robust.UnitTesting/RobustIntegrationTestSetup.cs index a4f54dabe..374872d9d 100644 --- a/Robust.UnitTesting/RobustIntegrationTestSetup.cs +++ b/Robust.UnitTesting/RobustIntegrationTestSetup.cs @@ -4,7 +4,7 @@ using static Robust.UnitTesting.RobustIntegrationTest; [SetUpFixture] // ReSharper disable once CheckNamespace -public class RobustIntegrationTestSetup +public sealed class RobustIntegrationTestSetup { public void Shutdown() { diff --git a/Robust.UnitTesting/Server/GameObjects/Components/Container_Test.cs b/Robust.UnitTesting/Server/GameObjects/Components/Container_Test.cs index 5ebee458b..67e133a8f 100644 --- a/Robust.UnitTesting/Server/GameObjects/Components/Container_Test.cs +++ b/Robust.UnitTesting/Server/GameObjects/Components/Container_Test.cs @@ -11,7 +11,7 @@ using Robust.Shared.Map; namespace Robust.UnitTesting.Server.GameObjects.Components { [TestFixture, Parallelizable] - public class ContainerTest + public sealed class ContainerTest { private static ISimulation SimulationFactory() { @@ -276,7 +276,7 @@ namespace Robust.UnitTesting.Server.GameObjects.Components Assert.That(state.ContainerSet[0].ContainedEntities[0], Is.EqualTo(childEnt)); } - private class ContainerOnlyContainer : BaseContainer + private sealed class ContainerOnlyContainer : BaseContainer { /// /// The generic container class uses a list of entities diff --git a/Robust.UnitTesting/Server/GameObjects/Components/Transform_Test.cs b/Robust.UnitTesting/Server/GameObjects/Components/Transform_Test.cs index b746de45f..f04ba0b8c 100644 --- a/Robust.UnitTesting/Server/GameObjects/Components/Transform_Test.cs +++ b/Robust.UnitTesting/Server/GameObjects/Components/Transform_Test.cs @@ -18,7 +18,7 @@ namespace Robust.UnitTesting.Server.GameObjects.Components { [TestFixture] [TestOf(typeof(TransformComponent))] - class Transform_Test : RobustUnitTest + sealed class Transform_Test : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Server; diff --git a/Robust.UnitTesting/Server/GameObjects/ServerEntityNetworkManagerTest.cs b/Robust.UnitTesting/Server/GameObjects/ServerEntityNetworkManagerTest.cs index e98cc1947..b04550f20 100644 --- a/Robust.UnitTesting/Server/GameObjects/ServerEntityNetworkManagerTest.cs +++ b/Robust.UnitTesting/Server/GameObjects/ServerEntityNetworkManagerTest.cs @@ -9,7 +9,7 @@ using Robust.Shared.Utility; namespace Robust.UnitTesting.Server.GameObjects { - public class ServerEntityNetworkManagerTest + public sealed class ServerEntityNetworkManagerTest { [Test] public void TestMessageSort() diff --git a/Robust.UnitTesting/Server/GameObjects/ThrowingEntityDeletion_Test.cs b/Robust.UnitTesting/Server/GameObjects/ThrowingEntityDeletion_Test.cs index 718258f42..0e8cf1ea1 100644 --- a/Robust.UnitTesting/Server/GameObjects/ThrowingEntityDeletion_Test.cs +++ b/Robust.UnitTesting/Server/GameObjects/ThrowingEntityDeletion_Test.cs @@ -12,7 +12,7 @@ using Robust.Shared.Serialization.Manager; namespace Robust.UnitTesting.Server.GameObjects { [TestFixture] - public class ThrowingEntityDeletion_Test : RobustUnitTest + public sealed class ThrowingEntityDeletion_Test : RobustUnitTest { private IServerEntityManager EntityManager = default!; private IComponentFactory _componentFactory = default!; diff --git a/Robust.UnitTesting/Server/Maps/MapLoaderTest.cs b/Robust.UnitTesting/Server/Maps/MapLoaderTest.cs index ac898df9b..15b0d6cdf 100644 --- a/Robust.UnitTesting/Server/Maps/MapLoaderTest.cs +++ b/Robust.UnitTesting/Server/Maps/MapLoaderTest.cs @@ -19,7 +19,7 @@ using Robust.Shared.Utility; namespace Robust.UnitTesting.Server.Maps { [TestFixture] - public class MapLoaderTest : RobustUnitTest + public sealed class MapLoaderTest : RobustUnitTest { private const string MapData = @" meta: diff --git a/Robust.UnitTesting/Server/RobustServerSimulation.cs b/Robust.UnitTesting/Server/RobustServerSimulation.cs index 8f20afbc9..2962644f6 100644 --- a/Robust.UnitTesting/Server/RobustServerSimulation.cs +++ b/Robust.UnitTesting/Server/RobustServerSimulation.cs @@ -68,7 +68,7 @@ namespace Robust.UnitTesting.Server internal delegate void PrototypeRegistrationDelegate(IPrototypeManager protoMan); - internal class RobustServerSimulation : ISimulation, ISimulationFactory + internal sealed class RobustServerSimulation : ISimulation, ISimulationFactory { private DiContainerDelegate? _diFactory; private CompRegistrationDelegate? _regDelegate; diff --git a/Robust.UnitTesting/Server/ViewVariables/ViewVariablesTraitMembersTest.cs b/Robust.UnitTesting/Server/ViewVariables/ViewVariablesTraitMembersTest.cs index 4ebf885c4..fee455849 100644 --- a/Robust.UnitTesting/Server/ViewVariables/ViewVariablesTraitMembersTest.cs +++ b/Robust.UnitTesting/Server/ViewVariables/ViewVariablesTraitMembersTest.cs @@ -3,6 +3,7 @@ using Moq; using NUnit.Framework; using Robust.Server.ViewVariables; using Robust.Server.ViewVariables.Traits; +using Robust.Shared.Analyzers; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -10,7 +11,7 @@ namespace Robust.UnitTesting.Server.ViewVariables { [Parallelizable] [TestFixture] - internal class ViewVariablesTraitMembersTest + internal sealed class ViewVariablesTraitMembersTest { [Test] public void Test() @@ -40,22 +41,24 @@ namespace Robust.UnitTesting.Server.ViewVariables Assert.That(group0.groupMembers[0].Name, Is.EqualTo("Y")); Assert.That(group0.groupMembers[1].Name, Is.EqualTo("Z")); - + Assert.That(group1.groupMembers[0].Name, Is.EqualTo("X")); } #pragma warning disable 649 + [Virtual] private class A { [ViewVariables] public int X; } + [Virtual] private class B : A { public int Hidden { get; set; } } - private class C : B + private sealed class C : B { [ViewVariables] public int Y { get; set; } [ViewVariables] public string? Z { get; set; } diff --git a/Robust.UnitTesting/Shared/ColorUtils_Test.cs b/Robust.UnitTesting/Shared/ColorUtils_Test.cs index 2dbee231d..f43a35159 100644 --- a/Robust.UnitTesting/Shared/ColorUtils_Test.cs +++ b/Robust.UnitTesting/Shared/ColorUtils_Test.cs @@ -5,7 +5,7 @@ namespace Robust.UnitTesting.Shared { [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] - public class ColorUtils_Test + public sealed class ColorUtils_Test { [Test] public void TestInterpolateBetween() diff --git a/Robust.UnitTesting/Shared/ContentPack/ResourceManagerTest.cs b/Robust.UnitTesting/Shared/ContentPack/ResourceManagerTest.cs index 3cdd6f5f7..b241983eb 100644 --- a/Robust.UnitTesting/Shared/ContentPack/ResourceManagerTest.cs +++ b/Robust.UnitTesting/Shared/ContentPack/ResourceManagerTest.cs @@ -8,7 +8,7 @@ using Robust.Shared.Utility; namespace Robust.UnitTesting.Shared.ContentPack { [TestFixture] - public class ResourceManagerTest : RobustUnitTest + public sealed class ResourceManagerTest : RobustUnitTest { private static Stream ZipStream => typeof(ResourceManagerTest).Assembly .GetManifestResourceStream("Robust.UnitTesting.Shared.ContentPack.ZipTest.zip")!; diff --git a/Robust.UnitTesting/Shared/EngineIntegrationTest_Test.cs b/Robust.UnitTesting/Shared/EngineIntegrationTest_Test.cs index a6f9dd3d5..4b2f9321e 100644 --- a/Robust.UnitTesting/Shared/EngineIntegrationTest_Test.cs +++ b/Robust.UnitTesting/Shared/EngineIntegrationTest_Test.cs @@ -9,7 +9,7 @@ using Robust.Shared.Network; namespace Robust.UnitTesting.Shared { [TestFixture] - public class EngineIntegrationTest_Test : RobustIntegrationTest + public sealed class EngineIntegrationTest_Test : RobustIntegrationTest { [Test] public void ServerStartsCorrectlyTest() diff --git a/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs b/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs index ea8bca2c4..98b5f44bd 100644 --- a/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/ComponentFactory_Tests.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.GameObjects { [TestFixture] [TestOf(typeof(ComponentFactory))] - public class ComponentFactory_Tests : RobustUnitTest + public sealed class ComponentFactory_Tests : RobustUnitTest { private const string TestComponentName = "A"; private const string LowercaseTestComponentName = "a"; @@ -109,7 +109,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [ComponentProtoName(TestComponentName)] - private class TestComponent : Component + private sealed class TestComponent : Component { } } diff --git a/Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs b/Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs index a3fedd1b6..309159374 100644 --- a/Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs @@ -11,7 +11,7 @@ using Robust.Shared.Network; namespace Robust.UnitTesting.Shared.GameObjects { - public class ContainerTests : RobustIntegrationTest + public sealed class ContainerTests : RobustIntegrationTest { /// /// Tests container states with children that do not exist on the client diff --git a/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.ComponentEvent.cs b/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.ComponentEvent.cs index bb7d2ff4c..9b39148c2 100644 --- a/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.ComponentEvent.cs +++ b/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.ComponentEvent.cs @@ -10,7 +10,7 @@ using Robust.UnitTesting.Server; namespace Robust.UnitTesting.Shared.GameObjects { - public partial class EntityEventBusTests + public sealed partial class EntityEventBusTests { [Test] public void SubscribeCompEvent() @@ -227,23 +227,23 @@ namespace Robust.UnitTesting.Shared.GameObjects Assert.That(c, Is.True, "C did not fire"); } - private class DummyComponent : Component + private sealed class DummyComponent : Component { } - private class OrderAComponent : Component + private sealed class OrderAComponent : Component { } - private class OrderBComponent : Component + private sealed class OrderBComponent : Component { } - private class OrderCComponent : Component + private sealed class OrderCComponent : Component { } - private class TestEvent : EntityEventArgs + private sealed class TestEvent : EntityEventArgs { public int TestNumber { get; } diff --git a/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.RefBroadcastEvents.cs b/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.RefBroadcastEvents.cs index 9300c3f24..4564e4f71 100644 --- a/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.RefBroadcastEvents.cs +++ b/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.RefBroadcastEvents.cs @@ -24,7 +24,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - public class SubscribeCompRefBroadcastSystem : EntitySystem + public sealed class SubscribeCompRefBroadcastSystem : EntitySystem { public override void Initialize() { @@ -54,7 +54,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class SubscriptionNoMixedRefValueBroadcastEventSystem : EntitySystem + private sealed class SubscriptionNoMixedRefValueBroadcastEventSystem : EntitySystem { public override void Initialize() { @@ -91,7 +91,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class BroadcastOrderASystem : EntitySystem + private sealed class BroadcastOrderASystem : EntitySystem { public override void Initialize() { @@ -109,7 +109,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class BroadcastOrderBSystem : EntitySystem + private sealed class BroadcastOrderBSystem : EntitySystem { public override void Initialize() { @@ -127,7 +127,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class BroadcastOrderCSystem : EntitySystem + private sealed class BroadcastOrderCSystem : EntitySystem { public override void Initialize() { diff --git a/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.RefDirectedEvents.cs b/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.RefDirectedEvents.cs index 8a722295f..4918f8ad4 100644 --- a/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.RefDirectedEvents.cs +++ b/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.RefDirectedEvents.cs @@ -38,7 +38,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class SubscribeCompRefDirectedEventSystem : EntitySystem + private sealed class SubscribeCompRefDirectedEventSystem : EntitySystem { public override void Initialize() { @@ -71,7 +71,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class SubscriptionNoMixedRefValueDirectedEventSystem : EntitySystem + private sealed class SubscriptionNoMixedRefValueDirectedEventSystem : EntitySystem { public override void Initialize() { @@ -122,7 +122,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class OrderASystem : EntitySystem + private sealed class OrderASystem : EntitySystem { public override void Initialize() { @@ -140,7 +140,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class OrderBSystem : EntitySystem + private sealed class OrderBSystem : EntitySystem { public override void Initialize() { @@ -158,7 +158,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [Reflect(false)] - private class OrderCSystem : EntitySystem + private sealed class OrderCSystem : EntitySystem { public override void Initialize() { @@ -175,7 +175,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } } - private class DummyTwoComponent : Component + private sealed class DummyTwoComponent : Component { } diff --git a/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.SystemEvent.cs b/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.SystemEvent.cs index d3286db72..5c3c3bcc2 100644 --- a/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.SystemEvent.cs +++ b/Robust.UnitTesting/Shared/GameObjects/EntityEventBusTests.SystemEvent.cs @@ -507,8 +507,8 @@ namespace Robust.UnitTesting.Shared.GameObjects } } - internal class TestEventSubscriber : IEntityEventSubscriber { } + internal sealed class TestEventSubscriber : IEntityEventSubscriber { } - internal class TestEventArgs : EntityEventArgs { } - internal class TestEventTwoArgs : EntityEventArgs { } + internal sealed class TestEventArgs : EntityEventArgs { } + internal sealed class TestEventTwoArgs : EntityEventArgs { } } diff --git a/Robust.UnitTesting/Shared/GameObjects/EntityManager_Components_Tests.cs b/Robust.UnitTesting/Shared/GameObjects/EntityManager_Components_Tests.cs index f9aa6d2f5..c00502577 100644 --- a/Robust.UnitTesting/Shared/GameObjects/EntityManager_Components_Tests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/EntityManager_Components_Tests.cs @@ -10,7 +10,7 @@ using Robust.UnitTesting.Server; namespace Robust.UnitTesting.Shared.GameObjects { [TestFixture, Parallelizable ,TestOf(typeof(EntityManager))] - public class EntityManager_Components_Tests + public sealed class EntityManager_Components_Tests { private static readonly EntityCoordinates DefaultCoords = new(new EntityUid(1), Vector2.Zero); @@ -274,7 +274,7 @@ namespace Robust.UnitTesting.Shared.GameObjects } [NetworkedComponent()] - private class DummyComponent : Component, ICompType1, ICompType2 + private sealed class DummyComponent : Component, ICompType1, ICompType2 { } diff --git a/Robust.UnitTesting/Shared/GameObjects/EntityState_Tests.cs b/Robust.UnitTesting/Shared/GameObjects/EntityState_Tests.cs index 6e238ec60..a52307225 100644 --- a/Robust.UnitTesting/Shared/GameObjects/EntityState_Tests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/EntityState_Tests.cs @@ -16,7 +16,7 @@ using Robust.Shared.Timing; namespace Robust.UnitTesting.Shared.GameObjects { [TestFixture, Serializable] - class EntityState_Tests + sealed class EntityState_Tests { /// /// Used to measure the size of s in bytes. This is not actually a test, diff --git a/Robust.UnitTesting/Shared/GameObjects/EntitySystemManagerOrderTest.cs b/Robust.UnitTesting/Shared/GameObjects/EntitySystemManagerOrderTest.cs index 909c2db0f..cb712511f 100644 --- a/Robust.UnitTesting/Shared/GameObjects/EntitySystemManagerOrderTest.cs +++ b/Robust.UnitTesting/Shared/GameObjects/EntitySystemManagerOrderTest.cs @@ -14,9 +14,9 @@ namespace Robust.UnitTesting.Shared.GameObjects { [TestFixture] [TestOf(typeof(EntitySystemManager))] - public class EntitySystemManagerOrderTest + public sealed class EntitySystemManagerOrderTest { - private class Counter + private sealed class Counter { public int X; } @@ -41,22 +41,22 @@ namespace Robust.UnitTesting.Shared.GameObjects // Expected update order is is A -> D -> C -> B - private class TestSystemA : TestSystemBase + private sealed class TestSystemA : TestSystemBase { } - private class TestSystemB : TestSystemBase + private sealed class TestSystemB : TestSystemBase { public override IEnumerable UpdatesAfter => new[] {typeof(TestSystemA)}; } - private class TestSystemC : TestSystemBase + private sealed class TestSystemC : TestSystemBase { public override IEnumerable UpdatesBefore => new[] {typeof(TestSystemB)}; } - private class TestSystemD : TestSystemBase + private sealed class TestSystemD : TestSystemBase { public override IEnumerable UpdatesAfter => new[] {typeof(TestSystemA)}; public override IEnumerable UpdatesBefore => new[] {typeof(TestSystemC)}; diff --git a/Robust.UnitTesting/Shared/GameObjects/EntitySystemManager_Tests.cs b/Robust.UnitTesting/Shared/GameObjects/EntitySystemManager_Tests.cs index fda1bcc01..5c4420fc5 100644 --- a/Robust.UnitTesting/Shared/GameObjects/EntitySystemManager_Tests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/EntitySystemManager_Tests.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.IoC.Exceptions; @@ -9,7 +10,7 @@ using Robust.Shared.IoC.Exceptions; namespace Robust.UnitTesting.Shared.GameObjects { [TestFixture, TestOf(typeof(EntitySystemManager))] - public class EntitySystemManager_Tests: RobustUnitTest + public sealed class EntitySystemManager_Tests: RobustUnitTest { public abstract class ESystemBase : IEntitySystem @@ -22,17 +23,18 @@ namespace Robust.UnitTesting.Shared.GameObjects public void Update(float frameTime) { } public void FrameUpdate(float frameTime) { } } + [Virtual] public class ESystemA : ESystemBase { } - public class ESystemC : ESystemA { } + public sealed class ESystemC : ESystemA { } public abstract class ESystemBase2 : ESystemBase { } - public class ESystemB : ESystemBase2 { } + public sealed class ESystemB : ESystemBase2 { } - public class ESystemDepA : ESystemBase + public sealed class ESystemDepA : ESystemBase { [Dependency] public readonly ESystemDepB ESystemDepB = default!; } - public class ESystemDepB : ESystemBase + public sealed class ESystemDepB : ESystemBase { [Dependency] public readonly ESystemDepA ESystemDepA = default!; } diff --git a/Robust.UnitTesting/Shared/GameObjects/IEntityManagerTests.cs b/Robust.UnitTesting/Shared/GameObjects/IEntityManagerTests.cs index 8f7962382..b469575b3 100644 --- a/Robust.UnitTesting/Shared/GameObjects/IEntityManagerTests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/IEntityManagerTests.cs @@ -6,7 +6,7 @@ using Robust.UnitTesting.Server; namespace Robust.UnitTesting.Shared.GameObjects { [TestFixture, Parallelizable] - class EntityManagerTests + sealed class EntityManagerTests { private static readonly MapId TestMapId = new(1); diff --git a/Robust.UnitTesting/Shared/GameObjects/Systems/AnchoredSystemTests.cs b/Robust.UnitTesting/Shared/GameObjects/Systems/AnchoredSystemTests.cs index 23ac56d8b..916996a66 100644 --- a/Robust.UnitTesting/Shared/GameObjects/Systems/AnchoredSystemTests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/Systems/AnchoredSystemTests.cs @@ -13,12 +13,12 @@ using Robust.UnitTesting.Server; namespace Robust.UnitTesting.Shared.GameObjects.Systems { [TestFixture, Parallelizable] - public class AnchoredSystemTests + public sealed class AnchoredSystemTests { private static readonly MapId TestMapId = new(1); private static readonly GridId TestGridId = new(1); - private class Subscriber : IEntityEventSubscriber { } + private sealed class Subscriber : IEntityEventSubscriber { } private const string Prototypes = @" - type: entity diff --git a/Robust.UnitTesting/Shared/GameObjects/Systems/TransformSystemTests.cs b/Robust.UnitTesting/Shared/GameObjects/Systems/TransformSystemTests.cs index 3b0b8cc6d..acbb95173 100644 --- a/Robust.UnitTesting/Shared/GameObjects/Systems/TransformSystemTests.cs +++ b/Robust.UnitTesting/Shared/GameObjects/Systems/TransformSystemTests.cs @@ -8,7 +8,7 @@ using Robust.UnitTesting.Server; namespace Robust.UnitTesting.Shared.GameObjects.Systems { [TestFixture, Parallelizable] - class TransformSystemTests + sealed class TransformSystemTests { private static ISimulation SimulationFactory() { @@ -47,6 +47,6 @@ namespace Robust.UnitTesting.Shared.GameObjects.Systems } } - private class Subscriber : IEntityEventSubscriber { } + private sealed class Subscriber : IEntityEventSubscriber { } } } diff --git a/Robust.UnitTesting/Shared/Input/Binding/CommandBindRegistry_Test.cs b/Robust.UnitTesting/Shared/Input/Binding/CommandBindRegistry_Test.cs index a28dd6798..602fd2417 100644 --- a/Robust.UnitTesting/Shared/Input/Binding/CommandBindRegistry_Test.cs +++ b/Robust.UnitTesting/Shared/Input/Binding/CommandBindRegistry_Test.cs @@ -9,14 +9,14 @@ using Robust.Shared.Players; namespace Robust.UnitTesting.Shared.Input.Binding { [TestFixture, TestOf(typeof(CommandBindRegistry))] - public class CommandBindRegistry_Test : RobustUnitTest + public sealed class CommandBindRegistry_Test : RobustUnitTest { - private class TypeA { } - private class TypeB { } - private class TypeC { } + private sealed class TypeA { } + private sealed class TypeB { } + private sealed class TypeC { } - private class TestInputCmdHandler : InputCmdHandler + private sealed class TestInputCmdHandler : InputCmdHandler { // these vars only for tracking / debugging during testing private readonly string name; diff --git a/Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs b/Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs index 677181606..1fc97cc59 100644 --- a/Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs +++ b/Robust.UnitTesting/Shared/IoC/IoCManager_Test.cs @@ -1,6 +1,7 @@ using System; using Moq; using NUnit.Framework; +using Robust.Shared.Analyzers; using Robust.Shared.IoC; using Robust.Shared.IoC.Exceptions; @@ -10,7 +11,7 @@ namespace Robust.UnitTesting.Shared.IoC /// This fixture CAN NOT be parallelized, because is a static singleton. /// [TestFixture, TestOf(typeof(IoCManager))] - public class IoCManager_Test + public sealed class IoCManager_Test { [OneTimeSetUp] public void OneTimeSetup() @@ -137,11 +138,11 @@ namespace Robust.UnitTesting.Shared.IoC Assert.That(IoCManager.Resolve(), Is.EqualTo(obj)); } - private class DependencyA + private sealed class DependencyA { [Dependency] public readonly DependencyB _depB = default!; } - private class DependencyB + private sealed class DependencyB { [Dependency] public readonly DependencyA _depA = default!; } @@ -156,7 +157,7 @@ namespace Robust.UnitTesting.Shared.IoC IoCManager.RegisterInstance(instanceB, deferInject: true); IoCManager.BuildGraph(); - + var resolveA = IoCManager.Resolve(); var resolveB = IoCManager.Resolve(); @@ -175,7 +176,7 @@ namespace Robust.UnitTesting.Shared.IoC IoCManager.RegisterInstance(instanceB, deferInject: true); IoCManager.BuildGraph(); - + var resolveA = IoCManager.Resolve(); var resolveB = IoCManager.Resolve(); @@ -217,12 +218,12 @@ namespace Robust.UnitTesting.Shared.IoC public interface IIoCTestPriorities { } - public class IoCTestPriorities1 : IIoCTestPriorities { } - public class IoCTestPriorities2 : IIoCTestPriorities { } + public sealed class IoCTestPriorities1 : IIoCTestPriorities { } + public sealed class IoCTestPriorities2 : IIoCTestPriorities { } public interface IConstructorException { } - public class ConstructorException : IConstructorException + public sealed class ConstructorException : IConstructorException { public ConstructorException() { @@ -230,10 +231,12 @@ namespace Robust.UnitTesting.Shared.IoC } } + [Virtual] public class TestConstructorExceptionException : Exception { } + [Virtual] public class TestFieldInjectionParent { [Dependency] @@ -251,7 +254,7 @@ namespace Robust.UnitTesting.Shared.IoC } } - public class TestFieldInjection : TestFieldInjectionParent + public sealed class TestFieldInjection : TestFieldInjectionParent { [Dependency] #pragma warning disable 649 @@ -269,7 +272,7 @@ namespace Robust.UnitTesting.Shared.IoC } } - public class TestConstructorInjection + public sealed class TestConstructorInjection { public TestFieldInjection FieldInjection { get; } @@ -279,7 +282,7 @@ namespace Robust.UnitTesting.Shared.IoC } } - public class TestUnregisteredInjection + public sealed class TestUnregisteredInjection { [Dependency] #pragma warning disable 414 @@ -287,11 +290,11 @@ namespace Robust.UnitTesting.Shared.IoC #pragma warning restore 414 } - public class TestFailImplementation : IIoCFailInterface { } + public sealed class TestFailImplementation : IIoCFailInterface { } public interface ITestDisposeExceptionCaught { } - public class TestDisposeExceptionCaught : ITestDisposeExceptionCaught, IDisposable + public sealed class TestDisposeExceptionCaught : ITestDisposeExceptionCaught, IDisposable { public void Dispose() { @@ -299,7 +302,7 @@ namespace Robust.UnitTesting.Shared.IoC } } - public class ExplicitInjectionTest + public sealed class ExplicitInjectionTest { [Dependency] public readonly IDependencyCollection DependencyCollection = default!; } diff --git a/Robust.UnitTesting/Shared/Map/EntityCoordinates_Tests.cs b/Robust.UnitTesting/Shared/Map/EntityCoordinates_Tests.cs index 403df730f..4ae631358 100644 --- a/Robust.UnitTesting/Shared/Map/EntityCoordinates_Tests.cs +++ b/Robust.UnitTesting/Shared/Map/EntityCoordinates_Tests.cs @@ -16,7 +16,7 @@ using Robust.Shared.Serialization.Manager; namespace Robust.UnitTesting.Shared.Map { [TestFixture, Parallelizable, TestOf(typeof(EntityCoordinates))] - public class EntityCoordinates_Tests : RobustUnitTest + public sealed class EntityCoordinates_Tests : RobustUnitTest { private const string PROTOTYPES = @" - type: entity diff --git a/Robust.UnitTesting/Shared/Map/GridChunkPartition_Tests.cs b/Robust.UnitTesting/Shared/Map/GridChunkPartition_Tests.cs index b4bd5fd80..797f5f8d7 100644 --- a/Robust.UnitTesting/Shared/Map/GridChunkPartition_Tests.cs +++ b/Robust.UnitTesting/Shared/Map/GridChunkPartition_Tests.cs @@ -7,7 +7,7 @@ using Robust.Shared.Maths; namespace Robust.UnitTesting.Shared.Map { [TestFixture, Parallelizable, TestOf(typeof(GridChunkPartition))] - internal class GridChunkPartition_Tests : RobustUnitTest + internal sealed class GridChunkPartition_Tests : RobustUnitTest { // origin is top left private static readonly int[] _testMiscTiles = { diff --git a/Robust.UnitTesting/Shared/Map/GridCollision_Test.cs b/Robust.UnitTesting/Shared/Map/GridCollision_Test.cs index f7a57991a..edf5b6175 100644 --- a/Robust.UnitTesting/Shared/Map/GridCollision_Test.cs +++ b/Robust.UnitTesting/Shared/Map/GridCollision_Test.cs @@ -8,7 +8,7 @@ using Robust.Shared.Physics; namespace Robust.UnitTesting.Shared.Map { - public class GridCollision_Test : RobustIntegrationTest + public sealed class GridCollision_Test : RobustIntegrationTest { [Test] public async Task TestGridsCollide() diff --git a/Robust.UnitTesting/Shared/Map/GridContraction_Test.cs b/Robust.UnitTesting/Shared/Map/GridContraction_Test.cs index da967145e..9113eba93 100644 --- a/Robust.UnitTesting/Shared/Map/GridContraction_Test.cs +++ b/Robust.UnitTesting/Shared/Map/GridContraction_Test.cs @@ -8,7 +8,7 @@ using Robust.Shared.Maths; namespace Robust.UnitTesting.Shared.Map { [TestFixture] - public class GridContraction_Test : RobustIntegrationTest + public sealed class GridContraction_Test : RobustIntegrationTest { [Test] public async Task TestGridDeletes() diff --git a/Robust.UnitTesting/Shared/Map/GridFixtures_Tests.cs b/Robust.UnitTesting/Shared/Map/GridFixtures_Tests.cs index 53a5d6383..d8c68cafb 100644 --- a/Robust.UnitTesting/Shared/Map/GridFixtures_Tests.cs +++ b/Robust.UnitTesting/Shared/Map/GridFixtures_Tests.cs @@ -12,7 +12,7 @@ namespace Robust.UnitTesting.Shared.Map /// Tests whether grid fixtures are being generated correctly. /// [TestFixture] - public class GridFixtures_Tests : RobustIntegrationTest + public sealed class GridFixtures_Tests : RobustIntegrationTest { [Test] public async Task TestGridFixtures() diff --git a/Robust.UnitTesting/Shared/Map/GridRotation_Tests.cs b/Robust.UnitTesting/Shared/Map/GridRotation_Tests.cs index bbb610d08..eda989810 100644 --- a/Robust.UnitTesting/Shared/Map/GridRotation_Tests.cs +++ b/Robust.UnitTesting/Shared/Map/GridRotation_Tests.cs @@ -10,7 +10,7 @@ using Robust.Shared.Maths; namespace Robust.UnitTesting.Shared.Map { [TestFixture] - public class GridRotation_Tests : RobustIntegrationTest + public sealed class GridRotation_Tests : RobustIntegrationTest { // Because integration tests are ten billion percent easier we'll just do all the rotation tests here. // These are mainly looking out for situations where the grid is rotated 90 / 180 degrees and we diff --git a/Robust.UnitTesting/Shared/Map/MapGrid_Tests.cs b/Robust.UnitTesting/Shared/Map/MapGrid_Tests.cs index cf0cff3df..476ea1dd9 100644 --- a/Robust.UnitTesting/Shared/Map/MapGrid_Tests.cs +++ b/Robust.UnitTesting/Shared/Map/MapGrid_Tests.cs @@ -14,7 +14,7 @@ using MapGrid = Robust.Shared.Map.MapGrid; namespace Robust.UnitTesting.Shared.Map { [TestFixture, TestOf(typeof(MapGrid))] - class MapGrid_Tests : RobustUnitTest + sealed class MapGrid_Tests : RobustUnitTest { protected override void OverrideIoC() { diff --git a/Robust.UnitTesting/Shared/Map/MapManager_Tests.cs b/Robust.UnitTesting/Shared/Map/MapManager_Tests.cs index e64cb3442..92d2be5e0 100644 --- a/Robust.UnitTesting/Shared/Map/MapManager_Tests.cs +++ b/Robust.UnitTesting/Shared/Map/MapManager_Tests.cs @@ -12,7 +12,7 @@ using Robust.Shared.Physics.Broadphase; namespace Robust.UnitTesting.Shared.Map { [TestFixture, TestOf(typeof(MapManager))] - class MapManager_Tests : RobustUnitTest + sealed class MapManager_Tests : RobustUnitTest { public override UnitTestProject Project => UnitTestProject.Server; diff --git a/Robust.UnitTesting/Shared/Maths/Angle_Test.cs b/Robust.UnitTesting/Shared/Maths/Angle_Test.cs index 87fed21d9..019a34235 100644 --- a/Robust.UnitTesting/Shared/Maths/Angle_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Angle_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Maths [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] [TestOf(typeof(Angle))] - public class Angle_Test + public sealed class Angle_Test { private const double Epsilon = 1.0e-8; diff --git a/Robust.UnitTesting/Shared/Maths/Box2Rotated_Test.cs b/Robust.UnitTesting/Shared/Maths/Box2Rotated_Test.cs index 65fbc1945..61992b9b0 100644 --- a/Robust.UnitTesting/Shared/Maths/Box2Rotated_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Box2Rotated_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Maths { [TestFixture] [TestOf(typeof(Box2Rotated))] - public class Box2Rotated_Test + public sealed class Box2Rotated_Test { private static IEnumerable BoxRotations = new[] { diff --git a/Robust.UnitTesting/Shared/Maths/Box2_Test.cs b/Robust.UnitTesting/Shared/Maths/Box2_Test.cs index c483143dc..47e6dbdc6 100644 --- a/Robust.UnitTesting/Shared/Maths/Box2_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Box2_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Maths [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] [TestOf(typeof(Box2))] - public class Box2_Test + public sealed class Box2_Test { private static IEnumerable<(float left, float bottom, float right, float top)> Sources => new (float, float, float, float)[] diff --git a/Robust.UnitTesting/Shared/Maths/Box2i_Test.cs b/Robust.UnitTesting/Shared/Maths/Box2i_Test.cs index 250ff1c36..3ee2ee3c5 100644 --- a/Robust.UnitTesting/Shared/Maths/Box2i_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Box2i_Test.cs @@ -4,7 +4,7 @@ using Robust.Shared.Maths; namespace Robust.UnitTesting.Shared.Maths { [TestFixture, Parallelizable, TestOf(typeof(Box2i))] - class Box2i_Test + sealed class Box2i_Test { [Test] public void Box2iUnion() diff --git a/Robust.UnitTesting/Shared/Maths/Circle_Test.cs b/Robust.UnitTesting/Shared/Maths/Circle_Test.cs index 4010efb47..9964c087f 100644 --- a/Robust.UnitTesting/Shared/Maths/Circle_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Circle_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Maths [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] [TestOf(typeof(Circle))] - public class Circle_Test + public sealed class Circle_Test { private static IEnumerable Coordinates => new float[] { -1, 0, 1 }; diff --git a/Robust.UnitTesting/Shared/Maths/Color_Test.cs b/Robust.UnitTesting/Shared/Maths/Color_Test.cs index 768303e02..c8677aa9b 100644 --- a/Robust.UnitTesting/Shared/Maths/Color_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Color_Test.cs @@ -9,7 +9,7 @@ namespace Robust.UnitTesting.Shared.Maths [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] [TestOf(typeof(Color))] - public class Color_Test + public sealed class Color_Test { static IEnumerable BytesSource = new byte[] { diff --git a/Robust.UnitTesting/Shared/Maths/Direction_Test.cs b/Robust.UnitTesting/Shared/Maths/Direction_Test.cs index 8dbac8de5..c6ab5bbdb 100644 --- a/Robust.UnitTesting/Shared/Maths/Direction_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Direction_Test.cs @@ -6,7 +6,7 @@ namespace Robust.UnitTesting.Shared.Maths { [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] - internal class DirectionTest + internal sealed class DirectionTest { private const double Epsilon = 1.0e-8; @@ -46,15 +46,15 @@ namespace Robust.UnitTesting.Shared.Maths Assert.That(val, Is.Approximately(control)); Assert.That(intVec, Is.EqualTo(controlInt)); } - + [Test] [Parallelizable] public void TestDirectionOffset() { var v = new Vector2i(1, 1); var expected = new Vector2i(2, 2); - var dir = Direction.NorthEast; - + var dir = Direction.NorthEast; + Assert.That(v.Offset(dir), Is.EqualTo(expected)); } diff --git a/Robust.UnitTesting/Shared/Maths/Matrix3_Test.cs b/Robust.UnitTesting/Shared/Maths/Matrix3_Test.cs index 6c1e4d361..fed795d46 100644 --- a/Robust.UnitTesting/Shared/Maths/Matrix3_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Matrix3_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Maths [TestFixture] [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestOf(typeof(Matrix3))] - public class Matrix3_Test + public sealed class Matrix3_Test { [Test] public void TranslationTest() diff --git a/Robust.UnitTesting/Shared/Maths/NumericsHelpers_Test.cs b/Robust.UnitTesting/Shared/Maths/NumericsHelpers_Test.cs index 91ad52a38..eb5a0a3cf 100644 --- a/Robust.UnitTesting/Shared/Maths/NumericsHelpers_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/NumericsHelpers_Test.cs @@ -13,7 +13,7 @@ namespace Robust.UnitTesting.Shared.Maths [TestFixture] [TestOf(typeof(NumericsHelpers))] [SuppressMessage("ReSharper", "AccessToStaticMemberViaDerivedType")] - public class NumericsHelpers_Test + public sealed class NumericsHelpers_Test { #region Utils diff --git a/Robust.UnitTesting/Shared/Maths/Ray_Test.cs b/Robust.UnitTesting/Shared/Maths/Ray_Test.cs index 7c410943b..d52e53e8a 100644 --- a/Robust.UnitTesting/Shared/Maths/Ray_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Ray_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Maths [TestFixture] [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestOf(typeof(Ray))] - class Ray_Test + sealed class Ray_Test { [Test] public void RayIntersectsBoxTest() diff --git a/Robust.UnitTesting/Shared/Maths/UIBox2_Test.cs b/Robust.UnitTesting/Shared/Maths/UIBox2_Test.cs index f44fc38af..8d66fecfb 100644 --- a/Robust.UnitTesting/Shared/Maths/UIBox2_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/UIBox2_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Maths [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] [TestOf(typeof(UIBox2))] - public class UIBox2_Test + public sealed class UIBox2_Test { private static IEnumerable<(float left, float top, float right, float bottom)> Sources => new (float, float, float, float)[] { diff --git a/Robust.UnitTesting/Shared/Maths/UIBox2i_Test.cs b/Robust.UnitTesting/Shared/Maths/UIBox2i_Test.cs index f9cf48ab2..e13dba3c8 100644 --- a/Robust.UnitTesting/Shared/Maths/UIBox2i_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/UIBox2i_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Maths [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] [TestOf(typeof(UIBox2i))] - public class UIBox2i_Test + public sealed class UIBox2i_Test { private static IEnumerable<(int left, int top, int right, int bottom)> Sources => new (int, int, int, int)[] { diff --git a/Robust.UnitTesting/Shared/Maths/Vector2_Test.cs b/Robust.UnitTesting/Shared/Maths/Vector2_Test.cs index d4c2cff6b..2194a70a3 100644 --- a/Robust.UnitTesting/Shared/Maths/Vector2_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Vector2_Test.cs @@ -6,7 +6,7 @@ namespace Robust.UnitTesting.Shared.Maths [TestFixture] [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestOf(typeof(Vector2))] - public class Vector2_Test + public sealed class Vector2_Test { [Test] [Sequential] diff --git a/Robust.UnitTesting/Shared/Maths/Vector2u_Test.cs b/Robust.UnitTesting/Shared/Maths/Vector2u_Test.cs index 7a030f5f5..6dcee9b91 100644 --- a/Robust.UnitTesting/Shared/Maths/Vector2u_Test.cs +++ b/Robust.UnitTesting/Shared/Maths/Vector2u_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Maths [TestFixture] [Parallelizable] [TestOf(typeof(Vector2u))] - public class Vector2u_Test + public sealed class Vector2u_Test { // This test basically only exists because RSI loading needs it. [Test] diff --git a/Robust.UnitTesting/Shared/Physics/B2DynamicTree_Test.cs b/Robust.UnitTesting/Shared/Physics/B2DynamicTree_Test.cs index 5c95f1e00..c871275ed 100644 --- a/Robust.UnitTesting/Shared/Physics/B2DynamicTree_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/B2DynamicTree_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Physics { [TestFixture] [TestOf(typeof(B2DynamicTree<>))] - public class B2DynamicTree_Test + public sealed class B2DynamicTree_Test { private static Box2[] aabbs1 = { diff --git a/Robust.UnitTesting/Shared/Physics/CollisionWake_Test.cs b/Robust.UnitTesting/Shared/Physics/CollisionWake_Test.cs index 50f28cdd4..91e83fee4 100644 --- a/Robust.UnitTesting/Shared/Physics/CollisionWake_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/CollisionWake_Test.cs @@ -8,7 +8,7 @@ using Robust.Shared.Maths; namespace Robust.UnitTesting.Shared.Physics { [TestFixture, TestOf(typeof(CollisionWakeSystem))] - public class CollisionWake_Test : RobustIntegrationTest + public sealed class CollisionWake_Test : RobustIntegrationTest { private const string Prototype = @" - type: entity diff --git a/Robust.UnitTesting/Shared/Physics/DynamicTree_Test.cs b/Robust.UnitTesting/Shared/Physics/DynamicTree_Test.cs index 838086958..ca51d60d8 100644 --- a/Robust.UnitTesting/Shared/Physics/DynamicTree_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/DynamicTree_Test.cs @@ -9,7 +9,7 @@ namespace Robust.UnitTesting.Shared.Physics [TestFixture] [TestOf(typeof(DynamicTree<>))] - public class DynamicTree_Test + public sealed class DynamicTree_Test { private static Box2[] aabbs1 = diff --git a/Robust.UnitTesting/Shared/Physics/FixtureShape_Test.cs b/Robust.UnitTesting/Shared/Physics/FixtureShape_Test.cs index bc0134f97..c71dc4579 100644 --- a/Robust.UnitTesting/Shared/Physics/FixtureShape_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/FixtureShape_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Physics { [TestFixture] [TestOf(typeof(FixtureSystem))] - public class FixtureShape_Test : RobustUnitTest + public sealed class FixtureShape_Test : RobustUnitTest { private FixtureSystem _shapeManager = default!; diff --git a/Robust.UnitTesting/Shared/Physics/GridDeletion_Test.cs b/Robust.UnitTesting/Shared/Physics/GridDeletion_Test.cs index b041821e9..74981a76c 100644 --- a/Robust.UnitTesting/Shared/Physics/GridDeletion_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/GridDeletion_Test.cs @@ -12,7 +12,7 @@ namespace Robust.UnitTesting.Shared.Physics; /// Mainly useful for grid dynamic tree. /// [TestFixture] -public class GridDeletion_Test : RobustIntegrationTest +public sealed class GridDeletion_Test : RobustIntegrationTest { [Test] public async Task GridDeletionTest() diff --git a/Robust.UnitTesting/Shared/Physics/JointDeletion_Test.cs b/Robust.UnitTesting/Shared/Physics/JointDeletion_Test.cs index a45acf9a4..b44bd4f09 100644 --- a/Robust.UnitTesting/Shared/Physics/JointDeletion_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/JointDeletion_Test.cs @@ -10,7 +10,7 @@ using Robust.Shared.Physics.Dynamics.Joints; namespace Robust.UnitTesting.Shared.Physics; [TestFixture] -public class JointDeletion_Test : RobustIntegrationTest +public sealed class JointDeletion_Test : RobustIntegrationTest { [Test] public async Task JointDeletionTest() diff --git a/Robust.UnitTesting/Shared/Physics/ManifoldManager_Test.cs b/Robust.UnitTesting/Shared/Physics/ManifoldManager_Test.cs index 7ca4cc31f..f25204bef 100644 --- a/Robust.UnitTesting/Shared/Physics/ManifoldManager_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/ManifoldManager_Test.cs @@ -9,7 +9,7 @@ namespace Robust.UnitTesting.Shared.Physics { [TestFixture] [TestOf(typeof(IManifoldManager))] - public class ManifoldManager_Test : RobustUnitTest + public sealed class ManifoldManager_Test : RobustUnitTest { private IManifoldManager _manifoldManager = default!; diff --git a/Robust.UnitTesting/Shared/Physics/MapVelocity_Test.cs b/Robust.UnitTesting/Shared/Physics/MapVelocity_Test.cs index dccbd2d87..f2f04f6da 100644 --- a/Robust.UnitTesting/Shared/Physics/MapVelocity_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/MapVelocity_Test.cs @@ -8,7 +8,7 @@ using Robust.Shared.Physics; namespace Robust.UnitTesting.Shared.Physics { - public class MapVelocity_Test : RobustIntegrationTest + public sealed class MapVelocity_Test : RobustIntegrationTest { private const string DummyEntity = "Dummy"; diff --git a/Robust.UnitTesting/Shared/Physics/PhysicsComponent_Test.cs b/Robust.UnitTesting/Shared/Physics/PhysicsComponent_Test.cs index e596a9f96..57c304d2e 100644 --- a/Robust.UnitTesting/Shared/Physics/PhysicsComponent_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/PhysicsComponent_Test.cs @@ -13,7 +13,7 @@ namespace Robust.UnitTesting.Shared.Physics { [TestFixture] [TestOf(typeof(PhysicsComponent))] - public class PhysicsComponent_Test : RobustIntegrationTest + public sealed class PhysicsComponent_Test : RobustIntegrationTest { [Test] public async Task TestPointLinearImpulse() diff --git a/Robust.UnitTesting/Shared/Physics/ShapeAABB_Test.cs b/Robust.UnitTesting/Shared/Physics/ShapeAABB_Test.cs index e1ad32cd7..bc22a01a9 100644 --- a/Robust.UnitTesting/Shared/Physics/ShapeAABB_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/ShapeAABB_Test.cs @@ -8,7 +8,7 @@ using Robust.Shared.Physics.Collision.Shapes; namespace Robust.UnitTesting.Shared.Physics { [TestFixture] - public class ShapeAABB_Test : RobustUnitTest + public sealed class ShapeAABB_Test : RobustUnitTest { private Transform _transform; private Transform _rotatedTransform; diff --git a/Robust.UnitTesting/Shared/Physics/Shape_Test.cs b/Robust.UnitTesting/Shared/Physics/Shape_Test.cs index 96a3f2c68..a04ca4c1c 100644 --- a/Robust.UnitTesting/Shared/Physics/Shape_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/Shape_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Physics { [TestFixture] [TestOf(typeof(IPhysShape))] - public class Shape_Test : RobustUnitTest + public sealed class Shape_Test : RobustUnitTest { [Test] public void TestPolyNormals() diff --git a/Robust.UnitTesting/Shared/Physics/Stack_Test.cs b/Robust.UnitTesting/Shared/Physics/Stack_Test.cs index 70febab21..a7747d659 100644 --- a/Robust.UnitTesting/Shared/Physics/Stack_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/Stack_Test.cs @@ -38,7 +38,7 @@ using Robust.Shared.Physics.Dynamics; namespace Robust.UnitTesting.Shared.Physics { [TestFixture] - public class PhysicsTestBedTest : RobustIntegrationTest + public sealed class PhysicsTestBedTest : RobustIntegrationTest { [Test] public async Task TestBoxStack() diff --git a/Robust.UnitTesting/Shared/Physics/VerticesSimplifier_Test.cs b/Robust.UnitTesting/Shared/Physics/VerticesSimplifier_Test.cs index d93337797..6d83f59e9 100644 --- a/Robust.UnitTesting/Shared/Physics/VerticesSimplifier_Test.cs +++ b/Robust.UnitTesting/Shared/Physics/VerticesSimplifier_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Physics { [TestFixture, Parallelizable] [TestOf(typeof(IVerticesSimplifier))] - public class VerticesSimplifier_Test : RobustUnitTest + public sealed class VerticesSimplifier_Test : RobustUnitTest { /* * Collinear tests diff --git a/Robust.UnitTesting/Shared/Prototypes/HotReloadTest.cs b/Robust.UnitTesting/Shared/Prototypes/HotReloadTest.cs index 61838650e..35aa7ba06 100644 --- a/Robust.UnitTesting/Shared/Prototypes/HotReloadTest.cs +++ b/Robust.UnitTesting/Shared/Prototypes/HotReloadTest.cs @@ -10,7 +10,7 @@ using Robust.Shared.Serialization.Manager.Attributes; namespace Robust.UnitTesting.Shared.Prototypes { [TestFixture] - public class HotReloadTest : RobustUnitTest + public sealed class HotReloadTest : RobustUnitTest { private const string DummyId = "Dummy"; public const string HotReloadTestComponentOneId = "HotReloadTestOne"; @@ -101,13 +101,13 @@ namespace Robust.UnitTesting.Shared.Prototypes } } - public class HotReloadTestOneComponent : Component + public sealed class HotReloadTestOneComponent : Component { [DataField("value")] public int Value { get; } } - public class HotReloadTestTwoComponent : Component + public sealed class HotReloadTestTwoComponent : Component { } } diff --git a/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs b/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs index 94762e95a..45d50bfcd 100644 --- a/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs +++ b/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs @@ -12,7 +12,7 @@ namespace Robust.UnitTesting.Shared.Prototypes { [UsedImplicitly] [TestFixture] - public class PrototypeManager_Test : RobustUnitTest + public sealed class PrototypeManager_Test : RobustUnitTest { private const string LoadStringTestDummyId = "LoadStringTestDummy"; private IPrototypeManager manager = default!; @@ -183,7 +183,7 @@ namespace Robust.UnitTesting.Shared.Prototypes name: {LoadStringTestDummyId}"; } - public class TestBasicPrototypeComponent : Component + public sealed class TestBasicPrototypeComponent : Component { [DataField("foo")] public string Foo = null!; diff --git a/Robust.UnitTesting/Shared/Reflection/ReflectionManager_Test.cs b/Robust.UnitTesting/Shared/Reflection/ReflectionManager_Test.cs index af9e52cd7..2729e9097 100644 --- a/Robust.UnitTesting/Shared/Reflection/ReflectionManager_Test.cs +++ b/Robust.UnitTesting/Shared/Reflection/ReflectionManager_Test.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Shared.Reflection } [TestFixture] - public class ReflectionManager_Test : RobustUnitTest + public sealed class ReflectionManager_Test : RobustUnitTest { protected override void OverrideIoC() { @@ -58,12 +58,12 @@ namespace Robust.UnitTesting.Shared.Reflection public interface IReflectionManagerTest { } // These two pass like normal. - public class TestClass1 : IReflectionManagerTest { } - public class TestClass2 : IReflectionManagerTest { } + public sealed class TestClass1 : IReflectionManagerTest { } + public sealed class TestClass2 : IReflectionManagerTest { } // These two should both NOT be passed. [Reflect(false)] - public class TestClass3 : IReflectionManagerTest { } + public sealed class TestClass3 : IReflectionManagerTest { } public abstract class TestClass4 : IReflectionManagerTest { } [Test] @@ -79,7 +79,7 @@ namespace Robust.UnitTesting.Shared.Reflection } } - public class TestGetType1 { } + public sealed class TestGetType1 { } public abstract class TestGetType2 { } public interface ITestGetType3 { } } diff --git a/Robust.UnitTesting/Shared/Resources/WritableDirProviderTest.cs b/Robust.UnitTesting/Shared/Resources/WritableDirProviderTest.cs index 124b02aad..edca3c0fd 100644 --- a/Robust.UnitTesting/Shared/Resources/WritableDirProviderTest.cs +++ b/Robust.UnitTesting/Shared/Resources/WritableDirProviderTest.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Resources { [TestFixture] [TestOf(typeof(WritableDirProvider))] - public class WritableDirProviderTest + public sealed class WritableDirProviderTest { private string _testDirPath = default!; private DirectoryInfo _testDir = default!; diff --git a/Robust.UnitTesting/Shared/Serialization/InheritanceSerializationTest.cs b/Robust.UnitTesting/Shared/Serialization/InheritanceSerializationTest.cs index 0aecaeef4..6d68e9076 100644 --- a/Robust.UnitTesting/Shared/Serialization/InheritanceSerializationTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/InheritanceSerializationTest.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Shared.Serialization { [TestFixture] [TestOf(typeof(DataDefinition))] - public class InheritanceSerializationTest : RobustUnitTest + public sealed class InheritanceSerializationTest : RobustUnitTest { private const string BaseEntityId = "BaseEntity"; private const string InheritorEntityId = "InheritorEntityId"; @@ -92,19 +92,21 @@ namespace Robust.UnitTesting.Shared.Serialization } } + [Virtual] public class TestBaseComponent : Component { [DataField("baseField")] public string? BaseField; } + [Virtual] public class TestInheritorComponent : TestBaseComponent { [DataField("inheritorField")] public string? InheritorField; } - public class TestFinalComponent : TestInheritorComponent + public sealed class TestFinalComponent : TestInheritorComponent { [DataField("finalField")] public string? FinalField; diff --git a/Robust.UnitTesting/Shared/Serialization/NetSerializableAttribute_Test.cs b/Robust.UnitTesting/Shared/Serialization/NetSerializableAttribute_Test.cs index ac93e4dea..a2e3a1e2b 100644 --- a/Robust.UnitTesting/Shared/Serialization/NetSerializableAttribute_Test.cs +++ b/Robust.UnitTesting/Shared/Serialization/NetSerializableAttribute_Test.cs @@ -7,7 +7,7 @@ using Robust.Shared.Serialization; namespace Robust.UnitTesting.Shared.Serialization { [TestFixture] - class NetSerializableAttribute_Test : RobustUnitTest + sealed class NetSerializableAttribute_Test : RobustUnitTest { private IReflectionManager _reflection = default!; diff --git a/Robust.UnitTesting/Shared/Serialization/NetSerializer_Test.cs b/Robust.UnitTesting/Shared/Serialization/NetSerializer_Test.cs index 857402507..3bd120c9d 100644 --- a/Robust.UnitTesting/Shared/Serialization/NetSerializer_Test.cs +++ b/Robust.UnitTesting/Shared/Serialization/NetSerializer_Test.cs @@ -9,7 +9,7 @@ namespace Robust.UnitTesting.Shared.Serialization // Tests NetSerializer itself because we have specific modifications. // e.g. (at the time of writing) list serialization being more compact. [Parallelizable(ParallelScope.All)] - public class NetSerializer_Test + public sealed class NetSerializer_Test { public static readonly List?[] ListValues = { diff --git a/Robust.UnitTesting/Shared/Serialization/PropertyAndFieldDefinitionTest.cs b/Robust.UnitTesting/Shared/Serialization/PropertyAndFieldDefinitionTest.cs index 3c684f2f0..dbd1b4ed9 100644 --- a/Robust.UnitTesting/Shared/Serialization/PropertyAndFieldDefinitionTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/PropertyAndFieldDefinitionTest.cs @@ -13,7 +13,7 @@ using Robust.Shared.Utility; namespace Robust.UnitTesting.Shared.Serialization { - public class PropertyAndFieldDefinitionTest : SerializationTest + public sealed class PropertyAndFieldDefinitionTest : SerializationTest { private const string GetOnlyPropertyName = "GetOnlyProperty"; private const string GetOnlyPropertyFieldTargetedName = "GetOnlyPropertyFieldTargeted"; @@ -111,7 +111,7 @@ namespace Robust.UnitTesting.Shared.Serialization } [Robust.Shared.Serialization.Manager.Attributes.DataDefinition] - public class PropertyAndFieldDefinitionTestDefinition + public sealed class PropertyAndFieldDefinitionTestDefinition { [DataField(GetOnlyPropertyName)] public int GetOnlyProperty { get; } diff --git a/Robust.UnitTesting/Shared/Serialization/SerializationPriorityTest.cs b/Robust.UnitTesting/Shared/Serialization/SerializationPriorityTest.cs index 694efefde..485138680 100644 --- a/Robust.UnitTesting/Shared/Serialization/SerializationPriorityTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/SerializationPriorityTest.cs @@ -15,7 +15,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.UnitTesting.Shared.Serialization { - public class SerializationPriorityTest : RobustUnitTest + public sealed class SerializationPriorityTest : RobustUnitTest { [Test] public void Test() @@ -43,7 +43,7 @@ namespace Robust.UnitTesting.Shared.Serialization } } - public class PriorityTestComponent : Component, ISerializationHooks + public sealed class PriorityTestComponent : Component, ISerializationHooks { public readonly List Strings = new() {string.Empty, string.Empty, string.Empty}; diff --git a/Robust.UnitTesting/Shared/Serialization/SerializationShutdownTest.cs b/Robust.UnitTesting/Shared/Serialization/SerializationShutdownTest.cs index 65fd87cf3..b43dce2aa 100644 --- a/Robust.UnitTesting/Shared/Serialization/SerializationShutdownTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/SerializationShutdownTest.cs @@ -4,7 +4,7 @@ namespace Robust.UnitTesting.Shared.Serialization { [TestFixture] [NonParallelizable] - public class SerializationShutdownTest : SerializationTest + public sealed class SerializationShutdownTest : SerializationTest { [Test] public void SerializationInitializeShutdownInitializeTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/AngleSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/AngleSerializerTest.cs index 871a8ca1e..08c246afa 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/AngleSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/AngleSerializerTest.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(AngleSerializer))] - public class AngleSerializerTest : SerializationTest + public sealed class AngleSerializerTest : SerializationTest { [Test] public void SerializationTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ArraySerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ArraySerializerTest.cs index 7d1501801..81e602af0 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ArraySerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ArraySerializerTest.cs @@ -10,7 +10,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(ListSerializers<>))] - public class ArraySerializerTest : SerializationTest + public sealed class ArraySerializerTest : SerializationTest { [Test] public void SerializationTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Box2SerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Box2SerializerTest.cs index b6d75114b..713d3989e 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Box2SerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Box2SerializerTest.cs @@ -10,7 +10,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(Box2Serializer))] - public class Box2SerializerTest : SerializationTest + public sealed class Box2SerializerTest : SerializationTest { [Test] public void SerializationTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ColorSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ColorSerializerTest.cs index 3172382cf..36653f612 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ColorSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ColorSerializerTest.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(ColorSerializer))] - public class ColorSerializerTest : SerializationTest + public sealed class ColorSerializerTest : SerializationTest { [Test] public void SerializationTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ComponentRegistrySerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ComponentRegistrySerializerTest.cs index 691a81cd6..66ce6a092 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ComponentRegistrySerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ComponentRegistrySerializerTest.cs @@ -16,7 +16,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(ComponentRegistrySerializer))] - public class ComponentRegistrySerializerTest : SerializationTest + public sealed class ComponentRegistrySerializerTest : SerializationTest { [OneTimeSetUp] public new void OneTimeSetup() @@ -56,7 +56,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers } } - public class TestComponent : Component + public sealed class TestComponent : Component { } } diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/FlagSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/FlagSerializerTest.cs index c59eabed8..69ca239a4 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/FlagSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/FlagSerializerTest.cs @@ -14,7 +14,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers.Custom { [TestFixture] [TestOf(typeof(FlagSerializer<>))] - public class FlagSerializerTest : SerializationTest + public sealed class FlagSerializerTest : SerializationTest { [Test] public void SingleFlagTest() @@ -65,7 +65,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers.Custom Assert.That(value.Flag, Is.EqualTo(TestFlags.Negative)); } - private class TestFlags + private sealed class TestFlags { public const int Negative = 1 << 31; } @@ -82,7 +82,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers.Custom } [DataDefinition] - private class TestDefinition + private sealed class TestDefinition { [DataField("flag", customTypeSerializer: typeof(FlagSerializer))] public int Flag { get; set; } diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/Prototype/PrototypeIdListSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/Prototype/PrototypeIdListSerializerTest.cs index 939a5d126..180dad5f4 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/Prototype/PrototypeIdListSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/Custom/Prototype/PrototypeIdListSerializerTest.cs @@ -20,7 +20,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers.Custom.Prototy { [TestFixture] [TestOf(typeof(PrototypeIdListSerializer<>))] - public class PrototypeIdListSerializerTest : SerializationTest + public sealed class PrototypeIdListSerializerTest : SerializationTest { private static readonly string TestEntityId = $"{nameof(PrototypeIdListSerializerTest)}Dummy"; @@ -167,7 +167,7 @@ entitiesImmutableList: } [DataDefinition] - public class PrototypeIdListSerializerTestDataDefinition + public sealed class PrototypeIdListSerializerTestDataDefinition { [DataField("entitiesList", customTypeSerializer: typeof(PrototypeIdListSerializer))] public List EntitiesList = new(); diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/DictionarySerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/DictionarySerializerTest.cs index fab667723..37471b359 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/DictionarySerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/DictionarySerializerTest.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(DictionarySerializer<,>))] - public class DictionarySerializerTest : SerializationTest + public sealed class DictionarySerializerTest : SerializationTest { [Test] public void SerializationTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/FormattedMessageSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/FormattedMessageSerializerTest.cs index 88f300b50..832ff60b4 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/FormattedMessageSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/FormattedMessageSerializerTest.cs @@ -10,7 +10,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers; [TestFixture] [TestOf(typeof(FormattedMessageSerializer))] -public class FormattedMessageSerializerTest : SerializationTest +public sealed class FormattedMessageSerializerTest : SerializationTest { [Test] [TestCase("message")] diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/HashSetSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/HashSetSerializerTest.cs index dff16f72c..dcf391745 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/HashSetSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/HashSetSerializerTest.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(HashSetSerializer<>))] - public class HashSetSerializerTest : SerializationTest + public sealed class HashSetSerializerTest : SerializationTest { [Test] public void SerializationTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/IntegerSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/IntegerSerializerTest.cs index ad7b3cece..ad62773e6 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/IntegerSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/IntegerSerializerTest.cs @@ -6,7 +6,7 @@ using Robust.Shared.Serialization.Markdown.Value; namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] - public class IntegerSerializerTest : SerializationTest + public sealed class IntegerSerializerTest : SerializationTest { [Test] public void IntReadTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ListSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ListSerializerTest.cs index 3f5e65051..e17a919cf 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ListSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/ListSerializerTest.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(ListSerializers<>))] - public class ListSerializerTest : SerializationTest + public sealed class ListSerializerTest : SerializationTest { [Test] public void SerializationTest() diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/PopulateTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/PopulateTest.cs index c79941f3a..860ab4f49 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/PopulateTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/PopulateTest.cs @@ -6,7 +6,7 @@ using Robust.Shared.Serialization.Markdown.Value; namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] - public class PopulateNullableStructTest : SerializationTest + public sealed class PopulateNullableStructTest : SerializationTest { [DataDefinition] private struct TestStruct : IPopulateDefaultValues diff --git a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/RegexSerializerTest.cs b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/RegexSerializerTest.cs index 1e5682b55..9b62a693c 100644 --- a/Robust.UnitTesting/Shared/Serialization/TypeSerializers/RegexSerializerTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/TypeSerializers/RegexSerializerTest.cs @@ -10,7 +10,7 @@ namespace Robust.UnitTesting.Shared.Serialization.TypeSerializers { [TestFixture] [TestOf(typeof(RegexSerializer))] - public class RegexSerializerTest : SerializationTest + public sealed class RegexSerializerTest : SerializationTest { [Test] public void SerializationTest() diff --git a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/ImmutableListSerializationTest.cs b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/ImmutableListSerializationTest.cs index 3aa3b3edb..5ba30766b 100644 --- a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/ImmutableListSerializationTest.cs +++ b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/ImmutableListSerializationTest.cs @@ -14,7 +14,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests { [TestFixture] - public class ImmutableListSerializationTest : RobustUnitTest + public sealed class ImmutableListSerializationTest : RobustUnitTest { [OneTimeSetUp] public void Setup() diff --git a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypePropertySerialization_Test.cs b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypePropertySerialization_Test.cs index 0649880ee..36c773bc7 100644 --- a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypePropertySerialization_Test.cs +++ b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypePropertySerialization_Test.cs @@ -15,7 +15,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests { [TestFixture] - public class TypePropertySerialization_Test : RobustUnitTest + public sealed class TypePropertySerialization_Test : RobustUnitTest { [OneTimeSetUp] public void Setup() @@ -83,7 +83,7 @@ namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests [SerializedType("testtype2")] [DataDefinition] - public class TestTypeTwo : ITestType + public sealed class TestTypeTwo : ITestType { [DataField("testPropertyOne")] public string? TestPropertyOne { get; set; } @@ -93,7 +93,7 @@ namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests } [RegisterComponent] - public class TestComponent : Component + public sealed class TestComponent : Component { [DataField("testType")] public ITestType? TestType { get; set; } } diff --git a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypeSerialization_Test.cs b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypeSerialization_Test.cs index 90cd4a04f..845fd2a90 100644 --- a/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypeSerialization_Test.cs +++ b/Robust.UnitTesting/Shared/Serialization/YamlObjectSerializerTests/TypeSerialization_Test.cs @@ -12,7 +12,7 @@ using YamlDotNet.RepresentationModel; namespace Robust.UnitTesting.Shared.Serialization.YamlObjectSerializerTests { [TestFixture] - public class TypeSerialization_Test : RobustUnitTest + public sealed class TypeSerialization_Test : RobustUnitTest { [OneTimeSetUp] public void Setup() @@ -67,7 +67,7 @@ test: [SerializedType("testtype1")] [DataDefinition] - public class TestTypeOne : ITestType + public sealed class TestTypeOne : ITestType { } } diff --git a/Robust.UnitTesting/Shared/Timing/GameLoop_Test.cs b/Robust.UnitTesting/Shared/Timing/GameLoop_Test.cs index b87a53363..e59eaf725 100644 --- a/Robust.UnitTesting/Shared/Timing/GameLoop_Test.cs +++ b/Robust.UnitTesting/Shared/Timing/GameLoop_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Timing { [TestFixture] [TestOf(typeof(GameLoop))] - class GameLoop_Test : RobustUnitTest + sealed class GameLoop_Test : RobustUnitTest { /// /// With single step enabled, the game loop should run 1 tick and then pause again. diff --git a/Robust.UnitTesting/Shared/Timing/GameTiming_Test.cs b/Robust.UnitTesting/Shared/Timing/GameTiming_Test.cs index 8336dd6a4..735fa6dd0 100644 --- a/Robust.UnitTesting/Shared/Timing/GameTiming_Test.cs +++ b/Robust.UnitTesting/Shared/Timing/GameTiming_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Timing { [TestFixture] [TestOf(typeof(GameTiming))] - class GameTiming_Test + sealed class GameTiming_Test { /// /// Checks that IGameTiming.RealTime returns the real(wall) uptime since the stopwatch was started. diff --git a/Robust.UnitTesting/Shared/Timing/TimerTest.cs b/Robust.UnitTesting/Shared/Timing/TimerTest.cs index dd87d3bb0..12a28f4a3 100644 --- a/Robust.UnitTesting/Shared/Timing/TimerTest.cs +++ b/Robust.UnitTesting/Shared/Timing/TimerTest.cs @@ -11,7 +11,7 @@ namespace Robust.UnitTesting.Shared.Timing { [TestFixture] [TestOf(typeof(Timer))] - public class TimerTest : RobustUnitTest + public sealed class TimerTest : RobustUnitTest { private LogCatcher _catcher = default!; diff --git a/Robust.UnitTesting/Shared/Utility/CollectionExtensions_Test.cs b/Robust.UnitTesting/Shared/Utility/CollectionExtensions_Test.cs index 0337be669..c95265cf5 100644 --- a/Robust.UnitTesting/Shared/Utility/CollectionExtensions_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/CollectionExtensions_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Utility { [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] - public class CollectionExtensions_Test + public sealed class CollectionExtensions_Test { [Test] public void RemoveSwapTest() diff --git a/Robust.UnitTesting/Shared/Utility/CommandParsing_Test.cs b/Robust.UnitTesting/Shared/Utility/CommandParsing_Test.cs index afa4ef95f..9524ee6a0 100644 --- a/Robust.UnitTesting/Shared/Utility/CommandParsing_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/CommandParsing_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Utility [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] [TestOf(typeof(CommandParsing))] - public class CommandParsing_Test + public sealed class CommandParsing_Test { [TestCase("foo bar", new[] {"foo", "bar"})] [TestCase("foo bar", new[] {"foo", "bar"})] diff --git a/Robust.UnitTesting/Shared/Utility/FormattedMessage_Test.cs b/Robust.UnitTesting/Shared/Utility/FormattedMessage_Test.cs index 1e2ee828a..918972bf5 100644 --- a/Robust.UnitTesting/Shared/Utility/FormattedMessage_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/FormattedMessage_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Utility [Parallelizable(ParallelScope.All)] [TestFixture] [TestOf(typeof(FormattedMessage))] - public class FormattedMessage_Test + public sealed class FormattedMessage_Test { [Test] public static void TestParseMarkup() diff --git a/Robust.UnitTesting/Shared/Utility/MathHelper_Test.cs b/Robust.UnitTesting/Shared/Utility/MathHelper_Test.cs index 6afcd73b6..b75e89e18 100644 --- a/Robust.UnitTesting/Shared/Utility/MathHelper_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/MathHelper_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Utility { [TestFixture, Parallelizable] [TestOf(typeof(MathHelper))] - public class MathHelper_Test + public sealed class MathHelper_Test { public static IEnumerable<(long val, long result)> LongNextPowerOfTwoData = new (long, long)[] { diff --git a/Robust.UnitTesting/Shared/Utility/NullableHelper_Test.cs b/Robust.UnitTesting/Shared/Utility/NullableHelper_Test.cs index 4b0044eac..d39d1ae03 100644 --- a/Robust.UnitTesting/Shared/Utility/NullableHelper_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/NullableHelper_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Utility { [TestFixture] [TestOf(typeof(NullableHelper))] - public class NullableHelper_Test + public sealed class NullableHelper_Test { [SetUp] public void Setup() @@ -42,7 +42,7 @@ namespace Robust.UnitTesting.Shared.Utility #pragma warning disable 169 #pragma warning disable 414 - public class NullableTestClass + public sealed class NullableTestClass { private int? i; private double? d; @@ -52,7 +52,7 @@ namespace Robust.UnitTesting.Shared.Utility private char? c; } - public class NotNullableTestClass + public sealed class NotNullableTestClass { private int i; private double d; diff --git a/Robust.UnitTesting/Shared/Utility/PrettyPrint_Test.cs b/Robust.UnitTesting/Shared/Utility/PrettyPrint_Test.cs index d92574305..2aa70c8e0 100644 --- a/Robust.UnitTesting/Shared/Utility/PrettyPrint_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/PrettyPrint_Test.cs @@ -4,12 +4,12 @@ using Robust.Shared.Utility; namespace Robust.Shared.TestPrettyPrint { - public class Foo + public sealed class Foo { override public string ToString() { return "ACustomFooRep"; } } - public class Bar {} + public sealed class Bar {} } namespace Robust.UnitTesting.Shared.Utility @@ -19,7 +19,7 @@ namespace Robust.UnitTesting.Shared.Utility [TestFixture] [Parallelizable(ParallelScope.Fixtures | ParallelScope.All)] [TestOf(typeof(PrettyPrint))] - public class PrettyPrint_Test + public sealed class PrettyPrint_Test { private static IEnumerable<(object val, string expectedRep, string expectedTypeRep)> TestCases { get; } = new (object, string, string)[] { diff --git a/Robust.UnitTesting/Shared/Utility/ResourcePath_Test.cs b/Robust.UnitTesting/Shared/Utility/ResourcePath_Test.cs index e9efa5f82..3e64d9d5a 100644 --- a/Robust.UnitTesting/Shared/Utility/ResourcePath_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/ResourcePath_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Utility [TestFixture] [Parallelizable(ParallelScope.Fixtures | ParallelScope.All)] [TestOf(typeof(ResourcePath))] - public class ResourcePath_Test + public sealed class ResourcePath_Test { public static List<(string, string)> InputClean_Values = new() { diff --git a/Robust.UnitTesting/Shared/Utility/TypeAbbreviations_Test.cs b/Robust.UnitTesting/Shared/Utility/TypeAbbreviations_Test.cs index aa180afb9..8e3feff25 100644 --- a/Robust.UnitTesting/Shared/Utility/TypeAbbreviations_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/TypeAbbreviations_Test.cs @@ -5,9 +5,9 @@ using Robust.Shared.Utility; namespace Robust.Shared.TestTypeAbbreviation { - public class Foo {} + public sealed class Foo {} - public class Bar {} + public sealed class Bar {} } namespace Robust.UnitTesting.Shared.Utility @@ -15,7 +15,7 @@ namespace Robust.UnitTesting.Shared.Utility [TestFixture] [Parallelizable(ParallelScope.Fixtures | ParallelScope.All)] [TestOf(typeof(TypeAbbreviation))] - public class TypeAbbreviations_Test + public sealed class TypeAbbreviations_Test { private static IEnumerable<(string name, string expected)> NameTestCases { get; } = new[] { diff --git a/Robust.UnitTesting/Shared/Utility/TypeHelpers_Test.cs b/Robust.UnitTesting/Shared/Utility/TypeHelpers_Test.cs index d93a72b3c..2842259a3 100644 --- a/Robust.UnitTesting/Shared/Utility/TypeHelpers_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/TypeHelpers_Test.cs @@ -7,7 +7,7 @@ namespace Robust.UnitTesting.Shared.Utility [TestFixture] [TestOf(typeof(TypeHelpers))] [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class TypeHelpers_Test + public sealed class TypeHelpers_Test { [Test] public void TestIsBasePropertyDefinition() @@ -19,21 +19,25 @@ namespace Robust.UnitTesting.Shared.Utility Assert.That(typeof(Hidden).GetProperty("X")!.IsBasePropertyDefinition(), Is.True); } + [Virtual] private class Parent { public virtual int X => 0; } + [Virtual] private class Child : Parent { public override int X => 5; } + [Virtual] private class SealedChild : Parent { public sealed override int X => 6; } + [Virtual] private class Hidden : Parent { public new int X { get; } = 5; diff --git a/Robust.UnitTesting/Shared/Utility/YamlHelpers_Test.cs b/Robust.UnitTesting/Shared/Utility/YamlHelpers_Test.cs index ca49c1833..83141059d 100644 --- a/Robust.UnitTesting/Shared/Utility/YamlHelpers_Test.cs +++ b/Robust.UnitTesting/Shared/Utility/YamlHelpers_Test.cs @@ -8,7 +8,7 @@ namespace Robust.UnitTesting.Shared.Utility { [Parallelizable(ParallelScope.All | ParallelScope.Fixtures)] [TestFixture] - public class YamlHelpers_Test : RobustUnitTest + public sealed class YamlHelpers_Test : RobustUnitTest { [Test] [SetCulture("fr-FR")] diff --git a/Robust.UnitTesting/Usings.cs b/Robust.UnitTesting/Usings.cs new file mode 100644 index 000000000..daaa0a738 --- /dev/null +++ b/Robust.UnitTesting/Usings.cs @@ -0,0 +1 @@ +global using Robust.Shared.Analyzers;