Make line endings explicit in editorconfig and share in sub projects, also apply editorconfig everywhere and move some namespaces.

This commit is contained in:
Ottermandias 2023-09-18 16:56:16 +02:00
parent 53adb6fa54
commit 2b4a01df06
155 changed files with 1620 additions and 1614 deletions

View file

@ -101,8 +101,8 @@ public readonly struct EqdpManipulation : IMetaManipulation<EqdpManipulation>
if (FileIndex() == (MetaIndex)(-1))
return false;
// No check for set id.
// No check for set id.
return true;
}
}

View file

@ -9,73 +9,71 @@ using SharpCompress.Common;
namespace Penumbra.Meta.Manipulations;
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public readonly struct EqpManipulation : IMetaManipulation< EqpManipulation >
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public readonly struct EqpManipulation : IMetaManipulation<EqpManipulation>
{
[JsonConverter( typeof( ForceNumericFlagEnumConverter ) )]
[JsonConverter(typeof(ForceNumericFlagEnumConverter))]
public EqpEntry Entry { get; private init; }
public SetId SetId { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
[JsonConverter(typeof(StringEnumConverter))]
public EquipSlot Slot { get; private init; }
[JsonConstructor]
public EqpManipulation( EqpEntry entry, EquipSlot slot, SetId setId )
public EqpManipulation(EqpEntry entry, EquipSlot slot, SetId setId)
{
Slot = slot;
SetId = setId;
Entry = Eqp.Mask( slot ) & entry;
Entry = Eqp.Mask(slot) & entry;
}
public EqpManipulation Copy( EqpEntry entry )
public EqpManipulation Copy(EqpEntry entry)
=> new(entry, Slot, SetId);
public override string ToString()
=> $"Eqp - {SetId} - {Slot}";
public bool Equals( EqpManipulation other )
=> Slot == other.Slot
public bool Equals(EqpManipulation other)
=> Slot == other.Slot
&& SetId == other.SetId;
public override bool Equals( object? obj )
=> obj is EqpManipulation other && Equals( other );
public override bool Equals(object? obj)
=> obj is EqpManipulation other && Equals(other);
public override int GetHashCode()
=> HashCode.Combine( ( int )Slot, SetId );
=> HashCode.Combine((int)Slot, SetId);
public int CompareTo( EqpManipulation other )
public int CompareTo(EqpManipulation other)
{
var set = SetId.Id.CompareTo( other.SetId.Id );
return set != 0 ? set : Slot.CompareTo( other.Slot );
var set = SetId.Id.CompareTo(other.SetId.Id);
return set != 0 ? set : Slot.CompareTo(other.Slot);
}
public MetaIndex FileIndex()
=> MetaIndex.Eqp;
public bool Apply( ExpandedEqpFile file )
public bool Apply(ExpandedEqpFile file)
{
var entry = file[ SetId ];
var mask = Eqp.Mask( Slot );
if( ( entry & mask ) == Entry )
{
var entry = file[SetId];
var mask = Eqp.Mask(Slot);
if ((entry & mask) == Entry)
return false;
}
file[ SetId ] = ( entry & ~mask ) | Entry;
file[SetId] = (entry & ~mask) | Entry;
return true;
}
public bool Validate()
{
{
var mask = Eqp.Mask(Slot);
if (mask == 0)
return false;
if ((Entry & mask) != Entry)
return false;
// No check for set id.
// No check for set id.
return true;
}
}
}

View file

@ -7,8 +7,8 @@ using Penumbra.Meta.Files;
namespace Penumbra.Meta.Manipulations;
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public readonly struct EstManipulation : IMetaManipulation< EstManipulation >
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public readonly struct EstManipulation : IMetaManipulation<EstManipulation>
{
public enum EstType : byte
{
@ -18,7 +18,7 @@ public readonly struct EstManipulation : IMetaManipulation< EstManipulation >
Head = MetaIndex.HeadEst,
}
public static string ToName( EstType type )
public static string ToName(EstType type)
=> type switch
{
EstType.Hair => "hair",
@ -30,19 +30,19 @@ public readonly struct EstManipulation : IMetaManipulation< EstManipulation >
public ushort Entry { get; private init; } // SkeletonIdx.
[JsonConverter( typeof( StringEnumConverter ) )]
[JsonConverter(typeof(StringEnumConverter))]
public Gender Gender { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
[JsonConverter(typeof(StringEnumConverter))]
public ModelRace Race { get; private init; }
public SetId SetId { get; private init; }
[JsonConverter( typeof( StringEnumConverter ) )]
[JsonConverter(typeof(StringEnumConverter))]
public EstType Slot { get; private init; }
[JsonConstructor]
public EstManipulation( Gender gender, ModelRace race, EstType slot, SetId setId, ushort entry )
public EstManipulation(Gender gender, ModelRace race, EstType slot, SetId setId, ushort entry)
{
Entry = entry;
Gender = gender;
@ -51,49 +51,45 @@ public readonly struct EstManipulation : IMetaManipulation< EstManipulation >
Slot = slot;
}
public EstManipulation Copy( ushort entry )
public EstManipulation Copy(ushort entry)
=> new(Gender, Race, Slot, SetId, entry);
public override string ToString()
=> $"Est - {SetId} - {Slot} - {Race.ToName()} {Gender.ToName()}";
public bool Equals( EstManipulation other )
public bool Equals(EstManipulation other)
=> Gender == other.Gender
&& Race == other.Race
&& Race == other.Race
&& SetId == other.SetId
&& Slot == other.Slot;
&& Slot == other.Slot;
public override bool Equals( object? obj )
=> obj is EstManipulation other && Equals( other );
public override bool Equals(object? obj)
=> obj is EstManipulation other && Equals(other);
public override int GetHashCode()
=> HashCode.Combine( ( int )Gender, ( int )Race, SetId, ( int )Slot );
=> HashCode.Combine((int)Gender, (int)Race, SetId, (int)Slot);
public int CompareTo( EstManipulation other )
public int CompareTo(EstManipulation other)
{
var r = Race.CompareTo( other.Race );
if( r != 0 )
{
var r = Race.CompareTo(other.Race);
if (r != 0)
return r;
}
var g = Gender.CompareTo( other.Gender );
if( g != 0 )
{
var g = Gender.CompareTo(other.Gender);
if (g != 0)
return g;
}
var s = Slot.CompareTo( other.Slot );
return s != 0 ? s : SetId.Id.CompareTo( other.SetId.Id );
var s = Slot.CompareTo(other.Slot);
return s != 0 ? s : SetId.Id.CompareTo(other.SetId.Id);
}
public MetaIndex FileIndex()
=> ( MetaIndex )Slot;
=> (MetaIndex)Slot;
public bool Apply( EstFile file )
public bool Apply(EstFile file)
{
return file.SetEntry( Names.CombinedRace( Gender, Race ), SetId.Id, Entry ) switch
return file.SetEntry(Names.CombinedRace(Gender, Race), SetId.Id, Entry) switch
{
EstFile.EstEntryChange.Unchanged => false,
EstFile.EstEntryChange.Changed => true,
@ -109,7 +105,8 @@ public readonly struct EstManipulation : IMetaManipulation< EstManipulation >
return false;
if (Names.CombinedRace(Gender, Race) == GenderRace.Unknown)
return false;
// No known check for set id or entry.
// No known check for set id or entry.
return true;
}
}
}

View file

@ -5,55 +5,51 @@ using Penumbra.Meta.Files;
namespace Penumbra.Meta.Manipulations;
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public readonly struct GmpManipulation : IMetaManipulation< GmpManipulation >
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public readonly struct GmpManipulation : IMetaManipulation<GmpManipulation>
{
public GmpEntry Entry { get; private init; }
public SetId SetId { get; private init; }
public SetId SetId { get; private init; }
[JsonConstructor]
public GmpManipulation( GmpEntry entry, SetId setId )
public GmpManipulation(GmpEntry entry, SetId setId)
{
Entry = entry;
SetId = setId;
}
public GmpManipulation Copy( GmpEntry entry )
public GmpManipulation Copy(GmpEntry entry)
=> new(entry, SetId);
public override string ToString()
=> $"Gmp - {SetId}";
public bool Equals( GmpManipulation other )
public bool Equals(GmpManipulation other)
=> SetId == other.SetId;
public override bool Equals( object? obj )
=> obj is GmpManipulation other && Equals( other );
public override bool Equals(object? obj)
=> obj is GmpManipulation other && Equals(other);
public override int GetHashCode()
=> SetId.GetHashCode();
public int CompareTo( GmpManipulation other )
=> SetId.Id.CompareTo( other.SetId.Id );
public int CompareTo(GmpManipulation other)
=> SetId.Id.CompareTo(other.SetId.Id);
public MetaIndex FileIndex()
=> MetaIndex.Gmp;
public bool Apply( ExpandedGmpFile file )
public bool Apply(ExpandedGmpFile file)
{
var entry = file[ SetId ];
if( entry == Entry )
{
var entry = file[SetId];
if (entry == Entry)
return false;
}
file[ SetId ] = Entry;
file[SetId] = Entry;
return true;
}
public bool Validate()
{
// No known conditions.
return true;
}
}
=> true;
}

View file

@ -10,6 +10,7 @@ using Penumbra.Interop.Services;
using Penumbra.Interop.Structs;
using Penumbra.Meta.Files;
using Penumbra.Mods;
using Penumbra.Mods.Subclasses;
using Penumbra.Services;
using ResidentResourceManager = Penumbra.Interop.Services.ResidentResourceManager;