mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Make meta parsing more robust.
This commit is contained in:
parent
a722acbc94
commit
5d97f77dc3
2 changed files with 19 additions and 10 deletions
|
|
@ -139,13 +139,19 @@ namespace Penumbra.Importer
|
|||
}
|
||||
|
||||
private void AddIfNotDefault( MetaManipulation manipulation )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( !Service< MetaDefaults >.Get().CheckAgainstDefault( manipulation ) )
|
||||
{
|
||||
Service< MetaDefaults >.Get().CheckAgainstDefault( manipulation );
|
||||
Manipulations.Add( manipulation );
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Debug("Skipped {Type}-manipulation:\n{e:l}", manipulation.Type, e );
|
||||
}
|
||||
}
|
||||
|
||||
private void DeserializeEqpEntry( Info info, byte[]? data )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,13 @@ using Penumbra.Mods;
|
|||
|
||||
namespace Penumbra.MetaData
|
||||
{
|
||||
public class InvalidImcVariantException : ArgumentOutOfRangeException
|
||||
{
|
||||
public InvalidImcVariantException()
|
||||
: base("Trying to manipulate invalid variant.")
|
||||
{ }
|
||||
}
|
||||
|
||||
public static class ImcExtensions
|
||||
{
|
||||
public static bool Equal( this ImcFile.ImageChangeData lhs, ImcFile.ImageChangeData rhs )
|
||||
|
|
@ -84,15 +91,11 @@ namespace Penumbra.MetaData
|
|||
|
||||
if( imc.Variant > parts[ idx ].Variants.Length )
|
||||
{
|
||||
PluginLog.Debug( "Trying to manipulate invalid variant {Variant} of {NumVariants} in file {FileName}.", imc.Variant,
|
||||
parts[ idx ].Variants.Length, file.FilePath.Path );
|
||||
return ref parts[ idx ].Variants[ parts[ idx ].Variants.Length - 1 ];
|
||||
throw new InvalidImcVariantException();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return ref parts[ idx ].Variants[ imc.Variant - 1 ];
|
||||
}
|
||||
}
|
||||
|
||||
public static ImcFile Clone( this ImcFile file )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue