From 57f3aa261a3fad4adcebcbeb2b1bf31c440c0888 Mon Sep 17 00:00:00 2001
From: miku-666 <74728189+NessieHax@users.noreply.github.com>
Date: Fri, 12 Dec 2025 21:31:12 +0100
Subject: [PATCH] Core - Move InvalidDLCPackage class into DLCPackage.cs
---
PckStudio.Core/DLC/DLCManager.cs | 4 ++--
PckStudio.Core/DLC/DLCPackage.cs | 8 +++++++
PckStudio.Core/DLC/InvalidDLCPackage.cs | 28 -------------------------
PckStudio.Core/PckStudio.Core.csproj | 1 -
4 files changed, 10 insertions(+), 31 deletions(-)
delete mode 100644 PckStudio.Core/DLC/InvalidDLCPackage.cs
diff --git a/PckStudio.Core/DLC/DLCManager.cs b/PckStudio.Core/DLC/DLCManager.cs
index 1047b043..e9ec2913 100644
--- a/PckStudio.Core/DLC/DLCManager.cs
+++ b/PckStudio.Core/DLC/DLCManager.cs
@@ -82,7 +82,7 @@ namespace PckStudio.Core.DLC
DLCPackageType.MG01 => new DLCBattlePackage(name, identifier),
DLCPackageType.MG02 => new DLCMiniGamePackage(name, identifier, packageType, MiniGameId.Tumble),
DLCPackageType.MG03 => new DLCMiniGamePackage(name, identifier, packageType, MiniGameId.Glide),
- DLCPackageType.Invalid => InvalidDLCPackage.Instance,
+ DLCPackageType.Invalid => DLCPackage.Invalid,
_ => throw new ArgumentException("Unable to create DLC Package of 'Unknown' type."),
};
@@ -102,7 +102,7 @@ namespace PckStudio.Core.DLC
throw new Exception($"{nameof(Platform)} is Unknown.");
if (!IsValidPckFile(fileInfo))
- return InvalidDLCPackage.Instance;
+ return DLCPackage.Invalid;
using Stream stream = fileInfo.OpenRead();
diff --git a/PckStudio.Core/DLC/DLCPackage.cs b/PckStudio.Core/DLC/DLCPackage.cs
index c9d4e8c2..5cb83563 100644
--- a/PckStudio.Core/DLC/DLCPackage.cs
+++ b/PckStudio.Core/DLC/DLCPackage.cs
@@ -10,6 +10,7 @@ namespace PckStudio.Core.DLC
{
public abstract class DLCPackage : IDLCPackage
{
+ public static IDLCPackage Invalid = new InvalidDLCPackage();
protected DLCPackage(string name, int identifier, IDLCPackage parentPackage)
{
Name = name;
@@ -17,6 +18,13 @@ namespace PckStudio.Core.DLC
ParentPackage = parentPackage;
}
+ private sealed class InvalidDLCPackage : DLCPackage
+ {
+ internal InvalidDLCPackage() : base(nameof(InvalidDLCPackage), -1, null) { }
+
+ public override DLCPackageType GetDLCPackageType() => DLCPackageType.Invalid;
+ }
+
public int Identifier { get; }
public string Name { get; } = string.Empty;
diff --git a/PckStudio.Core/DLC/InvalidDLCPackage.cs b/PckStudio.Core/DLC/InvalidDLCPackage.cs
deleted file mode 100644
index 14c7a9dd..00000000
--- a/PckStudio.Core/DLC/InvalidDLCPackage.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using PckStudio.Core.Interfaces;
-
-namespace PckStudio.Core.DLC
-{
- // Dummy class
- internal sealed class InvalidDLCPackage : DLCPackage
- {
- internal static IDLCPackage Instance { get; } = new InvalidDLCPackage();
-
- private InvalidDLCPackage(string name, int identifier, IDLCPackage parentPackage)
- : base(name, identifier, parentPackage)
- {
- }
-
- private InvalidDLCPackage()
- : this(nameof(InvalidDLCPackage), -1, null)
- {
-
- }
-
- public override DLCPackageType GetDLCPackageType() => DLCPackageType.Invalid;
- }
-}
diff --git a/PckStudio.Core/PckStudio.Core.csproj b/PckStudio.Core/PckStudio.Core.csproj
index c872a71b..1faac615 100644
--- a/PckStudio.Core/PckStudio.Core.csproj
+++ b/PckStudio.Core/PckStudio.Core.csproj
@@ -131,7 +131,6 @@
-