Fix CA1802
This commit is contained in:
@@ -692,6 +692,10 @@ dotnet_diagnostic.CA1717.severity = warning
|
||||
### Performance Rules
|
||||
### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/performance-warnings
|
||||
|
||||
# Use Literals Where Appropriate.
|
||||
#dotnet_code_quality.CA1802.required_modifiers = static
|
||||
dotnet_diagnostic.CA1802.severity = warning
|
||||
|
||||
# Remove empty finalizers.
|
||||
dotnet_diagnostic.CA1821.severity = warning
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace OpenRA
|
||||
|
||||
public sealed class Actor : IScriptBindable, IScriptNotifyBind, ILuaTableBinding, ILuaEqualityBinding, ILuaToStringBinding, IEquatable<Actor>, IDisposable
|
||||
{
|
||||
/// <summary>Value used to represent an invalid token.</summary>
|
||||
public const int InvalidConditionToken = -1;
|
||||
|
||||
internal readonly struct SyncHash
|
||||
{
|
||||
public readonly ISync Trait;
|
||||
@@ -78,9 +81,6 @@ namespace OpenRA
|
||||
|
||||
public WRot Orientation => facing?.Orientation ?? WRot.None;
|
||||
|
||||
/// <summary>Value used to represent an invalid token.</summary>
|
||||
public static readonly int InvalidConditionToken = -1;
|
||||
|
||||
sealed class ConditionState
|
||||
{
|
||||
/// <summary>Delegates that have registered to be notified when this condition changes.</summary>
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.FileSystem
|
||||
{
|
||||
public class ZipFileLoader : IPackageLoader
|
||||
{
|
||||
static readonly uint ZipSignature = 0x04034b50;
|
||||
const uint ZipSignature = 0x04034b50;
|
||||
|
||||
class ReadOnlyZipFile : IReadOnlyPackage
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA
|
||||
{
|
||||
public static class TextNotificationsManager
|
||||
{
|
||||
public static readonly int SystemClientId = -1;
|
||||
public const int SystemClientId = -1;
|
||||
static readonly string SystemMessageLabel;
|
||||
|
||||
public static long ChatDisabledUntil { get; internal set; }
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
{
|
||||
public class Beacon : IEffect, IScriptBindable, IEffectAboveShroud
|
||||
{
|
||||
static readonly int MaxArrowHeight = 512;
|
||||
const int MaxArrowHeight = 512;
|
||||
|
||||
readonly Player owner;
|
||||
readonly WPos position;
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
{
|
||||
public static class Blast
|
||||
{
|
||||
public static readonly int MAXBITS = 13; // maximum code length
|
||||
public static readonly int MAXWIN = 4096; // maximum window size
|
||||
public const int MAXBITS = 13; // maximum code length
|
||||
public const int MAXWIN = 4096; // maximum window size
|
||||
|
||||
static readonly byte[] LitLen =
|
||||
{
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Server
|
||||
[TranslationReference("player", "timeout")]
|
||||
const string TimeoutIn = "notification-timeout-dropped-in";
|
||||
|
||||
static readonly int PingInterval = 5000; // Ping every 5 seconds
|
||||
static readonly int ConnReportInterval = 20000; // Report every 20 seconds
|
||||
static readonly int ConnTimeout = 60000; // Drop unresponsive clients after 60 seconds
|
||||
const int PingInterval = 5000; // Ping every 5 seconds
|
||||
const int ConnReportInterval = 20000; // Report every 20 seconds
|
||||
const int ConnTimeout = 60000; // Drop unresponsive clients after 60 seconds
|
||||
|
||||
long lastPing = 0;
|
||||
long lastConnReport = 0;
|
||||
|
||||
@@ -24,15 +24,15 @@ namespace OpenRA.Platforms.Default
|
||||
internal const uint OK = 0x00;
|
||||
internal const int FT_LOAD_RENDER = 0x04;
|
||||
|
||||
internal const int MetricsWidthOffset = 0; // offsetof(FT_Glyph_Metrics, width)
|
||||
internal const int BitmapPitchOffset = 8; // offsetof(FT_Bitmap, pitch)
|
||||
internal static readonly int FaceRecGlyphOffset = IntPtr.Size == 8 ? 152 : 84; // offsetof(FT_FaceRec, glyph)
|
||||
internal static readonly int GlyphSlotMetricsOffset = IntPtr.Size == 8 ? 48 : 24; // offsetof(FT_GlyphSlotRec, metrics)
|
||||
internal static readonly int GlyphSlotBitmapOffset = IntPtr.Size == 8 ? 152 : 76; // offsetof(FT_GlyphSlotRec, bitmap)
|
||||
internal static readonly int GlyphSlotBitmapLeftOffset = IntPtr.Size == 8 ? 192 : 100; // offsetof(FT_GlyphSlotRec, bitmap_left)
|
||||
internal static readonly int GlyphSlotBitmapTopOffset = IntPtr.Size == 8 ? 196 : 104; // offsetof(FT_GlyphSlotRec, bitmap_top)
|
||||
internal static readonly int MetricsWidthOffset = 0; // offsetof(FT_Glyph_Metrics, width)
|
||||
internal static readonly int MetricsHeightOffset = IntPtr.Size == 8 ? 8 : 4; // offsetof(FT_Glyph_Metrics, height)
|
||||
internal static readonly int MetricsAdvanceOffset = IntPtr.Size == 8 ? 32 : 16; // offsetof(FT_Glyph_Metrics, horiAdvance)
|
||||
internal static readonly int BitmapPitchOffset = 8; // offsetof(FT_Bitmap, pitch)
|
||||
internal static readonly int BitmapBufferOffset = IntPtr.Size == 8 ? 16 : 12; // offsetof(FT_Bitmap, buffer)
|
||||
|
||||
[DllImport("freetype6", CallingConvention = CallingConvention.Cdecl)]
|
||||
|
||||
Reference in New Issue
Block a user