From 4fca43d4f876a93a1b399f0f2d7d1f138de6bbb6 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Sun, 24 Nov 2024 17:25:12 +0100 Subject: [PATCH] Move extensions from 'PckFileExtensions' to 'PckAssetExtensions' --- PCK-Studio/Extensions/PckAssetExtensions.cs | 16 ++++++++++++++ PCK-Studio/Extensions/PckFileExtensions.cs | 24 --------------------- PCK-Studio/PckStudio.csproj | 1 - 3 files changed, 16 insertions(+), 25 deletions(-) delete mode 100644 PCK-Studio/Extensions/PckFileExtensions.cs diff --git a/PCK-Studio/Extensions/PckAssetExtensions.cs b/PCK-Studio/Extensions/PckAssetExtensions.cs index 841a5a86..08c3f96e 100644 --- a/PCK-Studio/Extensions/PckAssetExtensions.cs +++ b/PCK-Studio/Extensions/PckAssetExtensions.cs @@ -18,6 +18,22 @@ namespace PckStudio.Extensions { private const string MipMap = "MipMapLevel"; + internal static PckAsset CreateNewAssetIf(this PckFile pck, bool condition, string filename, PckAssetType filetype, IDataFormatWriter writer) + { + if (condition) + { + return pck.CreateNewAsset(filename, filetype, writer); + } + return default; + } + + internal static PckAsset CreateNewAsset(this PckFile pck, string filename, PckAssetType filetype, IDataFormatWriter writer) + { + PckAsset asset = pck.CreateNewAsset(filename, filetype); + asset.SetData(writer); + return asset; + } + internal static Image GetTexture(this PckAsset asset) { if (asset.Type != PckAssetType.SkinFile && diff --git a/PCK-Studio/Extensions/PckFileExtensions.cs b/PCK-Studio/Extensions/PckFileExtensions.cs deleted file mode 100644 index 218f52a0..00000000 --- a/PCK-Studio/Extensions/PckFileExtensions.cs +++ /dev/null @@ -1,24 +0,0 @@ -using OMI.Formats.Pck; -using OMI.Workers; - -namespace PckStudio.Extensions -{ - internal static class PckFileExtensions - { - internal static PckAsset CreateNewAssetIf(this PckFile pck, bool condition, string filename, PckAssetType filetype, IDataFormatWriter writer) - { - if (condition) - { - return pck.CreateNewAsset(filename, filetype, writer); - } - return null; - } - - internal static PckAsset CreateNewAsset(this PckFile pck, string filename, PckAssetType filetype, IDataFormatWriter writer) - { - PckAsset asset = pck.CreateNewAsset(filename, filetype); - asset.SetData(writer); - return asset; - } - } -} diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index d9c07712..31dd120b 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -197,7 +197,6 @@ - Form