From 2af0891c66fa06a29cd2aae6d96e63992749202a Mon Sep 17 00:00:00 2001 From: clodanSPT <193647717+clodanSPT@users.noreply.github.com> Date: Sun, 20 Jul 2025 19:04:02 +0000 Subject: [PATCH] .NET Format Style Fixes --- .../SPTarkov.Server.Core/Utils/RandomUtil.cs | 12 ++++++++-- UnitTests/DI.cs | 6 ++++- UnitTests/Mock/MockRandomUtil.cs | 24 +++++++++++++++---- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs index 37f47302..49a681c9 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs @@ -175,7 +175,11 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) /// If the generated number is less than 0, it will recursively attempt to generate a valid number up to 100 times. /// If it fails to generate a valid number after 100 attempts, it will return a random float between 0.01 and twice the mean. /// - public virtual double GetNormallyDistributedRandomNumber(double mean, double sigma, int attempt = 0) + public virtual double GetNormallyDistributedRandomNumber( + double mean, + double sigma, + int attempt = 0 + ) { double u, v; @@ -233,7 +237,11 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) /// and MaxSignificantDigits(15), inclusive. If not provided, precision is determined by the input values. /// /// - public virtual double RandNum(double val1, double val2 = 0, int precision = DecimalPointRandomPrecision) + public virtual double RandNum( + double val1, + double val2 = 0, + int precision = DecimalPointRandomPrecision + ) { if (!double.IsFinite(val1) || !double.IsFinite(val2)) { diff --git a/UnitTests/DI.cs b/UnitTests/DI.cs index 6b1b4d47..db1c3f59 100644 --- a/UnitTests/DI.cs +++ b/UnitTests/DI.cs @@ -28,7 +28,11 @@ public class DI var diHandler = new DependencyInjectionHandler(services); diHandler.AddInjectableTypesFromTypeAssembly(typeof(App)); - diHandler.AddInjectableTypesFromTypeList([typeof(MockLogger<>)/* TODO: this needs to be enabled but the randomizer needs to NOT be random, typeof(MockRandomUtil)*/]); + diHandler.AddInjectableTypesFromTypeList( + [ + typeof(MockLogger<>), /* TODO: this needs to be enabled but the randomizer needs to NOT be random, typeof(MockRandomUtil)*/ + ] + ); diHandler.InjectAll(); diff --git a/UnitTests/Mock/MockRandomUtil.cs b/UnitTests/Mock/MockRandomUtil.cs index fc66c1d4..9ae204ca 100644 --- a/UnitTests/Mock/MockRandomUtil.cs +++ b/UnitTests/Mock/MockRandomUtil.cs @@ -6,7 +6,8 @@ using SPTarkov.Server.Core.Utils.Cloners; namespace UnitTests.Mock; [Injectable(TypeOverride = typeof(RandomUtil))] -public class MockRandomUtil(ISptLogger _logger, ICloner _cloner) : RandomUtil(_logger, _cloner) +public class MockRandomUtil(ISptLogger _logger, ICloner _cloner) + : RandomUtil(_logger, _cloner) { public override int GetInt(int min, int max = Int32.MaxValue, bool exclusive = false) { @@ -66,7 +67,11 @@ public class MockRandomUtil(ISptLogger _logger, ICloner _cloner) : R return GetCollectionValue(dictionary.Values); } - public override double GetNormallyDistributedRandomNumber(double mean, double sigma, int attempt = 0) + public override double GetNormallyDistributedRandomNumber( + double mean, + double sigma, + int attempt = 0 + ) { // TODO: No idea what to do with this return base.GetNormallyDistributedRandomNumber(mean, sigma, attempt); @@ -82,12 +87,20 @@ public class MockRandomUtil(ISptLogger _logger, ICloner _cloner) : R return val1; } - public override List DrawRandomFromList(List originalList, int count = 1, bool replacement = true) + public override List DrawRandomFromList( + List originalList, + int count = 1, + bool replacement = true + ) { return originalList.Slice(0, count); } - public override List DrawRandomFromDict(Dictionary dict, int count = 1, bool replacement = true) + public override List DrawRandomFromDict( + Dictionary dict, + int count = 1, + bool replacement = true + ) { // TODO: derandomize return base.DrawRandomFromDict(dict, count, replacement); @@ -109,7 +122,8 @@ public class MockRandomUtil(ISptLogger _logger, ICloner _cloner) : R return base.GetNumberPrecision(num); } - public override T? GetArrayValue(IEnumerable list) where T : default + public override T? GetArrayValue(IEnumerable list) + where T : default { return GetCollectionValue(list); }