From bd41cf40617e4bff1e89bbd90b1cd321e4bfd36a Mon Sep 17 00:00:00 2001 From: sp-tarkov-bot Date: Thu, 21 Aug 2025 11:40:02 +0000 Subject: [PATCH] Format Style Fixes --- .../JsonExtensionDataPatch.cs | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/Patches/Ceciler.JsonExtensionData/JsonExtensionDataPatch.cs b/Patches/Ceciler.JsonExtensionData/JsonExtensionDataPatch.cs index ac03a449..847914f5 100644 --- a/Patches/Ceciler.JsonExtensionData/JsonExtensionDataPatch.cs +++ b/Patches/Ceciler.JsonExtensionData/JsonExtensionDataPatch.cs @@ -17,7 +17,9 @@ public class JsonExtensionDataPatch : IPatcher public void Patch(AssemblyDefinition assembly) { _dictionaryStringObjectReference ??= assembly.MainModule.ImportReference(typeof(Dictionary)); - _dictionaryStringObjectCtorReference ??= assembly.MainModule.ImportReference(typeof(Dictionary).GetConstructor(Type.EmptyTypes)); + _dictionaryStringObjectCtorReference ??= assembly.MainModule.ImportReference( + typeof(Dictionary).GetConstructor(Type.EmptyTypes) + ); if (_jsonExtensionDataAttributeReference is null) { @@ -38,22 +40,24 @@ public class JsonExtensionDataPatch : IPatcher _jsonIgnoreAttributeReference = assembly.MainModule.ImportReference(jsonIgnoreConstructorReference); } - var isExternalInitType = assembly.MainModule.ImportReference( - typeof(System.Runtime.CompilerServices.IsExternalInit) - ); + var isExternalInitType = assembly.MainModule.ImportReference(typeof(System.Runtime.CompilerServices.IsExternalInit)); var compilerGenerated = assembly.MainModule.ImportReference( assembly.MainModule.ImportReference( - typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute).GetConstructor(Type.EmptyTypes))); + typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute).GetConstructor(Type.EmptyTypes) + ) + ); var processed = new HashSet(); foreach (var typeDefinition in assembly.MainModule.Types) { - if (!typeDefinition.Namespace.Contains("SPTarkov.Server.Core.Models") || - typeDefinition.IsInterface || - typeDefinition.IsEnum || - IsStaticClass(typeDefinition) || - processed.Contains(typeDefinition.FullName)) + if ( + !typeDefinition.Namespace.Contains("SPTarkov.Server.Core.Models") + || typeDefinition.IsInterface + || typeDefinition.IsEnum + || IsStaticClass(typeDefinition) + || processed.Contains(typeDefinition.FullName) + ) { continue; } @@ -62,9 +66,11 @@ public class JsonExtensionDataPatch : IPatcher propertyDefinition.CustomAttributes.Add(new CustomAttribute(_jsonExtensionDataAttributeReference)); // Add backing field - var field = new FieldDefinition("k__BackingField", + var field = new FieldDefinition( + "k__BackingField", FieldAttributes.Private | FieldAttributes.InitOnly, - _dictionaryStringObjectReference); + _dictionaryStringObjectReference + ); field.CustomAttributes.Add(new CustomAttribute(compilerGenerated)); typeDefinition.Fields.Add(field); @@ -72,7 +78,8 @@ public class JsonExtensionDataPatch : IPatcher var get = new MethodDefinition( "get_ExtensionData", MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig, - _dictionaryStringObjectReference); + _dictionaryStringObjectReference + ); get.CustomAttributes.Add(new CustomAttribute(compilerGenerated)); get.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0)); get.Body.Instructions.Add(Instruction.Create(OpCodes.Ldfld, field)); @@ -129,9 +136,7 @@ public class JsonExtensionDataPatch : IPatcher private bool IsStaticClass(TypeDefinition type) { - return type.IsClass && - type.IsAbstract && - type.IsSealed; + return type.IsClass && type.IsAbstract && type.IsSealed; } public string Name