Move extensions from 'PckFileExtensions' to 'PckAssetExtensions'

This commit is contained in:
miku-666
2024-11-24 17:25:12 +01:00
parent 817d4957c7
commit 4fca43d4f8
3 changed files with 16 additions and 25 deletions

View File

@@ -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 &&

View File

@@ -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;
}
}
}

View File

@@ -197,7 +197,6 @@
<Compile Include="Extensions\ImageSection.cs" />
<Compile Include="Extensions\ListExtensions.cs" />
<Compile Include="Extensions\MathExtensions.cs" />
<Compile Include="Extensions\PckFileExtensions.cs" />
<Compile Include="Forms\Additional-Popups\NumericPrompt.cs">
<SubType>Form</SubType>
</Compile>