Analyzer to enforce classes to be either [Virtual], abstract, or sealed. (#2469)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Pieter-Jan Briers
2022-02-05 19:31:58 +01:00
committed by GitHub
parent ec768c563f
commit de4d255841
593 changed files with 1165 additions and 829 deletions

View File

@@ -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.");
}

View File

@@ -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";

View File

@@ -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<DiagnosticDescriptor> 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<ClassDeclarationSyntax>()
.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<Document> 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<Document> 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<Document> 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<Document> 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<string> FixableDiagnosticIds => ImmutableArray.Create(Diagnostics.IdExplicitVirtual);
}
*/

View File

@@ -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<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);

View File

@@ -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
{

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>9</LangVersion>
<LangVersion>10</LangVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -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<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);
@@ -139,7 +141,8 @@ namespace Robust.Analyzers
return document.WithSyntaxRoot(root);
}
public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(SerializableAnalyzer.DiagnosticId);
public sealed override ImmutableArray<string> FixableDiagnosticIds
=> ImmutableArray.Create(Diagnostics.IdSerializable);
public override FixAllProvider GetFixAllProvider()
{

View File

@@ -1,7 +1,9 @@
using BenchmarkDotNet.Attributes;
using Robust.Shared.Analyzers;
namespace Robust.Benchmarks.NumericsHelpers
{
[Virtual]
public class AddBenchmark
{
[Params(32, 128)]

View File

@@ -4,7 +4,7 @@ using System;
namespace Robust.Benchmarks
{
internal class Program
internal static class Program
{
// --allCategories=ctg1,ctg2
// --anyCategories=ctg1,ctg2

View File

@@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Interfaces;
namespace Robust.Benchmarks.Serialization
{
public class BenchmarkIntSerializer : ITypeSerializer<int, ValueDataNode>
public sealed class BenchmarkIntSerializer : ITypeSerializer<int, ValueDataNode>
{
public ValidationNode Validate(ISerializationManager serializationManager, ValueDataNode node,
IDependencyCollection dependencies, ISerializationContext? context = null)

View File

@@ -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()

View File

@@ -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;

View File

@@ -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")]

View File

@@ -11,7 +11,7 @@ namespace Robust.Benchmarks.Serialization.Definitions
/// Taken from content.
/// </summary>
[Prototype("seed")]
public class SeedDataDefinition : IPrototype
public sealed class SeedDataDefinition : IPrototype
{
public const string Prototype = @"
- type: seed

View File

@@ -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]

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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; }

View File

@@ -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
/// <summary>
/// This class is used to load soundfonts.
/// </summary>
private class ResourceLoaderCallbacks : SoundFontLoaderCallbacks
private sealed class ResourceLoaderCallbacks : SoundFontLoaderCallbacks
{
private readonly Dictionary<int, Stream> _openStreams = new();
private int _nextStreamId = 1;

View File

@@ -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!;

View File

@@ -20,7 +20,7 @@ using Robust.Shared.Utility;
namespace Robust.Client
{
/// <inheritdoc />
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
/// <summary>
/// Event arguments for when something changed with the player.
/// </summary>
public class PlayerEventArgs : EventArgs
public sealed class PlayerEventArgs : EventArgs
{
/// <summary>
/// The session that triggered the event.
@@ -310,7 +310,7 @@ namespace Robust.Client
/// <summary>
/// Event arguments for when the RunLevel has changed in the BaseClient.
/// </summary>
public class RunLevelChangedEventArgs : EventArgs
public sealed class RunLevelChangedEventArgs : EventArgs
{
/// <summary>
/// RunLevel that the BaseClient switched from.
@@ -335,7 +335,7 @@ namespace Robust.Client
/// <summary>
/// Info about the server and player that is sent to the client while connecting.
/// </summary>
public class ServerInfo
public sealed class ServerInfo
{
public ServerInfo(string serverName)
{

View File

@@ -2,7 +2,7 @@
namespace Robust.Client.Console
{
public class ClientConGroupController : IClientConGroupController
public sealed class ClientConGroupController : IClientConGroupController
{
private IClientConGroupImplementation? _implementation;
public event Action? ConGroupUpdated;

View File

@@ -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
}
/// <inheritdoc cref="IClientConsoleHost" />
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.
/// </summary>
[Reflect(false)]
internal class ServerDummyCommand : IConsoleCommand
internal sealed class ServerDummyCommand : IConsoleCommand
{
internal ServerDummyCommand(string command, string help, string description)
{

View File

@@ -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";

View File

@@ -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.";

View File

@@ -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 <componentName>";
@@ -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 <raylifetime>";
@@ -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 <gridID> <vector2i>\nThat vector2i param is in the form x<int>,y<int>.";
@@ -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";

View File

@@ -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";

View File

@@ -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" +

View File

@@ -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.";

View File

@@ -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.";

View File

@@ -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.";

View File

@@ -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";

View File

@@ -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;

View File

@@ -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!;

View File

@@ -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;

View File

@@ -7,7 +7,7 @@ using Robust.Shared.Maths;
namespace Robust.Client.Debugging
{
/// <inheritdoc />
public class DebugDrawing : IDebugDrawing
public sealed class DebugDrawing : IDebugDrawing
{
[Dependency] private readonly IOverlayManager _overlayManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;

View File

@@ -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)
{

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Utility;
namespace Robust.Client
{
public class GameControllerOptions
public sealed class GameControllerOptions
{
/// <summary>
/// Whether content sandboxing will be enabled & enforced.

View File

@@ -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)

View File

@@ -4,6 +4,7 @@ using System.Runtime.Serialization;
namespace Robust.Client.GameObjects
{
[Serializable]
[Virtual]
public class ComponentStateApplyException : Exception
{
public ComponentStateApplyException()

View File

@@ -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!;

View File

@@ -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; }

View File

@@ -8,7 +8,7 @@ namespace Robust.Client.GameObjects
/// <summary>
/// Defines data fields used in the <see cref="InputSystem"/>.
/// </summary>
public class InputComponent : Component
public sealed class InputComponent : Component
{
/// <summary>
/// The context that will be made active for a client that attaches to this entity.

View File

@@ -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; }

View File

@@ -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;

View File

@@ -1615,7 +1615,7 @@ namespace Robust.Client.GameObjects
Flip = 3,
}
public class Layer : ISpriteLayer
public sealed class Layer : ISpriteLayer
{
[ViewVariables] private readonly SpriteComponent _parent;

View File

@@ -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!;

View File

@@ -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!;

View File

@@ -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!;

View File

@@ -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
{
/// <summary>
/// Effect Sprite

View File

@@ -20,7 +20,7 @@ namespace Robust.Client.GameObjects
/// Updates the position of every Eye every frame, so that the camera follows the player around.
/// </summary>
[UsedImplicitly]
public class EyeUpdateSystem : EntitySystem
public sealed class EyeUpdateSystem : EntitySystem
{
/// <inheritdoc />
public override void Initialize()

View File

@@ -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!;

View File

@@ -16,7 +16,7 @@ namespace Robust.Client.GameObjects
/// <summary>
/// Client-side processing of all input commands through the simulation.
/// </summary>
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
/// <summary>
/// Entity system message that is raised when the player changes attached entities.
/// </summary>
public class PlayerAttachSysMessage : EntityEventArgs
public sealed class PlayerAttachSysMessage : EntityEventArgs
{
/// <summary>
/// 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)
{

View File

@@ -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!;

View File

@@ -11,7 +11,7 @@ namespace Robust.Client.GameObjects
/// Updates the layer animation for every visible sprite.
/// </summary>
[UsedImplicitly]
public class SpriteSystem : EntitySystem
public sealed class SpriteSystem : EntitySystem
{
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly RenderingTreeSystem _treeSystem = default!;

View File

@@ -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!;

View File

@@ -28,7 +28,7 @@ namespace Robust.Client.GameStates
{
/// <inheritdoc />
[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; }

View File

@@ -10,7 +10,7 @@ using Robust.Shared.Utility;
namespace Robust.Client.GameStates
{
/// <inheritdoc />
internal class GameStateProcessor : IGameStateProcessor
internal sealed class GameStateProcessor : IGameStateProcessor
{
private readonly IGameTiming _timing;

View File

@@ -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
/// </summary>
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>";

View File

@@ -16,7 +16,7 @@ namespace Robust.Client.GameStates
/// <summary>
/// Visual debug overlay for the network diagnostic graph.
/// </summary>
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>";

View File

@@ -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>";

View File

@@ -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);

View File

@@ -18,6 +18,7 @@ namespace Robust.Client.Graphics.Audio
/// <summary>
/// Hey look, it's ClydeAudio.AudioSource's evil twin brother!
/// </summary>
[Virtual]
internal class DummyAudioSource : IClydeAudioSource
{
public static DummyAudioSource Instance { get; } = new();

View File

@@ -7,6 +7,7 @@ using Robust.Shared.ViewVariables;
namespace Robust.Client.Graphics
{
/// <inheritdoc />
[Virtual]
public class Eye : IEye
{
private Vector2 _scale = Vector2.One/2f;

View File

@@ -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; }

View File

@@ -3,7 +3,7 @@
/// <summary>
/// A fixed eye is an eye which is fixed to one point, its position.
/// </summary>
public class FixedEye : Eye
public sealed class FixedEye : Eye
{
}
}

View File

@@ -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;

View File

@@ -34,7 +34,7 @@ namespace Robust.Client.Graphics.Clyde
private readonly ConcurrentQueue<ClydeHandle> _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;

View File

@@ -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();

View File

@@ -11,6 +11,7 @@ namespace Robust.Client.Graphics.Clyde
/// <summary>
/// Represents an OpenGL buffer object.
/// </summary>
[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 <see cref="GLBuffer"/> otherwise.
/// </summary>
private class GLBuffer<T> : GLBuffer where T : unmanaged
private sealed class GLBuffer<T> : GLBuffer where T : unmanaged
{
public GLBuffer(Clyde clyde, BufferTarget type, BufferUsageHint usage, Span<T> initialize,
string? name = null)

View File

@@ -4,7 +4,7 @@ namespace Robust.Client.Graphics.Clyde
{
internal partial class Clyde
{
private class GLShader
private sealed class GLShader
{
private readonly Clyde _clyde;

View File

@@ -14,7 +14,7 @@ namespace Robust.Client.Graphics.Clyde
/// You've been warned:
/// using things like <see cref="SetUniformTexture" /> if this buffer isn't bound WILL mess things up!
/// </summary>
private class GLShaderProgram
private sealed class GLShaderProgram
{
private readonly sbyte?[] _uniformIntCache = new sbyte?[UniCount];
private readonly Dictionary<string, int> _uniformCache = new();

View File

@@ -20,7 +20,7 @@ namespace Robust.Client.Graphics.Clyde
/// <summary>
/// Represents some set of uniforms that can be backed by a uniform buffer or by regular uniforms.
/// </summary>
private class GLUniformBuffer<T> where T : unmanaged, IAppliableUniformSet
private sealed class GLUniformBuffer<T> where T : unmanaged, IAppliableUniformSet
{
private readonly Clyde _clyde;
private readonly int _index;

View File

@@ -6,6 +6,7 @@ namespace Robust.Client.Graphics.Clyde
{
[Serializable]
[PublicAPI]
[Virtual]
internal class ShaderCompilationException : Exception
{
public ShaderCompilationException()

View File

@@ -104,6 +104,7 @@ namespace Robust.Client.Graphics.Clyde
}
[Serializable]
[Virtual]
public class GlfwException : Exception
{
public GlfwException()

View File

@@ -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)
{

View File

@@ -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; }

View File

@@ -7,7 +7,7 @@ namespace Robust.Client.Graphics
/// <summary>
/// Style box based on a 9-patch texture.
/// </summary>
public class StyleBoxTexture : StyleBox
public sealed class StyleBoxTexture : StyleBox
{
public StyleBoxTexture()
{

View File

@@ -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)
{

View File

@@ -6,7 +6,7 @@ using Robust.Shared.Timing;
namespace Robust.Client.Graphics
{
internal class OverlayManager : IOverlayManagerInternal
internal sealed class OverlayManager : IOverlayManagerInternal
{
private readonly Dictionary<Type, Overlay> _overlays = new Dictionary<Type, Overlay>();
public IEnumerable<Overlay> AllOverlays => _overlays.Values;

View File

@@ -192,7 +192,7 @@ namespace Robust.Client.Graphics
}
[DataDefinition]
public class StencilData
public sealed class StencilData
{
[DataField("ref")] public int StencilRef;

View File

@@ -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
{
/// <summary>
@@ -104,7 +106,7 @@ namespace Robust.Client.Input
}
}
public class MouseButtonEventArgs : MouseEventArgs
public sealed class MouseButtonEventArgs : MouseEventArgs
{
/// <summary>
/// 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
{
/// <summary>
/// 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
{
/// <summary>
/// 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; }

View File

@@ -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 => "";

View File

@@ -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;

View File

@@ -9,7 +9,7 @@ namespace Robust.Client.Log
/// <summary>
/// Writes logs to the in-game debug console.
/// </summary>
class DebugConsoleLogHandler : ILogHandler
sealed class DebugConsoleLogHandler : ILogHandler
{
readonly IClientConsoleHost Console;

View File

@@ -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!;

View File

@@ -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;

View File

@@ -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;

View File

@@ -7,6 +7,7 @@ using Robust.Shared.Maths;
namespace Robust.Client.Placement.Modes
{
[Virtual]
public class SnapgridCenter : PlacementMode
{
protected IMapGrid? Grid;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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) { }

View File

@@ -7,7 +7,7 @@ namespace Robust.Client.Placement.Modes
/// <summary>
/// Snaps in edge on one axis, center in the other.
/// </summary>
public class AlignWallProper : PlacementMode
public sealed class AlignWallProper : PlacementMode
{
public AlignWallProper(PlacementManager pMan) : base(pMan)
{

View File

@@ -2,7 +2,7 @@
namespace Robust.Client.Placement.Modes
{
public class PlaceFree : PlacementMode
public sealed class PlaceFree : PlacementMode
{
public PlaceFree(PlacementManager pMan) : base(pMan) { }

View File

@@ -2,7 +2,7 @@
namespace Robust.Client.Placement.Modes
{
public class PlaceNearby : PlacementMode
public sealed class PlaceNearby : PlacementMode
{
public PlaceNearby(PlacementManager pMan) : base(pMan) { }

View File

@@ -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;

View File

@@ -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!;

Some files were not shown because too many files have changed in this diff Show More