Apply enforced file scoped namespacing

This commit is contained in:
Archangel
2025-07-31 15:23:32 +02:00
parent aec8420d53
commit cec47fefd2
39 changed files with 2466 additions and 2513 deletions
+2 -3
View File
@@ -1,8 +1,8 @@
using BenchmarkDotNet.Attributes;
using SPTarkov.Server.Core.Utils;
namespace Benchmarks
{
namespace Benchmarks;
[SimpleJob(warmupCount: 10, iterationCount: 25)]
[MemoryDiagnoser]
public class MathUtilInterpBenchmarks
@@ -25,4 +25,3 @@ namespace Benchmarks
_mathUtil.Interp1(input, x, y);
}
}
}
@@ -1,5 +1,5 @@
namespace SPTarkov.Reflection.Patching
{
namespace SPTarkov.Reflection.Patching;
[AttributeUsage(AttributeTargets.Method)]
public class PatchPrefixAttribute : Attribute { }
@@ -14,4 +14,3 @@
[AttributeUsage(AttributeTargets.Method)]
public class PatchIlManipulatorAttribute : Attribute { }
}
@@ -1,5 +1,5 @@
namespace SPTarkov.Server.Core.DI
{
namespace SPTarkov.Server.Core.DI;
/// <summary>
/// A service locator designed specifically for Harmony patches and other
/// parts of the application that do not have direct access to the Dependency Injection (DI) system.
@@ -15,4 +15,3 @@
ServiceProvider = provider;
}
}
}
@@ -1,7 +1,7 @@
using SPTarkov.Server.Core.Models.Spt.Inventory;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class ContainerExtensions
{
/// <summary>
@@ -250,4 +250,3 @@ namespace SPTarkov.Server.Core.Extensions
return true; // Slot is free
}
}
}
@@ -1,8 +1,8 @@
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class CurrencyTypeExtensions
{
/// <summary>
@@ -22,4 +22,3 @@ namespace SPTarkov.Server.Core.Extensions
};
}
}
}
@@ -1,5 +1,5 @@
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class DateTimeExtensions
{
/// <summary>
@@ -138,4 +138,3 @@
return dateTime.AddDays(-dayDifferenceCount);
}
}
}
@@ -1,5 +1,5 @@
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class DictionaryExtensions
{
/// <summary>
@@ -42,4 +42,3 @@
}
}
}
}
@@ -1,8 +1,8 @@
using SPTarkov.Server.Core.Models.Eft.Match;
using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class EndRaidResultExtensions
{
private static readonly HashSet<ExitStatus> _deathStates = [ExitStatus.KILLED, ExitStatus.MISSINGINACTION, ExitStatus.LEFT];
@@ -70,4 +70,3 @@ namespace SPTarkov.Server.Core.Extensions
return raidResult?.ExitName is not null && coopExtracts.Contains(raidResult.ExitName.Trim());
}
}
}
@@ -3,8 +3,8 @@ using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class FullProfileExtensions
{
/// <summary>
@@ -220,4 +220,3 @@ namespace SPTarkov.Server.Core.Extensions
return fullProfile?.ProfileInfo?.Edition?.ToLowerInvariant().StartsWith("spt developer") ?? false;
}
}
}
@@ -2,8 +2,8 @@
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.ItemEvent;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class ItemEventRouterResponseExtensions
{
/// <summary>
@@ -30,4 +30,3 @@ namespace SPTarkov.Server.Core.Extensions
);
}
}
}
@@ -5,8 +5,8 @@ using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class ItemExtensions
{
/// <summary>
@@ -449,4 +449,3 @@ namespace SPTarkov.Server.Core.Extensions
}
}
}
}
@@ -1,7 +1,7 @@
using SPTarkov.Server.Core.Models.Spt.Config;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
/// <summary>
/// Get the rouble amount for the desired container, multiplied by the current map bot will spawn on
/// </summary>
@@ -49,4 +49,3 @@ namespace SPTarkov.Server.Core.Extensions
return matchingValue.Value;
}
}
}
@@ -1,5 +1,5 @@
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class MathExtensions
{
/// <summary>
@@ -80,4 +80,3 @@
return Math.Abs(value - target) <= error;
}
}
}
@@ -1,7 +1,7 @@
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class MongoIdExtensions
{
//Temporary, but necessary
@@ -68,4 +68,3 @@ namespace SPTarkov.Server.Core.Extensions
return true;
}
}
}
@@ -2,8 +2,8 @@
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class ProductionExtensions
{
/// <summary>
@@ -42,4 +42,3 @@ namespace SPTarkov.Server.Core.Extensions
}
}
}
}
@@ -3,8 +3,8 @@ using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class ProfileExtensions
{
/// <summary>
@@ -240,4 +240,3 @@ namespace SPTarkov.Server.Core.Extensions
}
}
}
}
@@ -1,7 +1,7 @@
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class QuestConditionExtensions
{
/// <summary>
@@ -64,4 +64,3 @@ namespace SPTarkov.Server.Core.Extensions
return filteredQuests;
}
}
}
@@ -1,8 +1,8 @@
using SPTarkov.Server.Core.Models.Eft.Ragfair;
using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class RagfairOfferExtensions
{
/// <summary>
@@ -46,4 +46,3 @@ namespace SPTarkov.Server.Core.Extensions
return false;
}
}
}
@@ -1,7 +1,7 @@
using SPTarkov.Server.Core.Models.Spt.Mod;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class SptModExtensions
{
public static string GetModPath(this SptMod sptMod)
@@ -11,4 +11,3 @@ namespace SPTarkov.Server.Core.Extensions
return relativeModPath;
}
}
}
@@ -1,7 +1,7 @@
using System.Text;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class StringExtensions
{
public static string Encode(this string value, EncodeType encode)
@@ -36,4 +36,3 @@ namespace SPTarkov.Server.Core.Extensions
UTF8,
}
}
}
@@ -1,8 +1,8 @@
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class TemplateItemExtensions
{
public static IEnumerable<TemplateItem> OfClass(this Dictionary<MongoId, TemplateItem> templates, params MongoId[] baseClasses)
@@ -77,4 +77,3 @@ namespace SPTarkov.Server.Core.Extensions
&& (item.Properties.Chambers is null || !item.Properties.Chambers.Any());
}
}
}
@@ -1,8 +1,8 @@
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class TraderAssortExtensions
{
/// <summary>
@@ -48,4 +48,3 @@ namespace SPTarkov.Server.Core.Extensions
.ToList();
}
}
}
@@ -1,5 +1,5 @@
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class UtilityExtensions
{
public static IEnumerable<T> IntersectWith<T>(this IEnumerable<T> first, IEnumerable<T> second)
@@ -10,4 +10,3 @@
return first.Where(second.Contains);
}
}
}
@@ -1,8 +1,8 @@
using SPTarkov.Server.Core.Constants;
using SPTarkov.Server.Core.Models.Eft.Common;
namespace SPTarkov.Server.Core.Extensions
{
namespace SPTarkov.Server.Core.Extensions;
public static class WildSpawnTypeExtensions
{
/// <summary>
@@ -33,4 +33,3 @@ namespace SPTarkov.Server.Core.Extensions
}
}
}
}
@@ -1,8 +1,8 @@
using System.Text.Json.Nodes;
using SPTarkov.Server.Core.Models.Eft.Profile;
namespace SPTarkov.Server.Core.Migration
{
namespace SPTarkov.Server.Core.Migration;
public abstract class AbstractProfileMigration : IProfileMigration
{
public abstract string FromVersion { get; }
@@ -37,4 +37,3 @@ namespace SPTarkov.Server.Core.Migration
return SemanticVersioning.Version.TryParse(versionNumber, out var version) ? version : null;
}
}
}
@@ -1,8 +1,8 @@
using System.Text.Json.Nodes;
using SPTarkov.Server.Core.Models.Eft.Profile;
namespace SPTarkov.Server.Core.Migration
{
namespace SPTarkov.Server.Core.Migration;
public interface IProfileMigration
{
/// <summary>
@@ -27,4 +27,3 @@ namespace SPTarkov.Server.Core.Migration
/// <returns>Should return true if successful, should return false if not</returns>
public bool PostMigrate(SptProfile profile);
}
}
@@ -3,8 +3,8 @@ using System.Text.Json.Nodes;
using SPTarkov.DI.Annotations;
using Range = SemanticVersioning.Range;
namespace SPTarkov.Server.Core.Migration.Migrations
{
namespace SPTarkov.Server.Core.Migration.Migrations;
/// <summary>
/// In 0.16.1.3.35312 BSG changed this to from an int to a hex64 encoded value.
/// </summary>
@@ -52,4 +52,3 @@ namespace SPTarkov.Server.Core.Migration.Migrations
return base.Migrate(profile);
}
}
}
@@ -2,8 +2,8 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Eft.Profile;
namespace SPTarkov.Server.Core.Migration.Migrations
{
namespace SPTarkov.Server.Core.Migration.Migrations;
/// <summary>
/// In the minor versions of 3.10 or somewhere in between these properties were added, it's possible that a profile has not updated
/// To these thus never having received them, re-add them here.
@@ -51,4 +51,3 @@ namespace SPTarkov.Server.Core.Migration.Migrations
return base.PostMigrate(profile);
}
}
}
@@ -8,8 +8,8 @@ using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Services;
using Range = SemanticVersioning.Range;
namespace SPTarkov.Server.Core.Migration.Migrations
{
namespace SPTarkov.Server.Core.Migration.Migrations;
[Injectable]
public class ThreeTenToThreeEleven(
DatabaseService databaseService,
@@ -156,11 +156,7 @@ namespace SPTarkov.Server.Core.Migration.Migrations
foreach (var oldSuite in _oldSuiteData)
{
// Default Bear clothing, dont need to add this
if (
oldSuite == "5cd946231388ce000d572fe3"
|| oldSuite == "5cd945d71388ce000a659dfb"
|| oldSuite == "666841a02537107dc508b704"
)
if (oldSuite == "5cd946231388ce000d572fe3" || oldSuite == "5cd945d71388ce000a659dfb" || oldSuite == "666841a02537107dc508b704")
{
continue;
}
@@ -203,11 +199,7 @@ namespace SPTarkov.Server.Core.Migration.Migrations
foreach (var oldSuite in _oldSuiteData)
{
// Default Usec clothing, dont need to add this
if (
oldSuite == "5cde9ec17d6c8b04723cf479"
|| oldSuite == "5cde9e957d6c8b0474535da7"
|| oldSuite == "666841a02537107dc508b704"
)
if (oldSuite == "5cde9ec17d6c8b04723cf479" || oldSuite == "5cde9e957d6c8b0474535da7" || oldSuite == "666841a02537107dc508b704")
{
continue;
}
@@ -229,4 +221,3 @@ namespace SPTarkov.Server.Core.Migration.Migrations
}
}
}
}
@@ -2,8 +2,8 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Services;
namespace SPTarkov.Server.Core.Migration.Migrations
{
namespace SPTarkov.Server.Core.Migration.Migrations;
/// <summary>
/// In 16.8.0.37972 BSG added customization for voices, technically this only affects BE profiles, but this should fix these.
/// </summary>
@@ -82,4 +82,3 @@ namespace SPTarkov.Server.Core.Migration.Migrations
profileObject["characters"]!["scav"]!["Customization"]!["Voice"] = voiceMongoId.ToString();
}
}
}
@@ -4,8 +4,8 @@ using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Utils;
using Range = SemanticVersioning.Range;
namespace SPTarkov.Server.Core.Migration.Migrations
{
namespace SPTarkov.Server.Core.Migration.Migrations;
[Injectable]
public class ThreeElevenToFourZero(Watermark watermark) : AbstractProfileMigration
{
@@ -72,4 +72,3 @@ namespace SPTarkov.Server.Core.Migration.Migrations
return base.PostMigrate(profile);
}
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace SPTarkov.Server.Core.Models.Eft.Ws
{
namespace SPTarkov.Server.Core.Models.Eft.Ws;
public record WsRagfairNewRating : WsNotificationEvent
{
[JsonPropertyName("rating")]
@@ -10,4 +10,3 @@ namespace SPTarkov.Server.Core.Models.Eft.Ws
[JsonPropertyName("isRatingGrowing")]
public bool? IsRatingGrowing { get; set; }
}
}
@@ -1,5 +1,5 @@
namespace SPTarkov.Server.Core.Models.Enums.Hideout
{
namespace SPTarkov.Server.Core.Models.Enums.Hideout;
public enum HideoutNotificationType
{
None,
@@ -14,4 +14,3 @@
ScavCaseReady,
DecryptionComplete,
}
}
@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace SPTarkov.Server.Core.Models.Enums
{
namespace SPTarkov.Server.Core.Models.Enums;
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum SkillClass
{
@@ -11,4 +11,3 @@ namespace SPTarkov.Server.Core.Models.Enums
Practical,
Mental,
}
}
@@ -1,9 +1,8 @@
namespace SPTarkov.Server.Core.Models.Spt.Launcher
{
namespace SPTarkov.Server.Core.Models.Spt.Launcher;
public enum NicknameValidationResult
{
Taken,
Short,
Valid,
}
}
@@ -2,8 +2,8 @@
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Models.Spt.Ragfair
{
namespace SPTarkov.Server.Core.Models.Spt.Ragfair;
public record CreateFleaOfferDetails
{
/// <summary>
@@ -46,4 +46,3 @@ namespace SPTarkov.Server.Core.Models.Spt.Ragfair
/// </summary>
public bool SellInOnePiece { get; set; }
}
}
@@ -2,8 +2,8 @@ using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Eft.Match;
using SPTarkov.Server.Core.Models.Spt.Location;
namespace SPTarkov.Server.Core.Models.Spt.Services
{
namespace SPTarkov.Server.Core.Models.Spt.Services;
public class ProfileActivityData
{
public long ClientStartedTimestamp { get; set; }
@@ -30,4 +30,3 @@ namespace SPTarkov.Server.Core.Models.Spt.Services
[JsonPropertyName("modVersion")]
public required Version Version { get; init; }
}
}
@@ -6,8 +6,8 @@ using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Services
{
namespace SPTarkov.Server.Core.Services;
[Injectable(InjectionType.Singleton)]
public class ProfileMigratorService(
IEnumerable<IProfileMigration> profileMigrations,
@@ -134,4 +134,3 @@ namespace SPTarkov.Server.Core.Services
sortedMigrations.Add(migration);
}
}
}
@@ -8,8 +8,8 @@ using SPTarkov.Server.Core.Servers.Http;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Status
{
namespace SPTarkov.Server.Core.Status;
[Injectable(TypePriority = 0)]
public class StatusPage(TimeUtil timeUtil, ProfileActivityService profileActivityService, ConfigServer configServer) : IHttpListener
{
@@ -51,4 +51,3 @@ namespace SPTarkov.Server.Core.Status
await resp.CompleteAsync();
}
}
}