From d10aa896846d1f70793ba0711de22ddb7e367547 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 2 Apr 2023 15:26:36 -0500 Subject: [PATCH 001/135] Change write-side float parameter name to divisor Matches what it's actually doing, more --- .../Translations/FloatBinaryTranslationExt.cs | 13 ++++----- .../Binary/FloatBinaryTranslation.cs | 26 ++++++++++++------ .../Major Records/AcousticSpace_Generated.cs | 2 +- .../Major Records/BodyPart_Generated.cs | 4 +-- .../DialogResponseFlags_Generated.cs | 2 +- .../Major Records/DialogTopic_Generated.cs | 2 +- .../FurnitureMarkerParameters_Generated.cs | 2 +- .../MovementRotationData_Generated.cs | 4 +-- .../Major Records/MovementType_Generated.cs | 24 ++++++++--------- .../Major Records/MusicTypeData_Generated.cs | 2 +- .../NpcFaceTintingLayer_Generated.cs | 2 +- .../ReverbParameters_Generated.cs | 2 +- .../Major Records/SoundCategory_Generated.cs | 4 +-- .../SoundDescriptorStandardData_Generated.cs | 2 +- .../SoundOutputModel_Generated.cs | 2 +- .../StoryManagerQuest_Generated.cs | 2 +- .../Major Records/Weather_Generated.cs | 6 ++--- .../FloatBinaryTranslationGeneration.cs | 27 ++++++++++++++----- .../SoundDataExtended_Generated.cs | 2 +- .../Records/Major Records/Armor_Generated.cs | 2 +- .../DialogResponseFlags_Generated.cs | 2 +- .../Major Records/DialogTopic_Generated.cs | 2 +- .../Major Records/MovementType_Generated.cs | 6 ++--- .../Major Records/MusicTypeData_Generated.cs | 2 +- .../ReverbParameters_Generated.cs | 2 +- .../Major Records/SoundCategory_Generated.cs | 4 +-- .../SoundDescriptor_Generated.cs | 2 +- .../StoryManagerQuest_Generated.cs | 2 +- .../Major Records/TintLayer_Generated.cs | 2 +- .../Major Records/Weather_Generated.cs | 6 ++--- 30 files changed, 93 insertions(+), 69 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs index c3c98ccbc..878306492 100644 --- a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs +++ b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs @@ -11,10 +11,10 @@ public static void Write( MutagenWriter writer, float item, RecordType header, - float multiplier) + float divisor) where TReader : IMutagenReadStream { - transl.Write(writer, item / multiplier, header); + transl.Write(writer, item / divisor, header); } public static void WriteNullable( @@ -22,11 +22,11 @@ public static void WriteNullable( MutagenWriter writer, float? item, RecordType header, - float multiplier) + float divisor) where TReader : IMutagenReadStream { if (!item.HasValue) return; - transl.Write(writer, item.Value / multiplier, header); + transl.Write(writer, item.Value / divisor, header); } public static void Write( @@ -35,7 +35,7 @@ public static void Write( float? item, RecordType header, FloatIntegerType integerType, - double multiplier) + double divisor) where TReader : IMutagenReadStream { try @@ -43,7 +43,8 @@ public static void Write( if (item == null) return; using (HeaderExport.Subrecord(writer, header)) { - FloatBinaryTranslation.Instance.Write(writer, item, integerType, multiplier); + FloatBinaryTranslation.Instance.Write(writer, item, integerType, + divisor: divisor); } } catch (Exception ex) diff --git a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs index 54214b533..c5fec3275 100644 --- a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs +++ b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs @@ -101,30 +101,40 @@ public override void Write(TWriter writer, float item) } } - public void Write(TWriter writer, float item, float multiplier) + public void Write( + TWriter writer, + float item, + float divisor) { - Write(writer, item / multiplier); + Write(writer, item / divisor); } - public void WriteNullable(TWriter writer, float? item, float multiplier) + public void WriteNullable( + TWriter writer, + float? item, + float divisor) { if (!item.HasValue) return; - Write(writer, item.Value / multiplier); + Write(writer, item.Value / divisor); } - public void Write(TWriter writer, float? item, FloatIntegerType integerType, double multiplier) + public void Write( + TWriter writer, + float? item, + FloatIntegerType integerType, + double divisor) { if (item == null) return; switch (integerType) { case FloatIntegerType.UInt: - writer.Write((uint)Math.Round(item.Value / multiplier)); + writer.Write((uint)Math.Round(item.Value / divisor)); break; case FloatIntegerType.UShort: - writer.Write((ushort)Math.Round(item.Value / multiplier)); + writer.Write((ushort)Math.Round(item.Value / divisor)); break; case FloatIntegerType.Byte: - writer.Write((byte)Math.Round(item.Value / multiplier)); + writer.Write((byte)Math.Round(item.Value / divisor)); break; default: throw new NotImplementedException(); diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/AcousticSpace_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/AcousticSpace_Generated.cs index 7d3d2afb2..08506367c 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/AcousticSpace_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/AcousticSpace_Generated.cs @@ -1645,7 +1645,7 @@ public static void WriteRecordTypes( writer: writer, item: item.WeatherAttenuationDb, integerType: FloatIntegerType.UShort, - multiplier: 0.01, + divisor: 0.01, header: translationParams.ConvertToCustom(RecordTypes.WNAM)); } diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/BodyPart_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/BodyPart_Generated.cs index 30b03541c..6d90d0980 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/BodyPart_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/BodyPart_Generated.cs @@ -3719,11 +3719,11 @@ public static void WriteRecordTypes( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.GoreEffectsLocalRotateX, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.GoreEffectsLocalRotateY, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.CutTesselation); diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs index e0d9168a9..955824d53 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs @@ -1006,7 +1006,7 @@ public static void WriteEmbedded( writer: writer, item: item.ResetHours, integerType: FloatIntegerType.UShort, - multiplier: 0.0003663003663003663); + divisor: 0.0003663003663003663); } public void Write( diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogTopic_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogTopic_Generated.cs index 8f573c1f7..3e050851d 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogTopic_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogTopic_Generated.cs @@ -2619,7 +2619,7 @@ public static void WriteRecordTypes( writer: writer, item: item.Priority, header: translationParams.ConvertToCustom(RecordTypes.PNAM), - multiplier: 50f); + divisor: 50f); FormLinkBinaryTranslation.Instance.WriteNullable( writer: writer, item: item.Branch, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs index 8e56731cd..9d9ac8eff 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs @@ -1281,7 +1281,7 @@ public static void WriteEmbedded( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RotationZ, - multiplier: 57.2958f); + divisor: 57.2958f); if (!item.Versioning.HasFlag(FurnitureMarkerParameters.VersioningBreaks.Break0)) { FormLinkBinaryTranslation.Instance.Write( diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementRotationData_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementRotationData_Generated.cs index 804f7a7f5..b2f8ad9ad 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementRotationData_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementRotationData_Generated.cs @@ -1093,11 +1093,11 @@ public static void WriteEmbedded( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.Walk, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.Run, - multiplier: 57.2958f); + divisor: 57.2958f); writer.Write(item.Unused2); } diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementType_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementType_Generated.cs index 500317aac..792f4c418 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementType_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementType_Generated.cs @@ -3259,53 +3259,53 @@ public static void WriteRecordTypes( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.PitchStanding, - multiplier: 57.2958f); + divisor: 57.2958f); if (!item.SPEDDataTypeState.HasFlag(MovementType.SPEDDataType.Break2)) { FloatBinaryTranslation.Instance.Write( writer: writer, item: item.PitchWalk, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.PitchRun, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.PitchSprint, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RollStanding, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RollWalk, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RollRun, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RollSprint, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.YawStanding, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.YawWalk, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.YawRun, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.YawSprint, - multiplier: 57.2958f); + divisor: 57.2958f); } } } diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/MusicTypeData_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/MusicTypeData_Generated.cs index ebfe10d6a..d992b30b1 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/MusicTypeData_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/MusicTypeData_Generated.cs @@ -1003,7 +1003,7 @@ public static void WriteEmbedded( writer: writer, item: item.DuckingDecibel, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + divisor: 0.01); } public void Write( diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/NpcFaceTintingLayer_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/NpcFaceTintingLayer_Generated.cs index 88f384fef..cd8f4bc16 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/NpcFaceTintingLayer_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/NpcFaceTintingLayer_Generated.cs @@ -1252,7 +1252,7 @@ public static void WriteRecordTypes( writer: writer, item: item.Value, integerType: FloatIntegerType.Byte, - multiplier: 0.01); + divisor: 0.01); if (!item.TENDDataTypeState.HasFlag(NpcFaceTintingLayer.TENDDataType.Break0)) { ColorBinaryTranslation.Instance.Write( diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/ReverbParameters_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/ReverbParameters_Generated.cs index 7a578165a..f9d01f821 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/ReverbParameters_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/ReverbParameters_Generated.cs @@ -1871,7 +1871,7 @@ public static void WriteRecordTypes( writer: writer, item: item.DecayHfRatio, integerType: FloatIntegerType.Byte, - multiplier: 0.01); + divisor: 0.01); writer.Write(item.ReflectDelayMS); writer.Write(item.ReverbDelayMS); PercentBinaryTranslation.Write( diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundCategory_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundCategory_Generated.cs index a29e6d5c8..9789f9673 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundCategory_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundCategory_Generated.cs @@ -1741,13 +1741,13 @@ public static void WriteRecordTypes( writer: writer, item: item.StaticVolumeMultiplier, integerType: FloatIntegerType.UShort, - multiplier: 1.5259021896696422E-05, + divisor: 1.5259021896696422E-05, header: translationParams.ConvertToCustom(RecordTypes.VNAM)); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.DefaultMenuVolume, integerType: FloatIntegerType.UShort, - multiplier: 1.5259021896696422E-05, + divisor: 1.5259021896696422E-05, header: translationParams.ConvertToCustom(RecordTypes.UNAM)); FloatBinaryTranslation.Instance.WriteNullable( writer: writer, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundDescriptorStandardData_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundDescriptorStandardData_Generated.cs index 09055091d..4b45ae125 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundDescriptorStandardData_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundDescriptorStandardData_Generated.cs @@ -1184,7 +1184,7 @@ public static void WriteEmbedded( writer: writer, item: item.StaticAttenuation, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + divisor: 0.01); } public void Write( diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundOutputModel_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundOutputModel_Generated.cs index 5f052d8ce..2c59589e8 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundOutputModel_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundOutputModel_Generated.cs @@ -1692,7 +1692,7 @@ public static void WriteRecordTypes( writer: writer, item: item.StaticAttenuation, integerType: FloatIntegerType.UShort, - multiplier: 0.01, + divisor: 0.01, header: translationParams.ConvertToCustom(RecordTypes.VNAM)); if (item.OutputChannels is {} OutputChannelsItem) { diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/StoryManagerQuest_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/StoryManagerQuest_Generated.cs index ced024b33..b66619463 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/StoryManagerQuest_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/StoryManagerQuest_Generated.cs @@ -1092,7 +1092,7 @@ public static void WriteRecordTypes( writer: writer, item: item.HoursUntilReset, header: translationParams.ConvertToCustom(RecordTypes.RNAM), - multiplier: 0.041666668f); + divisor: 0.041666668f); } public void Write( diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Weather_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Weather_Generated.cs index 150a82734..87c5fd6a8 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Weather_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Weather_Generated.cs @@ -7206,7 +7206,7 @@ public static void WriteRecordTypes( writer: writer, item: item.TransDelta, integerType: FloatIntegerType.Byte, - multiplier: 4); + divisor: 4); PercentBinaryTranslation.Write( writer: writer, item: item.SunGlare, @@ -7255,12 +7255,12 @@ public static void WriteRecordTypes( writer: writer, item: item.WindDirection, integerType: FloatIntegerType.Byte, - multiplier: 0.002777777777777778); + divisor: 0.002777777777777778); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.WindDirectionRange, integerType: FloatIntegerType.Byte, - multiplier: 0.005555555555555556); + divisor: 0.005555555555555556); if (!item.DATADataTypeState.HasFlag(Weather.DATADataType.Break0)) { PercentBinaryTranslation.Write( diff --git a/Mutagen.Bethesda.Generation/Modules/Binary/FloatBinaryTranslationGeneration.cs b/Mutagen.Bethesda.Generation/Modules/Binary/FloatBinaryTranslationGeneration.cs index a1ece66aa..b461e5a6b 100644 --- a/Mutagen.Bethesda.Generation/Modules/Binary/FloatBinaryTranslationGeneration.cs +++ b/Mutagen.Bethesda.Generation/Modules/Binary/FloatBinaryTranslationGeneration.cs @@ -13,14 +13,14 @@ public FloatBinaryTranslationGeneration() : base(expectedLen: 4, typeName: "Float") { PreferDirectTranslation = false; - this.CustomRead = ReadFloat; - this.CustomWrite = WriteFloat; - this.AdditionalWriteParams.Add(AdditionalParam); - this.AdditionalCopyInParams.Add(AdditionalParam); - this.AdditionalCopyInRetParams.Add(AdditionalParam); + CustomRead = ReadFloat; + CustomWrite = WriteFloat; + AdditionalWriteParams.Add(AdditionalWriteParam); + AdditionalCopyInParams.Add(AdditionalReadParam); + AdditionalCopyInRetParams.Add(AdditionalReadParam); } - private static TryGet AdditionalParam( + private static TryGet AdditionalReadParam( ObjectGeneration objGen, TypeGeneration typeGen) { @@ -33,6 +33,19 @@ private static TryGet AdditionalParam( return TryGet.Failure; } + private static TryGet AdditionalWriteParam( + ObjectGeneration objGen, + TypeGeneration typeGen) + { + var floatType = typeGen as FloatType; + if (floatType.IntegerType == null + && !floatType.Multiplier.EqualsWithin(1)) + { + return TryGet.Succeed($"divisor: {(float)floatType.Multiplier}f"); + } + return TryGet.Failure; + } + public override async Task ExpectedLength(ObjectGeneration objGen, TypeGeneration typeGen) { if (typeGen.GetFieldData().Binary != BinaryGenerationType.Normal) return await base.ExpectedLength(objGen, typeGen); @@ -106,7 +119,7 @@ bool WriteFloat(StructuredStringBuilder sb, ObjectGeneration objGen, TypeGenerat args.Add($"writer: {writer}"); args.Add($"item: {item}"); args.Add($"integerType: {nameof(FloatIntegerType)}.{floatType.IntegerType}"); - args.Add($"multiplier: {floatType.Multiplier}"); + args.Add($"divisor: {floatType.Multiplier}"); if (data.RecordType.HasValue && data.HandleTrigger) { diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/SoundDataExtended_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/SoundDataExtended_Generated.cs index e03ca2435..107b97b93 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/SoundDataExtended_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/SoundDataExtended_Generated.cs @@ -1146,7 +1146,7 @@ public static void WriteEmbedded( writer: writer, item: item.StaticAttenuation, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + divisor: 0.01); SoundDataExtendedBinaryWriteTranslation.WriteBinaryStopTime( writer: writer, item: item); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs index 9f8327734..045eff9cd 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs @@ -3306,7 +3306,7 @@ public static void WriteRecordTypes( writer: writer, item: item.ArmorRating, integerType: FloatIntegerType.UInt, - multiplier: 0.01, + divisor: 0.01, header: translationParams.ConvertToCustom(RecordTypes.DNAM)); FormLinkBinaryTranslation.Instance.WriteNullable( writer: writer, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs index 7aa4bd3b8..96b795de9 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs @@ -1006,7 +1006,7 @@ public static void WriteEmbedded( writer: writer, item: item.ResetHours, integerType: FloatIntegerType.UShort, - multiplier: 0.0003663003663003663); + divisor: 0.0003663003663003663); } public void Write( diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs index 0b9b9a3b0..009923208 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs @@ -2604,7 +2604,7 @@ public static void WriteRecordTypes( writer: writer, item: item.Priority, header: translationParams.ConvertToCustom(RecordTypes.PNAM), - multiplier: 50f); + divisor: 50f); FormLinkBinaryTranslation.Instance.WriteNullable( writer: writer, item: item.Branch, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MovementType_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MovementType_Generated.cs index f93f33bc0..f2518bf32 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MovementType_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MovementType_Generated.cs @@ -2055,17 +2055,17 @@ public static void WriteRecordTypes( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RotateInPlaceWalk, - multiplier: 57.2958f); + divisor: 57.2958f); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RotateInPlaceRun, - multiplier: 57.2958f); + divisor: 57.2958f); if (!item.SPEDDataTypeState.HasFlag(MovementType.SPEDDataType.Break0)) { FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RotateWhileMovingRun, - multiplier: 57.2958f); + divisor: 57.2958f); } } if (item.AnimationChangeThresholds is {} AnimationChangeThresholdsItem) diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTypeData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTypeData_Generated.cs index 92951a922..4d50a12f6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTypeData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTypeData_Generated.cs @@ -1003,7 +1003,7 @@ public static void WriteEmbedded( writer: writer, item: item.DuckingDecibel, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + divisor: 0.01); } public void Write( diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ReverbParameters_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ReverbParameters_Generated.cs index 8a05af636..1e007337f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ReverbParameters_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ReverbParameters_Generated.cs @@ -1826,7 +1826,7 @@ public static void WriteRecordTypes( writer: writer, item: item.DecayHfRatio, integerType: FloatIntegerType.Byte, - multiplier: 0.01); + divisor: 0.01); writer.Write(item.ReflectDelayMS); writer.Write(item.ReverbDelayMS); PercentBinaryTranslation.Write( diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundCategory_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundCategory_Generated.cs index 7d8f7a370..c18cedf5e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundCategory_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundCategory_Generated.cs @@ -1570,13 +1570,13 @@ public static void WriteRecordTypes( writer: writer, item: item.StaticVolumeMultiplier, integerType: FloatIntegerType.UShort, - multiplier: 1.5259021896696422E-05, + divisor: 1.5259021896696422E-05, header: translationParams.ConvertToCustom(RecordTypes.VNAM)); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.DefaultMenuVolume, integerType: FloatIntegerType.UShort, - multiplier: 1.5259021896696422E-05, + divisor: 1.5259021896696422E-05, header: translationParams.ConvertToCustom(RecordTypes.UNAM)); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs index e1c0269d4..fcf5ba73d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs @@ -2307,7 +2307,7 @@ public static void WriteRecordTypes( writer: writer, item: item.StaticAttenuation, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + divisor: 0.01); } } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/StoryManagerQuest_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/StoryManagerQuest_Generated.cs index 6594076a5..031202ff5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/StoryManagerQuest_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/StoryManagerQuest_Generated.cs @@ -1092,7 +1092,7 @@ public static void WriteRecordTypes( writer: writer, item: item.HoursUntilReset, header: translationParams.ConvertToCustom(RecordTypes.RNAM), - multiplier: 0.041666668f); + divisor: 0.041666668f); } public void Write( diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintLayer_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintLayer_Generated.cs index e9b982fb5..f933327ac 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintLayer_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintLayer_Generated.cs @@ -1137,7 +1137,7 @@ public static void WriteRecordTypes( writer: writer, item: item.InterpolationValue, integerType: FloatIntegerType.UInt, - multiplier: 0.01, + divisor: 0.01, header: translationParams.ConvertToCustom(RecordTypes.TINV)); Int16BinaryTranslation.Instance.WriteNullable( writer: writer, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs index 7151b9371..4f83e8677 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs @@ -5902,7 +5902,7 @@ public static void WriteRecordTypes( writer: writer, item: item.TransDelta, integerType: FloatIntegerType.Byte, - multiplier: 4); + divisor: 4); PercentBinaryTranslation.Write( writer: writer, item: item.SunGlare, @@ -5951,12 +5951,12 @@ public static void WriteRecordTypes( writer: writer, item: item.WindDirection, integerType: FloatIntegerType.Byte, - multiplier: 0.002777777777777778); + divisor: 0.002777777777777778); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.WindDirectionRange, integerType: FloatIntegerType.Byte, - multiplier: 0.005555555555555556); + divisor: 0.005555555555555556); } WeatherBinaryWriteTranslation.WriteBinaryDisabledCloudLayers( writer: writer, From 66fa6eb9f782e865b3303efd417e9c73085b058b Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 2 Apr 2023 21:02:29 -0500 Subject: [PATCH 002/135] Avoid a boxing in Subrecord header export --- .../Plugins/Binary/Translations/HeaderExport.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/HeaderExport.cs b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/HeaderExport.cs index 4b3f9967b..ffd3d1b83 100644 --- a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/HeaderExport.cs +++ b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/HeaderExport.cs @@ -91,7 +91,7 @@ public static HeaderExport Group( /// Writer to export header to /// RecordType of the header /// Object to dispose when header's content has been written - public static IDisposable Subrecord( + public static HeaderExport Subrecord( MutagenWriter writer, RecordType record) { From 762bcdb76b45fc3b7581711bb882222aeda8a869 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 2 Apr 2023 21:28:45 -0500 Subject: [PATCH 003/135] Some FloatTranslation unit tests --- .../Binary/FloatBinaryTranslationTests.cs | 458 ++++++++++++++++++ .../Translations/FloatBinaryTranslationExt.cs | 28 +- .../Binary/FloatBinaryTranslation.cs | 16 +- 3 files changed, 487 insertions(+), 15 deletions(-) create mode 100644 Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs diff --git a/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs b/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs new file mode 100644 index 000000000..cf3a121f4 --- /dev/null +++ b/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs @@ -0,0 +1,458 @@ +using System.Buffers.Binary; +using FluentAssertions; +using Mutagen.Bethesda.Plugins; +using Mutagen.Bethesda.Plugins.Binary.Streams; +using Mutagen.Bethesda.Plugins.Masters; +using Mutagen.Bethesda.Plugins.Meta; +using Mutagen.Bethesda.Translations.Binary; +using Noggog; +using Xunit; + +namespace Mutagen.Bethesda.UnitTests.Translations.Binary; + +public class FloatBinaryTranslationTests +{ + #region Write + + private byte[] GetWriteArray(Action, MutagenWriter> toDo) + { + var memStream = new MemoryStream(); + using var writer = new MutagenWriter(memStream, GameConstants.SkyrimSE); + toDo(FloatBinaryTranslation.Instance, writer); + memStream.Position = 0; + return memStream.ToArray(); + } + + private float? RunTypicalWriteTest(Action, MutagenWriter> toDo) + { + var content = GetWriteArray(toDo); + if (content.Length == 4) + { + return BinaryPrimitives.ReadSingleLittleEndian(content); + } + else if (content.Length == 0) + { + return default; + } + + throw new ArgumentException(); + } + + [Fact] + public void WriteEpsilon() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, float.Epsilon); + }).Should().Be(0); + } + + [Fact] + public void WriteZero() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, 0f); + }).Should().Be(0); + } + + [Fact] + public void WriteTypical() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, 1.234f); + }).Should().Be(1.234f); + } + + [Fact] + public void WriteNegative() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, -1.234f); + }).Should().Be(-1.234f); + } + + [Fact] + public void WriteWithDivisor() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, 100f, 10f); + }).Should().Be(10f); + } + + [Fact] + public void WriteWithDivisorOne() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, 100f, 1f); + }).Should().Be(100f); + } + + [Fact] + public void WriteWithIntegerType() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UInt, 1f); + }); + arr.Should().HaveCount(4); + BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(100); + } + + [Fact] + public void WriteWithIntegerTypeNull() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, null, FloatIntegerType.UInt, 1f); + }).Should().BeNull(); + } + + [Fact] + public void WriteWithIntegerTypeWithDivisor() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UInt, 10f); + }); + arr.Should().HaveCount(4); + BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(10); + } + + [Fact] + public void WriteWithIntegerTypeRounded() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UInt, 7f); + }); + arr.Should().HaveCount(4); + BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(14); + } + + [Fact] + public void WriteWithIntegerTypeLimit() + { + Assert.Throws(() => + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, int.MaxValue, FloatIntegerType.UInt, 0.5f); + }); + arr.Should().HaveCount(4); + BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(14); + }); + } + + [Fact] + public void WriteWithUShortType() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UShort, 1f); + }); + arr.Should().HaveCount(2); + BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(100); + } + + [Fact] + public void WriteWithUShortTypeNull() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, null, FloatIntegerType.UShort, 1f); + }).Should().BeNull(); + } + + [Fact] + public void WriteWithUShortTypeWithDivisor() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UShort, 10f); + }); + arr.Should().HaveCount(2); + BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(10); + } + + [Fact] + public void WriteWithUShortTypeRounded() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UShort, 7f); + }); + arr.Should().HaveCount(2); + BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(14); + } + + [Fact] + public void WriteWithUShortTypeLimit() + { + Assert.Throws(() => + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, ushort.MaxValue, FloatIntegerType.UShort, 0.5f); + }); + arr.Should().HaveCount(2); + BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(14); + }); + } + + [Fact] + public void WriteWithByteType() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.Byte, 1f); + }); + arr.Should().HaveCount(1); + arr[0].Should().Be(100); + } + + [Fact] + public void WriteWithByteTypeNull() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, null, FloatIntegerType.Byte, 1f); + }).Should().BeNull(); + } + + [Fact] + public void WriteWithByteTypeWithDivisor() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.Byte, 10f); + }); + arr.Should().HaveCount(1); + arr[0].Should().Be(10); + } + + [Fact] + public void WriteWithByteTypeRounded() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.Byte, 7f); + }); + arr.Should().HaveCount(1); + arr[0].Should().Be(14); + } + + [Fact] + public void WriteWithByteTypeLimit() + { + Assert.Throws(() => + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, byte.MaxValue, FloatIntegerType.Byte, 0.5f); + }); + arr.Should().HaveCount(2); + BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(14); + }); + } + + #endregion + + #region Read + + public float? GetReadFloat( + float f, + Func, MutagenFrame, float> toDo) + { + return GetReadFloat( + f, + (bytes, f) => BinaryPrimitives.WriteSingleLittleEndian(bytes, f), + toDo); + } + + public float? GetReadFloat( + float f, + Action writer, + Func, MutagenFrame, float> toDo) + { + var bytes = new byte[4]; + writer(bytes, f); + var memStream = new MemoryStream(bytes); + var mutagenFrame = new MutagenFrame( + new MutagenInterfaceReadStream( + new BinaryReadStream(memStream), + new ParsingBundle(GameConstants.SkyrimSE, new MasterReferenceCollection(ModKey.Null)))); + return toDo(FloatBinaryTranslation.Instance, mutagenFrame); + } + + [Fact] + public void ReadTypical() + { + GetReadFloat(1.5f, (t, f) => t.Parse(f)) + .Should().Be(1.5f); + } + + [Fact] + public void ReadEpsilon() + { + GetReadFloat(float.Epsilon, (t, f) => t.Parse(f)) + .Should().Be(0f); + } + + [Fact] + public void ReadMultiplier() + { + GetReadFloat(1.5f, (t, f) => t.Parse(f, 2f)) + .Should().Be(3f); + } + + [Fact] + public void ReadIntegerType() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (int)f), + (t, f) => + { + return t.Parse(f, FloatIntegerType.UInt, 1f); + }) + .Should().Be(100f); + } + + [Fact] + public void ReadIntegerTypeMultiplier() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (int)f), + (t, f) => + { + return t.Parse(f, FloatIntegerType.UInt, 2f); + }) + .Should().Be(200f); + } + + [Fact] + public void ReadUShortType() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (short)f), + (t, f) => + { + return t.Parse(f, FloatIntegerType.UShort, 1f); + }) + .Should().Be(100f); + } + + [Fact] + public void ReadUShortTypeMultiplier() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (int)f), + (t, f) => + { + return t.Parse(f, FloatIntegerType.UShort, 2f); + }) + .Should().Be(200f); + } + + [Fact] + public void ReadByteType() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (short)f), + (t, f) => + { + return t.Parse(f, FloatIntegerType.Byte, 1f); + }) + .Should().Be(100f); + } + + [Fact] + public void ReadByteTypeMultiplier() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (int)f), + (t, f) => + { + return t.Parse(f, FloatIntegerType.Byte, 2f); + }) + .Should().Be(200f); + } + + [Fact] + public void GetIntegerType() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (int)f), + (t, f) => + { + return t.GetFloat(f.ReadBytes(4), FloatIntegerType.UInt, 1f); + }) + .Should().Be(100f); + } + + [Fact] + public void GetIntegerTypeMultiplier() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (int)f), + (t, f) => + { + return t.GetFloat(f.ReadBytes(4), FloatIntegerType.UInt, 2f); + }) + .Should().Be(200f); + } + + [Fact] + public void GetUShortType() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (short)f), + (t, f) => + { + return t.GetFloat(f.ReadBytes(4), FloatIntegerType.UShort, 1f); + }) + .Should().Be(100f); + } + + [Fact] + public void GetUShortTypeMultiplier() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (int)f), + (t, f) => + { + return t.GetFloat(f.ReadBytes(4), FloatIntegerType.UShort, 2f); + }) + .Should().Be(200f); + } + + [Fact] + public void GetByteType() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (short)f), + (t, f) => + { + return t.GetFloat(f.ReadBytes(4), FloatIntegerType.Byte, 1f); + }) + .Should().Be(100f); + } + + [Fact] + public void GetByteTypeMultiplier() + { + GetReadFloat(100f, + (b, f) => BinaryPrimitives.WriteInt32LittleEndian(b, (int)f), + (t, f) => + { + return t.GetFloat(f.ReadBytes(4), FloatIntegerType.Byte, 2f); + }) + .Should().Be(200f); + } + + #endregion +} \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs index 878306492..b148b138e 100644 --- a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs +++ b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs @@ -14,7 +14,18 @@ public static void Write( float divisor) where TReader : IMutagenReadStream { - transl.Write(writer, item / divisor, header); + try + { + using (HeaderExport.Subrecord(writer, header)) + { + FloatBinaryTranslation.Instance.Write( + writer, item, divisor: divisor); + } + } + catch (Exception ex) + { + throw SubrecordException.Enrich(ex, header); + } } public static void WriteNullable( @@ -25,8 +36,19 @@ public static void WriteNullable( float divisor) where TReader : IMutagenReadStream { - if (!item.HasValue) return; - transl.Write(writer, item.Value / divisor, header); + try + { + if (item == null) return; + using (HeaderExport.Subrecord(writer, header)) + { + FloatBinaryTranslation.Instance.Write( + writer, item.Value, divisor: divisor); + } + } + catch (Exception ex) + { + throw SubrecordException.Enrich(ex, header); + } } public static void Write( diff --git a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs index c5fec3275..3778610eb 100644 --- a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs +++ b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs @@ -109,15 +109,6 @@ public void Write( Write(writer, item / divisor); } - public void WriteNullable( - TWriter writer, - float? item, - float divisor) - { - if (!item.HasValue) return; - Write(writer, item.Value / divisor); - } - public void Write( TWriter writer, float? item, @@ -125,16 +116,17 @@ public void Write( double divisor) { if (item == null) return; + var unrounded = item.Value / divisor; switch (integerType) { case FloatIntegerType.UInt: - writer.Write((uint)Math.Round(item.Value / divisor)); + writer.Write(checked((uint)Math.Round(unrounded))); break; case FloatIntegerType.UShort: - writer.Write((ushort)Math.Round(item.Value / divisor)); + writer.Write(checked((ushort)Math.Round(unrounded))); break; case FloatIntegerType.Byte: - writer.Write((byte)Math.Round(item.Value / divisor)); + writer.Write(checked((byte)Math.Round(unrounded))); break; default: throw new NotImplementedException(); From 5748a9f7862851eea58f66c5aa4d24f9ae95a71c Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 2 Apr 2023 22:47:28 -0500 Subject: [PATCH 004/135] Float multiplier transformation revamp fixes #428 --- .../Binary/FloatBinaryTranslationTests.cs | 131 +++++++++++++++--- .../Translations/FloatBinaryTranslationExt.cs | 20 ++- .../Binary/FloatBinaryTranslation.cs | 80 +++++++---- .../Major Records/AcousticSpace_Generated.cs | 8 +- .../Major Records/BodyPart_Generated.cs | 12 +- .../DialogResponseFlags_Generated.cs | 8 +- .../Major Records/DialogTopic_Generated.cs | 6 +- .../FurnitureMarkerParameters_Generated.cs | 6 +- .../MovementRotationData_Generated.cs | 12 +- .../Major Records/MovementType_Generated.cs | 72 ++++++---- .../Major Records/MusicTypeData_Generated.cs | 8 +- .../NpcFaceTintingLayer_Generated.cs | 8 +- .../ReverbParameters_Generated.cs | 8 +- .../Major Records/SoundCategory_Generated.cs | 16 ++- .../SoundDescriptorStandardData_Generated.cs | 8 +- .../SoundOutputModel_Generated.cs | 8 +- .../StoryManagerQuest_Generated.cs | 8 +- .../Major Records/Weather_Generated.cs | 28 ++-- .../Fields/FloatType.cs | 38 +++-- .../FloatBinaryTranslationGeneration.cs | 74 ++++++++-- .../SoundDataExtended_Generated.cs | 8 +- .../Records/Major Records/Armor_Generated.cs | 8 +- .../DialogResponseFlags_Generated.cs | 8 +- .../Major Records/DialogTopic_Generated.cs | 6 +- .../Major Records/MovementType_Generated.cs | 18 ++- .../Major Records/MusicTypeData_Generated.cs | 8 +- .../ReverbParameters_Generated.cs | 8 +- .../Major Records/SoundCategory_Generated.cs | 16 ++- .../SoundDescriptor_Generated.cs | 8 +- .../StoryManagerQuest_Generated.cs | 8 +- .../Major Records/TintLayer_Generated.cs | 8 +- .../Major Records/Weather_Generated.cs | 28 ++-- 32 files changed, 480 insertions(+), 211 deletions(-) diff --git a/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs b/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs index cf3a121f4..8fc099901 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs +++ b/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs @@ -79,17 +79,26 @@ public void WriteWithDivisor() { RunTypicalWriteTest((transl, writer) => { - transl.Write(writer, 100f, 10f); + transl.Write(writer, 100f, multiplier: null, divisor: 10); }).Should().Be(10f); } [Fact] - public void WriteWithDivisorOne() + public void WriteWithMultiplier() { RunTypicalWriteTest((transl, writer) => { - transl.Write(writer, 100f, 1f); - }).Should().Be(100f); + transl.Write(writer, 100f, multiplier: 10, divisor: null); + }).Should().Be(1000f); + } + + [Fact] + public void WriteWithComplex() + { + RunTypicalWriteTest((transl, writer) => + { + transl.Write(writer, 100f, multiplier: 10, divisor: 2); + }).Should().Be(500f); } [Fact] @@ -97,7 +106,7 @@ public void WriteWithIntegerType() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.UInt, 1f); + transl.Write(writer, 100f, FloatIntegerType.UInt, multiplier: null, divisor: null); }); arr.Should().HaveCount(4); BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(100); @@ -108,7 +117,7 @@ public void WriteWithIntegerTypeNull() { RunTypicalWriteTest((transl, writer) => { - transl.Write(writer, null, FloatIntegerType.UInt, 1f); + transl.Write(writer, null, FloatIntegerType.UInt, multiplier: null, divisor: null); }).Should().BeNull(); } @@ -117,18 +126,40 @@ public void WriteWithIntegerTypeWithDivisor() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.UInt, 10f); + transl.Write(writer, 100f, FloatIntegerType.UInt, multiplier: null, divisor: 10); }); arr.Should().HaveCount(4); BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(10); } + [Fact] + public void WriteWithIntegerTypeWithMultiplier() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UInt, multiplier: 10, divisor: null); + }); + arr.Should().HaveCount(4); + BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(1000); + } + + [Fact] + public void WriteWithIntegerTypeWithComplex() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UInt, multiplier: 10, divisor: 2); + }); + arr.Should().HaveCount(4); + BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(500); + } + [Fact] public void WriteWithIntegerTypeRounded() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.UInt, 7f); + transl.Write(writer, 100f, FloatIntegerType.UInt, multiplier: null, divisor: 7); }); arr.Should().HaveCount(4); BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(14); @@ -141,7 +172,7 @@ public void WriteWithIntegerTypeLimit() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, int.MaxValue, FloatIntegerType.UInt, 0.5f); + transl.Write(writer, int.MaxValue, FloatIntegerType.UInt, multiplier: 2, divisor: null); }); arr.Should().HaveCount(4); BinaryPrimitives.ReadUInt32LittleEndian(arr).Should().Be(14); @@ -153,7 +184,7 @@ public void WriteWithUShortType() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.UShort, 1f); + transl.Write(writer, 100f, FloatIntegerType.UShort, multiplier: null, divisor: null); }); arr.Should().HaveCount(2); BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(100); @@ -164,7 +195,7 @@ public void WriteWithUShortTypeNull() { RunTypicalWriteTest((transl, writer) => { - transl.Write(writer, null, FloatIntegerType.UShort, 1f); + transl.Write(writer, null, FloatIntegerType.UShort, multiplier: null, divisor: null); }).Should().BeNull(); } @@ -173,18 +204,40 @@ public void WriteWithUShortTypeWithDivisor() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.UShort, 10f); + transl.Write(writer, 100f, FloatIntegerType.UShort, multiplier: null, divisor: 10); }); arr.Should().HaveCount(2); BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(10); } + [Fact] + public void WriteWithUShortTypeWithMultiplier() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UShort, multiplier: 10, divisor: null); + }); + arr.Should().HaveCount(2); + BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(1000); + } + + [Fact] + public void WriteWithUShortTypeWithComplex() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 100f, FloatIntegerType.UShort, multiplier: 10, divisor: 2); + }); + arr.Should().HaveCount(2); + BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(500); + } + [Fact] public void WriteWithUShortTypeRounded() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.UShort, 7f); + transl.Write(writer, 100f, FloatIntegerType.UShort, multiplier: null, divisor: 7); }); arr.Should().HaveCount(2); BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(14); @@ -197,7 +250,7 @@ public void WriteWithUShortTypeLimit() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, ushort.MaxValue, FloatIntegerType.UShort, 0.5f); + transl.Write(writer, ushort.MaxValue, FloatIntegerType.UShort, multiplier: 2, divisor: null); }); arr.Should().HaveCount(2); BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(14); @@ -209,7 +262,7 @@ public void WriteWithByteType() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.Byte, 1f); + transl.Write(writer, 100f, FloatIntegerType.Byte, multiplier: null, divisor: null); }); arr.Should().HaveCount(1); arr[0].Should().Be(100); @@ -220,7 +273,7 @@ public void WriteWithByteTypeNull() { RunTypicalWriteTest((transl, writer) => { - transl.Write(writer, null, FloatIntegerType.Byte, 1f); + transl.Write(writer, null, FloatIntegerType.Byte, multiplier: null, divisor: null); }).Should().BeNull(); } @@ -229,18 +282,40 @@ public void WriteWithByteTypeWithDivisor() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.Byte, 10f); + transl.Write(writer, 100f, FloatIntegerType.Byte, multiplier: null, divisor: 10); }); arr.Should().HaveCount(1); arr[0].Should().Be(10); } + [Fact] + public void WriteWithByteTypeWithMultiplier() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 10f, FloatIntegerType.Byte, multiplier: 10, divisor: null); + }); + arr.Should().HaveCount(1); + arr[0].Should().Be(100); + } + + [Fact] + public void WriteWithByteTypeWithComplex() + { + var arr = GetWriteArray((transl, writer) => + { + transl.Write(writer, 10f, FloatIntegerType.Byte, multiplier: 10, divisor: 2); + }); + arr.Should().HaveCount(1); + arr[0].Should().Be(50); + } + [Fact] public void WriteWithByteTypeRounded() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, 100f, FloatIntegerType.Byte, 7f); + transl.Write(writer, 100f, FloatIntegerType.Byte, multiplier: null, divisor: 7); }); arr.Should().HaveCount(1); arr[0].Should().Be(14); @@ -253,9 +328,9 @@ public void WriteWithByteTypeLimit() { var arr = GetWriteArray((transl, writer) => { - transl.Write(writer, byte.MaxValue, FloatIntegerType.Byte, 0.5f); + transl.Write(writer, byte.MaxValue, FloatIntegerType.Byte, multiplier: 2, divisor: null); }); - arr.Should().HaveCount(2); + arr.Should().HaveCount(1); BinaryPrimitives.ReadUInt16LittleEndian(arr).Should().Be(14); }); } @@ -306,10 +381,24 @@ public void ReadEpsilon() [Fact] public void ReadMultiplier() { - GetReadFloat(1.5f, (t, f) => t.Parse(f, 2f)) + GetReadFloat(1.5f, (t, f) => t.Parse(f, multiplier: 2f, divisor: null)) .Should().Be(3f); } + [Fact] + public void ReadDivisor() + { + GetReadFloat(3f, (t, f) => t.Parse(f, multiplier: null, divisor: 2f)) + .Should().Be(1.5f); + } + + [Fact] + public void ReadComplex() + { + GetReadFloat(3f, (t, f) => t.Parse(f, multiplier: 4f, divisor: 2f)) + .Should().Be(6f); + } + [Fact] public void ReadIntegerType() { diff --git a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs index b148b138e..e6ac431b2 100644 --- a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs +++ b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/FloatBinaryTranslationExt.cs @@ -11,7 +11,8 @@ public static void Write( MutagenWriter writer, float item, RecordType header, - float divisor) + float? divisor, + float? multiplier) where TReader : IMutagenReadStream { try @@ -19,7 +20,8 @@ public static void Write( using (HeaderExport.Subrecord(writer, header)) { FloatBinaryTranslation.Instance.Write( - writer, item, divisor: divisor); + writer, item, + multiplier: multiplier, divisor: divisor); } } catch (Exception ex) @@ -33,7 +35,8 @@ public static void WriteNullable( MutagenWriter writer, float? item, RecordType header, - float divisor) + float? divisor, + float? multiplier) where TReader : IMutagenReadStream { try @@ -42,7 +45,8 @@ public static void WriteNullable( using (HeaderExport.Subrecord(writer, header)) { FloatBinaryTranslation.Instance.Write( - writer, item.Value, divisor: divisor); + writer, item.Value, + multiplier: multiplier, divisor: divisor); } } catch (Exception ex) @@ -57,7 +61,8 @@ public static void Write( float? item, RecordType header, FloatIntegerType integerType, - double divisor) + float? divisor = null, + float? multiplier = null) where TReader : IMutagenReadStream { try @@ -65,8 +70,9 @@ public static void Write( if (item == null) return; using (HeaderExport.Subrecord(writer, header)) { - FloatBinaryTranslation.Instance.Write(writer, item, integerType, - divisor: divisor); + FloatBinaryTranslation.Instance.Write( + writer, item, integerType, + multiplier: multiplier, divisor: divisor); } } catch (Exception ex) diff --git a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs index 3778610eb..800812caf 100644 --- a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs +++ b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs @@ -20,65 +20,61 @@ public override float Parse(TReader reader) return ret; } - public float Parse(TReader reader, FloatIntegerType integerType, double multiplier) + public float Parse(TReader reader, FloatIntegerType integerType, + float? multiplier = null, + float? divisor = null) { switch (integerType) { case FloatIntegerType.UInt: { var raw = reader.ReadUInt32(); - double d = raw; - d *= multiplier; - return (float)d; + return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.UShort: { var raw = reader.ReadUInt16(); - double d = raw; - d *= multiplier; - return (float)d; + return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.Byte: { var raw = reader.ReadUInt8(); - double d = raw; - d *= multiplier; - return (float)d; + return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } default: throw new NotImplementedException(); } } - public float Parse(TReader reader, float multiplier) + public float Parse(TReader reader, + float? multiplier, + float? divisor) { - return Parse(reader) * multiplier; + return ApplyTransformations(Parse(reader), multiplier: multiplier, divisor: divisor); } - public float GetFloat(ReadOnlySpan bytes, FloatIntegerType integerType, double multiplier) + public float GetFloat( + ReadOnlySpan bytes, + FloatIntegerType integerType, + float? multiplier = null, + float? divisor = null) { switch (integerType) { case FloatIntegerType.UInt: { var raw = BinaryPrimitives.ReadUInt32LittleEndian(bytes); - double d = raw; - d *= multiplier; - return (float)d; + return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.UShort: { var raw = BinaryPrimitives.ReadUInt16LittleEndian(bytes); - double d = raw; - d *= multiplier; - return (float)d; + return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.Byte: { var raw = bytes[0]; - double d = raw; - d *= multiplier; - return (float)d; + return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } default: throw new NotImplementedException(); @@ -104,32 +100,58 @@ public override void Write(TWriter writer, float item) public void Write( TWriter writer, float item, - float divisor) + float? multiplier, + float? divisor) { - Write(writer, item / divisor); + var transformed = ApplyTransformations(item, multiplier: multiplier, divisor: divisor); + + Write(writer, transformed); } public void Write( TWriter writer, float? item, FloatIntegerType integerType, - double divisor) + float? multiplier = null, + float? divisor = null) { if (item == null) return; - var unrounded = item.Value / divisor; + + var transformed = ApplyTransformations(item.Value, multiplier: multiplier, divisor: divisor); + switch (integerType) { case FloatIntegerType.UInt: - writer.Write(checked((uint)Math.Round(unrounded))); + writer.Write(checked((uint)Math.Round(transformed))); break; case FloatIntegerType.UShort: - writer.Write(checked((ushort)Math.Round(unrounded))); + writer.Write(checked((ushort)Math.Round(transformed))); break; case FloatIntegerType.Byte: - writer.Write(checked((byte)Math.Round(unrounded))); + writer.Write(checked((byte)Math.Round(transformed))); break; default: throw new NotImplementedException(); } } + + public float ApplyTransformations(float input, float? multiplier, float? divisor) + { + if (multiplier == null && divisor == null) + { + return input; + } + + if (multiplier == null) + { + return input / divisor!.Value; + } + + if (divisor == null) + { + return input * multiplier.Value; + } + + return input * multiplier.Value / divisor.Value; + } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/AcousticSpace_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/AcousticSpace_Generated.cs index 08506367c..fbbe9c5e8 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/AcousticSpace_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/AcousticSpace_Generated.cs @@ -1645,7 +1645,8 @@ public static void WriteRecordTypes( writer: writer, item: item.WeatherAttenuationDb, integerType: FloatIntegerType.UShort, - divisor: 0.01, + multiplier: 100f, + divisor: null, header: translationParams.ConvertToCustom(RecordTypes.WNAM)); } @@ -1767,7 +1768,8 @@ public static ParseResult FillBinaryRecordTypes( item.WeatherAttenuationDb = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + multiplier: null, + divisor: 100f); return (int)AcousticSpace_FieldIndex.WeatherAttenuationDb; } default: @@ -1852,7 +1854,7 @@ void IBinaryItem.WriteToBinary( #endregion #region WeatherAttenuationDb private int? _WeatherAttenuationDbLocation; - public Single? WeatherAttenuationDb => _WeatherAttenuationDbLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _WeatherAttenuationDbLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, 0.01) : default(Single?); + public Single? WeatherAttenuationDb => _WeatherAttenuationDbLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _WeatherAttenuationDbLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, multiplier: null, divisor: 100f) : default(Single?); #endregion partial void CustomFactoryEnd( OverlayStream stream, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/BodyPart_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/BodyPart_Generated.cs index 6d90d0980..d774c437b 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/BodyPart_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/BodyPart_Generated.cs @@ -3719,11 +3719,13 @@ public static void WriteRecordTypes( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.GoreEffectsLocalRotateX, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.GoreEffectsLocalRotateY, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.CutTesselation); @@ -3931,11 +3933,13 @@ public static ParseResult FillBinaryRecordTypes( if (dataFrame.Remaining < 4) return null; item.GoreEffectsLocalRotateX = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.GoreEffectsLocalRotateY = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.CutTesselation = FloatBinaryTranslation.Instance.Parse(reader: dataFrame); if (dataFrame.Remaining < 4) return null; diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs index 955824d53..c80aae34e 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs @@ -1006,7 +1006,8 @@ public static void WriteEmbedded( writer: writer, item: item.ResetHours, integerType: FloatIntegerType.UShort, - divisor: 0.0003663003663003663); + multiplier: 2730f, + divisor: null); } public void Write( @@ -1053,7 +1054,8 @@ public static void FillBinaryStructs( item.ResetHours = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 0.0003663003663003663); + multiplier: null, + divisor: 2730f); } } @@ -1120,7 +1122,7 @@ void IBinaryItem.WriteToBinary( } public DialogResponses.Flag Flags => (DialogResponses.Flag)BinaryPrimitives.ReadUInt16LittleEndian(_structData.Span.Slice(0x0, 0x2)); - public Single ResetHours => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, 0.0003663003663003663); + public Single ResetHours => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, multiplier: null, divisor: 2730f); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogTopic_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogTopic_Generated.cs index 3e050851d..35814747e 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogTopic_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogTopic_Generated.cs @@ -2619,7 +2619,8 @@ public static void WriteRecordTypes( writer: writer, item: item.Priority, header: translationParams.ConvertToCustom(RecordTypes.PNAM), - divisor: 50f); + divisor: 50f, + multiplier: null); FormLinkBinaryTranslation.Instance.WriteNullable( writer: writer, item: item.Branch, @@ -2789,7 +2790,8 @@ public static ParseResult FillBinaryRecordTypes( frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; item.Priority = FloatBinaryTranslation.Instance.Parse( reader: frame.SpawnWithLength(contentLength), - multiplier: 50f); + multiplier: 50f, + divisor: null); return (int)DialogTopic_FieldIndex.Priority; } case RecordTypeInts.BNAM: diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs index 9d9ac8eff..66aaed8ec 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs @@ -1281,7 +1281,8 @@ public static void WriteEmbedded( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RotationZ, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); if (!item.Versioning.HasFlag(FurnitureMarkerParameters.VersioningBreaks.Break0)) { FormLinkBinaryTranslation.Instance.Write( @@ -1334,7 +1335,8 @@ public static void FillBinaryStructs( item.Offset = P3FloatBinaryTranslation.Instance.Parse(reader: frame); item.RotationZ = FloatBinaryTranslation.Instance.Parse( reader: frame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (frame.Complete) { item.Versioning |= FurnitureMarkerParameters.VersioningBreaks.Break0; diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementRotationData_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementRotationData_Generated.cs index b2f8ad9ad..6f7f10621 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementRotationData_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementRotationData_Generated.cs @@ -1093,11 +1093,13 @@ public static void WriteEmbedded( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.Walk, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.Run, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); writer.Write(item.Unused2); } @@ -1135,10 +1137,12 @@ public static void FillBinaryStructs( item.Unused1 = frame.ReadInt32(); item.Walk = FloatBinaryTranslation.Instance.Parse( reader: frame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); item.Run = FloatBinaryTranslation.Instance.Parse( reader: frame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); item.Unused2 = frame.ReadInt32(); } diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementType_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementType_Generated.cs index 792f4c418..ef96ff830 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementType_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/MovementType_Generated.cs @@ -3259,53 +3259,65 @@ public static void WriteRecordTypes( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.PitchStanding, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); if (!item.SPEDDataTypeState.HasFlag(MovementType.SPEDDataType.Break2)) { FloatBinaryTranslation.Instance.Write( writer: writer, item: item.PitchWalk, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.PitchRun, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.PitchSprint, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RollStanding, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RollWalk, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RollRun, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RollSprint, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.YawStanding, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.YawWalk, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.YawRun, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.YawSprint, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); } } } @@ -3476,7 +3488,8 @@ public static ParseResult FillBinaryRecordTypes( if (dataFrame.Remaining < 4) return null; item.PitchStanding = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Complete) { item.SPEDDataTypeState |= MovementType.SPEDDataType.Break2; @@ -3485,47 +3498,58 @@ public static ParseResult FillBinaryRecordTypes( if (dataFrame.Remaining < 4) return null; item.PitchWalk = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.PitchRun = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.PitchSprint = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.RollStanding = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.RollWalk = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.RollRun = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.RollSprint = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.YawStanding = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.YawWalk = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.YawRun = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.YawSprint = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); return (int)MovementType_FieldIndex.YawSprint; } case RecordTypeInts.INAM: diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/MusicTypeData_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/MusicTypeData_Generated.cs index d992b30b1..8b3231e3b 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/MusicTypeData_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/MusicTypeData_Generated.cs @@ -1003,7 +1003,8 @@ public static void WriteEmbedded( writer: writer, item: item.DuckingDecibel, integerType: FloatIntegerType.UShort, - divisor: 0.01); + multiplier: 100f, + divisor: null); } public void Write( @@ -1048,7 +1049,8 @@ public static void FillBinaryStructs( item.DuckingDecibel = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + multiplier: null, + divisor: 100f); } } @@ -1115,7 +1117,7 @@ void IBinaryItem.WriteToBinary( } public UInt16 Priority => BinaryPrimitives.ReadUInt16LittleEndian(_structData.Slice(0x0, 0x2)); - public Single DuckingDecibel => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, 0.01); + public Single DuckingDecibel => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, multiplier: null, divisor: 100f); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/NpcFaceTintingLayer_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/NpcFaceTintingLayer_Generated.cs index cd8f4bc16..baa6dfcd2 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/NpcFaceTintingLayer_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/NpcFaceTintingLayer_Generated.cs @@ -1252,7 +1252,8 @@ public static void WriteRecordTypes( writer: writer, item: item.Value, integerType: FloatIntegerType.Byte, - divisor: 0.01); + multiplier: 100f, + divisor: null); if (!item.TENDDataTypeState.HasFlag(NpcFaceTintingLayer.TENDDataType.Break0)) { ColorBinaryTranslation.Instance.Write( @@ -1333,7 +1334,8 @@ public static ParseResult FillBinaryRecordTypes( item.Value = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 0.01); + multiplier: null, + divisor: 100f); if (dataFrame.Complete) { item.TENDDataTypeState |= NpcFaceTintingLayer.TENDDataType.Break0; @@ -1429,7 +1431,7 @@ void IBinaryItem.WriteToBinary( #region Value private int _ValueLocation => _TENDLocation!.Value.Min; private bool _Value_IsSet => _TENDLocation.HasValue; - public Single Value => _Value_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_ValueLocation, 1), FloatIntegerType.Byte, 0.01) : default; + public Single Value => _Value_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_ValueLocation, 1), FloatIntegerType.Byte, multiplier: null, divisor: 100f) : default; #endregion #region Color private int _ColorLocation => _TENDLocation!.Value.Min + 0x1; diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/ReverbParameters_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/ReverbParameters_Generated.cs index f9d01f821..95a7ec949 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/ReverbParameters_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/ReverbParameters_Generated.cs @@ -1871,7 +1871,8 @@ public static void WriteRecordTypes( writer: writer, item: item.DecayHfRatio, integerType: FloatIntegerType.Byte, - divisor: 0.01); + multiplier: 100f, + divisor: null); writer.Write(item.ReflectDelayMS); writer.Write(item.ReverbDelayMS); PercentBinaryTranslation.Write( @@ -1994,7 +1995,8 @@ public static ParseResult FillBinaryRecordTypes( item.DecayHfRatio = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 0.01); + multiplier: null, + divisor: 100f); if (dataFrame.Remaining < 1) return null; item.ReflectDelayMS = dataFrame.ReadUInt8(); if (dataFrame.Remaining < 1) return null; @@ -2111,7 +2113,7 @@ void IBinaryItem.WriteToBinary( #region DecayHfRatio private int _DecayHfRatioLocation => _DATALocation!.Value.Min + 0x8; private bool _DecayHfRatio_IsSet => _DATALocation.HasValue; - public Single DecayHfRatio => _DecayHfRatio_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_DecayHfRatioLocation, 1), FloatIntegerType.Byte, 0.01) : default; + public Single DecayHfRatio => _DecayHfRatio_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_DecayHfRatioLocation, 1), FloatIntegerType.Byte, multiplier: null, divisor: 100f) : default; #endregion #region ReflectDelayMS private int _ReflectDelayMSLocation => _DATALocation!.Value.Min + 0x9; diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundCategory_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundCategory_Generated.cs index 9789f9673..e8f97ce1e 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundCategory_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundCategory_Generated.cs @@ -1741,13 +1741,15 @@ public static void WriteRecordTypes( writer: writer, item: item.StaticVolumeMultiplier, integerType: FloatIntegerType.UShort, - divisor: 1.5259021896696422E-05, + multiplier: 65535f, + divisor: null, header: translationParams.ConvertToCustom(RecordTypes.VNAM)); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.DefaultMenuVolume, integerType: FloatIntegerType.UShort, - divisor: 1.5259021896696422E-05, + multiplier: 65535f, + divisor: null, header: translationParams.ConvertToCustom(RecordTypes.UNAM)); FloatBinaryTranslation.Instance.WriteNullable( writer: writer, @@ -1877,7 +1879,8 @@ public static ParseResult FillBinaryRecordTypes( item.StaticVolumeMultiplier = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 1.5259021896696422E-05); + multiplier: null, + divisor: 65535f); return (int)SoundCategory_FieldIndex.StaticVolumeMultiplier; } case RecordTypeInts.UNAM: @@ -1886,7 +1889,8 @@ public static ParseResult FillBinaryRecordTypes( item.DefaultMenuVolume = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 1.5259021896696422E-05); + multiplier: null, + divisor: 65535f); return (int)SoundCategory_FieldIndex.DefaultMenuVolume; } case RecordTypeInts.MNAM: @@ -1986,11 +1990,11 @@ void IBinaryItem.WriteToBinary( #endregion #region StaticVolumeMultiplier private int? _StaticVolumeMultiplierLocation; - public Single? StaticVolumeMultiplier => _StaticVolumeMultiplierLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _StaticVolumeMultiplierLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, 1.5259021896696422E-05) : default(Single?); + public Single? StaticVolumeMultiplier => _StaticVolumeMultiplierLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _StaticVolumeMultiplierLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, multiplier: null, divisor: 65535f) : default(Single?); #endregion #region DefaultMenuVolume private int? _DefaultMenuVolumeLocation; - public Single? DefaultMenuVolume => _DefaultMenuVolumeLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _DefaultMenuVolumeLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, 1.5259021896696422E-05) : default(Single?); + public Single? DefaultMenuVolume => _DefaultMenuVolumeLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _DefaultMenuVolumeLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, multiplier: null, divisor: 65535f) : default(Single?); #endregion #region MinFrequencyMultiplier private int? _MinFrequencyMultiplierLocation; diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundDescriptorStandardData_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundDescriptorStandardData_Generated.cs index 4b45ae125..d3223a7da 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundDescriptorStandardData_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundDescriptorStandardData_Generated.cs @@ -1184,7 +1184,8 @@ public static void WriteEmbedded( writer: writer, item: item.StaticAttenuation, integerType: FloatIntegerType.UShort, - divisor: 0.01); + multiplier: 100f, + divisor: null); } public void Write( @@ -1240,7 +1241,8 @@ public static void FillBinaryStructs( item.StaticAttenuation = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + multiplier: null, + divisor: 100f); } } @@ -1291,7 +1293,7 @@ void IBinaryItem.WriteToBinary( public Percent PercentFrequencyVariance => PercentBinaryTranslation.GetPercent(_structData.Slice(0x1, 0x1), FloatIntegerType.Byte); public SByte Priority => (sbyte)_structData.Slice(0x2, 0x1)[0]; public SByte Variance => (sbyte)_structData.Slice(0x3, 0x1)[0]; - public Single StaticAttenuation => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x4, 0x2), FloatIntegerType.UShort, 0.01); + public Single StaticAttenuation => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x4, 0x2), FloatIntegerType.UShort, multiplier: null, divisor: 100f); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundOutputModel_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundOutputModel_Generated.cs index 2c59589e8..52e96094a 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundOutputModel_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/SoundOutputModel_Generated.cs @@ -1692,7 +1692,8 @@ public static void WriteRecordTypes( writer: writer, item: item.StaticAttenuation, integerType: FloatIntegerType.UShort, - divisor: 0.01, + multiplier: 100f, + divisor: null, header: translationParams.ConvertToCustom(RecordTypes.VNAM)); if (item.OutputChannels is {} OutputChannelsItem) { @@ -1816,7 +1817,8 @@ public static ParseResult FillBinaryRecordTypes( item.StaticAttenuation = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + multiplier: null, + divisor: 100f); return (int)SoundOutputModel_FieldIndex.StaticAttenuation; } case RecordTypeInts.ONAM: @@ -1904,7 +1906,7 @@ void IBinaryItem.WriteToBinary( #endregion #region StaticAttenuation private int? _StaticAttenuationLocation; - public Single? StaticAttenuation => _StaticAttenuationLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _StaticAttenuationLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, 0.01) : default(Single?); + public Single? StaticAttenuation => _StaticAttenuationLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _StaticAttenuationLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, multiplier: null, divisor: 100f) : default(Single?); #endregion #region OutputChannels private RangeInt32? _OutputChannelsLocation; diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/StoryManagerQuest_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/StoryManagerQuest_Generated.cs index b66619463..14029e707 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/StoryManagerQuest_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/StoryManagerQuest_Generated.cs @@ -1092,7 +1092,8 @@ public static void WriteRecordTypes( writer: writer, item: item.HoursUntilReset, header: translationParams.ConvertToCustom(RecordTypes.RNAM), - divisor: 0.041666668f); + divisor: null, + multiplier: 24f); } public void Write( @@ -1155,7 +1156,8 @@ public static ParseResult FillBinaryRecordTypes( frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; item.HoursUntilReset = FloatBinaryTranslation.Instance.Parse( reader: frame.SpawnWithLength(contentLength), - multiplier: 0.041666668f); + multiplier: null, + divisor: 24f); return (int)StoryManagerQuest_FieldIndex.HoursUntilReset; } default: @@ -1237,7 +1239,7 @@ void IBinaryItem.WriteToBinary( #endregion #region HoursUntilReset private int? _HoursUntilResetLocation; - public Single? HoursUntilReset => _HoursUntilResetLocation.HasValue ? HeaderTranslation.ExtractSubrecordMemory(_recordData, _HoursUntilResetLocation.Value, _package.MetaData.Constants).Float() * 0.041666668f : default(Single?); + public Single? HoursUntilReset => _HoursUntilResetLocation.HasValue ? HeaderTranslation.ExtractSubrecordMemory(_recordData, _HoursUntilResetLocation.Value, _package.MetaData.Constants).Float() / 24f : default(Single?); #endregion partial void CustomFactoryEnd( OverlayStream stream, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Weather_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Weather_Generated.cs index 87c5fd6a8..dfe47d415 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Weather_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Weather_Generated.cs @@ -447,11 +447,11 @@ public Single FogDistanceNightFarHeightRange #endregion #region WindDirection public Single WindDirection { get; set; } = default; - public static RangeFloat WindDirection_Range = new RangeFloat(0, 0.7083333333333334f); + public static RangeFloat WindDirection_Range = new RangeFloat(0, 255f); #endregion #region WindDirectionRange public Single WindDirectionRange { get; set; } = default; - public static RangeFloat WindDirectionRange_Range = new RangeFloat(0, 1.4166666666666667f); + public static RangeFloat WindDirectionRange_Range = new RangeFloat(0, 255f); #endregion #region WindTurbulance [DebuggerBrowsable(DebuggerBrowsableState.Never)] @@ -7206,7 +7206,8 @@ public static void WriteRecordTypes( writer: writer, item: item.TransDelta, integerType: FloatIntegerType.Byte, - divisor: 4); + multiplier: null, + divisor: 4f); PercentBinaryTranslation.Write( writer: writer, item: item.SunGlare, @@ -7255,12 +7256,14 @@ public static void WriteRecordTypes( writer: writer, item: item.WindDirection, integerType: FloatIntegerType.Byte, - divisor: 0.002777777777777778); + multiplier: 360f, + divisor: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.WindDirectionRange, integerType: FloatIntegerType.Byte, - divisor: 0.005555555555555556); + multiplier: 180f, + divisor: null); if (!item.DATADataTypeState.HasFlag(Weather.DATADataType.Break0)) { PercentBinaryTranslation.Write( @@ -7719,7 +7722,8 @@ public static ParseResult FillBinaryRecordTypes( item.TransDelta = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 4); + multiplier: 4f, + divisor: null); if (dataFrame.Remaining < 1) return null; item.SunGlare = PercentBinaryTranslation.Parse( reader: dataFrame, @@ -7766,12 +7770,14 @@ public static ParseResult FillBinaryRecordTypes( item.WindDirection = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 0.002777777777777778); + multiplier: null, + divisor: 360f); if (dataFrame.Remaining < 1) return null; item.WindDirectionRange = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 0.005555555555555556); + multiplier: null, + divisor: 180f); if (dataFrame.Complete) { item.DATADataTypeState |= Weather.DATADataType.Break0; @@ -8239,7 +8245,7 @@ public partial ParseResult CloudAlphasCustomParse( #region TransDelta private int _TransDeltaLocation => _DATALocation!.Value.Min + 0x3; private bool _TransDelta_IsSet => _DATALocation.HasValue; - public Single TransDelta => _TransDelta_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_TransDeltaLocation, 1), FloatIntegerType.Byte, 4) : default; + public Single TransDelta => _TransDelta_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_TransDeltaLocation, 1), FloatIntegerType.Byte, multiplier: 4f, divisor: null) : default; #endregion #region SunGlare private int _SunGlareLocation => _DATALocation!.Value.Min + 0x4; @@ -8299,12 +8305,12 @@ public partial ParseResult CloudAlphasCustomParse( #region WindDirection private int _WindDirectionLocation => _DATALocation!.Value.Min + 0x11; private bool _WindDirection_IsSet => _DATALocation.HasValue; - public Single WindDirection => _WindDirection_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_WindDirectionLocation, 1), FloatIntegerType.Byte, 0.002777777777777778) : default; + public Single WindDirection => _WindDirection_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_WindDirectionLocation, 1), FloatIntegerType.Byte, multiplier: null, divisor: 360f) : default; #endregion #region WindDirectionRange private int _WindDirectionRangeLocation => _DATALocation!.Value.Min + 0x12; private bool _WindDirectionRange_IsSet => _DATALocation.HasValue; - public Single WindDirectionRange => _WindDirectionRange_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_WindDirectionRangeLocation, 1), FloatIntegerType.Byte, 0.005555555555555556) : default; + public Single WindDirectionRange => _WindDirectionRange_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_WindDirectionRangeLocation, 1), FloatIntegerType.Byte, multiplier: null, divisor: 180f) : default; #endregion #region WindTurbulance private int _WindTurbulanceLocation => _DATALocation!.Value.Min + 0x13; diff --git a/Mutagen.Bethesda.Generation/Fields/FloatType.cs b/Mutagen.Bethesda.Generation/Fields/FloatType.cs index 42b7cc433..f06b078e9 100644 --- a/Mutagen.Bethesda.Generation/Fields/FloatType.cs +++ b/Mutagen.Bethesda.Generation/Fields/FloatType.cs @@ -7,42 +7,50 @@ namespace Mutagen.Bethesda.Generation.Fields; public class FloatType : Loqui.Generation.FloatType { public FloatIntegerType? IntegerType; - public double Multiplier; + public double Multiplier = 1; + public double Divisor = 1; public bool IsRotation; + public bool HasMultiplier => !Multiplier.EqualsWithin(1); + public bool HasDivisor => !Divisor.EqualsWithin(1); + public bool HasTransformations => HasMultiplier || HasDivisor; + public string MultiplierString => HasMultiplier ? $"{Multiplier}f" : "null"; + public string DivisorString => HasDivisor ? $"{Divisor}f" : "null"; + public override async Task Load(XElement node, bool requireName = true) { await base.Load(node, requireName); var data = this.GetFieldData(); - this.Multiplier = node.GetAttribute("multiplier", 1d); + Multiplier = node.GetAttribute("multiplier", 1d); if (node.TryGetAttribute("divisor", out double div)) { - this.Multiplier *= 1 / div; + Divisor = div; } - this.IntegerType = node.GetAttribute("integerType", default(FloatIntegerType?)); - this.IsRotation = node.GetAttribute("isRotation", false); + IntegerType = node.GetAttribute("integerType", default(FloatIntegerType?)); + IsRotation = node.GetAttribute("isRotation", false); if (IsRotation) { - // Passthrough tests require 4 digits precision - this.Multiplier = 57.2958f; //180f / Math.PI; + // Passthrough tests require 4 digits precision + // Intentionally not using Math.PI + Multiplier = 57.2958f; //180f / Math.PI; } - if (this.IntegerType.HasValue) + if (IntegerType.HasValue) { - switch (this.IntegerType) + switch (IntegerType) { case FloatIntegerType.UInt: - this.Min = "0"; - this.Max = $"{uint.MaxValue * Multiplier}f"; + Min = "0"; + Max = $"{uint.MaxValue * Multiplier}f"; data.Length = 4; break; case FloatIntegerType.UShort: - this.Min = "0"; - this.Max = $"{ushort.MaxValue * Multiplier}f"; + Min = "0"; + Max = $"{ushort.MaxValue * Multiplier}f"; data.Length = 2; break; case FloatIntegerType.Byte: - this.Min = "0"; - this.Max = $"{byte.MaxValue * Multiplier}f"; + Min = "0"; + Max = $"{byte.MaxValue * Multiplier}f"; data.Length = 1; break; default: diff --git a/Mutagen.Bethesda.Generation/Modules/Binary/FloatBinaryTranslationGeneration.cs b/Mutagen.Bethesda.Generation/Modules/Binary/FloatBinaryTranslationGeneration.cs index b461e5a6b..4f9f9fc38 100644 --- a/Mutagen.Bethesda.Generation/Modules/Binary/FloatBinaryTranslationGeneration.cs +++ b/Mutagen.Bethesda.Generation/Modules/Binary/FloatBinaryTranslationGeneration.cs @@ -15,33 +15,64 @@ public FloatBinaryTranslationGeneration() PreferDirectTranslation = false; CustomRead = ReadFloat; CustomWrite = WriteFloat; - AdditionalWriteParams.Add(AdditionalWriteParam); - AdditionalCopyInParams.Add(AdditionalReadParam); - AdditionalCopyInRetParams.Add(AdditionalReadParam); + AdditionalWriteParams.Add(AdditionalMultWriteParam); + AdditionalWriteParams.Add(AdditionalDivisorWriteParam); + AdditionalCopyInParams.Add(AdditionalMultReadParam); + AdditionalCopyInParams.Add(AdditionalDivisorReadParam); + AdditionalCopyInRetParams.Add(AdditionalMultReadParam); + AdditionalCopyInRetParams.Add(AdditionalDivisorReadParam); } - private static TryGet AdditionalReadParam( + private static TryGet AdditionalMultReadParam( ObjectGeneration objGen, TypeGeneration typeGen) { var floatType = typeGen as FloatType; if (floatType.IntegerType == null - && !floatType.Multiplier.EqualsWithin(1)) + && floatType.HasTransformations) { - return TryGet.Succeed($"multiplier: {(float)floatType.Multiplier}f"); + return TryGet.Succeed($"multiplier: {floatType.MultiplierString}"); } return TryGet.Failure; } - private static TryGet AdditionalWriteParam( + private static TryGet AdditionalDivisorReadParam( ObjectGeneration objGen, TypeGeneration typeGen) { var floatType = typeGen as FloatType; if (floatType.IntegerType == null - && !floatType.Multiplier.EqualsWithin(1)) + && floatType.HasTransformations) { - return TryGet.Succeed($"divisor: {(float)floatType.Multiplier}f"); + return TryGet.Succeed($"divisor: {floatType.DivisorString}"); + } + return TryGet.Failure; + } + + private static TryGet AdditionalMultWriteParam( + ObjectGeneration objGen, + TypeGeneration typeGen) + { + var floatType = typeGen as FloatType; + if (floatType.IntegerType == null + && floatType.HasTransformations) + { + // Intentionally flipped + return TryGet.Succeed($"divisor: {floatType.MultiplierString}"); + } + return TryGet.Failure; + } + + private static TryGet AdditionalDivisorWriteParam( + ObjectGeneration objGen, + TypeGeneration typeGen) + { + var floatType = typeGen as FloatType; + if (floatType.IntegerType == null + && floatType.HasTransformations) + { + // Intentionally flipped + return TryGet.Succeed($"multiplier: {floatType.DivisorString}"); } return TryGet.Failure; } @@ -75,12 +106,20 @@ public override string GenerateForTypicalWrapper( var floatType = typeGen as FloatType; if (floatType.IntegerType.HasValue) { - return $"{GetTranslatorInstance(typeGen, getter: true)}.GetFloat({dataAccessor}, {nameof(FloatIntegerType)}.{floatType.IntegerType}, {floatType.Multiplier})"; + return $"{GetTranslatorInstance(typeGen, getter: true)}.GetFloat({dataAccessor}, {nameof(FloatIntegerType)}.{floatType.IntegerType}, multiplier: {floatType.MultiplierString}, divisor: {floatType.DivisorString})"; + } + else if (floatType.HasMultiplier && floatType.HasDivisor) + { + return $"{dataAccessor}.Float() * {(float)floatType.Multiplier}f / {(float)floatType.Divisor}f"; } - else if (!floatType.Multiplier.EqualsWithin(1)) + else if (floatType.HasMultiplier) { return $"{dataAccessor}.Float() * {(float)floatType.Multiplier}f"; } + else if (floatType.HasDivisor) + { + return $"{dataAccessor}.Float() / {(float)floatType.Divisor}f"; + } else { return $"{dataAccessor}.Float()"; @@ -97,7 +136,11 @@ bool ReadFloat(StructuredStringBuilder sb, ObjectGeneration objGen, TypeGenerati { args.Add($"reader: {reader}"); args.Add($"integerType: {nameof(FloatIntegerType)}.{floatType.IntegerType}"); - args.Add($"multiplier: {floatType.Multiplier}"); + if (floatType.HasTransformations) + { + args.Add($"multiplier: {floatType.MultiplierString}"); + args.Add($"divisor: {floatType.DivisorString}"); + } } return true; } @@ -119,7 +162,12 @@ bool WriteFloat(StructuredStringBuilder sb, ObjectGeneration objGen, TypeGenerat args.Add($"writer: {writer}"); args.Add($"item: {item}"); args.Add($"integerType: {nameof(FloatIntegerType)}.{floatType.IntegerType}"); - args.Add($"divisor: {floatType.Multiplier}"); + if (floatType.HasTransformations) + { + // Intentionally flipped + args.Add($"multiplier: {floatType.DivisorString}"); + args.Add($"divisor: {floatType.MultiplierString}"); + } if (data.RecordType.HasValue && data.HandleTrigger) { diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/SoundDataExtended_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/SoundDataExtended_Generated.cs index 107b97b93..779f983b1 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/SoundDataExtended_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/SoundDataExtended_Generated.cs @@ -1146,7 +1146,8 @@ public static void WriteEmbedded( writer: writer, item: item.StaticAttenuation, integerType: FloatIntegerType.UShort, - divisor: 0.01); + multiplier: 100f, + divisor: null); SoundDataExtendedBinaryWriteTranslation.WriteBinaryStopTime( writer: writer, item: item); @@ -1236,7 +1237,8 @@ public static void FillBinaryStructs( item.StaticAttenuation = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + multiplier: null, + divisor: 100f); SoundDataExtendedBinaryCreateTranslation.FillBinaryStopTimeCustom( frame: frame, item: item); @@ -1297,7 +1299,7 @@ void IBinaryItem.WriteToBinary( translationParams: translationParams); } - public Single StaticAttenuation => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x8, 0x2), FloatIntegerType.UShort, 0.01); + public Single StaticAttenuation => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x8, 0x2), FloatIntegerType.UShort, multiplier: null, divisor: 100f); #region StopTime public partial Single GetStopTimeCustom(int location); public Single StopTime => GetStopTimeCustom(location: 0xA); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs index 045eff9cd..92c713c45 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs @@ -3306,7 +3306,8 @@ public static void WriteRecordTypes( writer: writer, item: item.ArmorRating, integerType: FloatIntegerType.UInt, - divisor: 0.01, + multiplier: 100f, + divisor: null, header: translationParams.ConvertToCustom(RecordTypes.DNAM)); FormLinkBinaryTranslation.Instance.WriteNullable( writer: writer, @@ -3563,7 +3564,8 @@ public static ParseResult FillBinaryRecordTypes( item.ArmorRating = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UInt, - multiplier: 0.01); + multiplier: null, + divisor: 100f); return (int)Armor_FieldIndex.ArmorRating; } case RecordTypeInts.TNAM: @@ -3736,7 +3738,7 @@ partial void BodyTemplateCustomParse( #endregion #region ArmorRating private int? _ArmorRatingLocation; - public Single ArmorRating => _ArmorRatingLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _ArmorRatingLocation.Value, _package.MetaData.Constants), FloatIntegerType.UInt, 0.01) : default; + public Single ArmorRating => _ArmorRatingLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _ArmorRatingLocation.Value, _package.MetaData.Constants), FloatIntegerType.UInt, multiplier: null, divisor: 100f) : default; #endregion #region TemplateArmor private int? _TemplateArmorLocation; diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs index 96b795de9..fd4d7d086 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs @@ -1006,7 +1006,8 @@ public static void WriteEmbedded( writer: writer, item: item.ResetHours, integerType: FloatIntegerType.UShort, - divisor: 0.0003663003663003663); + multiplier: 2730f, + divisor: null); } public void Write( @@ -1053,7 +1054,8 @@ public static void FillBinaryStructs( item.ResetHours = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 0.0003663003663003663); + multiplier: null, + divisor: 2730f); } } @@ -1120,7 +1122,7 @@ void IBinaryItem.WriteToBinary( } public DialogResponses.Flag Flags => (DialogResponses.Flag)BinaryPrimitives.ReadUInt16LittleEndian(_structData.Span.Slice(0x0, 0x2)); - public Single ResetHours => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, 0.0003663003663003663); + public Single ResetHours => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, multiplier: null, divisor: 2730f); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs index 009923208..4b702b6c6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs @@ -2604,7 +2604,8 @@ public static void WriteRecordTypes( writer: writer, item: item.Priority, header: translationParams.ConvertToCustom(RecordTypes.PNAM), - divisor: 50f); + divisor: 50f, + multiplier: null); FormLinkBinaryTranslation.Instance.WriteNullable( writer: writer, item: item.Branch, @@ -2770,7 +2771,8 @@ public static ParseResult FillBinaryRecordTypes( frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; item.Priority = FloatBinaryTranslation.Instance.Parse( reader: frame.SpawnWithLength(contentLength), - multiplier: 50f); + multiplier: 50f, + divisor: null); return (int)DialogTopic_FieldIndex.Priority; } case RecordTypeInts.BNAM: diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MovementType_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MovementType_Generated.cs index f2518bf32..a6de676a2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MovementType_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MovementType_Generated.cs @@ -2055,17 +2055,20 @@ public static void WriteRecordTypes( FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RotateInPlaceWalk, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RotateInPlaceRun, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); if (!item.SPEDDataTypeState.HasFlag(MovementType.SPEDDataType.Break0)) { FloatBinaryTranslation.Instance.Write( writer: writer, item: item.RotateWhileMovingRun, - divisor: 57.2958f); + divisor: 57.295799255371094f, + multiplier: null); } } if (item.AnimationChangeThresholds is {} AnimationChangeThresholdsItem) @@ -2200,11 +2203,13 @@ public static ParseResult FillBinaryRecordTypes( if (dataFrame.Remaining < 4) return null; item.RotateInPlaceWalk = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Remaining < 4) return null; item.RotateInPlaceRun = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); if (dataFrame.Complete) { item.SPEDDataTypeState |= MovementType.SPEDDataType.Break0; @@ -2213,7 +2218,8 @@ public static ParseResult FillBinaryRecordTypes( if (dataFrame.Remaining < 4) return null; item.RotateWhileMovingRun = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, - multiplier: 57.2958f); + multiplier: 57.295799255371094f, + divisor: null); return (int)MovementType_FieldIndex.RotateWhileMovingRun; } case RecordTypeInts.INAM: diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTypeData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTypeData_Generated.cs index 4d50a12f6..8a260a355 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTypeData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTypeData_Generated.cs @@ -1003,7 +1003,8 @@ public static void WriteEmbedded( writer: writer, item: item.DuckingDecibel, integerType: FloatIntegerType.UShort, - divisor: 0.01); + multiplier: 100f, + divisor: null); } public void Write( @@ -1048,7 +1049,8 @@ public static void FillBinaryStructs( item.DuckingDecibel = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + multiplier: null, + divisor: 100f); } } @@ -1115,7 +1117,7 @@ void IBinaryItem.WriteToBinary( } public UInt16 Priority => BinaryPrimitives.ReadUInt16LittleEndian(_structData.Slice(0x0, 0x2)); - public Single DuckingDecibel => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, 0.01); + public Single DuckingDecibel => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, multiplier: null, divisor: 100f); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ReverbParameters_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ReverbParameters_Generated.cs index 1e007337f..165e355e9 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ReverbParameters_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ReverbParameters_Generated.cs @@ -1826,7 +1826,8 @@ public static void WriteRecordTypes( writer: writer, item: item.DecayHfRatio, integerType: FloatIntegerType.Byte, - divisor: 0.01); + multiplier: 100f, + divisor: null); writer.Write(item.ReflectDelayMS); writer.Write(item.ReverbDelayMS); PercentBinaryTranslation.Write( @@ -1944,7 +1945,8 @@ public static ParseResult FillBinaryRecordTypes( item.DecayHfRatio = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 0.01); + multiplier: null, + divisor: 100f); if (dataFrame.Remaining < 1) return null; item.ReflectDelayMS = dataFrame.ReadUInt8(); if (dataFrame.Remaining < 1) return null; @@ -2053,7 +2055,7 @@ void IBinaryItem.WriteToBinary( #region DecayHfRatio private int _DecayHfRatioLocation => _DATALocation!.Value.Min + 0x8; private bool _DecayHfRatio_IsSet => _DATALocation.HasValue; - public Single DecayHfRatio => _DecayHfRatio_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_DecayHfRatioLocation, 1), FloatIntegerType.Byte, 0.01) : default; + public Single DecayHfRatio => _DecayHfRatio_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_DecayHfRatioLocation, 1), FloatIntegerType.Byte, multiplier: null, divisor: 100f) : default; #endregion #region ReflectDelayMS private int _ReflectDelayMSLocation => _DATALocation!.Value.Min + 0x9; diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundCategory_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundCategory_Generated.cs index c18cedf5e..70bc1b08b 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundCategory_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundCategory_Generated.cs @@ -1570,13 +1570,15 @@ public static void WriteRecordTypes( writer: writer, item: item.StaticVolumeMultiplier, integerType: FloatIntegerType.UShort, - divisor: 1.5259021896696422E-05, + multiplier: 65535f, + divisor: null, header: translationParams.ConvertToCustom(RecordTypes.VNAM)); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.DefaultMenuVolume, integerType: FloatIntegerType.UShort, - divisor: 1.5259021896696422E-05, + multiplier: 65535f, + divisor: null, header: translationParams.ConvertToCustom(RecordTypes.UNAM)); } @@ -1692,7 +1694,8 @@ public static ParseResult FillBinaryRecordTypes( item.StaticVolumeMultiplier = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 1.5259021896696422E-05); + multiplier: null, + divisor: 65535f); return (int)SoundCategory_FieldIndex.StaticVolumeMultiplier; } case RecordTypeInts.UNAM: @@ -1701,7 +1704,8 @@ public static ParseResult FillBinaryRecordTypes( item.DefaultMenuVolume = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: 1.5259021896696422E-05); + multiplier: null, + divisor: 65535f); return (int)SoundCategory_FieldIndex.DefaultMenuVolume; } default: @@ -1785,11 +1789,11 @@ void IBinaryItem.WriteToBinary( #endregion #region StaticVolumeMultiplier private int? _StaticVolumeMultiplierLocation; - public Single? StaticVolumeMultiplier => _StaticVolumeMultiplierLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _StaticVolumeMultiplierLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, 1.5259021896696422E-05) : default(Single?); + public Single? StaticVolumeMultiplier => _StaticVolumeMultiplierLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _StaticVolumeMultiplierLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, multiplier: null, divisor: 65535f) : default(Single?); #endregion #region DefaultMenuVolume private int? _DefaultMenuVolumeLocation; - public Single? DefaultMenuVolume => _DefaultMenuVolumeLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _DefaultMenuVolumeLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, 1.5259021896696422E-05) : default(Single?); + public Single? DefaultMenuVolume => _DefaultMenuVolumeLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _DefaultMenuVolumeLocation.Value, _package.MetaData.Constants), FloatIntegerType.UShort, multiplier: null, divisor: 65535f) : default(Single?); #endregion partial void CustomFactoryEnd( OverlayStream stream, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs index fcf5ba73d..af17fb911 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs @@ -2307,7 +2307,8 @@ public static void WriteRecordTypes( writer: writer, item: item.StaticAttenuation, integerType: FloatIntegerType.UShort, - divisor: 0.01); + multiplier: 100f, + divisor: null); } } @@ -2479,7 +2480,8 @@ public static ParseResult FillBinaryRecordTypes( item.StaticAttenuation = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.UShort, - multiplier: 0.01); + multiplier: null, + divisor: 100f); return (int)SoundDescriptor_FieldIndex.StaticAttenuation; } default: @@ -2592,7 +2594,7 @@ void IBinaryItem.WriteToBinary( #region StaticAttenuation private int _StaticAttenuationLocation => _BNAMLocation!.Value.Min + 0x4; private bool _StaticAttenuation_IsSet => _BNAMLocation.HasValue; - public Single StaticAttenuation => _StaticAttenuation_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_StaticAttenuationLocation, 2), FloatIntegerType.UShort, 0.01) : default; + public Single StaticAttenuation => _StaticAttenuation_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_StaticAttenuationLocation, 2), FloatIntegerType.UShort, multiplier: null, divisor: 100f) : default; #endregion partial void CustomFactoryEnd( OverlayStream stream, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/StoryManagerQuest_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/StoryManagerQuest_Generated.cs index 031202ff5..9a9448add 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/StoryManagerQuest_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/StoryManagerQuest_Generated.cs @@ -1092,7 +1092,8 @@ public static void WriteRecordTypes( writer: writer, item: item.HoursUntilReset, header: translationParams.ConvertToCustom(RecordTypes.RNAM), - divisor: 0.041666668f); + divisor: null, + multiplier: 24f); } public void Write( @@ -1155,7 +1156,8 @@ public static ParseResult FillBinaryRecordTypes( frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; item.HoursUntilReset = FloatBinaryTranslation.Instance.Parse( reader: frame.SpawnWithLength(contentLength), - multiplier: 0.041666668f); + multiplier: null, + divisor: 24f); return (int)StoryManagerQuest_FieldIndex.HoursUntilReset; } default: @@ -1237,7 +1239,7 @@ void IBinaryItem.WriteToBinary( #endregion #region HoursUntilReset private int? _HoursUntilResetLocation; - public Single? HoursUntilReset => _HoursUntilResetLocation.HasValue ? HeaderTranslation.ExtractSubrecordMemory(_recordData, _HoursUntilResetLocation.Value, _package.MetaData.Constants).Float() * 0.041666668f : default(Single?); + public Single? HoursUntilReset => _HoursUntilResetLocation.HasValue ? HeaderTranslation.ExtractSubrecordMemory(_recordData, _HoursUntilResetLocation.Value, _package.MetaData.Constants).Float() / 24f : default(Single?); #endregion partial void CustomFactoryEnd( OverlayStream stream, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintLayer_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintLayer_Generated.cs index f933327ac..1e17b9b84 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintLayer_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintLayer_Generated.cs @@ -1137,7 +1137,8 @@ public static void WriteRecordTypes( writer: writer, item: item.InterpolationValue, integerType: FloatIntegerType.UInt, - divisor: 0.01, + multiplier: 100f, + divisor: null, header: translationParams.ConvertToCustom(RecordTypes.TINV)); Int16BinaryTranslation.Instance.WriteNullable( writer: writer, @@ -1206,7 +1207,8 @@ public static ParseResult FillBinaryRecordTypes( item.InterpolationValue = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UInt, - multiplier: 0.01); + multiplier: null, + divisor: 100f); return (int)TintLayer_FieldIndex.InterpolationValue; } case RecordTypeInts.TIAS: @@ -1294,7 +1296,7 @@ void IBinaryItem.WriteToBinary( #endregion #region InterpolationValue private int? _InterpolationValueLocation; - public Single? InterpolationValue => _InterpolationValueLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _InterpolationValueLocation.Value, _package.MetaData.Constants), FloatIntegerType.UInt, 0.01) : default(Single?); + public Single? InterpolationValue => _InterpolationValueLocation.HasValue ? FloatBinaryTranslation.Instance.GetFloat(HeaderTranslation.ExtractSubrecordMemory(_recordData, _InterpolationValueLocation.Value, _package.MetaData.Constants), FloatIntegerType.UInt, multiplier: null, divisor: 100f) : default(Single?); #endregion #region Preset private int? _PresetLocation; diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs index 4f83e8677..fd97d0056 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs @@ -326,11 +326,11 @@ public CloudLayer[] Clouds #endregion #region WindDirection public Single WindDirection { get; set; } = default; - public static RangeFloat WindDirection_Range = new RangeFloat(0, 0.7083333333333334f); + public static RangeFloat WindDirection_Range = new RangeFloat(0, 255f); #endregion #region WindDirectionRange public Single WindDirectionRange { get; set; } = default; - public static RangeFloat WindDirectionRange_Range = new RangeFloat(0, 1.4166666666666667f); + public static RangeFloat WindDirectionRange_Range = new RangeFloat(0, 255f); #endregion #region Sounds [DebuggerBrowsable(DebuggerBrowsableState.Never)] @@ -5902,7 +5902,8 @@ public static void WriteRecordTypes( writer: writer, item: item.TransDelta, integerType: FloatIntegerType.Byte, - divisor: 4); + multiplier: null, + divisor: 4f); PercentBinaryTranslation.Write( writer: writer, item: item.SunGlare, @@ -5951,12 +5952,14 @@ public static void WriteRecordTypes( writer: writer, item: item.WindDirection, integerType: FloatIntegerType.Byte, - divisor: 0.002777777777777778); + multiplier: 360f, + divisor: null); FloatBinaryTranslation.Instance.Write( writer: writer, item: item.WindDirectionRange, integerType: FloatIntegerType.Byte, - divisor: 0.005555555555555556); + multiplier: 180f, + divisor: null); } WeatherBinaryWriteTranslation.WriteBinaryDisabledCloudLayers( writer: writer, @@ -6368,7 +6371,8 @@ public static ParseResult FillBinaryRecordTypes( item.TransDelta = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 4); + multiplier: 4f, + divisor: null); if (dataFrame.Remaining < 1) return null; item.SunGlare = PercentBinaryTranslation.Parse( reader: dataFrame, @@ -6415,12 +6419,14 @@ public static ParseResult FillBinaryRecordTypes( item.WindDirection = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 0.002777777777777778); + multiplier: null, + divisor: 360f); if (dataFrame.Remaining < 1) return null; item.WindDirectionRange = FloatBinaryTranslation.Instance.Parse( reader: dataFrame, integerType: FloatIntegerType.Byte, - multiplier: 0.005555555555555556); + multiplier: null, + divisor: 180f); return (int)Weather_FieldIndex.WindDirectionRange; } case RecordTypeInts.NAM1: @@ -6804,7 +6810,7 @@ public partial ParseResult CloudAlphasCustomParse( #region TransDelta private int _TransDeltaLocation => _DATALocation!.Value.Min + 0x3; private bool _TransDelta_IsSet => _DATALocation.HasValue; - public Single TransDelta => _TransDelta_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_TransDeltaLocation, 1), FloatIntegerType.Byte, 4) : default; + public Single TransDelta => _TransDelta_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_TransDeltaLocation, 1), FloatIntegerType.Byte, multiplier: 4f, divisor: null) : default; #endregion #region SunGlare private int _SunGlareLocation => _DATALocation!.Value.Min + 0x4; @@ -6864,12 +6870,12 @@ public partial ParseResult CloudAlphasCustomParse( #region WindDirection private int _WindDirectionLocation => _DATALocation!.Value.Min + 0x11; private bool _WindDirection_IsSet => _DATALocation.HasValue; - public Single WindDirection => _WindDirection_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_WindDirectionLocation, 1), FloatIntegerType.Byte, 0.002777777777777778) : default; + public Single WindDirection => _WindDirection_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_WindDirectionLocation, 1), FloatIntegerType.Byte, multiplier: null, divisor: 360f) : default; #endregion #region WindDirectionRange private int _WindDirectionRangeLocation => _DATALocation!.Value.Min + 0x12; private bool _WindDirectionRange_IsSet => _DATALocation.HasValue; - public Single WindDirectionRange => _WindDirectionRange_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_WindDirectionRangeLocation, 1), FloatIntegerType.Byte, 0.005555555555555556) : default; + public Single WindDirectionRange => _WindDirectionRange_IsSet ? FloatBinaryTranslation.Instance.GetFloat(_recordData.Slice(_WindDirectionRangeLocation, 1), FloatIntegerType.Byte, multiplier: null, divisor: 180f) : default; #endregion #region DisabledCloudLayers public partial ParseResult DisabledCloudLayersCustomParse( From 4ab20852d6b9b353cfdb42b71628dfd60e6de18a Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Mon, 3 Apr 2023 21:42:10 -0500 Subject: [PATCH 005/135] Split DialogResponseFlags.ResetHour multiplier/divisor fixes #428 --- .../Major Records/DialogResponseFlags_Generated.cs | 10 +++++----- .../Records/Major Records/DialogResponses.xml | 2 +- .../Major Records/DialogResponseFlags_Generated.cs | 10 +++++----- .../Records/Major Records/DialogResponses.xml | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs index c80aae34e..fa608cb0f 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponseFlags_Generated.cs @@ -1006,8 +1006,8 @@ public static void WriteEmbedded( writer: writer, item: item.ResetHours, integerType: FloatIntegerType.UShort, - multiplier: 2730f, - divisor: null); + multiplier: 65535f, + divisor: 24f); } public void Write( @@ -1054,8 +1054,8 @@ public static void FillBinaryStructs( item.ResetHours = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: null, - divisor: 2730f); + multiplier: 24f, + divisor: 65535f); } } @@ -1122,7 +1122,7 @@ void IBinaryItem.WriteToBinary( } public DialogResponses.Flag Flags => (DialogResponses.Flag)BinaryPrimitives.ReadUInt16LittleEndian(_structData.Span.Slice(0x0, 0x2)); - public Single ResetHours => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, multiplier: null, divisor: 2730f); + public Single ResetHours => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, multiplier: 24f, divisor: 65535f); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponses.xml b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponses.xml index 4d4a2b777..73a0f17fe 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponses.xml +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/DialogResponses.xml @@ -28,7 +28,7 @@ - + diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs index fd4d7d086..b9a91550a 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponseFlags_Generated.cs @@ -1006,8 +1006,8 @@ public static void WriteEmbedded( writer: writer, item: item.ResetHours, integerType: FloatIntegerType.UShort, - multiplier: 2730f, - divisor: null); + multiplier: 65535f, + divisor: 24f); } public void Write( @@ -1054,8 +1054,8 @@ public static void FillBinaryStructs( item.ResetHours = FloatBinaryTranslation.Instance.Parse( reader: frame, integerType: FloatIntegerType.UShort, - multiplier: null, - divisor: 2730f); + multiplier: 24f, + divisor: 65535f); } } @@ -1122,7 +1122,7 @@ void IBinaryItem.WriteToBinary( } public DialogResponses.Flag Flags => (DialogResponses.Flag)BinaryPrimitives.ReadUInt16LittleEndian(_structData.Span.Slice(0x0, 0x2)); - public Single ResetHours => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, multiplier: null, divisor: 2730f); + public Single ResetHours => FloatBinaryTranslation.Instance.GetFloat(_structData.Slice(0x2, 0x2), FloatIntegerType.UShort, multiplier: 24f, divisor: 65535f); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses.xml b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses.xml index 36252e78f..b33ea2e68 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses.xml +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses.xml @@ -27,7 +27,7 @@ - + From 426be470204aca4468ddd9973dd17cb811e85cf0 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Wed, 5 Apr 2023 20:00:22 -0500 Subject: [PATCH 006/135] float ApplyTransformation overloads Should provide some more accuracy depending on how it's being converted --- .../Binary/FloatBinaryTranslation.cs | 61 ++++++++++++++++--- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs index 800812caf..7a0847eeb 100644 --- a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs +++ b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs @@ -64,17 +64,17 @@ public float GetFloat( case FloatIntegerType.UInt: { var raw = BinaryPrimitives.ReadUInt32LittleEndian(bytes); - return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); + return ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.UShort: { var raw = BinaryPrimitives.ReadUInt16LittleEndian(bytes); - return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); + return ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.Byte: { var raw = bytes[0]; - return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); + return ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); } default: throw new NotImplementedException(); @@ -117,25 +117,70 @@ public void Write( { if (item == null) return; - var transformed = ApplyTransformations(item.Value, multiplier: multiplier, divisor: divisor); + var transformed = ApplyTransformationsToUInt32(item.Value, multiplier: multiplier, divisor: divisor); switch (integerType) { case FloatIntegerType.UInt: - writer.Write(checked((uint)Math.Round(transformed))); + writer.Write(transformed); break; case FloatIntegerType.UShort: - writer.Write(checked((ushort)Math.Round(transformed))); + writer.Write(checked((ushort)transformed)); break; case FloatIntegerType.Byte: - writer.Write(checked((byte)Math.Round(transformed))); + writer.Write(checked((byte)transformed)); break; default: throw new NotImplementedException(); } } - public float ApplyTransformations(float input, float? multiplier, float? divisor) + private float ApplyTransformations(float input, float? multiplier, float? divisor) + { + if (multiplier == null && divisor == null) + { + return input; + } + + if (multiplier == null) + { + return input / divisor!.Value; + } + + if (divisor == null) + { + return input * multiplier.Value; + } + + return input * multiplier.Value / divisor.Value; + } + + private uint ApplyTransformationsToUInt32(float input, float? multiplier, float? divisor) + { + if (multiplier == null && divisor == null) + { + return checked((uint)Math.Round(input)); + } + + double transformed = input; + + if (multiplier == null) + { + transformed /= divisor!.Value; + } + else if (divisor == null) + { + transformed *= multiplier.Value; + } + else + { + transformed = (transformed * multiplier.Value) / divisor.Value; + } + + return checked((uint)Math.Round(transformed)); + } + + private float ApplyTransformationsFromUInt32(uint input, float? multiplier, float? divisor) { if (multiplier == null && divisor == null) { From 1d2d45665652f1aaf9230e38d1630c4120c4a9b5 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Wed, 5 Apr 2023 23:42:35 -0500 Subject: [PATCH 007/135] FloatStoredAsIntegerOverflowException --- .../Mutagen.Bethesda.Core.csproj | 1 + .../FloatStoredAsIntegerOverflowException.cs | 49 +++++++++++++ .../Binary/FloatBinaryTranslation.cs | 68 ++++++++++++------- 3 files changed, 93 insertions(+), 25 deletions(-) create mode 100644 Mutagen.Bethesda.Core/Plugins/Exceptions/FloatStoredAsIntegerOverflowException.cs diff --git a/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj b/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj index 391fbed97..c87876b4e 100644 --- a/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj +++ b/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj @@ -262,6 +262,7 @@ + diff --git a/Mutagen.Bethesda.Core/Plugins/Exceptions/FloatStoredAsIntegerOverflowException.cs b/Mutagen.Bethesda.Core/Plugins/Exceptions/FloatStoredAsIntegerOverflowException.cs new file mode 100644 index 000000000..3984a63bd --- /dev/null +++ b/Mutagen.Bethesda.Core/Plugins/Exceptions/FloatStoredAsIntegerOverflowException.cs @@ -0,0 +1,49 @@ +using Mutagen.Bethesda.Translations.Binary; + +namespace Mutagen.Bethesda.Plugins.Exceptions; + +public class FloatStoredAsIntegerOverflowException : Exception +{ + public float? Multiplier { get; } + public float? Divisor { get; } + public FloatIntegerType IntegerType { get; } + + public FloatStoredAsIntegerOverflowException( + string? name, + float? multiplier, + float? divisor, + FloatIntegerType integerType) + : base(GetMessage(name, multiplier, divisor, integerType)) + { + Multiplier = multiplier; + Divisor = divisor; + IntegerType = integerType; + } + + private static string GetMessage( + string? name, + float? multiplier, + float? divisor, + FloatIntegerType integerType) + { + uint max; + switch (integerType) + { + case FloatIntegerType.UInt: + max = uint.MaxValue; + break; + case FloatIntegerType.UShort: + max = ushort.MaxValue; + break; + case FloatIntegerType.Byte: + max = byte.MaxValue; + break; + default: + throw new ArgumentOutOfRangeException(nameof(integerType), integerType, null); + } + + max = FloatBinaryTranslation.ApplyTransformationsToUInt32(max, multiplier: multiplier, divisor: divisor); + + return $"{name ?? "This float"} does not support values smaller than 0, or greater than {max}"; + } +} \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs index 7a0847eeb..a7e7ceadb 100644 --- a/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs +++ b/Mutagen.Bethesda.Core/Translations/Binary/FloatBinaryTranslation.cs @@ -1,5 +1,7 @@ using Noggog; using System.Buffers.Binary; +using System.Runtime.CompilerServices; +using Mutagen.Bethesda.Plugins.Exceptions; namespace Mutagen.Bethesda.Translations.Binary; @@ -29,17 +31,17 @@ public float Parse(TReader reader, FloatIntegerType integerType, case FloatIntegerType.UInt: { var raw = reader.ReadUInt32(); - return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); + return FloatBinaryTranslation.ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.UShort: { var raw = reader.ReadUInt16(); - return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); + return FloatBinaryTranslation.ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.Byte: { var raw = reader.ReadUInt8(); - return ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); + return FloatBinaryTranslation.ApplyTransformations(raw, multiplier: multiplier, divisor: divisor); } default: throw new NotImplementedException(); @@ -50,7 +52,7 @@ public float Parse(TReader reader, float? multiplier, float? divisor) { - return ApplyTransformations(Parse(reader), multiplier: multiplier, divisor: divisor); + return FloatBinaryTranslation.ApplyTransformations(Parse(reader), multiplier: multiplier, divisor: divisor); } public float GetFloat( @@ -64,17 +66,17 @@ public float GetFloat( case FloatIntegerType.UInt: { var raw = BinaryPrimitives.ReadUInt32LittleEndian(bytes); - return ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); + return FloatBinaryTranslation.ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.UShort: { var raw = BinaryPrimitives.ReadUInt16LittleEndian(bytes); - return ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); + return FloatBinaryTranslation.ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); } case FloatIntegerType.Byte: { var raw = bytes[0]; - return ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); + return FloatBinaryTranslation.ApplyTransformationsFromUInt32(raw, multiplier: multiplier, divisor: divisor); } default: throw new NotImplementedException(); @@ -103,7 +105,7 @@ public void Write( float? multiplier, float? divisor) { - var transformed = ApplyTransformations(item, multiplier: multiplier, divisor: divisor); + var transformed = FloatBinaryTranslation.ApplyTransformations(item, multiplier: multiplier, divisor: divisor); Write(writer, transformed); } @@ -113,29 +115,45 @@ public void Write( float? item, FloatIntegerType integerType, float? multiplier = null, - float? divisor = null) + float? divisor = null, + [CallerArgumentExpression("item")] string? propertyName = default) { if (item == null) return; - var transformed = ApplyTransformationsToUInt32(item.Value, multiplier: multiplier, divisor: divisor); + try + { + var transformed = FloatBinaryTranslation.ApplyTransformationsToUInt32(item.Value, multiplier: multiplier, divisor: divisor); - switch (integerType) + switch (integerType) + { + case FloatIntegerType.UInt: + writer.Write(transformed); + break; + case FloatIntegerType.UShort: + writer.Write(checked((ushort)transformed)); + break; + case FloatIntegerType.Byte: + writer.Write(checked((byte)transformed)); + break; + default: + throw new NotImplementedException(); + } + } + catch (OverflowException) { - case FloatIntegerType.UInt: - writer.Write(transformed); - break; - case FloatIntegerType.UShort: - writer.Write(checked((ushort)transformed)); - break; - case FloatIntegerType.Byte: - writer.Write(checked((byte)transformed)); - break; - default: - throw new NotImplementedException(); + throw new FloatStoredAsIntegerOverflowException( + propertyName, + // Intentionally flipped + divisor: multiplier, + multiplier: divisor, + integerType: integerType); } } +} - private float ApplyTransformations(float input, float? multiplier, float? divisor) +internal static class FloatBinaryTranslation +{ + public static float ApplyTransformations(float input, float? multiplier, float? divisor) { if (multiplier == null && divisor == null) { @@ -155,7 +173,7 @@ private float ApplyTransformations(float input, float? multiplier, float? diviso return input * multiplier.Value / divisor.Value; } - private uint ApplyTransformationsToUInt32(float input, float? multiplier, float? divisor) + public static uint ApplyTransformationsToUInt32(float input, float? multiplier, float? divisor) { if (multiplier == null && divisor == null) { @@ -180,7 +198,7 @@ private uint ApplyTransformationsToUInt32(float input, float? multiplier, float? return checked((uint)Math.Round(transformed)); } - private float ApplyTransformationsFromUInt32(uint input, float? multiplier, float? divisor) + public static float ApplyTransformationsFromUInt32(uint input, float? multiplier, float? divisor) { if (multiplier == null && divisor == null) { From 20852c88deae0d234a27eb22b807c414fc513f2d Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 6 Apr 2023 19:18:32 -0500 Subject: [PATCH 008/135] Accessing-Known-Records docs --- docs/Accessing-Known-Records | 54 ++++++++++++++++++++++++++++++++++++ docs/_Sidebar.md | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 docs/Accessing-Known-Records diff --git a/docs/Accessing-Known-Records b/docs/Accessing-Known-Records new file mode 100644 index 000000000..23cc72e5b --- /dev/null +++ b/docs/Accessing-Known-Records @@ -0,0 +1,54 @@ +# Recommended Patterns +Often, especially for base master files like `Skyrim.esm`, there are specific records that you want to look up. + +The recommended strategy is to use the [FormKeys library](https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys), which lets you refer to records by EditorID, while still using FormKeys under the hood: +``` +var env = ...; // Some environment, like Synthesis, or Mutagen's GameEnvironment + +if (Skyrim.Race.ArgonianRace.TryResolve(env.LinkCache, out var race)) +{ + Console.WriteLine($"Found the race record"); +} +``` + +The following sections will outline the alternatives and reasoning for the recommended best practices. + +# Desire To Access Known Records + +## By FormKey +For example, if you wanted to look up the Argonian Race record, you might do the following: +```cs +var env = ...; // Some environment, like Synthesis, or Mutagen's GameEnvironment + +var formKey = FormKey.Factory("123456:Skyrim.esm"); + +if (env.LinkCache.TryResolve(formKey, out var race)) +{ + Console.WriteLine($"Found the race record"); +} +``` + +First, a FormKey is created pointing to the known record for the Argonian race in Skyrim.esm. Then the link cache is asked to resolve the winning override for the record. +This will retrieve the winning override. + +However, there's a few annoyances: +- Neither the dev nor future readers know the FormID for records offhand, and so must always look them up. +- The only indication that `123456` points to the argonian race is to look it up and check, or hope the variable is named something intelligent (like `argonianRaceFormKey`) +- Potential for typos. What if it was actually `123457` and got mis-copied? + +## EditorID +EditorIDs are a common alternative for looking up records, as they are human readable. + +```cs +var env = ...; // Some environment, like Synthesis, or Mutagen's GameEnvironment + +if (env.LinkCache.TryResolve("ArgonianRace", out var race)) +{ + Console.WriteLine($"Found the race record"); +} +``` + +However, they are not recommended for general use, for the reasons [outlined here](https://github.com/Mutagen-Modding/Mutagen/wiki/FormLinks-vs-EditorID-as-Identifiers). + +# Neither is Ideal +Neither direct FormKeys or EditorIDs are ideal for looking up known records. This is why the recommended pattern is to use the [FormLinks library](https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys) to bridge the gap and get the best of both worlds diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md index 5c26513a2..a7381f4bd 100644 --- a/docs/_Sidebar.md +++ b/docs/_Sidebar.md @@ -65,7 +65,7 @@ Examples * [[Print Some Content]] - * [[Locate Records via FormLinks]] + * [[Accessing Known Records]] * [[Record Overrides and Duplication]] * [[Low Level Examples]] From 136ec5adc0bda8eb2c590791569ef5acf71780a9 Mon Sep 17 00:00:00 2001 From: IDontCare <19627854+NoIDontCare@users.noreply.github.com> Date: Fri, 21 Apr 2023 13:51:52 -0500 Subject: [PATCH 009/135] Fix typo in Aggression enum. --- Mutagen.Bethesda.Skyrim/Enums/Agression.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Skyrim/Enums/Agression.cs b/Mutagen.Bethesda.Skyrim/Enums/Agression.cs index 4c5038f21..7182b1eae 100644 --- a/Mutagen.Bethesda.Skyrim/Enums/Agression.cs +++ b/Mutagen.Bethesda.Skyrim/Enums/Agression.cs @@ -3,7 +3,7 @@ namespace Mutagen.Bethesda.Skyrim; public enum Aggression { Unagressive, - Agressive, + Aggressive, VeryAggressive, Frenzied, } \ No newline at end of file From d6a8d84f0a2b12ee8830d52756c1cc3fa2d21b6a Mon Sep 17 00:00:00 2001 From: IDontCare <19627854+NoIDontCare@users.noreply.github.com> Date: Fri, 21 Apr 2023 18:15:39 -0500 Subject: [PATCH 010/135] Fix filename misspelling. Fix typo in enum. --- Mutagen.Bethesda.Skyrim/Enums/{Agression.cs => Aggression.cs} | 2 +- Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Mutagen.Bethesda.Skyrim/Enums/{Agression.cs => Aggression.cs} (86%) diff --git a/Mutagen.Bethesda.Skyrim/Enums/Agression.cs b/Mutagen.Bethesda.Skyrim/Enums/Aggression.cs similarity index 86% rename from Mutagen.Bethesda.Skyrim/Enums/Agression.cs rename to Mutagen.Bethesda.Skyrim/Enums/Aggression.cs index 7182b1eae..072362c4e 100644 --- a/Mutagen.Bethesda.Skyrim/Enums/Agression.cs +++ b/Mutagen.Bethesda.Skyrim/Enums/Aggression.cs @@ -2,7 +2,7 @@ namespace Mutagen.Bethesda.Skyrim; public enum Aggression { - Unagressive, + Unaggressive, Aggressive, VeryAggressive, Frenzied, diff --git a/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj b/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj index 7eb0bf637..053282fce 100644 --- a/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj +++ b/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj @@ -58,7 +58,7 @@ - + From 9b908d053f110b933aee01da8d186c4569cf6ed1 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Wed, 19 Apr 2023 21:58:31 -0500 Subject: [PATCH 011/135] nuget bump --- Directory.Packages.props | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 9b1104d6e..e52faa304 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,10 +24,10 @@ - 2.56 + 2.56.0.1-dev - 2.56 + 2.56.0.1-dev @@ -39,16 +39,16 @@ - 2.56 + 2.56.0.1-dev - 2.56 + 2.56.0.1-dev - 2.56 + 2.56.0.1-dev - 2.56 + 2.56.0.1-dev From 05d4a69c69940b4131d21cc7fa77128e039a6c14 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Apr 2023 23:27:02 -0500 Subject: [PATCH 012/135] MajorRecordBuilder now sets properties of major records it returns --- .../AutoData/MajorRecordBuilder.cs | 16 +++++++++++++--- .../AutoData/MutagenConcreteModsCustomization.cs | 6 ++++-- .../AutoData/MutagenModAutoData.cs | 2 +- .../AutoData/MajorRecordBuilderTests.cs | 10 ++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs b/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs index 20ba2d8c3..75311cca7 100644 --- a/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs +++ b/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs @@ -2,6 +2,7 @@ using Mutagen.Bethesda.Plugins.Records; using Mutagen.Bethesda.Plugins.Utility; using Noggog; +using Noggog.Testing.AutoFixture.Testing; namespace Mutagen.Bethesda.Testing.AutoData; @@ -9,13 +10,16 @@ public class MajorRecordBuilder : ISpecimenBuilder { private readonly GameRelease _release; private readonly ModConcreteBuilder _modBuilder; + private readonly bool _configureMembers; public MajorRecordBuilder( GameRelease release, - ModConcreteBuilder modBuilder) + ModConcreteBuilder modBuilder, + bool configureMembers) { _release = release; _modBuilder = modBuilder; + _configureMembers = configureMembers; } public object Create(object request, ISpecimenContext context) @@ -29,17 +33,23 @@ public object Create(object request, ISpecimenContext context) if (!t.IsAbstract && !t.IsInterface && t.InheritsFrom(typeof(IMajorRecord))) { - var ret = GetMajorRecord(t); + var ret = GetMajorRecord(t, context); if (ret != null) return ret; } return new NoSpecimen(); } - private IMajorRecord? GetMajorRecord(Type t) + private IMajorRecord? GetMajorRecord(Type t, ISpecimenContext context) { if (_modBuilder.LastCreatedConcreteMod == null) return null; var ret = MajorRecordInstantiator.Activator(_modBuilder.LastCreatedConcreteMod.GetNextFormKey(), _release, t); + + if (_configureMembers) + { + context.FillAllProperties(ret); + } + var group = _modBuilder.LastCreatedConcreteMod.TryGetTopLevelGroup(t); group?.AddUntyped(ret); return ret; diff --git a/Mutagen.Bethesda.Testing/AutoData/MutagenConcreteModsCustomization.cs b/Mutagen.Bethesda.Testing/AutoData/MutagenConcreteModsCustomization.cs index 4bbcd328d..395148cd7 100644 --- a/Mutagen.Bethesda.Testing/AutoData/MutagenConcreteModsCustomization.cs +++ b/Mutagen.Bethesda.Testing/AutoData/MutagenConcreteModsCustomization.cs @@ -5,16 +5,18 @@ namespace Mutagen.Bethesda.Testing.AutoData; public class MutagenConcreteModsCustomization : ICustomization { private readonly GameRelease _release; + private readonly bool _configureMembers; - public MutagenConcreteModsCustomization(GameRelease release) + public MutagenConcreteModsCustomization(GameRelease release, bool configureMembers) { _release = release; + _configureMembers = configureMembers; } public void Customize(IFixture fixture) { var modBuilder = new ModConcreteBuilder(_release); fixture.Customizations.Add(modBuilder); - fixture.Customizations.Add(new MajorRecordBuilder(_release, modBuilder)); + fixture.Customizations.Add(new MajorRecordBuilder(_release, modBuilder, _configureMembers)); } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Testing/AutoData/MutagenModAutoData.cs b/Mutagen.Bethesda.Testing/AutoData/MutagenModAutoData.cs index f136eaefa..c00ba8401 100644 --- a/Mutagen.Bethesda.Testing/AutoData/MutagenModAutoData.cs +++ b/Mutagen.Bethesda.Testing/AutoData/MutagenModAutoData.cs @@ -17,7 +17,7 @@ public MutagenModAutoDataAttribute( useMockFileSystem: UseMockFileSystem, configureMembers: ConfigureMembers, release: Release)); - ret.Customize(new MutagenConcreteModsCustomization(release: Release)); + ret.Customize(new MutagenConcreteModsCustomization(release: Release, configureMembers: ConfigureMembers)); return ret; }) { diff --git a/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs b/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs index 8a61e1715..2e427ebfd 100644 --- a/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs +++ b/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs @@ -51,4 +51,14 @@ public void DeepRecord( { responses.FormKey.ModKey.Should().Be(mod.ModKey); } + + [Theory] + [MutagenModAutoData(ConfigureMembers: true)] + public void CellNestedMajorRecords( + SkyrimMod mod, + Cell cell) + { + cell.FormKey.ModKey.Should().Be(mod.ModKey); + cell.Temporary.Should().NotBeEmpty(); + } } \ No newline at end of file From af1b12217aefbb39b33f2df1c1fd5719ae6a7e33 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Apr 2023 01:25:30 -0500 Subject: [PATCH 013/135] FloatStoredAsIntegerOverflowException unit test fixes --- .../Translations/Binary/FloatBinaryTranslationTests.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs b/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs index 8fc099901..adf9d2a5d 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs +++ b/Mutagen.Bethesda.Core.UnitTests/Translations/Binary/FloatBinaryTranslationTests.cs @@ -2,6 +2,7 @@ using FluentAssertions; using Mutagen.Bethesda.Plugins; using Mutagen.Bethesda.Plugins.Binary.Streams; +using Mutagen.Bethesda.Plugins.Exceptions; using Mutagen.Bethesda.Plugins.Masters; using Mutagen.Bethesda.Plugins.Meta; using Mutagen.Bethesda.Translations.Binary; @@ -168,7 +169,7 @@ public void WriteWithIntegerTypeRounded() [Fact] public void WriteWithIntegerTypeLimit() { - Assert.Throws(() => + Assert.Throws(() => { var arr = GetWriteArray((transl, writer) => { @@ -246,7 +247,7 @@ public void WriteWithUShortTypeRounded() [Fact] public void WriteWithUShortTypeLimit() { - Assert.Throws(() => + Assert.Throws(() => { var arr = GetWriteArray((transl, writer) => { @@ -324,7 +325,7 @@ public void WriteWithByteTypeRounded() [Fact] public void WriteWithByteTypeLimit() { - Assert.Throws(() => + Assert.Throws(() => { var arr = GetWriteArray((transl, writer) => { From e6e8239db02e5e121a4b9bc8e2fa75b6fe7096e2 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Apr 2023 15:35:18 -0500 Subject: [PATCH 014/135] MajorRecordBuilder should keep arrays of known length stable --- .../AutoData/MajorRecordBuilder.cs | 97 ++++++++++++++++++- .../AutoData/MajorRecordBuilderTests.cs | 10 ++ 2 files changed, 105 insertions(+), 2 deletions(-) diff --git a/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs b/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs index 75311cca7..f4efbb13e 100644 --- a/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs +++ b/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs @@ -1,4 +1,6 @@ -using AutoFixture.Kernel; +using System.Reflection; +using AutoFixture.Kernel; +using Loqui; using Mutagen.Bethesda.Plugins.Records; using Mutagen.Bethesda.Plugins.Utility; using Noggog; @@ -47,11 +49,102 @@ public object Create(object request, ISpecimenContext context) if (_configureMembers) { - context.FillAllProperties(ret); + FillAllProperties(context, ret, keepArraySizes: true); } var group = _modBuilder.LastCreatedConcreteMod.TryGetTopLevelGroup(t); group?.AddUntyped(ret); return ret; } + + public static void FillAllProperties(ISpecimenContext context, object item, bool keepArraySizes = false) + { + foreach (var prop in item.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + var setter = prop.GetSetMethod(); + if (setter == null) continue; + + var toSet = GetPropertyFor(context, item, prop, keepArraySizes); + if (toSet != null) + { + setter.Invoke(item, new object[] { toSet }); + } + } + } + + private static object? GetPropertyFor( + ISpecimenContext context, + object item, + PropertyInfo prop, + bool keepArraySizes) + { + if (keepArraySizes && prop.PropertyType.IsArray) + { + var getter = prop.GetGetMethod(); + if (getter == null) return null; + var arr = getter.Invoke(item, Array.Empty()) as Array; + if (arr == null) return null; + var genArg = prop.PropertyType.GenericTypeArguments[0]; + for (int i = 0; i < arr.Length; i++) + { + var indexedItem = GetTypeFor(context, genArg, keepArraySizes); + if (indexedItem == null) break; + arr.SetValue(indexedItem, i); + } + + return null; + } + + if (keepArraySizes + && prop.PropertyType.IsGenericType + && prop.PropertyType.GetGenericTypeDefinition() == typeof(MemorySlice<>)) + { + var getter = prop.GetGetMethod(); + if (getter == null) return null; + var arr = getter.Invoke(item, Array.Empty()); + if (arr == null) return null; + var len = (int)arr.GetType().GetMember("Length") + .OfType() + .First().GetValue(arr); + if (len == 0) return null; + + var genArg = prop.PropertyType.GenericTypeArguments[0]; + var indexedSetter = prop.PropertyType.GetProperties() + .First(x => x.GetIndexParameters().Length > 0); + + for (int i = 0; i < len; i++) + { + var indexedItem = GetTypeFor(context, genArg, keepArraySizes); + if (indexedItem == null) break; + indexedSetter.SetValue(arr, indexedItem, new object[] { i }); + } + + return null; + } + + return GetTypeFor(context, prop.PropertyType, keepArraySizes); + } + + private static object? GetTypeFor( + ISpecimenContext context, + Type type, + bool keepArraySizes) + { + if (LoquiRegistration.IsLoquiType(type)) + { + try + { + var subItem = Activator.CreateInstance(type); + if (subItem == null) return null; + FillAllProperties(context, subItem, keepArraySizes: keepArraySizes); + return subItem; + } + catch (Exception) + { + return null; + } + } + + return context.Resolve(type); + } } \ No newline at end of file diff --git a/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs b/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs index 2e427ebfd..a479cffd3 100644 --- a/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs +++ b/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs @@ -61,4 +61,14 @@ public void CellNestedMajorRecords( cell.FormKey.ModKey.Should().Be(mod.ModKey); cell.Temporary.Should().NotBeEmpty(); } + + [Theory] + [MutagenModAutoData(ConfigureMembers: true)] + public void WeaponDataSubArray( + SkyrimMod mod, + Weapon weapon) + { + weapon.Data.Should().NotBeNull(); + weapon.Data!.Unknown3.Length.Should().Be(12); + } } \ No newline at end of file From 86ab49a46de51654a50dfd575d8496444d4aa5f3 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Apr 2023 15:36:36 -0500 Subject: [PATCH 015/135] Missing filesystem parameter pass --- .../Records/Fallout4Mod_Generated.cs | 8 ++++---- .../Modules/Plugin/PluginTranslationModule.cs | 4 ++-- .../Records/OblivionMod_Generated.cs | 8 ++++---- Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs index d42009b47..8e9095f2b 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs @@ -6671,7 +6671,7 @@ public static Fallout4Mod CreateFromBinary( using (var reader = new MutagenBinaryReadStream(path, GameRelease.Fallout4, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Fallout4)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Fallout4, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; frame.MetaData.Absorb(stringsParam); @@ -6708,7 +6708,7 @@ public static Fallout4Mod CreateFromBinary( using (var reader = new MutagenBinaryReadStream(path, GameRelease.Fallout4, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Fallout4)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Fallout4, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; frame.MetaData.Absorb(stringsParam); @@ -7632,7 +7632,7 @@ public static void CopyInFromBinary( using (var reader = new MutagenBinaryReadStream(path, GameRelease.Fallout4, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Fallout4)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Fallout4, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; frame.MetaData.Absorb(stringsParam); @@ -25095,7 +25095,7 @@ public static Fallout4ModBinaryOverlay Fallout4ModFactory( { var meta = new ParsingBundle(GameRelease.Fallout4, new MasterReferenceCollection(path.ModKey)) { - RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Fallout4)) + RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Fallout4, fileSystem: fileSystem)) }; var stream = new MutagenBinaryReadStream( path: path.Path, diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/PluginTranslationModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/PluginTranslationModule.cs index aac6b0c44..36139799f 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/PluginTranslationModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/PluginTranslationModule.cs @@ -466,7 +466,7 @@ private void ConvertFromPathIn(ObjectGeneration obj, StructuredStringBuilder sb, using (sb.CurlyBrace()) { sb.AppendLine("var frame = new MutagenFrame(reader);"); - sb.AppendLine($"frame.{nameof(MutagenFrame.MetaData)}.{nameof(ParsingBundle.RecordInfoCache)} = new {nameof(RecordTypeInfoCacheReader)}(() => new {nameof(MutagenBinaryReadStream)}(path, {gameReleaseStr}));"); + sb.AppendLine($"frame.{nameof(MutagenFrame.MetaData)}.{nameof(ParsingBundle.RecordInfoCache)} = new {nameof(RecordTypeInfoCacheReader)}(() => new {nameof(MutagenBinaryReadStream)}(path, {gameReleaseStr}, fileSystem: fileSystem));"); sb.AppendLine($"frame.{nameof(MutagenFrame.MetaData)}.{nameof(ParsingBundle.Parallel)} = parallel;"); sb.AppendLine($"frame.{nameof(MutagenFrame.MetaData)}.{nameof(ParsingBundle.ModKey)} = path.ModKey;"); if (obj.GetObjectData().UsesStringFiles) @@ -2443,7 +2443,7 @@ await typeGen.GenerateWrapperCtor( sb.AppendLine($"var meta = new {nameof(ParsingBundle)}({gameReleaseStr}, new {nameof(MasterReferenceCollection)}(path.ModKey))"); using (sb.CurlyBrace(appendSemiColon: true)) { - sb.AppendLine($"{nameof(ParsingBundle.RecordInfoCache)} = new {nameof(RecordTypeInfoCacheReader)}(() => new {nameof(MutagenBinaryReadStream)}(path, {gameReleaseStr}))"); + sb.AppendLine($"{nameof(ParsingBundle.RecordInfoCache)} = new {nameof(RecordTypeInfoCacheReader)}(() => new {nameof(MutagenBinaryReadStream)}(path, {gameReleaseStr}, fileSystem: fileSystem))"); } using (var args = sb.Call( $"var stream = new {nameof(MutagenBinaryReadStream)}")) diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs index b3e988b56..f85c30403 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs @@ -3240,7 +3240,7 @@ public static OblivionMod CreateFromBinary( using (var reader = new MutagenBinaryReadStream(path, GameRelease.Oblivion, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Oblivion)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Oblivion, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; return CreateFromBinary( @@ -3266,7 +3266,7 @@ public static OblivionMod CreateFromBinary( using (var reader = new MutagenBinaryReadStream(path, GameRelease.Oblivion, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Oblivion)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Oblivion, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; return CreateFromBinary( @@ -4031,7 +4031,7 @@ public static void CopyInFromBinary( using (var reader = new MutagenBinaryReadStream(path, GameRelease.Oblivion, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Oblivion)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Oblivion, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; CopyInFromBinary( @@ -12361,7 +12361,7 @@ public static OblivionModBinaryOverlay OblivionModFactory( { var meta = new ParsingBundle(GameRelease.Oblivion, new MasterReferenceCollection(path.ModKey)) { - RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Oblivion)) + RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, GameRelease.Oblivion, fileSystem: fileSystem)) }; var stream = new MutagenBinaryReadStream( path: path.Path, diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs index 97f6202f7..7d44b66bc 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs @@ -6040,7 +6040,7 @@ public static SkyrimMod CreateFromBinary( using (var reader = new MutagenBinaryReadStream(path, gameRelease, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, gameRelease)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, gameRelease, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; frame.MetaData.Absorb(stringsParam); @@ -6080,7 +6080,7 @@ public static SkyrimMod CreateFromBinary( using (var reader = new MutagenBinaryReadStream(path, gameRelease, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, gameRelease)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, gameRelease, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; frame.MetaData.Absorb(stringsParam); @@ -6999,7 +6999,7 @@ public static void CopyInFromBinary( using (var reader = new MutagenBinaryReadStream(path, gameRelease, fileSystem: fileSystem)) { var frame = new MutagenFrame(reader); - frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, gameRelease)); + frame.MetaData.RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, gameRelease, fileSystem: fileSystem)); frame.MetaData.Parallel = parallel; frame.MetaData.ModKey = path.ModKey; frame.MetaData.Absorb(stringsParam); @@ -23361,7 +23361,7 @@ public static SkyrimModBinaryOverlay SkyrimModFactory( { var meta = new ParsingBundle(release.ToGameRelease(), new MasterReferenceCollection(path.ModKey)) { - RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, release.ToGameRelease())) + RecordInfoCache = new RecordTypeInfoCacheReader(() => new MutagenBinaryReadStream(path, release.ToGameRelease(), fileSystem: fileSystem)) }; var stream = new MutagenBinaryReadStream( path: path.Path, From d2e82f27b76df1b90557e24ce6d4395ac4b4b281 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Apr 2023 16:38:46 -0500 Subject: [PATCH 016/135] Ensure major record compression/deletion is off during building --- .../AutoData/MajorRecordBuilder.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs b/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs index f4efbb13e..997c041ad 100644 --- a/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs +++ b/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs @@ -51,11 +51,19 @@ public object Create(object request, ISpecimenContext context) { FillAllProperties(context, ret, keepArraySizes: true); } + + ModifyMajorRecordFields(ret); var group = _modBuilder.LastCreatedConcreteMod.TryGetTopLevelGroup(t); group?.AddUntyped(ret); return ret; } + + private static void ModifyMajorRecordFields(IMajorRecord rec) + { + rec.IsCompressed = false; + rec.IsDeleted = false; + } public static void FillAllProperties(ISpecimenContext context, object item, bool keepArraySizes = false) { @@ -137,6 +145,10 @@ public static void FillAllProperties(ISpecimenContext context, object item, bool var subItem = Activator.CreateInstance(type); if (subItem == null) return null; FillAllProperties(context, subItem, keepArraySizes: keepArraySizes); + if (subItem is IMajorRecord majRec) + { + ModifyMajorRecordFields(majRec); + } return subItem; } catch (Exception) From ae666c1c63b07a02736b6fef9496abc98d47f66a Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Apr 2023 20:10:10 -0500 Subject: [PATCH 017/135] MajorRecordBuilder improvements for IPlaced --- .../AutoData/MajorRecordBuilder.cs | 40 ++++++++++++++----- .../AutoData/MajorRecordBuilderTests.cs | 22 ++++++++++ 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs b/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs index 997c041ad..6b5f897a6 100644 --- a/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs +++ b/Mutagen.Bethesda.Testing/AutoData/MajorRecordBuilder.cs @@ -1,10 +1,14 @@ using System.Reflection; +using AutoFixture; using AutoFixture.Kernel; using Loqui; +using Mutagen.Bethesda.Plugins; using Mutagen.Bethesda.Plugins.Records; +using Mutagen.Bethesda.Plugins.Records.Mapping; using Mutagen.Bethesda.Plugins.Utility; using Noggog; using Noggog.Testing.AutoFixture.Testing; +using NSubstitute; namespace Mutagen.Bethesda.Testing.AutoData; @@ -13,6 +17,7 @@ public class MajorRecordBuilder : ISpecimenBuilder private readonly GameRelease _release; private readonly ModConcreteBuilder _modBuilder; private readonly bool _configureMembers; + private bool _isBuilding; public MajorRecordBuilder( GameRelease release, @@ -26,14 +31,14 @@ public MajorRecordBuilder( public object Create(object request, ISpecimenContext context) { + if (_isBuilding) return new NoSpecimen(); if (request is SeededRequest seed) { request = seed.Request; } if (request is not Type t) return new NoSpecimen(); - if (!t.IsAbstract && !t.IsInterface - && t.InheritsFrom(typeof(IMajorRecord))) + if (t.InheritsFrom(typeof(IMajorRecord))) { var ret = GetMajorRecord(t, context); if (ret != null) return ret; @@ -44,25 +49,42 @@ public object Create(object request, ISpecimenContext context) private IMajorRecord? GetMajorRecord(Type t, ISpecimenContext context) { - if (_modBuilder.LastCreatedConcreteMod == null) return null; - var ret = MajorRecordInstantiator.Activator(_modBuilder.LastCreatedConcreteMod.GetNextFormKey(), _release, t); + FormKey formKey = _modBuilder.LastCreatedConcreteMod?.GetNextFormKey() ?? context.Create(); + IMajorRecordInternal? ret; + if (t.IsInterface + && MetaInterfaceMapping.Instance.TryGetRegistrationsForInterface(_release.ToCategory(), t, out var regis) + && regis.Registrations.Count > 0) + { + ret = MajorRecordInstantiator.Activator(formKey, _release, regis.Registrations.First().ClassType) as IMajorRecordInternal; + } + else if (!t.IsAbstract) + { + ret = MajorRecordInstantiator.Activator(formKey, _release, t) as IMajorRecordInternal; + } + else + { + return null; + } + + if (ret == null) return null; if (_configureMembers) { FillAllProperties(context, ret, keepArraySizes: true); } - ModifyMajorRecordFields(ret); + ModifyMajorRecordFields(ret, formKey); - var group = _modBuilder.LastCreatedConcreteMod.TryGetTopLevelGroup(t); + var group = _modBuilder.LastCreatedConcreteMod?.TryGetTopLevelGroup(t); group?.AddUntyped(ret); return ret; } - private static void ModifyMajorRecordFields(IMajorRecord rec) + private static void ModifyMajorRecordFields(IMajorRecordInternal rec, FormKey formKey) { rec.IsCompressed = false; rec.IsDeleted = false; + rec.FormKey = formKey; } public static void FillAllProperties(ISpecimenContext context, object item, bool keepArraySizes = false) @@ -145,9 +167,9 @@ public static void FillAllProperties(ISpecimenContext context, object item, bool var subItem = Activator.CreateInstance(type); if (subItem == null) return null; FillAllProperties(context, subItem, keepArraySizes: keepArraySizes); - if (subItem is IMajorRecord majRec) + if (subItem is IMajorRecordInternal majRec) { - ModifyMajorRecordFields(majRec); + ModifyMajorRecordFields(majRec, majRec.FormKey); } return subItem; } diff --git a/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs b/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs index a479cffd3..dee888521 100644 --- a/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs +++ b/Mutagen.Bethesda.UnitTests/AutoData/MajorRecordBuilderTests.cs @@ -1,4 +1,5 @@ using FluentAssertions; +using Mutagen.Bethesda.Plugins; using Mutagen.Bethesda.Skyrim; using Mutagen.Bethesda.Testing.AutoData; using Xunit; @@ -71,4 +72,25 @@ public void WeaponDataSubArray( weapon.Data.Should().NotBeNull(); weapon.Data!.Unknown3.Length.Should().Be(12); } + + [Theory] + [MutagenModAutoData(ConfigureMembers: true)] + public void IPlacedWithMod( + SkyrimMod mod, + IPlaced placed) + { + placed.FormKey.ModKey.Should().Be(mod.ModKey); + placed.IsCompressed.Should().BeFalse(); + placed.IsDeleted.Should().BeFalse(); + } + + [Theory] + [MutagenModAutoData(ConfigureMembers: true)] + public void IPlacedNoMod( + IPlaced placed) + { + placed.FormKey.Should().NotBe(FormKey.Null); + placed.IsCompressed.Should().BeFalse(); + placed.IsDeleted.Should().BeFalse(); + } } \ No newline at end of file From 1c6f420ee71dbf50581691cbf1ee42276d0ba504 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Apr 2023 20:10:21 -0500 Subject: [PATCH 018/135] NavigationMeshData.Parent default value --- .../Records/Major Records/NavigationMeshData.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/NavigationMeshData.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/NavigationMeshData.cs index 2fab8618a..7627d9f2c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/NavigationMeshData.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/NavigationMeshData.cs @@ -8,6 +8,14 @@ namespace Mutagen.Bethesda.Skyrim; +partial class NavigationMeshData +{ + partial void CustomCtor() + { + Parent = new CellNavmeshParent(); + } +} + partial class NavigationMeshDataBinaryCreateTranslation { public static partial void FillBinaryCoverTrianglesLogicCustom(MutagenFrame frame, INavigationMeshData item) From 4b7054d89ce06ed253ff1e0fc4caae054b418d7c Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Apr 2023 20:45:14 -0500 Subject: [PATCH 019/135] Improved fallback handling for bytes after breaks --- .../Common Subrecords/EnableParent_Generated.cs | 2 +- .../FurnitureMarkerParameters_Generated.cs | 2 +- .../Binary/ByteArrayBinaryTranslationGeneration.cs | 11 ++++++++++- .../Common Subrecords/EnableParent_Generated.cs | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Mutagen.Bethesda.Fallout4/Records/Common Subrecords/EnableParent_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Common Subrecords/EnableParent_Generated.cs index b4a776162..97242e813 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Common Subrecords/EnableParent_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Common Subrecords/EnableParent_Generated.cs @@ -1263,7 +1263,7 @@ void IBinaryItem.WriteToBinary( public EnableParent.VersioningBreaks Versioning { get; private set; } public IFormLinkGetter Reference => new FormLink(FormKey.Factory(_package.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(_structData.Span.Slice(0x0, 0x4)))); public EnableParent.Flag Flags => _structData.Span.Length <= 0x4 ? default : (EnableParent.Flag)_structData.Span.Slice(0x4, 0x1)[0]; - public ReadOnlyMemorySlice Unknown => _structData.Span.Slice(0x5, 0x3).ToArray(); + public ReadOnlyMemorySlice Unknown => _structData.Span.Length <= 0x5 ? UtilityTranslation.Zeros.Slice(3) : _structData.Span.Slice(0x5, 0x3).ToArray(); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs index 66aaed8ec..461c82b73 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/FurnitureMarkerParameters_Generated.cs @@ -1423,7 +1423,7 @@ void IBinaryItem.WriteToBinary( public Single RotationZ => _structData.Slice(0xC, 0x4).Float() * 57.2958f; public IFormLinkGetter Keyword => _structData.Length <= 0x10 ? FormLink.Null : new FormLink(FormKey.Factory(_package.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(_structData.Span.Slice(0x10, 0x4)))); public Furniture.EntryParameterType EntryTypes => _structData.Span.Length <= 0x14 ? default : (Furniture.EntryParameterType)_structData.Span.Slice(0x14, 0x1)[0]; - public ReadOnlyMemorySlice Unknown => _structData.Span.Slice(0x15, 0x3).ToArray(); + public ReadOnlyMemorySlice Unknown => _structData.Span.Length <= 0x15 ? UtilityTranslation.Zeros.Slice(3) : _structData.Span.Slice(0x15, 0x3).ToArray(); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, diff --git a/Mutagen.Bethesda.Generation/Modules/Binary/ByteArrayBinaryTranslationGeneration.cs b/Mutagen.Bethesda.Generation/Modules/Binary/ByteArrayBinaryTranslationGeneration.cs index ae80e4196..c17768988 100644 --- a/Mutagen.Bethesda.Generation/Modules/Binary/ByteArrayBinaryTranslationGeneration.cs +++ b/Mutagen.Bethesda.Generation/Modules/Binary/ByteArrayBinaryTranslationGeneration.cs @@ -150,6 +150,7 @@ public override async Task GenerateWrapperFields( DataType? dataType = null) { var data = typeGen.CustomData[Constants.DataKey] as MutagenFieldData; + var posStr = dataType == null ? passedLengthAccessor : $"_{typeGen.Name}Location"; switch (data.BinaryOverlayFallback) { case BinaryGenerationType.Normal: @@ -202,7 +203,15 @@ await this.Module.CustomLogic.GenerateForCustomFlagWrapperFields( } else if (data.Length.HasValue) { - sb.AppendLine($"public {typeGen.TypeName(getter: true)}{(typeGen.Nullable ? "?" : null)} {typeGen.Name} => {structDataAccessor}.Span.Slice({passedLengthAccessor ?? "0x0"}, 0x{data.Length.Value:X}).ToArray();"); + // Only support up to 8 with Zeros array + if (data.IsAfterBreak && data.Length.Value < 8) + { + sb.AppendLine($"public {typeGen.TypeName(getter: true)}{(typeGen.Nullable ? "?" : null)} {typeGen.Name} => {structDataAccessor}.Span.Length <= {posStr} ? UtilityTranslation.Zeros.Slice({data.Length}) : {structDataAccessor}.Span.Slice({passedLengthAccessor ?? "0x0"}, 0x{data.Length.Value:X}).ToArray();"); + } + else + { + sb.AppendLine($"public {typeGen.TypeName(getter: true)}{(typeGen.Nullable ? "?" : null)} {typeGen.Name} => {structDataAccessor}.Span.Slice({passedLengthAccessor ?? "0x0"}, 0x{data.Length.Value:X}).ToArray();"); + } } else { diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/EnableParent_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/EnableParent_Generated.cs index 8157c48c2..0ff37db37 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/EnableParent_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/EnableParent_Generated.cs @@ -1263,7 +1263,7 @@ void IBinaryItem.WriteToBinary( public EnableParent.VersioningBreaks Versioning { get; private set; } public IFormLinkGetter Reference => new FormLink(FormKey.Factory(_package.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(_structData.Span.Slice(0x0, 0x4)))); public EnableParent.Flag Flags => _structData.Span.Length <= 0x4 ? default : (EnableParent.Flag)_structData.Span.Slice(0x4, 0x1)[0]; - public ReadOnlyMemorySlice Unknown => _structData.Span.Slice(0x5, 0x3).ToArray(); + public ReadOnlyMemorySlice Unknown => _structData.Span.Length <= 0x5 ? UtilityTranslation.Zeros.Slice(3) : _structData.Span.Slice(0x5, 0x3).ToArray(); partial void CustomFactoryEnd( OverlayStream stream, int finalPos, From 88f318736d8be32193b2aff54cc960b1fd8209c1 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 23 Apr 2023 13:45:36 -0500 Subject: [PATCH 020/135] Default value for LocationTargetRadius.Target --- .../Records/Common Subrecords/LocationTargetRadius.cs | 2 +- .../Records/Common Subrecords/LocationTargetRadius.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mutagen.Bethesda.Fallout4/Records/Common Subrecords/LocationTargetRadius.cs b/Mutagen.Bethesda.Fallout4/Records/Common Subrecords/LocationTargetRadius.cs index 294ca45b2..e0517e2ee 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Common Subrecords/LocationTargetRadius.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Common Subrecords/LocationTargetRadius.cs @@ -6,7 +6,7 @@ namespace Mutagen.Bethesda.Fallout4; public partial class LocationTargetRadius { - public ALocationTarget Target { get; set; } = null!; + public ALocationTarget Target { get; set; } = new LocationFallback(); [DebuggerBrowsable(DebuggerBrowsableState.Never)] IALocationTargetGetter ILocationTargetRadiusGetter.Target => Target; diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/LocationTargetRadius.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/LocationTargetRadius.cs index d26e65066..c40b1b5cc 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/LocationTargetRadius.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/LocationTargetRadius.cs @@ -7,7 +7,7 @@ namespace Mutagen.Bethesda.Skyrim; public partial class LocationTargetRadius { - public ALocationTarget Target { get; set; } = null!; + public ALocationTarget Target { get; set; } = new LocationFallback(); [DebuggerBrowsable(DebuggerBrowsableState.Never)] IALocationTargetGetter ILocationTargetRadiusGetter.Target => Target; From c864d71fd0de1172f330fcf566132d29643493c9 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Apr 2023 16:06:17 -0500 Subject: [PATCH 021/135] ImmutableDictionary add usage threading bugfixes --- .../Plugins/Utility/MajorRecordInstantiator.cs | 7 ++----- .../Plugins/Utility/RecordTypeInfoCacheReader.cs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Utility/MajorRecordInstantiator.cs b/Mutagen.Bethesda.Core/Plugins/Utility/MajorRecordInstantiator.cs index 4eb1d1ebb..00ae74537 100644 --- a/Mutagen.Bethesda.Core/Plugins/Utility/MajorRecordInstantiator.cs +++ b/Mutagen.Bethesda.Core/Plugins/Utility/MajorRecordInstantiator.cs @@ -64,11 +64,8 @@ public static IMajorRecord Activator(FormKey formKey, GameRelease release, Type if (!_activators.TryGetValue(regis.ClassType, out var activator)) { - lock (_activators) - { - activator = GetActivatorFor(regis.ClassType); - _activators = _activators.Add(regis.ClassType, activator); - } + activator = GetActivatorFor(regis.ClassType); + _activators = _activators.SetItem(regis.ClassType, activator); } return activator(formKey, release); diff --git a/Mutagen.Bethesda.Core/Plugins/Utility/RecordTypeInfoCacheReader.cs b/Mutagen.Bethesda.Core/Plugins/Utility/RecordTypeInfoCacheReader.cs index a5cdd2b09..bc9a2b7a4 100644 --- a/Mutagen.Bethesda.Core/Plugins/Utility/RecordTypeInfoCacheReader.cs +++ b/Mutagen.Bethesda.Core/Plugins/Utility/RecordTypeInfoCacheReader.cs @@ -50,7 +50,7 @@ private CacheItem GetCacheItem() interestingTypes: PluginUtilityTranslation.GetRecordType())); cache = new(locs.FormKeys.ToList(), locs.FormKeys.ToHashSet()); - _cachedLocs = _cachedLocs.Add(typeof(T), cache); + _cachedLocs = _cachedLocs.SetItem(typeof(T), cache); return cache; } } \ No newline at end of file From f0362c8b9078cc93c8f542e0951c9d0ceb4fbf02 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 2 May 2023 20:26:38 -0500 Subject: [PATCH 022/135] nuget bump --- Directory.Packages.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index e52faa304..c13617958 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -39,16 +39,16 @@ - 2.56.0.1-dev + 2.57.0.1-dev - 2.56.0.1-dev + 2.57.0.1-dev - 2.56.0.1-dev + 2.57.0.1-dev - 2.56.0.1-dev + 2.57.0.1-dev From 915f093f51ff3f4696df28ef703b231131b698ce Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 2 May 2023 20:27:15 -0500 Subject: [PATCH 023/135] MkDocs tests --- .github/workflows/DeployMkDocs.yml | 33 +++++++++++++++ mkdocs.yml | 67 ++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/DeployMkDocs.yml create mode 100644 mkdocs.yml diff --git a/.github/workflows/DeployMkDocs.yml b/.github/workflows/DeployMkDocs.yml new file mode 100644 index 000000000..1f723cc89 --- /dev/null +++ b/.github/workflows/DeployMkDocs.yml @@ -0,0 +1,33 @@ +name: DeployMkDocs + +# Controls when the action will run. +on: + # Triggers the workflow on push on the master branch + push: + branches: [ dev ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout Branch + uses: actions/checkout@v2 + + # Deploy MkDocs + - name: Deploy MkDocs + # You may pin to the exact commit or the version. + # uses: mhausenblas/mkdocs-deploy-gh-pages@66340182cb2a1a63f8a3783e3e2146b7d151a0bb + uses: mhausenblas/mkdocs-deploy-gh-pages@master + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + REQUIREMENTS: ./docs/requirements.txt diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 000000000..a781d7734 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,67 @@ +site_name: Mutagen Documentation +site_url: https://mutagen-modding.github.io/Mutagen/ + +repo_name: Mutagen-Modding/Mutagen +repo_url: https://github.com/Mutagen-Modding/Mutagen + +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/Mutagen-Modding + +markdown_extensions: + - admonition + - tables + - pymdownx.details + - pymdownx.highlight + - pymdownx.superfences + - pymdownx.tasklist + - def_list + - meta + - md_in_html + - attr_list + - footnotes + - pymdownx.tabbed: + alternate_style: true + - pymdownx.emoji: + emoji_index: !!python/name:materialx.emoji.twemoji + emoji_generator: !!python/name:materialx.emoji.to_svg + +extra_css: + - Custom/Stylesheets/extra.css + +plugins: + - search + +theme: + name: material + palette: + primary: red + accent: red + scheme: slate + features: + - navigation.instant + +nav: + - Home: Home.md + - Big Cheat Sheet: Big-Cheat-Sheet.md + - Plugin Record Suite + - ModKey, FormKey, FormLink: ModKey,-FormKey,-FormLink.md + - Generated Classes: Generated-Classes.md + - Binary Importing: Binary-Importing.md + - Binary Overlay: Binary-Overlay.md + - Interfaces (Aspect/Link/Getters): Interfaces-(Aspect-Link-Getters).md + - Copy Functionality: Copy-Functionality.md + - Binary Exporting: Binary-Exporting.md + - Equality Checks: Equality-Checks.md + - Translation Masks: Translation-Masks.md + - Flags and Enums: Flags-and-Enums.md + - Asset Links: AssetLink.md + - Binary Format Complexity Abstraction: Binary-Format-Complexity-Abstraction.md + - Create, Duplicate, and Override: Create,-Duplicate,-and-Override.md + - Abstract Subclassing: Abstract-Subclassing.md + - Printing: Printing.md + - Typical Mod Construction and Importing: Typical-Mod-Construction-and-Importing.md + - Environment: Environment.md + - Environment Construction: Environment-Construction.md + - Game Locations: Game-Locations.md From 4f277f5d69da8be849ece65d1ee4d2ac83223d85 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 2 May 2023 20:55:27 -0500 Subject: [PATCH 024/135] mkdocs --- mkdocs.yml | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index a781d7734..b140daccb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -46,22 +46,21 @@ nav: - Home: Home.md - Big Cheat Sheet: Big-Cheat-Sheet.md - Plugin Record Suite - - ModKey, FormKey, FormLink: ModKey,-FormKey,-FormLink.md - - Generated Classes: Generated-Classes.md - - Binary Importing: Binary-Importing.md - - Binary Overlay: Binary-Overlay.md - - Interfaces (Aspect/Link/Getters): Interfaces-(Aspect-Link-Getters).md - - Copy Functionality: Copy-Functionality.md - - Binary Exporting: Binary-Exporting.md - - Equality Checks: Equality-Checks.md - - Translation Masks: Translation-Masks.md - - Flags and Enums: Flags-and-Enums.md - - Asset Links: AssetLink.md - - Binary Format Complexity Abstraction: Binary-Format-Complexity-Abstraction.md - - Create, Duplicate, and Override: Create,-Duplicate,-and-Override.md - - Abstract Subclassing: Abstract-Subclassing.md - - Printing: Printing.md - - Typical Mod Construction and Importing: Typical-Mod-Construction-and-Importing.md + - Generated Classes: Generated-Classes.md + - Binary Importing: Binary-Importing.md + - Binary Overlay: Binary-Overlay.md + - Interfaces (Aspect/Link/Getters): Interfaces-(Aspect-Link-Getters).md + - Copy Functionality: Copy-Functionality.md + - Binary Exporting: Binary-Exporting.md + - Equality Checks: Equality-Checks.md + - Translation Masks: Translation-Masks.md + - Flags and Enums: Flags-and-Enums.md + - Asset Links: AssetLink.md + - Binary Format Complexity Abstraction: Binary-Format-Complexity-Abstraction.md + - Create, Duplicate, and Override: Create,-Duplicate,-and-Override.md + - Abstract Subclassing: Abstract-Subclassing.md + - Printing: Printing.md + - Typical Mod Construction and Importing: Typical-Mod-Construction-and-Importing.md - Environment: Environment.md - Environment Construction: Environment-Construction.md - - Game Locations: Game-Locations.md + - Game Locations: Game-Locations.md From 0101ffb84fdfd5a11569d3c44644f329b0d83006 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 2 May 2023 21:18:23 -0500 Subject: [PATCH 025/135] mkdocs --- mkdocs.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index b140daccb..f2b7092fb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -45,7 +45,7 @@ theme: nav: - Home: Home.md - Big Cheat Sheet: Big-Cheat-Sheet.md - - Plugin Record Suite + - Plugin Record Suite: - Generated Classes: Generated-Classes.md - Binary Importing: Binary-Importing.md - Binary Overlay: Binary-Overlay.md @@ -61,6 +61,5 @@ nav: - Abstract Subclassing: Abstract-Subclassing.md - Printing: Printing.md - Typical Mod Construction and Importing: Typical-Mod-Construction-and-Importing.md - - Environment: Environment.md - - Environment Construction: Environment-Construction.md - - Game Locations: Game-Locations.md + +index: Pages/index.md \ No newline at end of file From 24b6991b558df9e267281556a9dead46343a2474 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 4 May 2023 23:50:09 -0500 Subject: [PATCH 026/135] Lib updates --- Mutagen.Bethesda.Core/Plugins/Binary/Overlay/OverlayStream.cs | 2 +- .../Plugins/Binary/Streams/MutagenMemoryReadStream.cs | 3 ++- .../Records/Major Records/QuestAdapter.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter.cs | 2 +- Mutagen.Bethesda.Tests/Benchmarks/StringParsing.cs | 2 +- Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Binary/Overlay/OverlayStream.cs b/Mutagen.Bethesda.Core/Plugins/Binary/Overlay/OverlayStream.cs index 8043a3d2d..f53607a2d 100644 --- a/Mutagen.Bethesda.Core/Plugins/Binary/Overlay/OverlayStream.cs +++ b/Mutagen.Bethesda.Core/Plugins/Binary/Overlay/OverlayStream.cs @@ -27,7 +27,7 @@ long IBinaryReadStream.Position public OverlayStream(ReadOnlyMemorySlice data, ParsingBundle constants) { Data = data; - _readStream = new BinaryMemoryReadStream(data); + _readStream = BinaryMemoryReadStream.LittleEndian(data); MetaData = constants; } diff --git a/Mutagen.Bethesda.Core/Plugins/Binary/Streams/MutagenMemoryReadStream.cs b/Mutagen.Bethesda.Core/Plugins/Binary/Streams/MutagenMemoryReadStream.cs index 6b034c796..99db83db7 100644 --- a/Mutagen.Bethesda.Core/Plugins/Binary/Streams/MutagenMemoryReadStream.cs +++ b/Mutagen.Bethesda.Core/Plugins/Binary/Streams/MutagenMemoryReadStream.cs @@ -1,11 +1,12 @@ using Noggog; +using Noggog.Streams.Binary; namespace Mutagen.Bethesda.Plugins.Binary.Streams; /// /// A class that wraps an array or span directly with Mutagen-specific binary reading functionality /// -public sealed class MutagenMemoryReadStream : BinaryMemoryReadStream, IMutagenReadStream +public sealed class MutagenMemoryReadStream : LittleEndianBinaryMemoryReadStream, IMutagenReadStream { /// public long OffsetReference { get; } diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/QuestAdapter.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/QuestAdapter.cs index 31e6331b5..1fe10fc31 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/QuestAdapter.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/QuestAdapter.cs @@ -99,7 +99,7 @@ partial void CustomFactoryEnd( { var frame = new MutagenFrame( new MutagenInterfaceReadStream( - new BinaryMemoryReadStream(_structData.Slice(ScriptsEndingPos + 1)), + BinaryMemoryReadStream.LittleEndian(_structData.Slice(ScriptsEndingPos + 1)), _package.MetaData)); if (frame.Complete) return; var count = frame.ReadUInt16(); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter.cs index 417a161c0..bf39d1411 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter.cs @@ -97,7 +97,7 @@ partial void CustomFileNameEndPos() if (_structData.Length <= this.ScriptsEndingPos) return; var frame = new MutagenFrame( new MutagenInterfaceReadStream( - new BinaryMemoryReadStream(_structData.Slice(ScriptsEndingPos)), + BinaryMemoryReadStream.LittleEndian(_structData.Slice(ScriptsEndingPos)), _package.MetaData)); // Skip unknown frame.Position += 1; diff --git a/Mutagen.Bethesda.Tests/Benchmarks/StringParsing.cs b/Mutagen.Bethesda.Tests/Benchmarks/StringParsing.cs index fb23c0458..458bcdf0d 100644 --- a/Mutagen.Bethesda.Tests/Benchmarks/StringParsing.cs +++ b/Mutagen.Bethesda.Tests/Benchmarks/StringParsing.cs @@ -9,7 +9,7 @@ namespace Mutagen.Bethesda.Tests; public class StringParsing { public static byte[] data = Enumerable.Range(1, 15).Select(i => (byte)i).ToArray(); - public static BinaryMemoryReadStream stream = new(data); + public static BinaryMemoryReadStream stream = BinaryMemoryReadStream.LittleEndian(data); [Benchmark] public string StringCreate() { diff --git a/Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs b/Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs index 3d00742c9..6ef32b37e 100644 --- a/Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs +++ b/Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs @@ -459,7 +459,7 @@ public Test TestPex() public void TestPex(GameRelease release, ReadOnlyMemorySlice bytes) { - var memStream = new BinaryMemoryReadStream(bytes); + var memStream = BinaryMemoryReadStream.LittleEndian(bytes); PexFile.CreateFromStream(memStream, release.ToCategory()); } From 28b21353cff4def8c8b5e2f91f99fe470ede6c16 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 4 May 2023 23:50:46 -0500 Subject: [PATCH 027/135] More docs --- .github/workflows/toc.yml | 19 --- .github/workflows/wiki-copy.yml | 23 ---- docs/Abstract-Subclassing.md | 16 +-- docs/Adding-Required-Resources.md | 12 +- docs/Archives.md | 14 +-- docs/AssetLink.md | 17 --- docs/Big-Cheat-Sheet.md | 32 +---- docs/Binary-Exporting.md | 13 +- docs/Binary-Format-Complexity-Abstraction.md | 20 --- docs/Binary-Importing.md | 12 +- docs/Binary-Overlay.md | 31 +---- docs/Binary-Streams.md | 11 +- docs/Binary-Utility.md | 18 --- docs/C#-Span.md | 14 +-- docs/Copy-Functionality.md | 13 +- docs/Correctness.md | 18 --- docs/Create,-Duplicate,-and-Override.md | 17 +-- docs/Enumerable-Laziness.md | 19 +-- docs/Environment-Construction.md | 19 --- docs/Environment.md | 13 +- docs/Equality-Checks.md | 11 +- docs/Flags-and-Enums.md | 9 -- docs/FormKey-Allocation-and-Persistence.md | 16 --- docs/FormKey-Picker.md | 15 +-- docs/FormLink-vs-FormLinkNullable.md | 9 -- ...rmLinks-Always-Target-Getter-Interfaces.md | 12 +- docs/FormLinks-vs-EditorID-as-Identifiers.md | 24 +--- docs/Game-Locations.md | 16 +-- docs/Getters-Everywhere.md | 16 +-- docs/Header-Structs.md | 24 +--- docs/Home.md | 22 +--- docs/ITPO-Avoidance.md | 11 +- docs/Installing-Visual-Studio.md | 19 +-- docs/Interfaces-(Aspect-Link-Getters).md | 22 ---- docs/Json.md | 10 +- docs/LinkCache---Record-Lookup.md | 15 --- docs/LinkCache.md | 15 +-- docs/Load-Order.md | 21 +--- docs/Low-Level-Examples.md | 10 +- docs/Low-Level-Tools.md | 12 +- docs/ModContexts.md | 15 +-- docs/ModKey,-FormKey,-FormLink.md | 23 ---- docs/ModKey-Picker.md | 15 +-- docs/Modifying-Groups-Being-Iterated.md | 15 +-- docs/Namespaces.md | 16 +-- docs/New-Project-With-Mutagen.md | 10 -- ...Nullability-to-Indicate-Record-Presence.md | 16 +-- docs/Oblivion-Aspect-Interfaces.md | 70 ----------- docs/Oblivion-Link-Interfaces.md | 18 --- docs/Plugin-Record-Suite.md | 12 +- docs/Previous-Override-Iteration.md | 12 +- docs/Printing.md | 11 +- docs/Record-Lookup.md | 12 +- docs/Reflection-Powered-Settings.md | 23 +--- docs/Skyrim-Aspect-Interfaces.md | 119 ------------------ docs/Skyrim-Link-Interfaces.md | 87 ------------- docs/Skyrim-Perks.md | 11 +- docs/Testing-and-Correctness.md | 10 +- docs/Translated-Strings.md | 16 +-- docs/Translation-Masks.md | 18 +-- docs/TryGet-Concepts.md | 16 +-- docs/WPF-Library.md | 12 +- docs/Winning-Overrides.md | 11 +- 63 files changed, 45 insertions(+), 1183 deletions(-) delete mode 100644 .github/workflows/toc.yml delete mode 100644 .github/workflows/wiki-copy.yml diff --git a/.github/workflows/toc.yml b/.github/workflows/toc.yml deleted file mode 100644 index aa118c95f..000000000 --- a/.github/workflows/toc.yml +++ /dev/null @@ -1,19 +0,0 @@ -on: - push: - branches: - - dev - paths: - - 'README.md' - - 'docs/**' -name: TOC Generator -jobs: - generateTOC: - name: TOC Generator - runs-on: ubuntu-latest - steps: - - uses: technote-space/toc-generator@v4.0.0 - with: - TOC_TITLE: | - ## Table Of Contents - GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} - TARGET_PATHS: README.md, docs/**.md, docs/*/**.md \ No newline at end of file diff --git a/.github/workflows/wiki-copy.yml b/.github/workflows/wiki-copy.yml deleted file mode 100644 index 084df9c72..000000000 --- a/.github/workflows/wiki-copy.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Wiki - -on: - push: - branches: [ dev ] - paths: - - 'README.md' - - 'docs/**' - -jobs: - run: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - with: - token: ${{ secrets.ACCESS_TOKEN_WIKI }} - # Additional steps to generate documentation in "Documentation" directory - - name: github-docs-to-wiki - uses: cmbrose/github-docs-to-wiki@v0.24 - with: - githubToken: ${{ secrets.ACCESS_TOKEN_WIKI }} - rootDocsFolder: "docs/" diff --git a/docs/Abstract-Subclassing.md b/docs/Abstract-Subclassing.md index 79514e9f5..f5d032994 100644 --- a/docs/Abstract-Subclassing.md +++ b/docs/Abstract-Subclassing.md @@ -1,17 +1,3 @@ - - -## Table Of Contents - -- [What is Abstract Subclassing](#what-is-abstract-subclassing) -- [Why is it Needed?](#why-is-it-needed) -- [Setting an Abstract Subclass Member](#setting-an-abstract-subclass-member) -- [Reading an Abstract Subclass Member](#reading-an-abstract-subclass-member) -- [Summary](#summary) -- [Other Records with Abstract Subclassing](#other-records-with-abstract-subclassing) -- [Documentation](#documentation) - - - # What is Abstract Subclassing Occasionally records will have an Abstract subobject. @@ -123,4 +109,4 @@ public partial interface IANpcLevel } ``` This helps narrow down which types it can be so you know what to switch on and handle. -- Also, you can sometimes refer to the xmls that define the records, like the ones linked above. \ No newline at end of file +- Also, you can sometimes refer to the xmls that define the records, like the ones linked above. diff --git a/docs/Adding-Required-Resources.md b/docs/Adding-Required-Resources.md index 519bc5d05..d724c2671 100644 --- a/docs/Adding-Required-Resources.md +++ b/docs/Adding-Required-Resources.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [Global Import](#global-import) -- [Non-Global Import](#non-global-import) -- [Work In Progress](#work-in-progress) - - - `Mutagen.WPF` is built with style-less controls. This means the controls are just logic, and you can add your own look exactly how you want it. Typically though a default look is provided, and `Mutagen.WPF` does this as well. It is built on top of [MahApps](https://mahapps.com/), and other reusable libraries. @@ -43,4 +33,4 @@ To import these resources/looks, the easiest way is to modify the `App.xaml` fil You can also add the above ResourceDictionary to specific controls in your WPF app, if you don't want to import/apply them globally to everything. # Work In Progress -These patterns may be adjusted over time, as they don't allow for the easiest customization of color theming and such. As better patterns for exposing more control are discovered, these suggestions might change. \ No newline at end of file +These patterns may be adjusted over time, as they don't allow for the easiest customization of color theming and such. As better patterns for exposing more control are discovered, these suggestions might change. diff --git a/docs/Archives.md b/docs/Archives.md index ebd06d50b..be86b3faa 100644 --- a/docs/Archives.md +++ b/docs/Archives.md @@ -1,15 +1,3 @@ - - -## Table Of Contents - -- [Reading](#reading) - - [Archive Reader](#archive-reader) - - [File Enumeration](#file-enumeration) - - [Folder Lookup](#folder-lookup) -- [Finding Applicable Archives](#finding-applicable-archives) - - - Certain Bethesda files like textures, meshes, and similar assets are often stored in zipped up files with extensions like `.bsa` or `b2a`. Mutagen calls these `Archives` and offers API to read the contents from those. Writing new Archives is not something Mutagen can currently do, but is on the list of features to eventually be added. @@ -45,4 +33,4 @@ if (reader.TryGetFolder("some/sub/folder", out var archiveFolder)) Folders have similar API of looping contained files as an Archive Reader # Finding Applicable Archives -(Todo) \ No newline at end of file +(Todo) diff --git a/docs/AssetLink.md b/docs/AssetLink.md index 0dae842d0..ab382001f 100644 --- a/docs/AssetLink.md +++ b/docs/AssetLink.md @@ -1,20 +1,3 @@ - - -## Table Of Contents - -- [What is an AssetLink](#what-is-an-assetlink) -- [AssetLink Members](#assetlink-members) - - [RawPath](#rawpath) - - [DataRelativePath](#datarelativepath) -- [AssetTypes - AssetLink's Generic Type](#assettypes---assetlinks-generic-type) -- [Asset Enumeration](#asset-enumeration) - - [Typical Usage](#typical-usage) - - [AssetLinkQuery](#assetlinkquery) - - [IAssetLinkCache](#iassetlinkcache) - - [Creating an Asset Link Cache](#creating-an-asset-link-cache) - - - # What is an AssetLink An AssetLink is a strongly typed object wrapping what is normally a `string` subpath pointing to an asset. diff --git a/docs/Big-Cheat-Sheet.md b/docs/Big-Cheat-Sheet.md index 4fb032a7c..8b79d2b65 100644 --- a/docs/Big-Cheat-Sheet.md +++ b/docs/Big-Cheat-Sheet.md @@ -1,33 +1,3 @@ - - -## Table Of Contents - -- [Overview](#overview) - - [Related Reading](#related-reading) - - [Target Game](#target-game) - - [Preparing the Examples](#preparing-the-examples) - - [Missing Namespaces](#missing-namespaces) -- [Construct an Environment](#construct-an-environment) -- [Retrieve a Mod From a Load Order](#retrieve-a-mod-from-a-load-order) -- [Construct a ModKey](#construct-a-modkey) -- [Get List of Masters From A Mod](#get-list-of-masters-from-a-mod) - - [Via MasterReferenceCollection](#via-masterreferencecollection) - - [Via Mod Object](#via-mod-object) -- [Get Access to Record Data](#get-access-to-record-data) -- [Convert FormKey to FormID](#convert-formkey-to-formid) - - [Via MasterReferenceCollection](#via-masterreferencecollection-1) -- [Convert FormKey to FormLink](#convert-formkey-to-formlink) -- [Convert MajorRecord to FormLink](#convert-majorrecord-to-formlink) -- [Iterate Winning Overrides](#iterate-winning-overrides) -- [Iterate Records' Original Definitions](#iterate-records-original-definitions) -- [Check If A FormLink Points to a Specific Record](#check-if-a-formlink-points-to-a-specific-record) - - [By FormKey](#by-formkey) - - [By FormLink](#by-formlink) - - [Using FormKey Mapping Library](#using-formkey-mapping-library) -- [Duplicate a Record](#duplicate-a-record) - - - # Overview A massive list of code snippets without much contextual explanation. @@ -224,4 +194,4 @@ var dup3 = someMod.Npcs.DuplicateInAsNewRecord(someEditorId); ``` [Read more about duplication](https://github.com/Mutagen-Modding/Mutagen/wiki/Create%2C-Duplicate%2C-and-Override#by-duplication) -[Read more about FormKey Persistence](https://github.com/Mutagen-Modding/Mutagen/wiki/FormKey-Allocation-and-Persistence) \ No newline at end of file +[Read more about FormKey Persistence](https://github.com/Mutagen-Modding/Mutagen/wiki/FormKey-Allocation-and-Persistence) diff --git a/docs/Binary-Exporting.md b/docs/Binary-Exporting.md index 90fa97e2d..60b942567 100644 --- a/docs/Binary-Exporting.md +++ b/docs/Binary-Exporting.md @@ -1,14 +1,3 @@ - - -## Table Of Contents - -- [Typical Export](#typical-export) - - [Master Content](#master-content) - - [Master Ordering](#master-ordering) -- [Master Sync Options](#master-sync-options) - - - # Typical Export A basic mod write call is pretty straightforward: ``` @@ -35,4 +24,4 @@ Mutagen automatically handles the logic to determine which masters are required. Typically, the order that masters are written -# Master Sync Options \ No newline at end of file +# Master Sync Options diff --git a/docs/Binary-Format-Complexity-Abstraction.md b/docs/Binary-Format-Complexity-Abstraction.md index 1a4effdb4..0f0725dc1 100644 --- a/docs/Binary-Format-Complexity-Abstraction.md +++ b/docs/Binary-Format-Complexity-Abstraction.md @@ -1,23 +1,3 @@ - - -## Table Of Contents - -- [FormKeys and FormLinks](#formkeys-and-formlinks) -- [Record Types](#record-types) - - [Four Character Headers](#four-character-headers) - - [Alternate Headers](#alternate-headers) -- [List Mechanics](#list-mechanics) - - [Item Storage](#item-storage) - - [Count Subrecords](#count-subrecords) -- [Global/Gamesetting types](#globalgamesetting-types) -- [Markers](#markers) -- [PathGrid Point Zipping](#pathgrid-point-zipping) -- [Multiple Flag Consolidation](#multiple-flag-consolidation) -- [GenderedItem](#gendereditem) -- [Pseudo Enum Dictionaries](#pseudo-enum-dictionaries) - - - Bethesda's binary format contains a lot implementation complexities that are unrelated to the actual content of the records. A lot of times the exposure of these details are a source of confusion, and don't add much upside in the way of flexibility or power into the hands of the user. Mutagen attempts to abstract these complexities away so that the end user is dealing with the distilled record content more directly, rather than wading through the gritty specifics that only matter in the context of their binary format on disk. # FormKeys and FormLinks diff --git a/docs/Binary-Importing.md b/docs/Binary-Importing.md index eb2eb092c..26701a65f 100644 --- a/docs/Binary-Importing.md +++ b/docs/Binary-Importing.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [Basic Importing](#basic-importing) -- [Group Masks](#group-masks) -- [Notes](#notes) - - - All Mods are generated with the ability to create themselves from their binary format. ## Basic Importing ```cs @@ -31,4 +21,4 @@ var mod = OblivionMod.CreateFromBinary( This import call will only process and import Potions and NPCs. ## Notes -While these basic import features sounds fundamental, they are overshadowed and depreciated somewhat by the [[Binary Overlay]] concepts. \ No newline at end of file +While these basic import features sounds fundamental, they are overshadowed and depreciated somewhat by the [[Binary Overlay]] concepts. diff --git a/docs/Binary-Overlay.md b/docs/Binary-Overlay.md index 0eda6f277..61e33a7ec 100644 --- a/docs/Binary-Overlay.md +++ b/docs/Binary-Overlay.md @@ -1,32 +1,3 @@ - - -## Table Of Contents - -- [Reasoning for an Alternate Pattern](#reasoning-for-an-alternate-pattern) - - [Memory Usage is Frontloaded](#memory-usage-is-frontloaded) - - [User Must Specify Interest](#user-must-specify-interest) - - [All Records are Parsed (for Interest Groups)](#all-records-are-parsed-for-interest-groups) -- [Introduction to Overlay Concepts](#introduction-to-overlay-concepts) - - [It returns a `Getter` interface.](#it-returns-a-getter-interface) - - [Requires an open Stream](#requires-an-open-stream) - - [No Up Front Parsing Work](#no-up-front-parsing-work) - - [No Persistent References to Records or Memory](#no-persistent-references-to-records-or-memory) -- [Concrete Example](#concrete-example) - - [What work is actually done by this code?](#what-work-is-actually-done-by-this-code) - - [What are some things that were not done?](#what-are-some-things-that-were-not-done) -- [Summary Overview](#summary-overview) - - [Pros](#pros) - - [Cons:](#cons) -- [Best Practices](#best-practices) - - [Example of Misuse](#example-of-misuse) - - [Save to Variable](#save-to-variable) - - [Group Access Special Case](#group-access-special-case) - - [Pattern Matching](#pattern-matching) - - [Safe Navigation Operator](#safe-navigation-operator) - - [Null Coalescing Operator](#null-coalescing-operator) - - - Binary Overlays are an alternative to the more simplistic [[Binary Importing]] concepts. # Reasoning for an Alternate Pattern @@ -187,4 +158,4 @@ Another common operator related to potentially null items is the Null Coalescing ```cs System.Console.WriteLine($"NPC's EditorID was {npcOverlay.EditorID ?? "UNKNOWN"}"); ``` -This will access and return EditorID, unless it is null, at which point "UNKNOWN" will be returned and printed. It also has the upside of only accessing the property once before calling the function, and so is proper practice when accessing Overlay members that could be null. \ No newline at end of file +This will access and return EditorID, unless it is null, at which point "UNKNOWN" will be returned and printed. It also has the upside of only accessing the property once before calling the function, and so is proper practice when accessing Overlay members that could be null. diff --git a/docs/Binary-Streams.md b/docs/Binary-Streams.md index 5c5dc0b6a..f9e285247 100644 --- a/docs/Binary-Streams.md +++ b/docs/Binary-Streams.md @@ -1,16 +1,7 @@ - - -## Table Of Contents - -- [BinaryReadStream](#binaryreadstream) -- [MutagenBinaryReadStream](#mutagenbinaryreadstream) - - - # BinaryReadStream `IBinaryReadStream` is an interface that exposes binary extraction from a stream, with `BinaryReadStream` being a basic implementation. The interface offers calls to read `int`, `short`, `uint`, `double`, `byte[]`, and even newer concepts such as `ReadOnlySpan` and `ReadOnlyMemorySlice`. # MutagenBinaryReadStream This is just a further extension on BinaryReadStream, offering additionally: - A [[HeaderConstants]] object for reference when alignment is important -- An offset member, to help calculate position relative to a source file, if the MutagenBinaryReadStream happens to be a substream on only a slice of data. \ No newline at end of file +- An offset member, to help calculate position relative to a source file, if the MutagenBinaryReadStream happens to be a substream on only a slice of data. diff --git a/docs/Binary-Utility.md b/docs/Binary-Utility.md index 524254bc0..5a7ced91a 100644 --- a/docs/Binary-Utility.md +++ b/docs/Binary-Utility.md @@ -1,21 +1,3 @@ - - -## Table Of Contents - -- [BinaryStringUtility](#binarystringutility) - - [ToZString](#tozstring) - - [ProcessWholeToZString](#processwholetozstring) - - [ParseUnknownLengthString](#parseunknownlengthstring) -- [SubRecord Iteration and Location](#subrecord-iteration-and-location) - - [EnumerateSubrecords](#enumeratesubrecords) - - [TryFindFirstSubrecord](#tryfindfirstsubrecord) - - [FindFirstSubrecords](#findfirstsubrecords) - - [CompileFirstSubrecordLocations](#compilefirstsubrecordlocations) -- [RecordLocator](#recordlocator) -- [Decompression](#decompression) - - - # BinaryStringUtility Bethesda games store their strings on disk in a single byte format, with a null terminator. There are some convenience parsing functions inside `BinaryStringUtility` to convert these to C# strings. diff --git a/docs/C#-Span.md b/docs/C#-Span.md index 97f619df4..37b0b447b 100644 --- a/docs/C#-Span.md +++ b/docs/C#-Span.md @@ -1,15 +1,3 @@ - - -## Table Of Contents - -- [Spans are Sub-Sections of Arrays](#spans-are-sub-sections-of-arrays) -- [Faster Substring Alternative](#faster-substring-alternative) -- [Interpreting Data as Another Type](#interpreting-data-as-another-type) -- [Parsing Data from Span](#parsing-data-from-span) -- [MemorySlice Alternative for Non-Stack Usage](#memoryslice-alternative-for-non-stack-usage) - - - `Span`s are not a Mutagen concept, but rather a general C# concept. However, since they are used extensively by Mutagen's parsing systems and they are a newer concept just recently added to C#, it will be covered to some extent here. If you are more interested in Mutagen-specific concepts, you can skip this section. @@ -115,4 +103,4 @@ str = BinaryStringUtility.ToZString(span.Slice(11, 23)); # MemorySlice Alternative for Non-Stack Usage One of the major downsides of `Span` is that it is a `ref struct` which can only "live" on the stack. This means it cannot be a member of a class, or even be associated with async/await concepts, among other things. -In this case, `MemorySlice` is an alternative concept (subsection of an array) that can live outside of the stack. \ No newline at end of file +In this case, `MemorySlice` is an alternative concept (subsection of an array) that can live outside of the stack. diff --git a/docs/Copy-Functionality.md b/docs/Copy-Functionality.md index 112b15ce3..61df4daa0 100644 --- a/docs/Copy-Functionality.md +++ b/docs/Copy-Functionality.md @@ -1,14 +1,3 @@ - - -## Table Of Contents - -- [DeepCopy](#deepcopy) -- [DeepCopyIn](#deepcopyin) -- [Translation Masks](#translation-masks) -- [CopyInFrom[Binary]](#copyinfrombinary) - - - Mutagen provides functionality for copying in data to an already existing object. # DeepCopy @@ -68,4 +57,4 @@ mod.CopyInFromBinary( }); ``` -This code will replace the `mod` object's NPC Group's contents with the NPC contents from the file on disk. \ No newline at end of file +This code will replace the `mod` object's NPC Group's contents with the NPC contents from the file on disk. diff --git a/docs/Correctness.md b/docs/Correctness.md index 950983348..4b9d928b7 100644 --- a/docs/Correctness.md +++ b/docs/Correctness.md @@ -1,21 +1,3 @@ - - -## Table Of Contents - -- [Passthrough Testing](#passthrough-testing) - - [Definition](#definition) - - [Pre-Processing](#pre-processing) - - [Decompression](#decompression) - - [Float Standardization](#float-standardization) - - [Subrecord Order Standardization](#subrecord-order-standardization) - - [Strings File Key Reindexing](#strings-file-key-reindexing) - - [Other Minor Inconsistencies](#other-minor-inconsistencies) - - [Running](#running) -- [Helper UI](#helper-ui) -- [More References](#more-references) - - - # Passthrough Testing Besides general unit tests for edge-case prone code section, Mutagen has a passthrough test suite that it uses to help confirm correctness. ## Definition diff --git a/docs/Create,-Duplicate,-and-Override.md b/docs/Create,-Duplicate,-and-Override.md index 00c45ce51..162666bb8 100644 --- a/docs/Create,-Duplicate,-and-Override.md +++ b/docs/Create,-Duplicate,-and-Override.md @@ -1,18 +1,3 @@ - - -## Table Of Contents - -- [Create New Records](#create-new-records) - - [By Constructor](#by-constructor) - - [From a Mod's Group](#from-a-mods-group) - - [By Duplication](#by-duplication) -- [Overriding Records](#overriding-records) - - [GetOrAddAsOverride](#getoraddasoverride) - - [Deep Copy Then Insert](#deep-copy-then-insert) - - [Nested Records](#nested-records) - - - # Create New Records New records can be constructed in a few ways. Note that a record's FormKey is required during construction, and immutable. If you want to change the FormKey of a record, a new one should be made. Any desired fields can be brought over via [CopyIn](Copy-Functionality#deepcopyin) mechanics. ## By Constructor @@ -74,4 +59,4 @@ outputMod.Npcs.Add(npcCopy); This strategy works well if you might change your mind and not add the copied record to the outgoing mod. It lets you get a mutable version of the record without adding it to your outgoing mod until you are certain you want to include it. ## Nested Records -Some records like Placed Objects and Cells are often nested underneath other records. This makes it harder to follow the above patterns. For these you will want to make use of the [[ModContexts]] concepts. \ No newline at end of file +Some records like Placed Objects and Cells are often nested underneath other records. This makes it harder to follow the above patterns. For these you will want to make use of the [[ModContexts]] concepts. diff --git a/docs/Enumerable-Laziness.md b/docs/Enumerable-Laziness.md index fb89f306c..706ea4ee6 100644 --- a/docs/Enumerable-Laziness.md +++ b/docs/Enumerable-Laziness.md @@ -1,20 +1,3 @@ - - -## Table Of Contents - -- [Setup](#setup) -- [Problem](#problem) - - [What's the problem?](#whats-the-problem) - - [What does this mean?](#what-does-this-mean) - - [Why does this matter?](#why-does-this-matter) -- [Solution](#solution) - - [Small Metaphor](#small-metaphor) - - [The Fix](#the-fix) -- [Why is Linq Deferred/Lazy?](#why-is-linq-deferredlazy) -- [Conclusion](#conclusion) - - - # Setup One common pitfall related to Enumerable/LINQ usage. Take this basic Synthesis patcher example: ```cs @@ -172,4 +155,4 @@ If a Linq statement is going to be reused, consider calling a `ToArray` to do th If the Linq statement only has one user, it's better to leave as a Deferred Linq statement, so that that one user can choose to stop processing early. -If you're unsure, it is usually better to use the `ToArray`. Doing unnecessary work once is a better gamble than potentially doing the same work 1000x. \ No newline at end of file +If you're unsure, it is usually better to use the `ToArray`. Doing unnecessary work once is a better gamble than potentially doing the same work 1000x. diff --git a/docs/Environment-Construction.md b/docs/Environment-Construction.md index 2519d4f85..c1c946315 100644 --- a/docs/Environment-Construction.md +++ b/docs/Environment-Construction.md @@ -1,22 +1,3 @@ - - -## Table Of Contents - -- [Single Game Category Construction](#single-game-category-construction) - - [Synthesis Usage](#synthesis-usage) -- [Unknown Game Construction](#unknown-game-construction) -- [Game Environment Builder](#game-environment-builder) - - [Problem](#problem) - - [Builder Pattern](#builder-pattern) - - [Transform Load Order](#transform-load-order) - - [TransformLoadOrderListings](#transformloadorderlistings) - - [TransformModListings](#transformmodlistings) - - [WithOutputMod](#withoutputmod) - - [WithTargetDataFolder](#withtargetdatafolder) - - [WithLoadOrder](#withloadorder) - - - # Single Game Category Construction As mentioned in the [overview section](Environment), the typical way to construct an environment if you know the game you want to target is: ```cs diff --git a/docs/Environment.md b/docs/Environment.md index cee68f73f..f8e622044 100644 --- a/docs/Environment.md +++ b/docs/Environment.md @@ -1,14 +1,3 @@ - - -## Table Of Contents - -- [Typical Single Game Usage](#typical-single-game-usage) -- [GameEnvironmentState](#gameenvironmentstate) -- [Advanced Usage](#advanced-usage) -- [Synthesis Usage](#synthesis-usage) - - - When writing a program that is going to interact with Bethesda mods, there are several things you typically want to interact with. Mutagen comes with a convenience bootstrapper object that constructs them all for a typical installation and exposes them all in one place: # Typical Single Game Usage @@ -44,4 +33,4 @@ The above example just shows the basic one line environment definition to get th If you have custom requirements or want to mix in output mods, etc, be sure to check out the [Environment Construction](https://github.com/Mutagen-Modding/Mutagen/wiki/Environment-Construction) documentation. # Synthesis Usage -If you're coding within a [Synthesis Patcher](https://github.com/Mutagen-Modding/Synthesis), you should not make your own environment as described here. Synthesis provides its own environment-like `IPatcherState` object in its Run function. [Read More](https://github.com/Mutagen-Modding/Synthesis/wiki/Coding-a-Patcher#synthesis-state-object) \ No newline at end of file +If you're coding within a [Synthesis Patcher](https://github.com/Mutagen-Modding/Synthesis), you should not make your own environment as described here. Synthesis provides its own environment-like `IPatcherState` object in its Run function. [Read More](https://github.com/Mutagen-Modding/Synthesis/wiki/Coding-a-Patcher#synthesis-state-object) diff --git a/docs/Equality-Checks.md b/docs/Equality-Checks.md index 141aae85c..68cd24f04 100644 --- a/docs/Equality-Checks.md +++ b/docs/Equality-Checks.md @@ -1,12 +1,3 @@ - - -## Table Of Contents - -- [Basic Equality](#basic-equality) -- [Equals Mask](#equals-mask) - - - # Basic Equality Mutagen generates Equals and Hash functions for all classes based on record content. Normal C# equality checks can be used: ```cs @@ -35,4 +26,4 @@ NPC.Mask equalsMask = npc1.GetEqualsMask(npc2); bool isEditorIdEqual = equalsMask.EditorID; bool isNameEqual = equalsMask.Name; bool allFieldsEqual = equalsMask.AllEqual(isEqualBool => isEqualBool); -``` \ No newline at end of file +``` diff --git a/docs/Flags-and-Enums.md b/docs/Flags-and-Enums.md index 10db807d0..0d4838e34 100644 --- a/docs/Flags-and-Enums.md +++ b/docs/Flags-and-Enums.md @@ -1,12 +1,3 @@ - - -## Table Of Contents - -- [Normal Enum](#normal-enum) -- [Flags Enum](#flags-enum) - - - A lot of Record data is exposed via flags and enums. All of known enum types and their options are defined explicitly for strongly typed use. ### Normal Enum Certain fields have a certain subset of valid options. These are exposed as enums, where only one choice can be made. diff --git a/docs/FormKey-Allocation-and-Persistence.md b/docs/FormKey-Allocation-and-Persistence.md index 8e8fc0f26..302e91efa 100644 --- a/docs/FormKey-Allocation-and-Persistence.md +++ b/docs/FormKey-Allocation-and-Persistence.md @@ -1,19 +1,3 @@ - - -## Table Of Contents - -- [Mapping Records Via EditorID](#mapping-records-via-editorid) -- [Keep EditorIDs Unique](#keep-editorids-unique) -- [Persistence and Allocation](#persistence-and-allocation) - - [Setting a Mod's Allocator](#setting-a-mods-allocator) - - [Text File Allocators](#text-file-allocators) - - [TextFileFormKeyAllocator](#textfileformkeyallocator) - - [TextFileSharedFormKeyAllocator](#textfilesharedformkeyallocator) - - [Sqlite](#sqlite) - - [Saving Allocation State](#saving-allocation-state) - - - It is common that tooling that is generating new records when creating plugins wants to keep their FormKeys consistent across several runs. The same records should get the same FormKeys. There are some challenges with fulfilling this: diff --git a/docs/FormKey-Picker.md b/docs/FormKey-Picker.md index 154d6848d..24a83b272 100644 --- a/docs/FormKey-Picker.md +++ b/docs/FormKey-Picker.md @@ -1,16 +1,3 @@ - - -## Table Of Contents - -- [FormKey Picker](#formkey-picker) - - [View Side](#view-side) - - [ViewModel Side](#viewmodel-side) -- [FormKey Multipicker](#formkey-multipicker) - - [View Side](#view-side-1) - - [ViewModel Side](#viewmodel-side-1) - - - The FormKey Picker helps users select record(s) by typing in: - EditorIDs - FormKeys @@ -124,4 +111,4 @@ public class MyViewModel : ViewModel // User can now fill FormKeys collection, and the viewmodel can see the results } } -``` \ No newline at end of file +``` diff --git a/docs/FormLink-vs-FormLinkNullable.md b/docs/FormLink-vs-FormLinkNullable.md index a5ba43d60..d526977ca 100644 --- a/docs/FormLink-vs-FormLinkNullable.md +++ b/docs/FormLink-vs-FormLinkNullable.md @@ -1,12 +1,3 @@ - - -## Table Of Contents - -- [Which You Should Use](#which-you-should-use) -- [What is FormLinkNullable](#what-is-formlinknullable) - - - FormLinks are used widely as a strongly typed identifier of a record, as an alternative to FormID, EditorID, or even FormKey. When using them, though, there are two variants: diff --git a/docs/FormLinks-Always-Target-Getter-Interfaces.md b/docs/FormLinks-Always-Target-Getter-Interfaces.md index c4ee79fe0..4d23a6af6 100644 --- a/docs/FormLinks-Always-Target-Getter-Interfaces.md +++ b/docs/FormLinks-Always-Target-Getter-Interfaces.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [Complication](#complication) -- [Best Practice](#best-practice) -- [Why](#why) - - - # Complication `FormLinks` are `FormKeys` with typing information mixed in as to which record type they should associate with. As such, they require you specify the typing you want to target. Assuming you just wanted to target Npcs, there are still a few options: - `Npc` -> The direct class @@ -49,4 +39,4 @@ if (myTargetNpc.TryResolve(myLinkCache, out var npc)) ``` But it's preferable to have just had the FormLink type target getters in the first place. -There are very limited and intentional scenarios where having a FormLink target a mutable type is desirable, but for the most part it's a pitfall trap for new users. \ No newline at end of file +There are very limited and intentional scenarios where having a FormLink target a mutable type is desirable, but for the most part it's a pitfall trap for new users. diff --git a/docs/FormLinks-vs-EditorID-as-Identifiers.md b/docs/FormLinks-vs-EditorID-as-Identifiers.md index fb90b39be..6b97f2aa1 100644 --- a/docs/FormLinks-vs-EditorID-as-Identifiers.md +++ b/docs/FormLinks-vs-EditorID-as-Identifiers.md @@ -1,25 +1,3 @@ - - -## Table Of Contents - -- [EditorID vs FormLink](#editorid-vs-formlink) -- [EditorID Upsides](#editorid-upsides) - - [Readability and FormLink Mapping](#readability-and-formlink-mapping) - - [EditorIDs are More Readable](#editorids-are-more-readable) - - [FormLink Mapping Brings Readability to FormLink-Based Systems](#formlink-mapping-brings-readability-to-formlink-based-systems) -- [EditorID Downsides](#editorid-downsides) - - [Overriding Mods Can Ruin Lookups](#overriding-mods-can-ruin-lookups) - - [Type Info Is Lost, Potentially Losing Speed](#type-info-is-lost-potentially-losing-speed) - - [Requires Decompression, Losing Speed](#requires-decompression-losing-speed) - - [Some Records Cannot Be Looked Up](#some-records-cannot-be-looked-up) - - [Specialized UI Input Systems](#specialized-ui-input-systems) - - [Typos](#typos) - - [You Can Make Typos](#you-can-make-typos) - - [Your Users Can Make Typos](#your-users-can-make-typos) -- [String Comparisons Are Slower than Int Comparisons](#string-comparisons-are-slower-than-int-comparisons) - - - # EditorID vs FormLink When choosing how you want to look up records, or store lists of record identifiers, there's the common choice between EditorIDs and FormLinks. @@ -167,4 +145,4 @@ As a bonus, the IDE intellisense can suggest EditorIDs for you and autocomplete: Users will also have to deal with typos. With EditorID based input, you're typically going to be exposing these via a list of strings on a UI or in a json file. As they type in their desired records, they will be very vulnerable to making typos. It's highly likely they don't realize and might complain to you the developer that your program is broken. # String Comparisons Are Slower than Int Comparisons -I put this last, as it's a factor, but is minor compared to the other issues. Comparing a long string of an EditorID like "ArmorImprialCuirass" is slower than comparing FormLinks which use integers for comparison. As such, there will be a slight speed penalty. Nothing to worry about too much, but just another small negative to add to the pile. \ No newline at end of file +I put this last, as it's a factor, but is minor compared to the other issues. Comparing a long string of an EditorID like "ArmorImprialCuirass" is slower than comparing FormLinks which use integers for comparison. As such, there will be a slight speed penalty. Nothing to worry about too much, but just another small negative to add to the pile. diff --git a/docs/Game-Locations.md b/docs/Game-Locations.md index bff49fcd6..becd88da9 100644 --- a/docs/Game-Locations.md +++ b/docs/Game-Locations.md @@ -1,17 +1,3 @@ - - -## Table Of Contents - -- [Use Environments When Possible](#use-environments-when-possible) -- [Game Locations](#game-locations) - - [Game Folder vs Data Folder](#game-folder-vs-data-folder) -- [Get__Folder](#get__folder) -- [Sources](#sources) -- [AdHoc Installations](#adhoc-installations) -- [GetGameFolders](#getgamefolders) - - - # Use Environments When Possible Game location concepts are somewhat unnecessary to interact with, since usually the preferred entry point is via [Environments](Environment) @@ -58,4 +44,4 @@ There is an enumerable option to get all the Game folders from the above listed foreach (var location in GameLocations.GetGameFolders(GameRelease.SkyrimSE)) { } -``` \ No newline at end of file +``` diff --git a/docs/Getters-Everywhere.md b/docs/Getters-Everywhere.md index 9cfaf4c37..1b9fc8dcf 100644 --- a/docs/Getters-Everywhere.md +++ b/docs/Getters-Everywhere.md @@ -1,17 +1,3 @@ - - -## Table Of Contents - -- [Overview](#overview) -- [Best Practices](#best-practices) -- [Reasoning](#reasoning) - - [Readonly Increases Speed](#readonly-increases-speed) - - [Adds Clearer Intention to Modifications](#adds-clearer-intention-to-modifications) - - [A Fully Mutable Ecosystem Has Easy Pitfalls](#a-fully-mutable-ecosystem-has-easy-pitfalls) - - [Initially Immutable Environment Encourages Clearer Intentions](#initially-immutable-environment-encourages-clearer-intentions) - - - # Overview Mutagen offers up records in several ways. Consider dealing with an Npc, it would offer: - `Npc` class. A class with all the fields an Npc has @@ -85,4 +71,4 @@ orthornSetter.Speed *= 2; This is better in a few ways: - As part of the modification process, we are required to indicate which mod is going to "house" those modifications - The object instance we are modifying only exists in our outgoing patch, rather than many mods -- The original Skyrim.esm definition is left intact. In fact, it cannot possibly be modified as the entire mod object is readonly fundamentally. \ No newline at end of file +- The original Skyrim.esm definition is left intact. In fact, it cannot possibly be modified as the entire mod object is readonly fundamentally. diff --git a/docs/Header-Structs.md b/docs/Header-Structs.md index 4aa716e0d..23549bc06 100644 --- a/docs/Header-Structs.md +++ b/docs/Header-Structs.md @@ -1,25 +1,3 @@ - - -## Table Of Contents - -- [General Concept](#general-concept) -- [Example Usage](#example-usage) -- [Headers, Frames and Pins](#headers-frames-and-pins) - - [Categories](#categories) - - [Flavors](#flavors) - - [Header](#header) - - [Frame](#frame) - - [Pin](#pin) -- [Additional Functionality](#additional-functionality) - - [Iteration](#iteration) - - [Subrecord Location](#subrecord-location) - - [Subrecord Frame Data Interpretation](#subrecord-frame-data-interpretation) - - [Primitives](#primitives) - - [Strings](#strings) -- [Writable Structs](#writable-structs) - - - # General Concept Header Structs are lightweight overlays that "lay" on top of some bytes and offers API to retrieve the various header fields or content bytes they contain. They are extremely cheap to create, as they do no parsing unless asked. They are aware of any differences in data alignments from game to game, so the same systems can be applied even if alignments change slightly. @@ -154,4 +132,4 @@ All the above concepts mentioned have been read-only. Header Structs can be ove There are writable structs as well, which have both getter and setter API. You can then read a section of data, and then make modifications which will affect the source `byte[]` at the correct indices. -These systems are less mature, but will be expanded on in the future. \ No newline at end of file +These systems are less mature, but will be expanded on in the future. diff --git a/docs/Home.md b/docs/Home.md index 47d9599bb..22eb3f87b 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -1,23 +1,3 @@ - - -## Table Of Contents - -- [Goals](#goals) -- [Sample API](#sample-api) -- [Major Features](#major-features) - - [Plugins](#plugins) - - [Linking and Record Lookups](#linking-and-record-lookups) - - [Load Order](#load-order) - - [Archives (Bsa/Ba2)](#archives-bsaba2) - - [Strings](#strings) - - [WPF UI Controls](#wpf-ui-controls) -- [Seeing Mutagen in Action](#seeing-mutagen-in-action) - - [Synthesis](#synthesis) - - [Example Project](#example-project) -- [Installing Mutagen](#installing-mutagen) - - - [![Discord](https://discordapp.com/api/guilds/759302581448474626/widget.png)](https://discord.gg/53KMEsW) Mutagen is a C# library for analyzing, modifying, and creating Bethesda mods. One of its main features is offering interfaces and classes for the records that exist at compile time and are first class citizens in C#. With actual members for each field they get the benefits of type safety, simple live debugging, Intellisense features such as autocomplete. The interfaces offer clean API to the user and abstract away much of the binary record specifics and oddities of how they are stored on disk, while the actual implementation remains very closely tied to the data offering as much speed as it can by leveraging some of the latest C# features. Most of the public facing API is created by code generation, with small manual snippets of code for the one-off special cases. This means the library is able to provide consistent API with very little manual work when adding new record definitions or features. @@ -97,4 +77,4 @@ Another option is the [Mutagen Bootcamp](https://github.com/Mutagen-Modding/Muta ## Installing Mutagen Mutagen can be added to your C# project via NuGet, under the package name `Mutagen.Bethesda`. Search for it in Visual Studio, or find it [here](https://www.nuget.org/packages/Mutagen.Bethesda/). -If you're unfamiliar with setting up C# projects in general, a good place to start might be creating a simple [Synthesis patcher](https://github.com/Mutagen-Modding/Synthesis/wiki/Create-a-Patcher), and be sure to ask questions on our [Discord](https://discord.gg/53KMEsW). \ No newline at end of file +If you're unfamiliar with setting up C# projects in general, a good place to start might be creating a simple [Synthesis patcher](https://github.com/Mutagen-Modding/Synthesis/wiki/Create-a-Patcher), and be sure to ask questions on our [Discord](https://discord.gg/53KMEsW). diff --git a/docs/ITPO-Avoidance.md b/docs/ITPO-Avoidance.md index 6d41a8b65..abf8c7320 100644 --- a/docs/ITPO-Avoidance.md +++ b/docs/ITPO-Avoidance.md @@ -1,12 +1,3 @@ - - -## Table Of Contents - -- [What is an ITPO](#what-is-an-itpo) -- [Avoiding ITPOs](#avoiding-itpos) - - - # What is an ITPO A very typical thing that can happen during processing mods is exporting a record that doesn't have any changes compared to the original. This is known as an ITPO (Identical to Previous Override), or sometimes ITM (Idential to Master). @@ -69,4 +60,4 @@ foreach (var weapon in loadOrder.PriorityOrder.Weapon().WinningOverrides()) } ``` -There are many ways to achieve the same goal. The important takeaway is that code should first try to not make any ITPOs in the first place by only adding it to the outgoing mod once/if modifications have been made to the record. Depending on the complexity of what you're doing, it may require different patterns than the ones outlined above. No matter what though, if you find yourself reaching for ITPO tooling, take a step back and see if you can refactor it to process a different way to avoid them altogether. \ No newline at end of file +There are many ways to achieve the same goal. The important takeaway is that code should first try to not make any ITPOs in the first place by only adding it to the outgoing mod once/if modifications have been made to the record. Depending on the complexity of what you're doing, it may require different patterns than the ones outlined above. No matter what though, if you find yourself reaching for ITPO tooling, take a step back and see if you can refactor it to process a different way to avoid them altogether. diff --git a/docs/Installing-Visual-Studio.md b/docs/Installing-Visual-Studio.md index 792287554..bacd61957 100644 --- a/docs/Installing-Visual-Studio.md +++ b/docs/Installing-Visual-Studio.md @@ -1,20 +1,3 @@ - - -## Table Of Contents - -- [Downloading Visual Studio](#downloading-visual-studio) -- [Installation Options](#installation-options) - - [C# Desktop Development Modules](#c-desktop-development-modules) - - [Ensure .NET Standard 2.1 is Installed](#ensure-net-standard-21-is-installed) - - [Let It Install, Start It Up](#let-it-install-start-it-up) -- [Initial Setup](#initial-setup) - - [Skip Creating/Opening a Project For Now](#skip-creatingopening-a-project-for-now) - - [Dark Mode](#dark-mode) - - [Keybinds](#keybinds) - - [Good to Go](#good-to-go) - - - Visual Studio is the typical IDE (Integrated Development Environment) used for C#. It is used for writing code, error checking, building, running, debugging, etc. There are alternatives such as Rider, or VSCode, but VS will be used in this 101 tutorial. # Downloading Visual Studio @@ -48,4 +31,4 @@ There are a few keybind schemes you can choose from. This bootstrap guide will ReSharper (JetBrains) is another popular alternative. Feel free to choose your preferred setup. ## Good to Go -At this point, you should have Visual Studio installed and ready to create your first C# project. \ No newline at end of file +At this point, you should have Visual Studio installed and ready to create your first C# project. diff --git a/docs/Interfaces-(Aspect-Link-Getters).md b/docs/Interfaces-(Aspect-Link-Getters).md index 014db17f4..c7c868f38 100644 --- a/docs/Interfaces-(Aspect-Link-Getters).md +++ b/docs/Interfaces-(Aspect-Link-Getters).md @@ -1,25 +1,3 @@ - - -## Table Of Contents - -- [Getters and Setters](#getters-and-setters) -- [Aspect Interfaces](#aspect-interfaces) - - [Problem to Solve](#problem-to-solve) - - [Typical Usage](#typical-usage) - - [Using Aspect Interfaces as a Parameter](#using-aspect-interfaces-as-a-parameter) - - [Weaving Multiple Aspect Interfaces Using Generics](#weaving-multiple-aspect-interfaces-using-generics) - - [Evolution](#evolution) -- [Link Interfaces](#link-interfaces) - - [Problem to Solve](#problem-to-solve-1) - - [Typical Usage](#typical-usage-1) - - [Knowing Types Allowed into a FormLink](#knowing-types-allowed-into-a-formlink) - - [Visual Studio Intellisense](#visual-studio-intellisense) - - [Autogenerated Documentation](#autogenerated-documentation) - - [Evolution](#evolution-1) -- [Documentation](#documentation) - - - Mutagen exposes a few categories of interfaces: - **[Getters and Setters](#getters-and-setters)** _(Immutable vs Mutable)_ - **[Aspect](#aspect-interfaces)** _(Expose aspects common to many records)_ diff --git a/docs/Json.md b/docs/Json.md index f98d17f50..2dda1ed9e 100644 --- a/docs/Json.md +++ b/docs/Json.md @@ -1,11 +1,3 @@ - - -## Table Of Contents - -- [Json Converters](#json-converters) - - - Currently, the libraries that Mutagen offers related to Json targets `Newtonsoft.Json`. Alternatives can be added for `System.Text.Json` if there's demand. # Json Converters @@ -45,4 +37,4 @@ Prints "MyRuntimeLink": "000456:MyMod.esp", "MyModKey ": "MyMod.esp" } -``` \ No newline at end of file +``` diff --git a/docs/LinkCache---Record-Lookup.md b/docs/LinkCache---Record-Lookup.md index 4ebeeb158..5f4fae264 100644 --- a/docs/LinkCache---Record-Lookup.md +++ b/docs/LinkCache---Record-Lookup.md @@ -1,18 +1,3 @@ - - -## Table Of Contents - -- [Creating a LinkCache](#creating-a-linkcache) -- [Querying a LinkCache](#querying-a-linkcache) - - [Lookup Optimizations](#lookup-optimizations) - - [Lazy Lookup and Caching](#lazy-lookup-and-caching) - - [Short Circuiting on Type](#short-circuiting-on-type) - - [Short Circuiting on Depth](#short-circuiting-on-depth) - - [Cache Lifetime Control](#cache-lifetime-control) - - [Modification Safety](#modification-safety) - - - Records commonly have "pointers" to other records via [FormLink](ModKey%2C-FormKey%2C-FormLink#formlinks) members, which are an enhancement wrapper around a FormID. To look up the record being referenced requires two things: - **A relative context to look up against**. Is the lookup relative to a single `Mod`, or a `LoadOrder`? - **Work to be done** to iterate over all records in a `Mod` or `LoadOrder`, so that it can be determined if the record is present. diff --git a/docs/LinkCache.md b/docs/LinkCache.md index 4a5abb4f1..6c30110b8 100644 --- a/docs/LinkCache.md +++ b/docs/LinkCache.md @@ -1,16 +1,3 @@ - - -## Table Of Contents - -- [Context](#context) -- [Mutability](#mutability) - - [Immutable Link Caches](#immutable-link-caches) - - [Mutable Link Caches](#mutable-link-caches) -- [Memory Usage](#memory-usage) - - [Identifier Only Caches](#identifier-only-caches) - - - The LinkCache is the record lookup engine. It powers a lot of functionality, such as: - Looking up records by [FormKey/FormLink](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#resolves) - Finding the [Winning Override](Winning-Overrides) in a [Load Order](Load-Order) @@ -83,4 +70,4 @@ In some situations like the [FormKey Picker](FormKey-Picker), we only care about var linkCache = myLoadOrder.ToImmutableLinkCache(LinkCachePreferences.OnlyIdentifiers()); ``` -In this mode, the Link Cache will only store the FormKey/EditorID. As such, any call that attempts to retrieve a record will throw an exception. Only certain calls that don't retrieve a whole record will be safe to use, namely `TryResolveIdentifier` or `AllIdentifiers`. \ No newline at end of file +In this mode, the Link Cache will only store the FormKey/EditorID. As such, any call that attempts to retrieve a record will throw an exception. Only certain calls that don't retrieve a whole record will be safe to use, namely `TryResolveIdentifier` or `AllIdentifiers`. diff --git a/docs/Load-Order.md b/docs/Load-Order.md index 45887b750..fb5e7777e 100644 --- a/docs/Load-Order.md +++ b/docs/Load-Order.md @@ -1,22 +1,3 @@ - - -## Table Of Contents - -- [Getting a Load Order](#getting-a-load-order) -- [ModListings](#modlistings) -- [Interacting with LoadOrder](#interacting-with-loadorder) - - [Priority vs Listed Ordering](#priority-vs-listed-ordering) - - [Filtering Listings](#filtering-listings) - - [Accessing Specific Listings](#accessing-specific-listings) -- [Reading a Load Order](#reading-a-load-order) - - [Getting Listings](#getting-listings) - - [Importing Mods](#importing-mods) - - [Specifying Getter vs Setter](#specifying-getter-vs-setter) -- [Writing a Load Order](#writing-a-load-order) -- [PluginListings and CreationClubListings](#pluginlistings-and-creationclublistings) - - - A Load Order represents a set of mods in a given order, where the mods loaded later "win" and override the records from previous mods. # Getting a Load Order @@ -127,4 +108,4 @@ Logic related to each concept lives in its own class: - PluginListings - CreationClubListings -In each you will be able to do tasks related to that specific load order source concept. \ No newline at end of file +In each you will be able to do tasks related to that specific load order source concept. diff --git a/docs/Low-Level-Examples.md b/docs/Low-Level-Examples.md index a6b065a27..98bccf23d 100644 --- a/docs/Low-Level-Examples.md +++ b/docs/Low-Level-Examples.md @@ -1,11 +1,3 @@ - - -## Table Of Contents - -- [Record Navigation Using Header Structs](#record-navigation-using-header-structs) - - - # Record Navigation Using Header Structs The following code will open a _simple_ mod file from disk, and print all EditorIDs. @@ -46,4 +38,4 @@ while (stream.Remaining > 0) Note that the above code does not handle the complexity of Sub-Groups such as Cells/Worldspaces, and will break if the mod contains those types of records, unless upgraded to also handle them. -However, it does give an extreme amount of control and flexibility of logic, while still abstracting the error prone concepts of header alignments away from the user. \ No newline at end of file +However, it does give an extreme amount of control and flexibility of logic, while still abstracting the error prone concepts of header alignments away from the user. diff --git a/docs/Low-Level-Tools.md b/docs/Low-Level-Tools.md index b1a3cfb2d..318d946df 100644 --- a/docs/Low-Level-Tools.md +++ b/docs/Low-Level-Tools.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [Reasoning and Typical Applications of Low Level Tooling](#reasoning-and-typical-applications-of-low-level-tooling) - - [Cross-game Processing](#cross-game-processing) - - [Testing the Record Suite Itself](#testing-the-record-suite-itself) - - - The API and tools listed in the [[Plugin Record Suite]] are intended to expose Bethesda records in an organized, strongly typed, and (hopefully) less error prone fashion. However, some tasks and some users require a less safe and more direct approach to get the job done. This section is about some of the mechanics and tools under the hood, and are recommended for more advanced users. @@ -21,4 +11,4 @@ Interfaces can provide a small bit of relief, allowing some fields that are comm Low Level Tooling can be used instead of the generated records to write logic that can apply to multiple games where interfaces aren't good enough. It comes at the cost of being a lot more error prone to use, losing a lot of the common functionality (Equals/ToString/etc), and requiring a lot more knowledge of binary details. ## Testing the Record Suite Itself -The generated records do the bulk of the parsing and data handling, but they cannot test themselves for correctness. The manual granularity of the Low Level Tools allow for code and logic to be written for testing projects to do the work needed to confirm correctness of the generated records. \ No newline at end of file +The generated records do the bulk of the parsing and data handling, but they cannot test themselves for correctness. The manual granularity of the Low Level Tools allow for code and logic to be written for testing projects to do the work needed to confirm correctness of the generated records. diff --git a/docs/ModContexts.md b/docs/ModContexts.md index ef1476954..a70373b00 100644 --- a/docs/ModContexts.md +++ b/docs/ModContexts.md @@ -1,16 +1,3 @@ - - -## Table Of Contents - -- [Retrieving a ModContext](#retrieving-a-modcontext) - - [By Looping WinningOverrides](#by-looping-winningoverrides) - - [By LinkCache Lookups](#by-linkcache-lookups) -- [Parent Concepts](#parent-concepts) -- [Deep Record Insertion and Duplication](#deep-record-insertion-and-duplication) -- [Complex Call Signature](#complex-call-signature) - - - Mod Contexts are an opt-in advanced feature of most LinkCache functionality. They act as storage for contextual information and the wiring and logic needed to perform certain actions in a context aware manner. `ModContext`s contain: @@ -52,4 +39,4 @@ Note: The API call is much more verbose. More on that [here](https://github.co # Deep Record Insertion and Duplication -# Complex Call Signature \ No newline at end of file +# Complex Call Signature diff --git a/docs/ModKey,-FormKey,-FormLink.md b/docs/ModKey,-FormKey,-FormLink.md index 262be9240..d49528307 100644 --- a/docs/ModKey,-FormKey,-FormLink.md +++ b/docs/ModKey,-FormKey,-FormLink.md @@ -1,26 +1,3 @@ - - -## Table Of Contents - -- [ModKey](#modkey) - - [Construction](#construction) - - [Basic Constructor](#basic-constructor) - - [Factory Construction](#factory-construction) -- [FormKey](#formkey) - - [Why does Mutagen use FormKeys instead of FormIDs?](#why-does-mutagen-use-formkeys-instead-of-formids) - - [FormKeys Avoid Master Mismatch Bugs](#formkeys-avoid-master-mismatch-bugs) - - [FormKeys Remove the 255 Mod Limit](#formkeys-remove-the-255-mod-limit) - - [Construction](#construction-1) - - [Basic Constructor](#basic-constructor-1) - - [Try Factory](#try-factory) -- [FormLink](#formlink) - - [Resolves](#resolves) - - [Scoping a Resolve](#scoping-a-resolve) - - [SetTo](#setto) - - [Construction](#construction-2) - - - This article covers three fundamental identifiers: - **[ModKey](#modkey)** _(a unique identifier for a mod)_ - **[FormKey](#formkey)** _(FormID)_ diff --git a/docs/ModKey-Picker.md b/docs/ModKey-Picker.md index 63ecb6c0b..68cbea93c 100644 --- a/docs/ModKey-Picker.md +++ b/docs/ModKey-Picker.md @@ -1,16 +1,3 @@ - - -## Table Of Contents - -- [ModKey Picker](#modkey-picker) - - [View Side](#view-side) - - [ViewModel Side](#viewmodel-side) -- [ModKey Multipicker](#modkey-multipicker) - - [View Side](#view-side-1) - - [ViewModel Side](#viewmodel-side-1) - - - The ModKey Picker helps users select mod(s) by typing in their names. The picker can reference certain objects to know what mods actually exist on a user's active load order: @@ -110,4 +97,4 @@ public class MyViewModel : ViewModel // User can now set the MyModKeys member, and the viewmodel can see the results } } -``` \ No newline at end of file +``` diff --git a/docs/Modifying-Groups-Being-Iterated.md b/docs/Modifying-Groups-Being-Iterated.md index 0cc52cdd4..d3a0f703b 100644 --- a/docs/Modifying-Groups-Being-Iterated.md +++ b/docs/Modifying-Groups-Being-Iterated.md @@ -1,16 +1,3 @@ - - -## Table Of Contents - -- [Looping and Modifying the Same Record Types](#looping-and-modifying-the-same-record-types) -- [Modifying a Collection Being Enumerated](#modifying-a-collection-being-enumerated) -- [Avoiding the Exceptions](#avoiding-the-exceptions) - - [Create a Temporary Collection](#create-a-temporary-collection) - - [Stop looping after modification](#stop-looping-after-modification) -- [Applying it to Mutagen](#applying-it-to-mutagen) - - - # Looping and Modifying the Same Record Types Consider this: ```cs @@ -87,4 +74,4 @@ foreach (var lvln in state.LoadOrder.PriorityOrder.LeveledNpc().WinningOverrides Note that this only matters when you are Adding/Removing/Replacing a record FROM/TO a group in a mod. -If you are just modifying fields on the records (Setting the name, for example), this is not dangerous. In this situation, you are not actually modifying the collection itself, you're modifying a field on a record. \ No newline at end of file +If you are just modifying fields on the records (Setting the name, for example), this is not dangerous. In this situation, you are not actually modifying the collection itself, you're modifying a field on a record. diff --git a/docs/Namespaces.md b/docs/Namespaces.md index ecf0ab74b..d4ce4cd2e 100644 --- a/docs/Namespaces.md +++ b/docs/Namespaces.md @@ -1,17 +1,3 @@ - - -## Table Of Contents - -- [What Are Namespaces](#what-are-namespaces) -- [Namespaces, Intellisense, and Compiling](#namespaces-intellisense-and-compiling) - - [Adding a Namespace](#adding-a-namespace) - - [Add the Namespace Import Yourself](#add-the-namespace-import-yourself) - - [Let the IDE add the Namespace](#let-the-ide-add-the-namespace) - - [Show Types From Other Namespaces in Intellisense](#show-types-from-other-namespaces-in-intellisense) -- [Namespaces Help With Collisions](#namespaces-help-with-collisions) - - - # What Are Namespaces Namespaces are "sections" of code that you can opt to import so that you have access to. They help organize things and prevent naming collisions. @@ -68,4 +54,4 @@ In addition to "scoping" Intellisense as mentioned above, namespaces also help w var classA = new SomeLibrary.MyClass(); var classB = new OtherLibrary.MyClass(); ``` -The above snippet shows that you can include the namespace to help specify which `MyClass` you're referring to, and so both can be used side by side, despite the bad naming. \ No newline at end of file +The above snippet shows that you can include the namespace to help specify which `MyClass` you're referring to, and so both can be used side by side, despite the bad naming. diff --git a/docs/New-Project-With-Mutagen.md b/docs/New-Project-With-Mutagen.md index 1f6122fde..25dd03c03 100644 --- a/docs/New-Project-With-Mutagen.md +++ b/docs/New-Project-With-Mutagen.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [Create a New Project](#create-a-new-project) -- [Add Mutagen via NuGet](#add-mutagen-via-nuget) -- [Starter Project Automatically Added](#starter-project-automatically-added) - - - # Create a New Project At this point, you should have Visual Studio installed and open. diff --git a/docs/Nullability-to-Indicate-Record-Presence.md b/docs/Nullability-to-Indicate-Record-Presence.md index 26c075109..ecf4eeee8 100644 --- a/docs/Nullability-to-Indicate-Record-Presence.md +++ b/docs/Nullability-to-Indicate-Record-Presence.md @@ -1,17 +1,3 @@ - - -## Table Of Contents - -- [Most Subrecords are Optional](#most-subrecords-are-optional) - - [Dealing with Nullable Fields](#dealing-with-nullable-fields) - - [Don't Check Unless Needed](#dont-check-unless-needed) - - [Skipping if null](#skipping-if-null) - - [Using a fallback value if null](#using-a-fallback-value-if-null) - - [Setting the null field to have a value](#setting-the-null-field-to-have-a-value) - - [Other](#other) - - - # Most Subrecords are Optional Most Bethesda subrecords are optional; They can be set to a value, or not exist at all. Mutagen uses a field's nullability to indicate which fields/subrecords are optional. This leverages one of C#'s newer concepts of [Nullable References](https://docs.microsoft.com/en-us/dotnet/csharp/nullable-references). @@ -71,4 +57,4 @@ foreach (var effect in objectEffect.Effects) ``` ### Other -There are many other ways to deal with the potential of null values besides the examples given, depending on the circumstances and goals. \ No newline at end of file +There are many other ways to deal with the potential of null values besides the examples given, depending on the circumstances and goals. diff --git a/docs/Oblivion-Aspect-Interfaces.md b/docs/Oblivion-Aspect-Interfaces.md index 561af0c18..0e2804c4a 100644 --- a/docs/Oblivion-Aspect-Interfaces.md +++ b/docs/Oblivion-Aspect-Interfaces.md @@ -1,73 +1,3 @@ - - -## Table Of Contents - -- [Aspect Interfaces](#aspect-interfaces) - - [Interfaces to Concrete Classes](#interfaces-to-concrete-classes) - - [IModeled](#imodeled) - - [INamed](#inamed) - - [IWeightValue](#iweightvalue) - - [Concrete Classes to Interfaces](#concrete-classes-to-interfaces) - - [AClothing](#aclothing) - - [Activator](#activator) - - [AlchemicalApparatus](#alchemicalapparatus) - - [AlchemicalApparatusData](#alchemicalapparatusdata) - - [Ammunition](#ammunition) - - [AmmunitionData](#ammunitiondata) - - [AnimatedObject](#animatedobject) - - [Armor](#armor) - - [ArmorData](#armordata) - - [Birthsign](#birthsign) - - [BodyData](#bodydata) - - [Book](#book) - - [Cell](#cell) - - [Class](#class) - - [Climate](#climate) - - [Clothing](#clothing) - - [ClothingData](#clothingdata) - - [Container](#container) - - [Creature](#creature) - - [DialogTopic](#dialogtopic) - - [Door](#door) - - [Enchantment](#enchantment) - - [Eye](#eye) - - [FacePart](#facepart) - - [Faction](#faction) - - [Flora](#flora) - - [Furniture](#furniture) - - [Grass](#grass) - - [Hair](#hair) - - [IdleAnimation](#idleanimation) - - [Ingredient](#ingredient) - - [Key](#key) - - [KeyData](#keydata) - - [Light](#light) - - [LightData](#lightdata) - - [LocalVariable](#localvariable) - - [MagicEffect](#magiceffect) - - [MapMarker](#mapmarker) - - [Miscellaneous](#miscellaneous) - - [Npc](#npc) - - [Potion](#potion) - - [Quest](#quest) - - [Race](#race) - - [ScriptEffect](#scripteffect) - - [SigilStone](#sigilstone) - - [SigilStoneData](#sigilstonedata) - - [SoulGem](#soulgem) - - [SoulGemData](#soulgemdata) - - [Spell](#spell) - - [SpellLeveled](#spellleveled) - - [SpellUnleveled](#spellunleveled) - - [Static](#static) - - [Tree](#tree) - - [Weapon](#weapon) - - [WeaponData](#weapondata) - - [Weather](#weather) - - [Worldspace](#worldspace) - - - # Aspect Interfaces Aspect Interfaces expose common aspects of records. For example, `INamed` are implemented by all records that have a `Name`. diff --git a/docs/Oblivion-Link-Interfaces.md b/docs/Oblivion-Link-Interfaces.md index 5d26ae9a8..390e0c9fa 100644 --- a/docs/Oblivion-Link-Interfaces.md +++ b/docs/Oblivion-Link-Interfaces.md @@ -1,21 +1,3 @@ - - -## Table Of Contents - -- [Link Interfaces](#link-interfaces) - - [Interfaces to Concrete Classes](#interfaces-to-concrete-classes) - - [IOwner](#iowner) - - [IPlaced](#iplaced) - - [Concrete Classes to Interfaces](#concrete-classes-to-interfaces) - - [Faction](#faction) - - [Landscape](#landscape) - - [Npc](#npc) - - [PlacedCreature](#placedcreature) - - [PlacedNpc](#placednpc) - - [PlacedObject](#placedobject) - - - # Link Interfaces Link Interfaces are used by FormLinks to point to several record types at once. For example, a Container record might be able to contain Armors, Weapons, Ingredients, etc. diff --git a/docs/Plugin-Record-Suite.md b/docs/Plugin-Record-Suite.md index e189f0cce..0908dca60 100644 --- a/docs/Plugin-Record-Suite.md +++ b/docs/Plugin-Record-Suite.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [Plugin Record Suite](#plugin-record-suite) -- [Code is Generated](#code-is-generated) -- [Explore](#explore) - - - ### Plugin Record Suite Mutagen offers custom classes, interfaces, and functionality for each Bethesda record type. For example, if you want to deal with and modify Potions in a mod you can read/write using a `Potion` class which has members for every stat and field. It comes with a suite of functionality alongside, such as how to print to string, how to compare equality, how to write itself, etc. @@ -15,4 +5,4 @@ Mutagen offers custom classes, interfaces, and functionality for each Bethesda r Records and their functionality are created and maintained via a code generation library. As such, the records feel like they are hand written, without actually needing to write them by hand. As new functionality is added or internal optimization is improved, most of Mutagen's code is regenerated to gain all the benefits without needing to manually update the definitions for every record that exists. ### Explore -Most functionality and use case scenarios deal with these generated records in some way. Learn more and explore the details in the other related pages. \ No newline at end of file +Most functionality and use case scenarios deal with these generated records in some way. Learn more and explore the details in the other related pages. diff --git a/docs/Previous-Override-Iteration.md b/docs/Previous-Override-Iteration.md index 14a85c294..f2d1d6a73 100644 --- a/docs/Previous-Override-Iteration.md +++ b/docs/Previous-Override-Iteration.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [ResolveAll](#resolveall) -- [ResolveAllContexts](#resolveallcontexts) -- [Lazy Enumeration](#lazy-enumeration) - - - A lot of functionality like [Record Lookup](Record-Lookup) or [Winning Overrides](Winning-Overrides) deals with the "winning" version of a record, as in the record as it exists in the last Mod to override it on the Load Order. LinkCache offers an easy way to dig deeper into the load order and access the non-winning versions of records from previous mods. @@ -75,4 +65,4 @@ if (recordWithPreviousOverride.Length > 1) // And it has a previous override, too var previousOverride = recordWithPreviousOverride[1]; } -``` \ No newline at end of file +``` diff --git a/docs/Printing.md b/docs/Printing.md index 4447bd69e..fc178ace3 100644 --- a/docs/Printing.md +++ b/docs/Printing.md @@ -1,12 +1,3 @@ - - -## Table Of Contents - -- [Normal ToString](#normal-tostring) -- [IPrintable and StructuredStringBuilder](#iprintable-and-structuredstringbuilder) - - - (Latest version of Mutagen does not match these docs. Will soon be updated to match this documentation) # Normal ToString @@ -18,4 +9,4 @@ If you call `ToString()` on a Mutagen object, you will typically not see any con All Mutagen objects implement `IPrintable`, which exposes a `Print()` method. Calling this will do a more verbose printing of the content: ```cs var str = npc.Print(); -``` \ No newline at end of file +``` diff --git a/docs/Record-Lookup.md b/docs/Record-Lookup.md index a2242e52e..0fb86302d 100644 --- a/docs/Record-Lookup.md +++ b/docs/Record-Lookup.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [TryResolve](#tryresolve) -- [FormLink Entry Point](#formlink-entry-point) -- [LinkCache Entry Point](#linkcache-entry-point) - - - # TryResolve `TryResolve` is the typical call for looking up records pointed to by a FormKey. Similar to how Control-Clicking a FormID in xEdit will bring you to the record a FormID points to. It takes a LinkCache as a parameter to the call, which will inspect the content it is attached to (whether it's a load order or a single mod) and try to locate the record that matches: - The FormKey (FormID) @@ -54,4 +44,4 @@ if (myLinkCache.TryResolve(myFormKey, out var npc)) } ``` -Now that the type is specified, it will run faster and be able to return a more appropriate type (INpcGetter) for you to use. As mentioned earlier, though, it is preferable to just [use FormLinks everywhere](https://github.com/Mutagen-Modding/Mutagen/wiki/FormLinks-Instead-of-FormID-FormKey) and initiate off of those. \ No newline at end of file +Now that the type is specified, it will run faster and be able to return a more appropriate type (INpcGetter) for you to use. As mentioned earlier, though, it is preferable to just [use FormLinks everywhere](https://github.com/Mutagen-Modding/Mutagen/wiki/FormLinks-Instead-of-FormID-FormKey) and initiate off of those. diff --git a/docs/Reflection-Powered-Settings.md b/docs/Reflection-Powered-Settings.md index 3ab24a718..36c6537da 100644 --- a/docs/Reflection-Powered-Settings.md +++ b/docs/Reflection-Powered-Settings.md @@ -1,24 +1,3 @@ - - -## Table Of Contents - -- [Overview](#overview) -- [Nesting](#nesting) -- [Attributes](#attributes) - - [Ignore](#ignore) - - [Tooltip](#tooltip) - - [SettingName](#settingname) - - [JsonDiskName](#jsondiskname) - - [MaintainOrder](#maintainorder) - - [ObjectNameMember](#objectnamemember) - - [FormLinkPickerCustomization](#formlinkpickercustomization) -- [Allowed Field Types](#allowed-field-types) -- [Implementing Within a UI Yourself](#implementing-within-a-ui-yourself) - - [View Side](#view-side) - - [ViewModel Side](#viewmodel-side) - - - This is a control that is able to attach to any DTO (Data Transfer Object) style class and generate a UI for each of the fields. This is very good for getting a basic settings editor up and running with minimal WPF experience. Originally it was part of Synthesis to provide UI controls for patcher settings, but has been moved up to Mutagen's libraries for more general use. @@ -223,4 +202,4 @@ public class MyViewModel : ViewModel // More functionality to access data from the reflection view will be added } -``` \ No newline at end of file +``` diff --git a/docs/Skyrim-Aspect-Interfaces.md b/docs/Skyrim-Aspect-Interfaces.md index d52072228..9f80082f5 100644 --- a/docs/Skyrim-Aspect-Interfaces.md +++ b/docs/Skyrim-Aspect-Interfaces.md @@ -1,122 +1,3 @@ - - -## Table Of Contents - -- [Aspect Interfaces](#aspect-interfaces) - - [Interfaces to Concrete Classes](#interfaces-to-concrete-classes) - - [IHasIcons](#ihasicons) - - [IKeyworded](#ikeyworded) - - [IModeled](#imodeled) - - [INamed](#inamed) - - [IObjectBounded](#iobjectbounded) - - [IWeightValue](#iweightvalue) - - [Keyword](#keyword) - - [Concrete Classes to Interfaces](#concrete-classes-to-interfaces) - - [AcousticSpace](#acousticspace) - - [Activator](#activator) - - [ActorValueInformation](#actorvalueinformation) - - [AddonNode](#addonnode) - - [AlchemicalApparatus](#alchemicalapparatus) - - [AlternateTexture](#alternatetexture) - - [Ammunition](#ammunition) - - [AnimatedObject](#animatedobject) - - [APackageData](#apackagedata) - - [Armor](#armor) - - [ArmorModel](#armormodel) - - [ArtObject](#artobject) - - [BodyData](#bodydata) - - [BodyPart](#bodypart) - - [BodyPartData](#bodypartdata) - - [Book](#book) - - [CameraShot](#camerashot) - - [Cell](#cell) - - [Class](#class) - - [Climate](#climate) - - [CollisionLayer](#collisionlayer) - - [ColorRecord](#colorrecord) - - [Container](#container) - - [DestructionStage](#destructionstage) - - [DialogTopic](#dialogtopic) - - [Door](#door) - - [DualCastData](#dualcastdata) - - [Explosion](#explosion) - - [Eyes](#eyes) - - [Faction](#faction) - - [Flora](#flora) - - [Furniture](#furniture) - - [Grass](#grass) - - [Hazard](#hazard) - - [HeadData](#headdata) - - [HeadPart](#headpart) - - [IdleMarker](#idlemarker) - - [Impact](#impact) - - [Ingestible](#ingestible) - - [Ingredient](#ingredient) - - [Key](#key) - - [Keyword](#keyword-1) - - [LeveledItem](#leveleditem) - - [LeveledNpc](#levelednpc) - - [LeveledSpell](#leveledspell) - - [Light](#light) - - [LoadScreen](#loadscreen) - - [Location](#location) - - [MagicEffect](#magiceffect) - - [MapMarker](#mapmarker) - - [MaterialObject](#materialobject) - - [MaterialType](#materialtype) - - [Message](#message) - - [MiscItem](#miscitem) - - [MoveableStatic](#moveablestatic) - - [MovementType](#movementtype) - - [Npc](#npc) - - [ObjectEffect](#objecteffect) - - [PackageDataBool](#packagedatabool) - - [PackageDataFloat](#packagedatafloat) - - [PackageDataInt](#packagedataint) - - [PackageDataLocation](#packagedatalocation) - - [PackageDataObjectList](#packagedataobjectlist) - - [PackageDataTarget](#packagedatatarget) - - [PackageDataTopic](#packagedatatopic) - - [Perk](#perk) - - [Phoneme](#phoneme) - - [Projectile](#projectile) - - [Quest](#quest) - - [QuestAlias](#questalias) - - [Race](#race) - - [RegionData](#regiondata) - - [RegionMap](#regionmap) - - [SceneAction](#sceneaction) - - [ScenePhase](#scenephase) - - [ScriptBoolListProperty](#scriptboollistproperty) - - [ScriptBoolProperty](#scriptboolproperty) - - [ScriptEntry](#scriptentry) - - [ScriptFloatListProperty](#scriptfloatlistproperty) - - [ScriptFloatProperty](#scriptfloatproperty) - - [ScriptIntListProperty](#scriptintlistproperty) - - [ScriptIntProperty](#scriptintproperty) - - [ScriptObjectListProperty](#scriptobjectlistproperty) - - [ScriptObjectProperty](#scriptobjectproperty) - - [ScriptProperty](#scriptproperty) - - [ScriptStringListProperty](#scriptstringlistproperty) - - [ScriptStringProperty](#scriptstringproperty) - - [Scroll](#scroll) - - [Shout](#shout) - - [SoulGem](#soulgem) - - [SoundCategory](#soundcategory) - - [SoundMarker](#soundmarker) - - [Spell](#spell) - - [Static](#static) - - [TalkingActivator](#talkingactivator) - - [TextureSet](#textureset) - - [Tree](#tree) - - [Water](#water) - - [Weapon](#weapon) - - [WeaponBasicStats](#weaponbasicstats) - - [WordOfPower](#wordofpower) - - [Worldspace](#worldspace) - - - # Aspect Interfaces Aspect Interfaces expose common aspects of records. For example, `INamed` are implemented by all records that have a `Name`. diff --git a/docs/Skyrim-Link-Interfaces.md b/docs/Skyrim-Link-Interfaces.md index bb7199032..9167f9458 100644 --- a/docs/Skyrim-Link-Interfaces.md +++ b/docs/Skyrim-Link-Interfaces.md @@ -1,90 +1,3 @@ - - -## Table Of Contents - -- [Link Interfaces](#link-interfaces) - - [Interfaces to Concrete Classes](#interfaces-to-concrete-classes) - - [IAliasVoiceType](#ialiasvoicetype) - - [IComplexLocation](#icomplexlocation) - - [IConstructible](#iconstructible) - - [IDialog](#idialog) - - [IEffectRecord](#ieffectrecord) - - [IEmittance](#iemittance) - - [IHarvestTarget](#iharvesttarget) - - [IIdleRelation](#iidlerelation) - - [IItem](#iitem) - - [IKeywordLinkedReference](#ikeywordlinkedreference) - - [ILinkedReference](#ilinkedreference) - - [ILocationRecord](#ilocationrecord) - - [ILocationTargetable](#ilocationtargetable) - - [ILockList](#ilocklist) - - [INpcSpawn](#inpcspawn) - - [IObjectId](#iobjectid) - - [IOutfitTarget](#ioutfittarget) - - [IOwner](#iowner) - - [IPlaced](#iplaced) - - [IPlacedSimple](#iplacedsimple) - - [IPlacedThing](#iplacedthing) - - [IPlacedTrapTarget](#iplacedtraptarget) - - [IRegionTarget](#iregiontarget) - - [IRelatable](#irelatable) - - [ISound](#isound) - - [ISpellSpawn](#ispellspawn) - - [Concrete Classes to Interfaces](#concrete-classes-to-interfaces) - - [ActionRecord](#actionrecord) - - [Activator](#activator) - - [AlchemicalApparatus](#alchemicalapparatus) - - [Ammunition](#ammunition) - - [APlaced](#aplaced) - - [APlacedTrap](#aplacedtrap) - - [Armor](#armor) - - [Book](#book) - - [Cell](#cell) - - [Container](#container) - - [DialogResponses](#dialogresponses) - - [DialogTopic](#dialogtopic) - - [Door](#door) - - [Faction](#faction) - - [Flora](#flora) - - [FormList](#formlist) - - [Furniture](#furniture) - - [Hazard](#hazard) - - [IdleAnimation](#idleanimation) - - [IdleMarker](#idlemarker) - - [Ingestible](#ingestible) - - [Ingredient](#ingredient) - - [Key](#key) - - [Keyword](#keyword) - - [LandscapeTexture](#landscapetexture) - - [LeveledItem](#leveleditem) - - [LeveledNpc](#levelednpc) - - [LeveledSpell](#leveledspell) - - [Light](#light) - - [Location](#location) - - [LocationReferenceType](#locationreferencetype) - - [MiscItem](#miscitem) - - [MoveableStatic](#moveablestatic) - - [Npc](#npc) - - [ObjectEffect](#objecteffect) - - [PlacedNpc](#placednpc) - - [PlacedObject](#placedobject) - - [Projectile](#projectile) - - [Race](#race) - - [Region](#region) - - [Scroll](#scroll) - - [Shout](#shout) - - [SoulGem](#soulgem) - - [SoundDescriptor](#sounddescriptor) - - [SoundMarker](#soundmarker) - - [Spell](#spell) - - [Static](#static) - - [TextureSet](#textureset) - - [Tree](#tree) - - [Weapon](#weapon) - - [Worldspace](#worldspace) - - - # Link Interfaces Link Interfaces are used by FormLinks to point to several record types at once. For example, a Container record might be able to contain Armors, Weapons, Ingredients, etc. diff --git a/docs/Skyrim-Perks.md b/docs/Skyrim-Perks.md index 02076bf18..0147672f2 100644 --- a/docs/Skyrim-Perks.md +++ b/docs/Skyrim-Perks.md @@ -1,12 +1,3 @@ - - -## Table Of Contents - -- [Perk Effect Types](#perk-effect-types) -- [Perk Entry Point Effect Types](#perk-entry-point-effect-types) - - - ## Perk Effect Types The abstract base class is `APerkEffect` which is inherited by: - `PerkQuestEffect` @@ -23,4 +14,4 @@ The abstract base class is `APerkEntryPointEffect` which is inherited by: - `PerkAddActivateChoice` - `PerkSelectSpell` - `PerkSelectText` -- `PerkSetText` \ No newline at end of file +- `PerkSetText` diff --git a/docs/Testing-and-Correctness.md b/docs/Testing-and-Correctness.md index b1af2e92b..b1a085455 100644 --- a/docs/Testing-and-Correctness.md +++ b/docs/Testing-and-Correctness.md @@ -1,9 +1 @@ - - -## Table Of Contents - -- [Pre-Processors](#pre-processors) - - - -# Pre-Processors \ No newline at end of file +# Pre-Processors diff --git a/docs/Translated-Strings.md b/docs/Translated-Strings.md index d2a3d007a..63d040642 100644 --- a/docs/Translated-Strings.md +++ b/docs/Translated-Strings.md @@ -1,17 +1,3 @@ - - -## Table Of Contents - -- [TranslatedString](#translatedstring) - - [Multi-Language Support](#multi-language-support) - - [Data Loading Patterns](#data-loading-patterns) -- [Internals](#internals) - - [StringsLookupOverlay](#stringslookupoverlay) - - [StringsFolderLookupOverlay](#stringsfolderlookupoverlay) - - [StringsWriter](#stringswriter) - - - Newer Bethesda titles come with the ability for a single string record to have multiple different translations in different languages. This is provided via the concept of extra `.strings` files, which provide an index to string mapping to alternate translations for a language. On the mod file binary side, string record contents are replaced with an index that can be used to lookup a value in the strings files for the language desired. # TranslatedString @@ -83,4 +69,4 @@ using (var stringsWriter = new StringsWriter(modKey, pathToStringsFolder)) uint key = stringsWriter.Register(myStr, source); System.Console.WriteLine($"{myStr} was registered into the strings files for {source} under key: {key}."); } -``` \ No newline at end of file +``` diff --git a/docs/Translation-Masks.md b/docs/Translation-Masks.md index a5b5b4197..e0bade6c5 100644 --- a/docs/Translation-Masks.md +++ b/docs/Translation-Masks.md @@ -1,19 +1,3 @@ - - -## Table Of Contents - -- [Equality](#equality) -- [DeepCopy(In)](#deepcopyin) -- [Translation Mask Construction](#translation-mask-construction) - - [defaultOn Parameter](#defaulton-parameter) - - [Subobjects](#subobjects) - - [onOverall Parameter](#onoverall-parameter) -- [Subobject Shorthand](#subobject-shorthand) -- [Best Practices](#best-practices) - - [Create Once, Use Many](#create-once-use-many) - - - Several functionalities such as Equality, DeepCopy, and a few others have support for a concept called Translation Masks. These allow for customization of what members are involved in those operations. # Equality @@ -164,4 +148,4 @@ This would copy over everything but the `Destructible` member, but is much easie # Best Practices ## Create Once, Use Many -It's best practice to not create a translation mask per call. As in, try to not make a new mask for every equality call, but rather make the desired mask once ahead of time and reuse it for each equality call if possible. \ No newline at end of file +It's best practice to not create a translation mask per call. As in, try to not make a new mask for every equality call, but rather make the desired mask once ahead of time and reuse it for each equality call if possible. diff --git a/docs/TryGet-Concepts.md b/docs/TryGet-Concepts.md index 6b3171ed1..725279628 100644 --- a/docs/TryGet-Concepts.md +++ b/docs/TryGet-Concepts.md @@ -1,17 +1,3 @@ - - -## Table Of Contents - -- [Direct Access](#direct-access) - - [Mutagen Example](#mutagen-example) - - [Generic C# Example](#generic-c-example) -- [TryGet Patterns Instead](#tryget-patterns-instead) - - [Mutagen Example](#mutagen-example-1) - - [Generic C# Example](#generic-c-example-1) -- [Summary](#summary) - - - There are many concepts within Mutagen that are optional, nullable, or may not link up at runtime. It is good practice to code in a way that is able to handle both situations: @@ -87,4 +73,4 @@ if (dict.TryGetValue(45, out var str)) # Summary It is almost always preferable to use the `Try` alternative when available. It will force you to consider both when it finds what it was looking for, as well as the case when it does not. -Straight "`Try`-less" calls should only be used when you've previously checked that the value exists. Then you know the call is safe, and so it's proper to not need to `Try`. This is rarely used, as the `Try` pattern both checks that it exists and gets the value in one swoop, so a followup retrieval is usually not needed. \ No newline at end of file +Straight "`Try`-less" calls should only be used when you've previously checked that the value exists. Then you know the call is safe, and so it's proper to not need to `Try`. This is rarely used, as the `Try` pattern both checks that it exists and gets the value in one swoop, so a followup retrieval is usually not needed. diff --git a/docs/WPF-Library.md b/docs/WPF-Library.md index c03356163..366b8fca7 100644 --- a/docs/WPF-Library.md +++ b/docs/WPF-Library.md @@ -1,13 +1,3 @@ - - -## Table Of Contents - -- [FormKey Pickers](#formkey-pickers) -- [ModKey Pickers](#modkey-pickers) -- [Reflection Powered Settings](#reflection-powered-settings) - - - If you are making a C# WPF UI application with Mutagen, you can import `Mutagen.Bethesda.WPF` to get some tooling related to Bethesda specific content. - Controls for Bethesda specific concepts, such as FormKeyPickers, LoadOrder displays, etc - Reflection powered settings editor @@ -26,4 +16,4 @@ Explore the right hand side bar for more specifics on the features provided by M ![ModKey Multipicker](https://i.imgur.com/TNnR53A.gif) # Reflection Powered Settings -![Reflection Settings](https://i.imgur.com/PdXSnk5.gif) \ No newline at end of file +![Reflection Settings](https://i.imgur.com/PdXSnk5.gif) diff --git a/docs/Winning-Overrides.md b/docs/Winning-Overrides.md index a55258c93..02e3c521a 100644 --- a/docs/Winning-Overrides.md +++ b/docs/Winning-Overrides.md @@ -1,12 +1,3 @@ - - -## Table Of Contents - -- [Winning Overrides](#winning-overrides) -- [Winning Context Overrides](#winning-context-overrides) - - - # Winning Overrides It is very common task to retrieve the "winning override" version of each record. These are the versions of each record as they exist in the mod with the highest priority, and will thus be what's used by the game when running. @@ -36,4 +27,4 @@ foreach (var npcContext in loadOrder.PriorityOrder.Npc().WinningContextOverrides } ``` -You can read more about [ModContexts](https://github.com/Mutagen-Modding/Mutagen/wiki/ModContexts) to see all the features they offer. \ No newline at end of file +You can read more about [ModContexts](https://github.com/Mutagen-Modding/Mutagen/wiki/ModContexts) to see all the features they offer. From b6f072ecdf7a12baa0a7a8fd2a0254a5d371a605 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 6 May 2023 21:59:27 +0200 Subject: [PATCH 028/135] Replace copy paste descriptions --- Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs index 98aed099e..59cb7e460 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs @@ -29,12 +29,12 @@ public interface IAssetLinkGetter string Extension { get; } /// - /// Extension of the asset + /// Type of the asset /// IAssetType Type { get; } /// - /// Extension of the asset + /// True if Asset Link points to a null path /// public bool IsNull { get; } } From 7405eb9e08a51d36e825623cc793e80a0d481369 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 6 May 2023 22:00:01 +0200 Subject: [PATCH 029/135] Fix crash for missing speakers (for example null speaker) --- .../Assets/VoiceType/VoiceTypeAssetLookup.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Mutagen.Bethesda.Skyrim/Records/Assets/VoiceType/VoiceTypeAssetLookup.cs b/Mutagen.Bethesda.Skyrim/Records/Assets/VoiceType/VoiceTypeAssetLookup.cs index c037cd663..2e69f7642 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Assets/VoiceType/VoiceTypeAssetLookup.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Assets/VoiceType/VoiceTypeAssetLookup.cs @@ -1,4 +1,3 @@ -using Mutagen.Bethesda.Assets; using Mutagen.Bethesda.Plugins; using Mutagen.Bethesda.Plugins.Assets; using Mutagen.Bethesda.Plugins.Cache; @@ -34,12 +33,8 @@ public void Prep(IAssetLinkCache linkCache) var childRaces = new HashSet(); foreach (var mod in _formLinkCache.PriorityOrder) { - foreach (var npc in mod.EnumerateMajorRecords()) - { - if (!_speakerVoices.ContainsKey(npc.FormKey)) - { - _speakerVoices.Add(npc.FormKey, GetVoiceTypes(npc)); - } + foreach (var npc in mod.EnumerateMajorRecords()) { + _speakerVoices.GetOrAdd(npc.FormKey, () => GetVoiceTypes(npc)); foreach (var factionKey in GetFactions(npc)) { @@ -369,9 +364,12 @@ private VoiceContainer GetVoices(IConditionGetter condition, IQuestGetter quest, switch (data) { case IGetIsIDConditionDataGetter getIsId: - if (getIsId.Object.UsesLink()) - { - voices = new VoiceContainer(getIsId.Object.Link.FormKey, _speakerVoices[getIsId.Object.Link.FormKey]); + if (getIsId.Object.UsesLink()) { + var getIsIdFormKey = getIsId.Object.Link.FormKey; + if (_speakerVoices.TryGetValue(getIsIdFormKey, out var idVoices)) + { + voices = new VoiceContainer(getIsIdFormKey, idVoices); + } } break; From 33375054dc52e77c36a5c9b2461ab9c6fc25793c Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 6 May 2023 22:10:10 +0200 Subject: [PATCH 030/135] Make asset type use the conventional extension format that doesn't omit the '.' --- .../Plugins/Assets/TestAssetType.cs | 2 +- Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs | 4 +--- Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs | 4 +--- .../Assets/SkyrimDeformedModelAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs | 3 +-- .../Assets/SkyrimScriptCompiledAssetType.cs | 3 +-- Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs | 4 +--- Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs | 3 +-- Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs | 2 +- .../Records/Common Subrecords/ScriptEntry.cs | 4 ++-- 14 files changed, 15 insertions(+), 24 deletions(-) diff --git a/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs b/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs index ff5c27f4a..f0868cac0 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs +++ b/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs @@ -6,5 +6,5 @@ public class TestAssetType : IAssetType { public static readonly TestAssetType Instance = new(); public string BaseFolder => "Meshes"; - public IEnumerable FileExtensions => new []{"nif"}; + public IEnumerable FileExtensions => new []{".nif"}; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index 1e0a15cc5..c165200c4 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -45,7 +45,7 @@ public AssetLinkGetter(string rawPath) public string DataRelativePath => ConvertToDataRelativePath(RawPath); - public string Extension => Path.GetExtension(RawPath).TrimStart('.'); + public string Extension => Path.GetExtension(RawPath); public IAssetType Type => AssetInstance; diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs index c332081b5..1160eb714 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs @@ -1,10 +1,8 @@ -using System.Collections.Generic; - namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimBehaviorAssetType : SkyrimModelAssetType { public static readonly SkyrimBehaviorAssetType Instance = new(); public string BaseFolder => "Meshes"; - public IEnumerable FileExtensions => new []{ "hkx" }; + public IEnumerable FileExtensions => new []{ ".hkx" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs index 43939136f..3062183d7 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs @@ -1,10 +1,8 @@ -using System.Collections.Generic; - namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimBodyTextureAssetType : SkyrimModelAssetType { public static readonly SkyrimBodyTextureAssetType Instance = new(); public string BaseFolder => "Meshes"; - public IEnumerable FileExtensions => new []{ "egt" }; + public IEnumerable FileExtensions => new []{ ".egt" }; } diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimDeformedModelAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimDeformedModelAssetType.cs index fba2c706a..6deac99d7 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimDeformedModelAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimDeformedModelAssetType.cs @@ -7,5 +7,5 @@ public class SkyrimDeformedModelAssetType : IAssetType { public static readonly SkyrimDeformedModelAssetType Instance = new(); public string BaseFolder => "Meshes"; - public IEnumerable FileExtensions => new []{"tri"}; + public IEnumerable FileExtensions => new []{".tri"}; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs index 8726d2707..400febfca 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs @@ -6,5 +6,5 @@ public class SkyrimModelAssetType : IAssetType { public static readonly SkyrimModelAssetType Instance = new(); public string BaseFolder => "Meshes"; - public IEnumerable FileExtensions => new []{"nif"}; + public IEnumerable FileExtensions => new []{".nif"}; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs index c39328b31..44aa03bb6 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using Mutagen.Bethesda.Assets; namespace Mutagen.Bethesda.Skyrim.Assets; @@ -7,5 +6,5 @@ public class SkyrimMusicAssetType : IAssetType { public static readonly SkyrimMusicAssetType Instance = new(); public string BaseFolder => "Music"; - public IEnumerable FileExtensions => new []{ "wav", "xwm" }; + public IEnumerable FileExtensions => new []{ ".wav", ".xwm" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptCompiledAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptCompiledAssetType.cs index 97e238134..5a6d6dd0c 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptCompiledAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptCompiledAssetType.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using Mutagen.Bethesda.Assets; namespace Mutagen.Bethesda.Skyrim.Assets; @@ -6,7 +5,7 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimScriptCompiledAssetType : IAssetType { public static readonly SkyrimScriptCompiledAssetType Instance = new(); - public const string PexExtension = "pex"; + public const string PexExtension = ".pex"; public string BaseFolder => "Scripts"; public IEnumerable FileExtensions => new []{ PexExtension }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs index 26cbec739..8919a26cb 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; -using System.IO; using Mutagen.Bethesda.Assets; namespace Mutagen.Bethesda.Skyrim.Assets; @@ -7,7 +5,7 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimScriptSourceAssetType : IAssetType { public static readonly SkyrimScriptSourceAssetType Instance = new(); - public const string PscExtension = "psc"; + public const string PscExtension = ".psc"; public string BaseFolder => Path.Combine("Scripts", "Source"); public IEnumerable FileExtensions => new []{ PscExtension }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs index 297f156db..1f838342e 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs @@ -7,5 +7,5 @@ public class SkyrimSeqAssetType : IAssetType { public static readonly SkyrimSeqAssetType Instance = new(); public string BaseFolder => "Seq"; - public IEnumerable FileExtensions => new []{ "seq" }; + public IEnumerable FileExtensions => new []{ ".seq" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs index 7cbfed11b..b3cc85b51 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs @@ -7,5 +7,5 @@ public class SkyrimSoundAssetType : IAssetType { public static readonly SkyrimSoundAssetType Instance = new(); public string BaseFolder => "Sound"; - public IEnumerable FileExtensions => new []{ "wav", "xwm" }; + public IEnumerable FileExtensions => new []{ ".wav", ".xwm" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs index ec08fbd75..dc0554479 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using Mutagen.Bethesda.Assets; namespace Mutagen.Bethesda.Skyrim.Assets; @@ -7,5 +6,5 @@ public class SkyrimTextureAssetType : IAssetType { public static readonly SkyrimTextureAssetType Instance = new(); public string BaseFolder => "Textures"; - public IEnumerable FileExtensions => new []{ "dds", "png" }; + public IEnumerable FileExtensions => new []{ ".dds", ".png" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs index 71befc780..87975077f 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs @@ -7,7 +7,7 @@ public class SkyrimTranslationAssetType : IAssetType { public static readonly SkyrimTranslationAssetType Instance = new(); public string BaseFolder => "Strings"; - public IEnumerable FileExtensions => new []{ "dlstrings", "ilstrings", "strings" }; + public IEnumerable FileExtensions => new []{ ".dlstrings", ".ilstrings", ".strings" }; public static IEnumerable Languages => new []{ "english", diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs index adcdf54e5..5bb1f7f3f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs @@ -22,8 +22,8 @@ public static partial IEnumerable GetInferredAssetLinks(IScriptEntry { if (string.IsNullOrWhiteSpace(obj.Name)) yield break; - yield return new AssetLink($"{obj.Name}.{SkyrimScriptCompiledAssetType.PexExtension}"); - yield return new AssetLink($"{obj.Name}.{SkyrimScriptSourceAssetType.PscExtension}"); + yield return new AssetLink(obj.Name + SkyrimScriptCompiledAssetType.PexExtension); + yield return new AssetLink(obj.Name + SkyrimScriptSourceAssetType.PscExtension); } } From 19a2b43dda26b944afbffb23e4adc1b45ef42191 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 6 May 2023 22:25:12 +0200 Subject: [PATCH 031/135] Move static fields into non-generic interface --- .../Plugins/Assets/AssetLink.cs | 46 ++++++++----------- .../Plugins/Assets/IAssetLink.cs | 10 ++++ 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index 1e0a15cc5..e75afaf70 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -12,16 +12,6 @@ namespace Mutagen.Bethesda.Plugins.Assets; public class AssetLinkGetter : IComparable>, IAssetLinkGetter where TAssetType : class, IAssetType { - protected static readonly string NullPath = string.Empty; - protected static readonly StringComparison PathComparison = StringComparison.OrdinalIgnoreCase; - protected static readonly StringComparer PathComparer = StringComparer.FromComparison(PathComparison); - protected const string DataDirectory = "Data"; - protected static readonly string DataPrefix = DataDirectory + Path.DirectorySeparatorChar; - protected static readonly string DataPrefixAlt = DataDirectory + Path.AltDirectorySeparatorChar; - protected static readonly string DataInfix = Path.DirectorySeparatorChar + DataDirectory + Path.DirectorySeparatorChar; - protected static readonly string DataInfixAlt = Path.AltDirectorySeparatorChar + DataDirectory + Path.AltDirectorySeparatorChar; - protected static readonly int DataPrefixLength = DataDirectory.Length + 1; - protected string _rawPath; protected static readonly TAssetType AssetInstance; public static readonly AssetLinkGetter Null = new(); @@ -33,7 +23,7 @@ static AssetLinkGetter() public AssetLinkGetter() { - _rawPath = NullPath; + _rawPath = IAssetLinkGetter.NullPath; } public AssetLinkGetter(string rawPath) @@ -60,17 +50,17 @@ public static string ConvertToDataRelativePath(ReadOnlySpan inputPath) // Reduce all absolute paths to the path under data directory if (path.Contains(Path.VolumeSeparatorChar)) { - var dataDirectoryIndex = path.IndexOf(DataInfix, PathComparison); + var dataDirectoryIndex = path.IndexOf(IAssetLinkGetter.DataInfix, IAssetLinkGetter.PathComparison); if (dataDirectoryIndex != -1) { - path = path[(dataDirectoryIndex + DataInfix.Length)..]; + path = path[(dataDirectoryIndex + IAssetLinkGetter.DataInfix.Length)..]; } else { - dataDirectoryIndex = path.IndexOf(DataInfixAlt, PathComparison); + dataDirectoryIndex = path.IndexOf(IAssetLinkGetter.DataInfixAlt, IAssetLinkGetter.PathComparison); if (dataDirectoryIndex != -1) { - path = path[(dataDirectoryIndex + DataInfixAlt.Length)..]; + path = path[(dataDirectoryIndex + IAssetLinkGetter.DataInfixAlt.Length)..]; } } } @@ -80,16 +70,16 @@ public static string ConvertToDataRelativePath(ReadOnlySpan inputPath) .TrimStart(Path.AltDirectorySeparatorChar); // Can be replaced with a version of TrimStart that takes the string comparison into account - if (path.StartsWith(DataPrefix, PathComparison)) + if (path.StartsWith(IAssetLinkGetter.DataPrefix, IAssetLinkGetter.PathComparison)) { - path = path[DataPrefixLength..]; + path = path[IAssetLinkGetter.DataPrefixLength..]; } - else if (path.StartsWith(DataPrefixAlt, PathComparison)) + else if (path.StartsWith(IAssetLinkGetter.DataPrefixAlt, IAssetLinkGetter.PathComparison)) { - path = path[DataPrefixLength..]; + path = path[IAssetLinkGetter.DataPrefixLength..]; } - return path.StartsWith(AssetInstance.BaseFolder, PathComparison) + return path.StartsWith(AssetInstance.BaseFolder, IAssetLinkGetter.PathComparison) ? path.ToString() : Path.Combine(AssetInstance.BaseFolder, path.ToString()); } @@ -109,7 +99,7 @@ public virtual bool Equals(AssetLinkGetter? other) public override int GetHashCode() { - return PathComparer.GetHashCode(DataRelativePath); + return IAssetLinkGetter.PathComparer.GetHashCode(DataRelativePath); } public int CompareTo(AssetLinkGetter? other) @@ -117,10 +107,10 @@ public int CompareTo(AssetLinkGetter? other) if (ReferenceEquals(this, other)) return 0; if (ReferenceEquals(null, other)) return 1; - return PathComparer.Compare(DataRelativePath, other.DataRelativePath); + return IAssetLinkGetter.PathComparer.Compare(DataRelativePath, other.DataRelativePath); } - public bool IsNull => RawPath == NullPath; + public bool IsNull => RawPath == IAssetLinkGetter.NullPath; [return: NotNullIfNotNull("asset")] public static implicit operator string? (AssetLinkGetter? asset) => asset?.RawPath; @@ -143,7 +133,7 @@ public class AssetLink : where TAssetType : class, IAssetType { public AssetLink() - : base(NullPath) + : base(IAssetLinkGetter.NullPath) { } @@ -160,7 +150,7 @@ public bool TrySetPath(string? path) return true; } - if (path.StartsWith(AssetInstance.BaseFolder, PathComparison)) + if (path.StartsWith(AssetInstance.BaseFolder, IAssetLinkGetter.PathComparison)) { _rawPath = path[AssetInstance.BaseFolder.Length..]; _rawPath = _rawPath @@ -193,7 +183,7 @@ public AssetLink ShallowClone() public void SetToNull() { - _rawPath = NullPath; + _rawPath = IAssetLinkGetter.NullPath; } public override string ToString() @@ -206,7 +196,7 @@ public virtual bool Equals(AssetLink? other) if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return PathComparer.Equals(RawPath, other.RawPath); + return IAssetLinkGetter.PathComparer.Equals(RawPath, other.RawPath); } public int CompareTo(AssetLink? other) @@ -214,7 +204,7 @@ public int CompareTo(AssetLink? other) if (ReferenceEquals(this, other)) return 0; if (ReferenceEquals(null, other)) return 1; - return PathComparer.Compare(RawPath, other.RawPath); + return IAssetLinkGetter.PathComparer.Compare(RawPath, other.RawPath); } [return: NotNullIfNotNull("asset")] diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs index 98aed099e..87ccf488a 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs @@ -4,6 +4,16 @@ namespace Mutagen.Bethesda.Plugins.Assets; public interface IAssetLinkGetter { + protected static readonly string NullPath = string.Empty; + protected static readonly StringComparison PathComparison = StringComparison.OrdinalIgnoreCase; + protected static readonly StringComparer PathComparer = StringComparer.FromComparison(PathComparison); + protected const string DataDirectory = "Data"; + protected static readonly string DataPrefix = DataDirectory + Path.DirectorySeparatorChar; + protected static readonly string DataPrefixAlt = DataDirectory + Path.AltDirectorySeparatorChar; + protected static readonly string DataInfix = Path.DirectorySeparatorChar + DataDirectory + Path.DirectorySeparatorChar; + protected static readonly string DataInfixAlt = Path.AltDirectorySeparatorChar + DataDirectory + Path.AltDirectorySeparatorChar; + protected static readonly int DataPrefixLength = DataDirectory.Length + 1; + /// /// Raw path pointing to the asset /// From fca45534808cc74e8499b3aad37808d72161562f Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 6 May 2023 23:12:51 -0500 Subject: [PATCH 032/135] Remove sidebar docs --- docs/_Sidebar.md | 146 ----------------------------------------------- 1 file changed, 146 deletions(-) delete mode 100644 docs/_Sidebar.md diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md deleted file mode 100644 index a7381f4bd..000000000 --- a/docs/_Sidebar.md +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - -[[Home]] - -[[Big Cheat Sheet]] - -
- - [[Plugin Record Suite]] - - * [[ModKey, FormKey, FormLink]] - * [[Generated Classes]] - * [[Binary Importing]] - * [[Binary Overlay]] - * [[Interfaces (Aspect/Link/Getters)]] - * [[Copy Functionality]] - * [[Binary Exporting]] - * [[Equality Checks]] - * [[Translation Masks]] - * [[Flags and Enums]] - * [[AssetLink]] - * [[Binary Format Complexity Abstraction]] - * [[Create, Duplicate, and Override]] - * [[Abstract Subclassing]] - * [[Printing]] - * [[Typical Mod Construction and Importing]] -
- -
- [[Environment]] - - * [[Environment Construction]] - * [[Game Locations]] -
- -
- [[LinkCache]] - - * [[Record Lookup]] - * [[ModContexts]] - * [[Previous Override Iteration]] -
-
- [[Load Order]] - - * [Winning Override Iteration](https://github.com/Mutagen-Modding/Mutagen/wiki/Winning-Overrides) - * [[Has Mod Assertions]] - * Live File Monitoring -
- -[Archives (BSAs)](https://github.com/Mutagen-Modding/Mutagen/wiki/Archives) - -
- Strings - - * [[Translated Strings]] - * [[Strings Overlays]] -
-
- Examples - - * [[Print Some Content]] - * [[Accessing Known Records]] - * [[Record Overrides and Duplication]] - * [[Low Level Examples]] -
-
- Getting Familiar - - * [[Namespaces]] - * [[Intellisense]] - * [[Nullability to Indicate Record Presence]] - * [[Inspect Class Definitions]] - * [[Debugging]] -
-
- Best Practices and Optimizations - - * [[Getters Everywhere?]] - * [[FormLinks Always Target Getter Interfaces]] - * [[FormLinks vs EditorID as Identifiers]] - * [[FormLinks vs FormID/FormKey as Identifiers]] - * [[Reference FormLinks By EditorID]] - * [[LinkCache Resolution Type Choice]] - * [[Lists vs HashSet]] - * [[Enumerable Laziness]] - * [[TryGet Concepts]] - * [[Access Overlays Once]] - * [[ITPO Avoidance]] - * [[Reuse Translation Masks]] - * [[Modifying Groups Being Iterated]] -
-
- [[Testing]] - - * [[AutoFixture]] - * [[Major Record Test Building]] -
-
- [[WPF Library]] - - * [[FormKey Picker]] - * [[ModKey Picker]] - * [[Load Order Display]] - * [[Reflection Powered Settings]] - * [[Adding Required Resources]] -
- -[Dependency Injection](Dependency-Injection) - -[FormKey Allocation/Persistence](FormKey-Allocation-and-Persistence) - -[[Json]] - -
- [[Low Level Tools]] - - * [[Header Structs]] - * [[Game Constants]] - * [[Binary Streams]] - * [[Binary Utility]] -
-
- Game Specific Documentation - -
- Oblivion - -* [[Oblivion Aspect Interfaces]] -* [[Oblivion Link Interfaces]] -
-
- Skyrim - -* [[Skyrim Perks]] -* [[Skyrim Aspect Interfaces]] -* [[Skyrim Link Interfaces]] -
-
- -[[Correctness]] From f5cbf8c06c3f55aeef515e6b31075217989c4a8e Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 6 May 2023 23:14:45 -0500 Subject: [PATCH 033/135] Deploy docs only runs if docs folder changed --- .github/workflows/DeployMkDocs.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/DeployMkDocs.yml b/.github/workflows/DeployMkDocs.yml index 1f723cc89..ab8da79a6 100644 --- a/.github/workflows/DeployMkDocs.yml +++ b/.github/workflows/DeployMkDocs.yml @@ -4,7 +4,10 @@ name: DeployMkDocs on: # Triggers the workflow on push on the master branch push: - branches: [ dev ] + branches: + - dev + paths: + - 'docs/**' # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From f5d276e4b1c705d88f08f302af62830290e7447c Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 6 May 2023 23:49:36 -0500 Subject: [PATCH 034/135] Net6/7 multitarget --- Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj | 2 +- .../Mutagen.Bethesda.Core.UnitTests.csproj | 2 +- Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj | 2 +- .../Mutagen.Bethesda.Fallout4.Generator.csproj | 2 +- Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj | 2 +- Mutagen.Bethesda.Generation/Mutagen.Bethesda.Generation.csproj | 2 +- .../Mutagen.Bethesda.Generator.All.csproj | 2 +- Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj | 2 +- Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj | 2 +- .../Mutagen.Bethesda.Oblivion.Generator.csproj | 2 +- Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj | 2 +- .../Mutagen.Bethesda.Pex.Generator.csproj | 2 +- .../Mutagen.Bethesda.Skyrim.Generator.csproj | 2 +- Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj | 2 +- Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj | 2 +- Mutagen.Bethesda.Testing/Mutagen.Bethesda.Testing.csproj | 2 +- Mutagen.Bethesda.Tests.GUI/Mutagen.Bethesda.Tests.GUI.csproj | 2 +- Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj | 2 +- Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj | 2 +- .../Mutagen.Bethesda.WPF.TestDisplay.csproj | 2 +- .../Mutagen.Bethesda.WPF.UnitTests.csproj | 2 +- Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj | 2 +- Mutagen.Bethesda/Mutagen.Bethesda.csproj | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj b/Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj index 931b45bac..8a54f4218 100644 --- a/Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj +++ b/Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj @@ -1,7 +1,7 @@  - net6.0 + net6.0;net7.0 true Mutagen Mutagen diff --git a/Mutagen.Bethesda.Core.UnitTests/Mutagen.Bethesda.Core.UnitTests.csproj b/Mutagen.Bethesda.Core.UnitTests/Mutagen.Bethesda.Core.UnitTests.csproj index 4e9e8bafc..1ab2bbe58 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Mutagen.Bethesda.Core.UnitTests.csproj +++ b/Mutagen.Bethesda.Core.UnitTests/Mutagen.Bethesda.Core.UnitTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 nullable true Mutagen.Bethesda.UnitTests diff --git a/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj b/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj index c87876b4e..afaa050b0 100644 --- a/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj +++ b/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 False true nullable diff --git a/Mutagen.Bethesda.Fallout4.Generator/Mutagen.Bethesda.Fallout4.Generator.csproj b/Mutagen.Bethesda.Fallout4.Generator/Mutagen.Bethesda.Fallout4.Generator.csproj index 831c33e2f..391cec22e 100644 --- a/Mutagen.Bethesda.Fallout4.Generator/Mutagen.Bethesda.Fallout4.Generator.csproj +++ b/Mutagen.Bethesda.Fallout4.Generator/Mutagen.Bethesda.Fallout4.Generator.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net6.0;net7.0 enable enable diff --git a/Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj b/Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj index bc72eb104..cb1a129f4 100644 --- a/Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj +++ b/Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 true true Noggog diff --git a/Mutagen.Bethesda.Generation/Mutagen.Bethesda.Generation.csproj b/Mutagen.Bethesda.Generation/Mutagen.Bethesda.Generation.csproj index 30db90ef3..a9fd0f08b 100644 --- a/Mutagen.Bethesda.Generation/Mutagen.Bethesda.Generation.csproj +++ b/Mutagen.Bethesda.Generation/Mutagen.Bethesda.Generation.csproj @@ -2,7 +2,7 @@ Library - net6.0 + net6.0;net7.0 false true enable diff --git a/Mutagen.Bethesda.Generator.All/Mutagen.Bethesda.Generator.All.csproj b/Mutagen.Bethesda.Generator.All/Mutagen.Bethesda.Generator.All.csproj index 1731ecd52..d39d22356 100644 --- a/Mutagen.Bethesda.Generator.All/Mutagen.Bethesda.Generator.All.csproj +++ b/Mutagen.Bethesda.Generator.All/Mutagen.Bethesda.Generator.All.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net6.0;net7.0 false true diff --git a/Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj b/Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj index e0a109966..f7dfaf542 100644 --- a/Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj +++ b/Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj @@ -1,7 +1,7 @@  - net6.0 + net6.0;net7.0 true Mutagen.Bethesda.Json Noggog diff --git a/Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj b/Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj index 391a1dc7c..bfb6bfa4a 100644 --- a/Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj +++ b/Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj @@ -1,7 +1,7 @@  - net6.0 + net6.0;net7.0 Noggog Mutagen Mutagen diff --git a/Mutagen.Bethesda.Oblivion.Generator/Mutagen.Bethesda.Oblivion.Generator.csproj b/Mutagen.Bethesda.Oblivion.Generator/Mutagen.Bethesda.Oblivion.Generator.csproj index 9a329eddd..f67d0267a 100644 --- a/Mutagen.Bethesda.Oblivion.Generator/Mutagen.Bethesda.Oblivion.Generator.csproj +++ b/Mutagen.Bethesda.Oblivion.Generator/Mutagen.Bethesda.Oblivion.Generator.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net6.0;net7.0 enable enable diff --git a/Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj b/Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj index d4b37df28..91e89cc93 100644 --- a/Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj +++ b/Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 true true Noggog diff --git a/Mutagen.Bethesda.Pex.Generator/Mutagen.Bethesda.Pex.Generator.csproj b/Mutagen.Bethesda.Pex.Generator/Mutagen.Bethesda.Pex.Generator.csproj index 9a329eddd..f67d0267a 100644 --- a/Mutagen.Bethesda.Pex.Generator/Mutagen.Bethesda.Pex.Generator.csproj +++ b/Mutagen.Bethesda.Pex.Generator/Mutagen.Bethesda.Pex.Generator.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net6.0;net7.0 enable enable diff --git a/Mutagen.Bethesda.Skyrim.Generator/Mutagen.Bethesda.Skyrim.Generator.csproj b/Mutagen.Bethesda.Skyrim.Generator/Mutagen.Bethesda.Skyrim.Generator.csproj index 9a329eddd..f67d0267a 100644 --- a/Mutagen.Bethesda.Skyrim.Generator/Mutagen.Bethesda.Skyrim.Generator.csproj +++ b/Mutagen.Bethesda.Skyrim.Generator/Mutagen.Bethesda.Skyrim.Generator.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net6.0;net7.0 enable enable diff --git a/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj b/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj index 053282fce..608ce29da 100644 --- a/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj +++ b/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 true true Noggog diff --git a/Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj b/Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj index 56fef8cbb..ec55082bf 100644 --- a/Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj +++ b/Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 true Mutagen.Bethesda.Sqlite Noggog diff --git a/Mutagen.Bethesda.Testing/Mutagen.Bethesda.Testing.csproj b/Mutagen.Bethesda.Testing/Mutagen.Bethesda.Testing.csproj index f64936078..a24f4526c 100644 --- a/Mutagen.Bethesda.Testing/Mutagen.Bethesda.Testing.csproj +++ b/Mutagen.Bethesda.Testing/Mutagen.Bethesda.Testing.csproj @@ -1,7 +1,7 @@  - net6.0 + net6.0;net7.0 Mutagen.Bethesda.Testing Noggog Mutagen diff --git a/Mutagen.Bethesda.Tests.GUI/Mutagen.Bethesda.Tests.GUI.csproj b/Mutagen.Bethesda.Tests.GUI/Mutagen.Bethesda.Tests.GUI.csproj index 6ea95173c..3bcdae864 100644 --- a/Mutagen.Bethesda.Tests.GUI/Mutagen.Bethesda.Tests.GUI.csproj +++ b/Mutagen.Bethesda.Tests.GUI/Mutagen.Bethesda.Tests.GUI.csproj @@ -2,7 +2,7 @@ WinExe - net6.0 + net6.0;net7.0 true false Windows diff --git a/Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj b/Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj index 8e7048a60..3cc7dfd70 100644 --- a/Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj +++ b/Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net6.0;net7.0 False false diff --git a/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj b/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj index 556dc17b3..83019693d 100644 --- a/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj +++ b/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 nullable true diff --git a/Mutagen.Bethesda.WPF.TestDisplay/Mutagen.Bethesda.WPF.TestDisplay.csproj b/Mutagen.Bethesda.WPF.TestDisplay/Mutagen.Bethesda.WPF.TestDisplay.csproj index 5ad1c3519..809df22df 100644 --- a/Mutagen.Bethesda.WPF.TestDisplay/Mutagen.Bethesda.WPF.TestDisplay.csproj +++ b/Mutagen.Bethesda.WPF.TestDisplay/Mutagen.Bethesda.WPF.TestDisplay.csproj @@ -2,7 +2,7 @@ WinExe - net6.0 + net6.0;net7.0 Windows true false diff --git a/Mutagen.Bethesda.WPF.UnitTests/Mutagen.Bethesda.WPF.UnitTests.csproj b/Mutagen.Bethesda.WPF.UnitTests/Mutagen.Bethesda.WPF.UnitTests.csproj index b35ddd44a..84474764a 100644 --- a/Mutagen.Bethesda.WPF.UnitTests/Mutagen.Bethesda.WPF.UnitTests.csproj +++ b/Mutagen.Bethesda.WPF.UnitTests/Mutagen.Bethesda.WPF.UnitTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 enable enable Windows diff --git a/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj b/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj index 22d9bf60b..9dc42fe53 100644 --- a/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj +++ b/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj @@ -1,7 +1,7 @@  - net6.0 + net6.0;net7.0 true true true diff --git a/Mutagen.Bethesda/Mutagen.Bethesda.csproj b/Mutagen.Bethesda/Mutagen.Bethesda.csproj index 247e4ce83..7bb89ece2 100644 --- a/Mutagen.Bethesda/Mutagen.Bethesda.csproj +++ b/Mutagen.Bethesda/Mutagen.Bethesda.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 true Mutagen Mutagen From 94b7f5bce36e01e13abfc2593f39c0201017a659 Mon Sep 17 00:00:00 2001 From: Troy Date: Sun, 7 May 2023 01:15:46 -0500 Subject: [PATCH 035/135] remove WPF.TestDisplay from core --- Mutagen.Core.sln | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Mutagen.Core.sln b/Mutagen.Core.sln index cd01219a2..61447297f 100644 --- a/Mutagen.Core.sln +++ b/Mutagen.Core.sln @@ -31,8 +31,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mutagen.Bethesda.WPF.TestDisplay", "Mutagen.Bethesda.WPF.TestDisplay\Mutagen.Bethesda.WPF.TestDisplay.csproj", "{2DEEFF28-3D4A-49D9-A514-599D6047888A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -75,14 +73,9 @@ Global {69E6BE96-A067-43EF-AF7D-0E450A21548F}.Debug|Any CPU.Build.0 = Debug|Any CPU {69E6BE96-A067-43EF-AF7D-0E450A21548F}.Release|Any CPU.ActiveCfg = Release|Any CPU {69E6BE96-A067-43EF-AF7D-0E450A21548F}.Release|Any CPU.Build.0 = Release|Any CPU - {2DEEFF28-3D4A-49D9-A514-599D6047888A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2DEEFF28-3D4A-49D9-A514-599D6047888A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2DEEFF28-3D4A-49D9-A514-599D6047888A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2DEEFF28-3D4A-49D9-A514-599D6047888A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {159FA529-5326-4283-B27C-5933962AF866} = {0B40425A-9B13-433B-BB38-EFB7FEB610BE} {03874A25-3E45-474A-A48D-FF5AADBF66F8} = {0B40425A-9B13-433B-BB38-EFB7FEB610BE} - {2DEEFF28-3D4A-49D9-A514-599D6047888A} = {0B40425A-9B13-433B-BB38-EFB7FEB610BE} EndGlobalSection EndGlobal From a4e353cabb6cf410615677bdf84bc619ecf75ff3 Mon Sep 17 00:00:00 2001 From: nickp Date: Sun, 7 May 2023 16:35:35 +0200 Subject: [PATCH 036/135] Move static fields to new static class AssetLink --- .../Plugins/Assets/AssetLink.cs | 50 ++++++++++++------- .../Plugins/Assets/IAssetLink.cs | 10 ---- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index e75afaf70..c6ac00724 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -2,10 +2,22 @@ using System.Reflection; using Mutagen.Bethesda.Assets; using Mutagen.Bethesda.Plugins.Exceptions; -using Noggog; namespace Mutagen.Bethesda.Plugins.Assets; +public static class AssetLink +{ + public static readonly string NullPath = string.Empty; + public static readonly StringComparison PathComparison = StringComparison.OrdinalIgnoreCase; + public static readonly StringComparer PathComparer = StringComparer.FromComparison(PathComparison); + public const string DataDirectory = "Data"; + public static readonly string DataPrefix = DataDirectory + Path.DirectorySeparatorChar; + public static readonly string DataPrefixAlt = DataDirectory + Path.AltDirectorySeparatorChar; + public static readonly string DataInfix = Path.DirectorySeparatorChar + DataDirectory + Path.DirectorySeparatorChar; + public static readonly string DataInfixAlt = Path.AltDirectorySeparatorChar + DataDirectory + Path.AltDirectorySeparatorChar; + public static readonly int DataPrefixLength = DataDirectory.Length + 1; +} + /// /// Asset referenced by a record /// @@ -23,7 +35,7 @@ static AssetLinkGetter() public AssetLinkGetter() { - _rawPath = IAssetLinkGetter.NullPath; + _rawPath = AssetLink.NullPath; } public AssetLinkGetter(string rawPath) @@ -50,17 +62,17 @@ public static string ConvertToDataRelativePath(ReadOnlySpan inputPath) // Reduce all absolute paths to the path under data directory if (path.Contains(Path.VolumeSeparatorChar)) { - var dataDirectoryIndex = path.IndexOf(IAssetLinkGetter.DataInfix, IAssetLinkGetter.PathComparison); + var dataDirectoryIndex = path.IndexOf(AssetLink.DataInfix, AssetLink.PathComparison); if (dataDirectoryIndex != -1) { - path = path[(dataDirectoryIndex + IAssetLinkGetter.DataInfix.Length)..]; + path = path[(dataDirectoryIndex + AssetLink.DataInfix.Length)..]; } else { - dataDirectoryIndex = path.IndexOf(IAssetLinkGetter.DataInfixAlt, IAssetLinkGetter.PathComparison); + dataDirectoryIndex = path.IndexOf(AssetLink.DataInfixAlt, AssetLink.PathComparison); if (dataDirectoryIndex != -1) { - path = path[(dataDirectoryIndex + IAssetLinkGetter.DataInfixAlt.Length)..]; + path = path[(dataDirectoryIndex + AssetLink.DataInfixAlt.Length)..]; } } } @@ -70,16 +82,16 @@ public static string ConvertToDataRelativePath(ReadOnlySpan inputPath) .TrimStart(Path.AltDirectorySeparatorChar); // Can be replaced with a version of TrimStart that takes the string comparison into account - if (path.StartsWith(IAssetLinkGetter.DataPrefix, IAssetLinkGetter.PathComparison)) + if (path.StartsWith(AssetLink.DataPrefix, AssetLink.PathComparison)) { - path = path[IAssetLinkGetter.DataPrefixLength..]; + path = path[AssetLink.DataPrefixLength..]; } - else if (path.StartsWith(IAssetLinkGetter.DataPrefixAlt, IAssetLinkGetter.PathComparison)) + else if (path.StartsWith(AssetLink.DataPrefixAlt, AssetLink.PathComparison)) { - path = path[IAssetLinkGetter.DataPrefixLength..]; + path = path[AssetLink.DataPrefixLength..]; } - return path.StartsWith(AssetInstance.BaseFolder, IAssetLinkGetter.PathComparison) + return path.StartsWith(AssetInstance.BaseFolder, AssetLink.PathComparison) ? path.ToString() : Path.Combine(AssetInstance.BaseFolder, path.ToString()); } @@ -99,7 +111,7 @@ public virtual bool Equals(AssetLinkGetter? other) public override int GetHashCode() { - return IAssetLinkGetter.PathComparer.GetHashCode(DataRelativePath); + return AssetLink.PathComparer.GetHashCode(DataRelativePath); } public int CompareTo(AssetLinkGetter? other) @@ -107,10 +119,10 @@ public int CompareTo(AssetLinkGetter? other) if (ReferenceEquals(this, other)) return 0; if (ReferenceEquals(null, other)) return 1; - return IAssetLinkGetter.PathComparer.Compare(DataRelativePath, other.DataRelativePath); + return AssetLink.PathComparer.Compare(DataRelativePath, other.DataRelativePath); } - public bool IsNull => RawPath == IAssetLinkGetter.NullPath; + public bool IsNull => RawPath == AssetLink.NullPath; [return: NotNullIfNotNull("asset")] public static implicit operator string? (AssetLinkGetter? asset) => asset?.RawPath; @@ -133,7 +145,7 @@ public class AssetLink : where TAssetType : class, IAssetType { public AssetLink() - : base(IAssetLinkGetter.NullPath) + : base(AssetLink.NullPath) { } @@ -150,7 +162,7 @@ public bool TrySetPath(string? path) return true; } - if (path.StartsWith(AssetInstance.BaseFolder, IAssetLinkGetter.PathComparison)) + if (path.StartsWith(AssetInstance.BaseFolder, AssetLink.PathComparison)) { _rawPath = path[AssetInstance.BaseFolder.Length..]; _rawPath = _rawPath @@ -183,7 +195,7 @@ public AssetLink ShallowClone() public void SetToNull() { - _rawPath = IAssetLinkGetter.NullPath; + _rawPath = AssetLink.NullPath; } public override string ToString() @@ -196,7 +208,7 @@ public virtual bool Equals(AssetLink? other) if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return IAssetLinkGetter.PathComparer.Equals(RawPath, other.RawPath); + return AssetLink.PathComparer.Equals(RawPath, other.RawPath); } public int CompareTo(AssetLink? other) @@ -204,7 +216,7 @@ public int CompareTo(AssetLink? other) if (ReferenceEquals(this, other)) return 0; if (ReferenceEquals(null, other)) return 1; - return IAssetLinkGetter.PathComparer.Compare(RawPath, other.RawPath); + return AssetLink.PathComparer.Compare(RawPath, other.RawPath); } [return: NotNullIfNotNull("asset")] diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs index 87ccf488a..98aed099e 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLink.cs @@ -4,16 +4,6 @@ namespace Mutagen.Bethesda.Plugins.Assets; public interface IAssetLinkGetter { - protected static readonly string NullPath = string.Empty; - protected static readonly StringComparison PathComparison = StringComparison.OrdinalIgnoreCase; - protected static readonly StringComparer PathComparer = StringComparer.FromComparison(PathComparison); - protected const string DataDirectory = "Data"; - protected static readonly string DataPrefix = DataDirectory + Path.DirectorySeparatorChar; - protected static readonly string DataPrefixAlt = DataDirectory + Path.AltDirectorySeparatorChar; - protected static readonly string DataInfix = Path.DirectorySeparatorChar + DataDirectory + Path.DirectorySeparatorChar; - protected static readonly string DataInfixAlt = Path.AltDirectorySeparatorChar + DataDirectory + Path.AltDirectorySeparatorChar; - protected static readonly int DataPrefixLength = DataDirectory.Length + 1; - /// /// Raw path pointing to the asset /// From ba873a4ce21de57c9c3817721cf47eb77ed2354e Mon Sep 17 00:00:00 2001 From: nickp Date: Sun, 7 May 2023 18:28:12 +0200 Subject: [PATCH 037/135] Add static abstract Instance property to IAssetType --- .../Plugins/Assets/TestAssetType.cs | 4 +++ Mutagen.Bethesda.Core/Assets/IAssetType.cs | 30 +++++++++++++++++-- .../Plugins/Assets/AssetLink.cs | 8 +++-- .../Assets/SkyrimBehaviorAssetType.cs | 5 ++++ .../Assets/SkyrimBodyTextureAssetType.cs | 5 ++++ .../Assets/SkyrimDeformedModelAssetType.cs | 4 +++ .../Assets/SkyrimModelAssetType.cs | 4 +++ .../Assets/SkyrimMusicAssetType.cs | 4 +++ .../Assets/SkyrimScriptCompiledAssetType.cs | 4 +++ .../Assets/SkyrimScriptSourceAssetType.cs | 4 +++ .../Assets/SkyrimSeqAssetType.cs | 4 +++ .../Assets/SkyrimSoundAssetType.cs | 4 +++ .../Assets/SkyrimTextureAssetType.cs | 4 +++ .../Assets/SkyrimTranslationAssetType.cs | 4 +++ 14 files changed, 84 insertions(+), 4 deletions(-) diff --git a/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs b/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs index f0868cac0..f0494b57f 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs +++ b/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs @@ -4,7 +4,11 @@ namespace Mutagen.Bethesda.UnitTests.Plugins.Assets; public class TestAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new TestAssetType(); +#else public static readonly TestAssetType Instance = new(); +#endif public string BaseFolder => "Meshes"; public IEnumerable FileExtensions => new []{".nif"}; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Assets/IAssetType.cs b/Mutagen.Bethesda.Core/Assets/IAssetType.cs index b320370b8..969ef3459 100644 --- a/Mutagen.Bethesda.Core/Assets/IAssetType.cs +++ b/Mutagen.Bethesda.Core/Assets/IAssetType.cs @@ -8,6 +8,10 @@ namespace Mutagen.Bethesda.Assets; /// public interface IAssetType { +#if NET7_0 + static abstract IAssetType Instance { get; } +#endif + /// /// Base folder(s) relative to the game's data directory /// @@ -24,8 +28,30 @@ public interface IAssetType /// Release of the game this asset comes from /// Path of the asset /// Instance of the parsed asset type or null if no asset type could be determined - public static IAssetType? GetAssetType(GameRelease gameRelease, string path) - { + public static IAssetType? GetAssetType(GameRelease gameRelease, string path) { +#if NET7_0 + switch (gameRelease) { + case GameRelease.Oblivion: + break; + case GameRelease.SkyrimLE: + case GameRelease.SkyrimSE: + case GameRelease.SkyrimSEGog: + case GameRelease.SkyrimVR: + case GameRelease.EnderalLE: + case GameRelease.EnderalSE: + + break; + case GameRelease.Fallout4: + break; + default: + throw new ArgumentOutOfRangeException(nameof(gameRelease), gameRelease, null); + } +#else throw new NotImplementedException(); +#endif + } + + static IAssetType() { + } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index c165200c4..e3ab600c8 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -23,14 +23,18 @@ public class AssetLinkGetter : IComparable Null = new(); static AssetLinkGetter() { +#if NET7_0 + AssetInstance = TAssetType.Instance; +#else AssetInstance = (TAssetType)(typeof(TAssetType).GetProperty("Instance", BindingFlags.Static)?.GetValue(null) ?? Activator.CreateInstance(typeof(TAssetType)))!; +#endif } - + public AssetLinkGetter() { _rawPath = NullPath; diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs index 1160eb714..66ab5ff2a 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs @@ -1,8 +1,13 @@ +using Mutagen.Bethesda.Assets; namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimBehaviorAssetType : SkyrimModelAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimBehaviorAssetType(); +#else public static readonly SkyrimBehaviorAssetType Instance = new(); +#endif public string BaseFolder => "Meshes"; public IEnumerable FileExtensions => new []{ ".hkx" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs index 3062183d7..204d14990 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs @@ -1,8 +1,13 @@ +using Mutagen.Bethesda.Assets; namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimBodyTextureAssetType : SkyrimModelAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimBodyTextureAssetType(); +#else public static readonly SkyrimBodyTextureAssetType Instance = new(); +#endif public string BaseFolder => "Meshes"; public IEnumerable FileExtensions => new []{ ".egt" }; } diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimDeformedModelAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimDeformedModelAssetType.cs index 6deac99d7..60a54ec11 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimDeformedModelAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimDeformedModelAssetType.cs @@ -5,7 +5,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimDeformedModelAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimDeformedModelAssetType(); +#else public static readonly SkyrimDeformedModelAssetType Instance = new(); +#endif public string BaseFolder => "Meshes"; public IEnumerable FileExtensions => new []{".tri"}; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs index 400febfca..acd96706c 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs @@ -4,7 +4,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimModelAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimModelAssetType(); +#else public static readonly SkyrimModelAssetType Instance = new(); +#endif public string BaseFolder => "Meshes"; public IEnumerable FileExtensions => new []{".nif"}; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs index 44aa03bb6..403e85907 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs @@ -4,7 +4,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimMusicAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimMusicAssetType(); +#else public static readonly SkyrimMusicAssetType Instance = new(); +#endif public string BaseFolder => "Music"; public IEnumerable FileExtensions => new []{ ".wav", ".xwm" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptCompiledAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptCompiledAssetType.cs index 5a6d6dd0c..4de16be7f 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptCompiledAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptCompiledAssetType.cs @@ -4,7 +4,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimScriptCompiledAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimScriptCompiledAssetType(); +#else public static readonly SkyrimScriptCompiledAssetType Instance = new(); +#endif public const string PexExtension = ".pex"; public string BaseFolder => "Scripts"; public IEnumerable FileExtensions => new []{ PexExtension }; diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs index 8919a26cb..da81333ff 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs @@ -4,7 +4,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimScriptSourceAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimScriptSourceAssetType(); +#else public static readonly SkyrimScriptSourceAssetType Instance = new(); +#endif public const string PscExtension = ".psc"; public string BaseFolder => Path.Combine("Scripts", "Source"); public IEnumerable FileExtensions => new []{ PscExtension }; diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs index 1f838342e..b6e261d71 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs @@ -5,7 +5,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimSeqAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimSeqAssetType(); +#else public static readonly SkyrimSeqAssetType Instance = new(); +#endif public string BaseFolder => "Seq"; public IEnumerable FileExtensions => new []{ ".seq" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs index b3cc85b51..ed7ab5033 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs @@ -5,7 +5,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimSoundAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimSoundAssetType(); +#else public static readonly SkyrimSoundAssetType Instance = new(); +#endif public string BaseFolder => "Sound"; public IEnumerable FileExtensions => new []{ ".wav", ".xwm" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs index dc0554479..a7d596d4c 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs @@ -4,7 +4,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimTextureAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimTextureAssetType(); +#else public static readonly SkyrimTextureAssetType Instance = new(); +#endif public string BaseFolder => "Textures"; public IEnumerable FileExtensions => new []{ ".dds", ".png" }; } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs index 87975077f..4eea611c4 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs @@ -5,7 +5,11 @@ namespace Mutagen.Bethesda.Skyrim.Assets; public class SkyrimTranslationAssetType : IAssetType { +#if NET7_0 + public static IAssetType Instance { get; } = new SkyrimTranslationAssetType(); +#else public static readonly SkyrimTranslationAssetType Instance = new(); +#endif public string BaseFolder => "Strings"; public IEnumerable FileExtensions => new []{ ".dlstrings", ".ilstrings", ".strings" }; From bc43a89e9cddf67fcee493f0de4ca17a11ec36f8 Mon Sep 17 00:00:00 2001 From: nickp Date: Sun, 7 May 2023 21:43:20 +0200 Subject: [PATCH 038/135] Use NET7_0_OR_GREATER instead of NET7_0 --- .../Plugins/Assets/TestAssetType.cs | 2 +- Mutagen.Bethesda.Core/Assets/IAssetType.cs | 4 ++-- Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs | 2 +- .../Assets/SkyrimDeformedModelAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimModelAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimMusicAssetType.cs | 2 +- .../Assets/SkyrimScriptCompiledAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimScriptSourceAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimSeqAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimSoundAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimTextureAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimTranslationAssetType.cs | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs b/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs index f0494b57f..85ef92d15 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs +++ b/Mutagen.Bethesda.Core.UnitTests/Plugins/Assets/TestAssetType.cs @@ -4,7 +4,7 @@ namespace Mutagen.Bethesda.UnitTests.Plugins.Assets; public class TestAssetType : IAssetType { -#if NET7_0 +#if NET7_0_OR_GREATER public static IAssetType Instance { get; } = new TestAssetType(); #else public static readonly TestAssetType Instance = new(); diff --git a/Mutagen.Bethesda.Core/Assets/IAssetType.cs b/Mutagen.Bethesda.Core/Assets/IAssetType.cs index 969ef3459..56ac55895 100644 --- a/Mutagen.Bethesda.Core/Assets/IAssetType.cs +++ b/Mutagen.Bethesda.Core/Assets/IAssetType.cs @@ -8,7 +8,7 @@ namespace Mutagen.Bethesda.Assets; /// public interface IAssetType { -#if NET7_0 +#if NET7_0_OR_GREATER static abstract IAssetType Instance { get; } #endif @@ -29,7 +29,7 @@ public interface IAssetType /// Path of the asset /// Instance of the parsed asset type or null if no asset type could be determined public static IAssetType? GetAssetType(GameRelease gameRelease, string path) { -#if NET7_0 +#if NET7_0_OR_GREATER switch (gameRelease) { case GameRelease.Oblivion: break; diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index e3ab600c8..63601899c 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -28,7 +28,7 @@ public class AssetLinkGetter : IComparable Date: Mon, 8 May 2023 19:28:49 -0500 Subject: [PATCH 039/135] Build fix --- Mutagen.Bethesda.Core/Assets/IAssetType.cs | 2 +- Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Core/Assets/IAssetType.cs b/Mutagen.Bethesda.Core/Assets/IAssetType.cs index 56ac55895..2833c9164 100644 --- a/Mutagen.Bethesda.Core/Assets/IAssetType.cs +++ b/Mutagen.Bethesda.Core/Assets/IAssetType.cs @@ -47,8 +47,8 @@ public interface IAssetType throw new ArgumentOutOfRangeException(nameof(gameRelease), gameRelease, null); } #else - throw new NotImplementedException(); #endif + throw new NotImplementedException(); } static IAssetType() { diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index c1ffe5566..28dcddb41 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -2,6 +2,7 @@ using System.Reflection; using Mutagen.Bethesda.Assets; using Mutagen.Bethesda.Plugins.Exceptions; +using Noggog; namespace Mutagen.Bethesda.Plugins.Assets; From 0f83645c3c1b16332c5f5d404161809a6eb66d52 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Mon, 8 May 2023 19:29:10 -0500 Subject: [PATCH 040/135] ModInstantiator.Importer returns disposable mod interface --- Mutagen.Bethesda.Core/Plugins/Records/ModInstantiator.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Records/ModInstantiator.cs b/Mutagen.Bethesda.Core/Plugins/Records/ModInstantiator.cs index e77ec04c6..d4f5c1d0c 100644 --- a/Mutagen.Bethesda.Core/Plugins/Records/ModInstantiator.cs +++ b/Mutagen.Bethesda.Core/Plugins/Records/ModInstantiator.cs @@ -13,7 +13,7 @@ namespace Mutagen.Bethesda.Plugins.Records /// public static class ModInstantiator { - record Delegates(ModInstantiator.ImporterDelegate Importer, ModInstantiator.ActivatorDelegate Activator); + record Delegates(ModInstantiator.ImporterDelegate Importer, ModInstantiator.ActivatorDelegate Activator); private static Dictionary _dict = new(); @@ -28,13 +28,13 @@ static ModInstantiator() var modRegistration = obj as IModRegistration; if (modRegistration == null) continue; _dict[modRegistration.GameCategory] = new Delegates( - ModInstantiatorReflection.GetOverlay(modRegistration), + ModInstantiatorReflection.GetOverlay(modRegistration), ModInstantiatorReflection.GetActivator(modRegistration)); } } - public static IModGetter Importer(ModPath path, GameRelease release, IFileSystem? fileSystem = null, StringsReadParameters? stringsParam = null) + public static IModDisposeGetter Importer(ModPath path, GameRelease release, IFileSystem? fileSystem = null, StringsReadParameters? stringsParam = null) { return _dict[release.ToCategory()].Importer(path, release, fileSystem, stringsParam); } From a366242ca985b183a3e302c7580206e44463629a Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 23 May 2023 15:43:28 -0500 Subject: [PATCH 041/135] Remove nullable as errors in test project --- Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj b/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj index 83019693d..317e72636 100644 --- a/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj +++ b/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj @@ -2,7 +2,6 @@ net6.0;net7.0 - nullable true From 28fdd74b10e126c910b3a10193f816320f7f511f Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 25 May 2023 01:44:11 -0500 Subject: [PATCH 042/135] Move nuget clear up to targets --- Directory.Build.targets | 8 +++++++- Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj | 4 ---- Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj | 3 --- .../Mutagen.Bethesda.Fallout4.csproj | 4 +--- Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj | 4 ---- Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj | 4 ---- .../Mutagen.Bethesda.Oblivion.csproj | 3 --- Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj | 3 --- .../Mutagen.Bethesda.SourceGenerators.csproj | 4 ---- Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj | 4 ---- Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj | 4 ---- Mutagen.Bethesda/Mutagen.Bethesda.csproj | 4 +--- 12 files changed, 9 insertions(+), 40 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index d36a19c12..f8fc11566 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -10,5 +10,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + + + diff --git a/Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj b/Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj index 8a54f4218..41ef3eacd 100644 --- a/Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj +++ b/Mutagen.Bethesda.Autofac/Mutagen.Bethesda.Autofac.csproj @@ -28,8 +28,4 @@ - - - - diff --git a/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj b/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj index afaa050b0..3ee1aef58 100644 --- a/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj +++ b/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj @@ -819,7 +819,4 @@ - - - \ No newline at end of file diff --git a/Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj b/Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj index cb1a129f4..505fa02fd 100644 --- a/Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj +++ b/Mutagen.Bethesda.Fallout4/Mutagen.Bethesda.Fallout4.csproj @@ -2508,7 +2508,5 @@ None - - - + \ No newline at end of file diff --git a/Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj b/Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj index f7dfaf542..73dc697f0 100644 --- a/Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj +++ b/Mutagen.Bethesda.Json/Mutagen.Bethesda.Json.csproj @@ -26,8 +26,4 @@ - - - - diff --git a/Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj b/Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj index bfb6bfa4a..e650955a3 100644 --- a/Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj +++ b/Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj @@ -23,10 +23,6 @@ true - - - - diff --git a/Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj b/Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj index 91e89cc93..c18fda342 100644 --- a/Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj +++ b/Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj @@ -919,7 +919,4 @@ - - - \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj b/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj index 608ce29da..67279e3f2 100644 --- a/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj +++ b/Mutagen.Bethesda.Skyrim/Mutagen.Bethesda.Skyrim.csproj @@ -4680,7 +4680,4 @@ - - - \ No newline at end of file diff --git a/Mutagen.Bethesda.SourceGenerators/Mutagen.Bethesda.SourceGenerators.csproj b/Mutagen.Bethesda.SourceGenerators/Mutagen.Bethesda.SourceGenerators.csproj index c2cf6b073..475845a4a 100644 --- a/Mutagen.Bethesda.SourceGenerators/Mutagen.Bethesda.SourceGenerators.csproj +++ b/Mutagen.Bethesda.SourceGenerators/Mutagen.Bethesda.SourceGenerators.csproj @@ -40,8 +40,4 @@ - - - - diff --git a/Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj b/Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj index ec55082bf..21c9487aa 100644 --- a/Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj +++ b/Mutagen.Bethesda.Sqlite/Mutagen.Bethesda.Sqlite.csproj @@ -34,8 +34,4 @@ - - - - diff --git a/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj b/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj index 9dc42fe53..bd5efb66f 100644 --- a/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj +++ b/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj @@ -45,10 +45,6 @@ Compile - - - - high diff --git a/Mutagen.Bethesda/Mutagen.Bethesda.csproj b/Mutagen.Bethesda/Mutagen.Bethesda.csproj index 7bb89ece2..d408898bb 100644 --- a/Mutagen.Bethesda/Mutagen.Bethesda.csproj +++ b/Mutagen.Bethesda/Mutagen.Bethesda.csproj @@ -34,7 +34,5 @@ - - - + \ No newline at end of file From 7e5a222d00c8d093edd4f81d38e06476e7a6daff Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 6 Jun 2023 18:02:15 -0500 Subject: [PATCH 043/135] Small if statement improvement --- .../Plugins/Binary/Translations/ModHeaderWriteLogic.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/ModHeaderWriteLogic.cs b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/ModHeaderWriteLogic.cs index 0c432763e..b24319cc0 100644 --- a/Mutagen.Bethesda.Core/Plugins/Binary/Translations/ModHeaderWriteLogic.cs +++ b/Mutagen.Bethesda.Core/Plugins/Binary/Translations/ModHeaderWriteLogic.cs @@ -235,7 +235,7 @@ private void SortMasters(List modKeys) } catch (Exception ex) { - if (!(ex is ArgumentOutOfRangeException) && !(ex is InvalidOperationException)) throw; + if (ex is not ArgumentOutOfRangeException && ex is not InvalidOperationException) throw; var keys = modKeys.ToHashSet(); keys.Remove(lo.LoadOrder); var modToComplainAbout = keys.First(); From 438b2c097c89805372bfe4a26de1167e98627ff0 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 6 Jun 2023 18:14:53 -0500 Subject: [PATCH 044/135] ModKey comparison /w capitalization difference tests --- .../Plugins/ModKeyTests.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Mutagen.Bethesda.Core.UnitTests/Plugins/ModKeyTests.cs b/Mutagen.Bethesda.Core.UnitTests/Plugins/ModKeyTests.cs index b4980f46d..2d5ad6837 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Plugins/ModKeyTests.cs +++ b/Mutagen.Bethesda.Core.UnitTests/Plugins/ModKeyTests.cs @@ -205,6 +205,7 @@ public void Comparer_Alphabetical_Equal() Assert.Equal(0, compare.Compare(k2, k1)); } #endregion + #region ModKey List [Fact] public void Comparer_ModKeyList_Typical() @@ -247,7 +248,41 @@ public void Comparer_ModKeyList_Unknown() var compare = ModKey.LoadOrderComparer(modKeys); Assert.Throws(() => compare.Compare(k1, k2)); } + + [Fact] + public void Comparer_ModKeyList_CapitalizationDifferences() + { + List modKeys = new List() + { + ModKey.FromNameAndExtension("Oblivion.esm"), + ModKey.FromNameAndExtension("Knights.esm"), + }; + ModKey k1 = ModKey.FromNameAndExtension("oblivion.esm"); + ModKey k2 = ModKey.FromNameAndExtension("Knights.esm"); + var compare = ModKey.LoadOrderComparer(modKeys); + Assert.True(compare.Compare(k1, k2) < 0); + } + + [Fact] + public void Comparer_ModKeyList_CapitalizationDifferences2() + { + var arr = new ModKey[] { "ModA.esp", "ModB.esp", "modc.esp" }; + var toSort = new List { "ModC.esp", "ModA.esp" }; + toSort.Sort(ModKey.LoadOrderComparer(arr)); + toSort.Should().Equal("ModA.esp", "ModC.esp"); + } + + [Fact] + public void Comparer_ModKeyList_CapitalizationDifferences3() + { + var arr = new ModKey[] { "ModA.esp", "ModB.esp", "ModC.esp" }; + var toSort = new List { "modc.esp", "ModA.esp" }; + toSort.Sort(ModKey.LoadOrderComparer(arr)); + toSort.Should().Equal("ModA.esp", "modc.esp"); + } + #endregion + #endregion [Fact] From 595a56cbf9b257a6bc1f6d21f157024b84b366b6 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 6 Jun 2023 18:56:21 -0500 Subject: [PATCH 045/135] Fix for ModKey equality to use the same StringComparison as the Hash --- Mutagen.Bethesda.Kernel/Plugins/ModKey.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Kernel/Plugins/ModKey.cs b/Mutagen.Bethesda.Kernel/Plugins/ModKey.cs index 20c733767..42df9201d 100644 --- a/Mutagen.Bethesda.Kernel/Plugins/ModKey.cs +++ b/Mutagen.Bethesda.Kernel/Plugins/ModKey.cs @@ -102,7 +102,7 @@ public bool Equals(ModKey other) { return (IsNull && other.IsNull) || (this.Type == other.Type - && string.Equals(this.Name, other.Name, StringComparison.CurrentCultureIgnoreCase)); + && string.Equals(this.Name, other.Name, StringComparison.OrdinalIgnoreCase)); } /// From e90fdea077f82fa322e4f682fb5346ef764621d3 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 6 Jun 2023 18:56:21 -0500 Subject: [PATCH 046/135] Fix for ModKey equality to use the same StringComparison as the Hash --- Mutagen.Bethesda.Kernel/Plugins/ModKey.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Kernel/Plugins/ModKey.cs b/Mutagen.Bethesda.Kernel/Plugins/ModKey.cs index 20c733767..42df9201d 100644 --- a/Mutagen.Bethesda.Kernel/Plugins/ModKey.cs +++ b/Mutagen.Bethesda.Kernel/Plugins/ModKey.cs @@ -102,7 +102,7 @@ public bool Equals(ModKey other) { return (IsNull && other.IsNull) || (this.Type == other.Type - && string.Equals(this.Name, other.Name, StringComparison.CurrentCultureIgnoreCase)); + && string.Equals(this.Name, other.Name, StringComparison.OrdinalIgnoreCase)); } /// From 33108108f8f08a19355a54f9435bf1ba076b20b4 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 6 Jun 2023 23:55:54 -0500 Subject: [PATCH 047/135] Remove nullable as errors in test project --- Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj b/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj index 556dc17b3..0e8c1561d 100644 --- a/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj +++ b/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj @@ -2,7 +2,6 @@ net6.0 - nullable true From a63e6e705602f174ee610ac1b7bd29ecc2e82846 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 16 Jun 2023 16:05:44 -0500 Subject: [PATCH 048/135] AssetLink implicit operator from FilePath --- Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index 28dcddb41..c88abb103 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -229,4 +229,7 @@ public int CompareTo(AssetLink? other) [return: NotNullIfNotNull("path")] public static implicit operator AssetLink?(string? path) => path == null ? null : new(path); + + [return: NotNullIfNotNull("path")] + public static implicit operator AssetLink?(FilePath? path) => path == null ? null : new(path.Value.Path); } From 61f2771d36f228dfec83ba7d54810b2244ff561f Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 16 Jun 2023 16:05:48 -0500 Subject: [PATCH 049/135] nuget bump --- Directory.Packages.props | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index c13617958..831b58bab 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,10 +24,10 @@ - 2.56.0.1-dev + 2.56.0.1-CI-20230616-201200 - 2.56.0.1-dev + 2.56.0.1-CI-20230616-201200 @@ -39,16 +39,16 @@ - 2.57.0.1-dev + 2.58.0.1-CI-20230615-044789 - 2.57.0.1-dev + 2.58.0.1-CI-20230615-044789 - 2.57.0.1-dev + 2.58.0.1-CI-20230615-044789 - 2.57.0.1-dev + 2.58.0.1-CI-20230615-044789 From 9134a772e5c74ae5472007f1b2b644a7810a5610 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 16 Jun 2023 16:29:57 -0500 Subject: [PATCH 050/135] CI updates --- .github/workflows/ci-build.yml | 83 ++++++++++++++++++++++++++++++++ .github/workflows/ci-dev.yml | 42 ---------------- .github/workflows/ci-linux.yml | 42 ---------------- .github/workflows/ci-release.yml | 42 ---------------- .github/workflows/publish.yml | 32 ------------ Directory.Build.props | 18 +++---- 6 files changed, 92 insertions(+), 167 deletions(-) create mode 100644 .github/workflows/ci-build.yml delete mode 100644 .github/workflows/ci-dev.yml delete mode 100644 .github/workflows/ci-linux.yml delete mode 100644 .github/workflows/ci-release.yml delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 000000000..b920e170c --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,83 @@ +name: Build + +on: + push: + branches: + - dev + - release + pull_request: + release: + types: [published] + inputs: + is_release_event: + description: Should this be a release or a preview package + required: true + default: 'false' + +jobs: + build-test: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + sln: + - Mutagen.Records.sln + - Mutagen.Records.Linux.sln + exclude: + - os: ubuntu-latest + sln: Mutagen.Records.sln + - os: macos-latest + sln: Mutagen.Records.sln + - os: windows-latest + sln: Mutagen.Records.Linux.sln + + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + dotnet clean ${{ matrix.sln }} -c Release && dotnet nuget locals all --clear + dotnet restore ${{ matrix.sln }} + - name: Build + run: dotnet build ${{ matrix.sln }} -c Release --no-restore /p:GeneratePackageOnBuild=false + - name: Test + run: dotnet test ${{ matrix.sln }} -c Release --no-build + + build-test-push: + needs: build-test + runs-on: windows-latest + steps: + - name: Get timestamp + uses: 1466587594/get-current-time@v1 + id: current-time + with: + format: YYYYMMDD-HHmmSS + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install dependencies + run: | + dotnet clean Mutagen.Records.sln -c Release && dotnet nuget locals all --clear + dotnet restore + - name: Build + run: dotnet build Mutagen.Records.sln -c Release --no-restore /p:GeneratePackageOnBuild=false + - name: Pack Preview + if: ${{ success() && (github.event.inputs.is_release_event != 'true' || github.ref != 'refs/heads/release') }} + run: | + dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out --version-suffix "CI-${{ steps.current-time.outputs.formattedTime }}" + - name: Pack Release + if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/release' }} + run: | + dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out + - name: Publish to Github + uses: svenstaro/upload-release-action@v2 + if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/release' }} + with: + file: "**/*.nupkg" + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.release.tag_name }} + file_glob: "true" + - name: Publish to Nuget.org + run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --no-symbols + diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml deleted file mode 100644 index 85e35a531..000000000 --- a/.github/workflows/ci-dev.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Dev - -on: - push: - branches: [ dev ] - pull_request: - branches: [ dev ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - sln: - - Mutagen.Records.sln - - Mutagen.Records.Linux.sln - exclude: - - os: ubuntu-latest - sln: Mutagen.Records.sln - - os: macos-latest - sln: Mutagen.Records.sln - - os: windows-latest - sln: Mutagen.Records.Linux.sln - - steps: - - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.* - - name: Install dependencies - run: | - dotnet clean ${{ matrix.sln }} -c Release && dotnet nuget locals all --clear - dotnet restore ${{ matrix.sln }} - - name: Build - run: dotnet build ${{ matrix.sln }} -c Release --no-restore - - name: Test - run: dotnet test ${{ matrix.sln }} -c Release --no-build diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml deleted file mode 100644 index 0985b4df3..000000000 --- a/.github/workflows/ci-linux.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Linux - -on: - push: - branches: [ linux ] - pull_request: - branches: [ linux ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - sln: - - Mutagen.Records.sln - - Mutagen.Records.Linux.sln - exclude: - - os: ubuntu-latest - sln: Mutagen.Records.sln - - os: macos-latest - sln: Mutagen.Records.sln - - os: windows-latest - sln: Mutagen.Records.Linux.sln - - steps: - - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.* - - name: Install dependencies - run: | - dotnet clean ${{ matrix.sln }} -c Release && dotnet nuget locals all --clear - dotnet restore ${{ matrix.sln }} - - name: Build - run: dotnet build ${{ matrix.sln }} -c Release --no-restore - - name: Test - run: dotnet test ${{ matrix.sln }} -c Release --no-build diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml deleted file mode 100644 index 1ba0f2779..000000000 --- a/.github/workflows/ci-release.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Release - -on: - push: - branches: [ release ] - pull_request: - branches: [ release ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - sln: - - Mutagen.Records.sln - - Mutagen.Records.Linux.sln - exclude: - - os: ubuntu-latest - sln: Mutagen.Records.sln - - os: macos-latest - sln: Mutagen.Records.sln - - os: windows-latest - sln: Mutagen.Records.Linux.sln - - steps: - - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.* - - name: Install dependencies - run: | - dotnet clean ${{ matrix.sln }} -c Release && dotnet nuget locals all --clear - dotnet restore ${{ matrix.sln }} - - name: Build - run: dotnet build ${{ matrix.sln }} -c Release --no-restore - - name: Test - run: dotnet test ${{ matrix.sln }} -c Release --no-build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 9fe2cacfc..000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Publish - -on: - release: - types: [published] - -jobs: - release: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.* - - name: Install dependencies - run: | - dotnet clean Mutagen.Records.sln -c Release && dotnet nuget locals all --clear - dotnet restore Mutagen.Records.sln - - name: Build - run: dotnet build Mutagen.Records.sln --no-restore -c Release /p:Version=${{ github.event.release.tag_name }} -p:PackageReleaseNotes="See https://github.com/Mutagen-Modding/Mutagen/releases/tag/${{ github.event.release.tag_name }}" - - name: Test - run: dotnet test Mutagen.Records.sln --no-build -c Release - - name: Publish to Github - uses: svenstaro/upload-release-action@v2 - with: - file: "**/*.nupkg" - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.event.release.tag_name }} - file_glob: "true" - - name: Publish to Nuget.org - run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --no-symbols diff --git a/Directory.Build.props b/Directory.Build.props index 039420f22..54d9fb297 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -18,14 +18,14 @@ BeforeTargets="GetAssemblyVersion;GetPackageVersion" DependsOnTargets="GitVersion" Returns="$(PackageVersion)"> - - .1-dev - $(GitSemVerDashLabel) - .1 - $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) - $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(DevLabel) - $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) - $(PackageVersion) - + + .1-dev + .1-$(VersionSuffix) + .1 + $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) + $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) + $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(DevLabel) + $(PackageVersion) + From af6f705c99e63b58a0bd76e8c831b7e051cd6921 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 16 Jun 2023 18:00:42 -0500 Subject: [PATCH 051/135] CI updates --- .github/workflows/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index b920e170c..a340acca8 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -59,7 +59,7 @@ jobs: - name: Install dependencies run: | dotnet clean Mutagen.Records.sln -c Release && dotnet nuget locals all --clear - dotnet restore + dotnet restore Mutagen.Records.sln - name: Build run: dotnet build Mutagen.Records.sln -c Release --no-restore /p:GeneratePackageOnBuild=false - name: Pack Preview From ea76b2987d3a0b63ebd65befc79a4eb06ac73652 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Mon, 19 Jun 2023 00:14:14 -0500 Subject: [PATCH 052/135] CI updates --- .github/workflows/ci-build.yml | 2 -- Directory.Build.props | 47 ++++++++++++++++++++-------------- Directory.Build.targets | 12 --------- Directory.Packages.props | 12 ++++----- 4 files changed, 34 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index a340acca8..720c5164c 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -78,6 +78,4 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.event.release.tag_name }} file_glob: "true" - - name: Publish to Nuget.org - run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --no-symbols diff --git a/Directory.Build.props b/Directory.Build.props index 54d9fb297..f15889324 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,31 +1,40 @@ - true + true + false + enable + preview + true - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - .1-dev - .1-$(VersionSuffix) - .1 - $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) - $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) - $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(DevLabel) - $(PackageVersion) - + BeforeTargets="GetAssemblyVersion;GetPackageVersion;GetAssemblyVersion;GenerateNuspec;GetPackageContents" + DependsOnTargets="GitVersion" + Returns="$(PackageVersion)"> + + .1-dev + .1-$(VersionSuffix) + .1 + $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) + $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) + $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(DevLabel) + $(PackageVersion) + + diff --git a/Directory.Build.targets b/Directory.Build.targets index f8fc11566..c39fbaf82 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,16 +1,4 @@ - - enable - preview - true - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - diff --git a/Directory.Packages.props b/Directory.Packages.props index 831b58bab..4666e2ec6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,10 +24,10 @@ - 2.56.0.1-CI-20230616-201200 + [2.56.0.1-CI-20230619-045454] - 2.56.0.1-CI-20230616-201200 + [2.56.0.1-CI-20230619-045454] @@ -39,16 +39,16 @@ - 2.58.0.1-CI-20230615-044789 + [2.58.0.1-CI-20230619-041947] - 2.58.0.1-CI-20230615-044789 + [2.58.0.1-CI-20230619-041947] - 2.58.0.1-CI-20230615-044789 + [2.58.0.1-CI-20230619-041947] - 2.58.0.1-CI-20230615-044789 + [2.58.0.1-CI-20230619-041947] From 81608b7b6ea7f4fc1556bd6f5b9e4a8be0822fde Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Mon, 19 Jun 2023 00:15:09 -0500 Subject: [PATCH 053/135] Reenable nuget upload --- .github/workflows/ci-build.yml | 2 ++ Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 720c5164c..a340acca8 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -78,4 +78,6 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.event.release.tag_name }} file_glob: "true" + - name: Publish to Nuget.org + run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --no-symbols diff --git a/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj b/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj index bd5efb66f..524a3e4b2 100644 --- a/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj +++ b/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj @@ -56,7 +56,8 @@ - .1-dev + .1-dev + .1-$(VersionSuffix) $(GitSemVerDashLabel) .1 $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) From dad8f366c090b9cd0a7ba23c1dc7b41196aafa5c Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 30 Jun 2023 00:40:42 -0500 Subject: [PATCH 054/135] Comments --- .../Plugins/Exceptions/RecordException.cs | 33 +++++++++++++++++++ .../Plugins/Exceptions/SubrecordException.cs | 15 +++++++++ 2 files changed, 48 insertions(+) diff --git a/Mutagen.Bethesda.Core/Plugins/Exceptions/RecordException.cs b/Mutagen.Bethesda.Core/Plugins/Exceptions/RecordException.cs index 7a1bf794f..b28180c47 100644 --- a/Mutagen.Bethesda.Core/Plugins/Exceptions/RecordException.cs +++ b/Mutagen.Bethesda.Core/Plugins/Exceptions/RecordException.cs @@ -3,6 +3,9 @@ namespace Mutagen.Bethesda.Plugins.Exceptions; +/// +/// An exception contains information about an associated Record +/// public class RecordException : Exception { public ModKey? ModKey { get; private set; } @@ -46,16 +49,25 @@ public RecordException(FormKey? formKey, Type? recordType, ModKey? modKey, strin } #region Enrich + /// + /// Wraps an exception to associate it with a specific major record + /// public static RecordException Enrich(Exception ex, IMajorRecordGetter? majorRec) { return Enrich(ex, majorRec?.FormKey, majorRec?.Registration.ClassType, majorRec?.EditorID); } + /// + /// Wraps an exception to associate it with a specific major record + /// public static RecordException Enrich(Exception ex, ModKey? modKey, IMajorRecordGetter? majorRec) { return Enrich(ex, majorRec?.FormKey, majorRec?.Registration.ClassType, majorRec?.EditorID, modKey); } + /// + /// Wraps an exception to associate it with a specific major record + /// public static RecordException Enrich(Exception ex, FormKey? formKey, Type? recordType, string? edid = null, ModKey? modKey = null) { if (ex is RecordException rec) @@ -96,6 +108,9 @@ private static Type GetRecordType(Type t) return t; } + /// + /// Wraps an exception to associate it with a specific major record + /// public static RecordException Enrich(Exception ex, FormKey? formKey, string? edid, ModKey? modKey = null) where TMajor : IMajorRecordGetter { @@ -107,6 +122,9 @@ public static RecordException Enrich(Exception ex, FormKey? formKey, str modKey); } + /// + /// Wraps an exception to associate it with a specific major record + /// public static RecordException Enrich(Exception ex, ModKey modKey) { if (ex is RecordException rec) @@ -128,6 +146,9 @@ public static RecordException Enrich(Exception ex, ModKey modKey) #endregion #region Create + /// + /// Creates an exception associated with a specific major record + /// public static RecordException Create(string message, IMajorRecordGetter majorRec, Exception? innerException = null) { return new RecordException( @@ -139,6 +160,9 @@ public static RecordException Create(string message, IMajorRecordGetter majorRec innerException: innerException); } + /// + /// Creates an exception associated with a specific major record + /// public static RecordException Create(string message, ModKey? modKey, IMajorRecordGetter majorRec, Exception? innerException = null) { return new RecordException( @@ -150,6 +174,9 @@ public static RecordException Create(string message, ModKey? modKey, IMajorRecor innerException: innerException); } + /// + /// Creates an exception associated with a specific major record + /// public static RecordException Create(string message, FormKey? formKey, Type? recordType, string? edid, ModKey? modKey = null, Exception? innerException = null) { return new RecordException( @@ -161,6 +188,9 @@ public static RecordException Create(string message, FormKey? formKey, Type? rec innerException: innerException); } + /// + /// Creates an exception associated with a specific major record + /// public static RecordException Create(string message, ModKey modKey, Exception? innerException = null) { return new RecordException( @@ -172,6 +202,9 @@ public static RecordException Create(string message, ModKey modKey, Exception? i innerException: innerException); } + /// + /// Creates an exception associated with a specific major record + /// public static RecordException Create(string message, FormKey? formKey, string? edid, ModKey? modKey = null, Exception? innerException = null) where TMajor : IMajorRecordGetter { diff --git a/Mutagen.Bethesda.Core/Plugins/Exceptions/SubrecordException.cs b/Mutagen.Bethesda.Core/Plugins/Exceptions/SubrecordException.cs index 66be7495e..bd8d3b44d 100644 --- a/Mutagen.Bethesda.Core/Plugins/Exceptions/SubrecordException.cs +++ b/Mutagen.Bethesda.Core/Plugins/Exceptions/SubrecordException.cs @@ -1,5 +1,8 @@ namespace Mutagen.Bethesda.Plugins.Exceptions; +/// +/// An exception contains information about an associated Subrecord +/// public class SubrecordException : RecordException { public RecordType Subrecord { get; internal set; } @@ -28,6 +31,9 @@ public SubrecordException(RecordType subRecord, FormKey? formKey, Type? majorRec Subrecord = subRecord; } + /// + /// Wraps an exception to associate it with a specific subrecord + /// public static SubrecordException Enrich(Exception ex, RecordType subRecord) { if (ex is SubrecordException sub) @@ -37,18 +43,27 @@ public static SubrecordException Enrich(Exception ex, RecordType subRecord) return new SubrecordException(subRecord, formKey: null, majorRecordType: null, modKey: null, edid: null, innerException: ex); } + /// + /// Creates an exception associated with a specific subrecord + /// [Obsolete("Use Create instead")] public static SubrecordException Factory(Exception ex, RecordType subRecord) { return Enrich(ex, subRecord); } + /// + /// Wraps an exception to associate it with a specific subrecord + /// [Obsolete("Use Enrich instead")] public static SubrecordException FactoryPassthroughExisting(Exception ex, RecordType subRecord) { return Enrich(ex, subRecord); } + /// + /// Creates an exception associated with a specific subrecord + /// public static SubrecordException Create(string message, RecordType recordType) { return new SubrecordException(recordType, default(FormKey?), default(Type?), default(ModKey?), From 6c17f4a156b6085d57a81a8ec31388f526aa61b1 Mon Sep 17 00:00:00 2001 From: nickp Date: Mon, 3 Jul 2023 11:46:42 +0200 Subject: [PATCH 055/135] Add exclusions to dialogue export for no export flag and sound overrides --- .../Records/Assets/VoiceType/VoiceTypeAssetLookup.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Mutagen.Bethesda.Skyrim/Records/Assets/VoiceType/VoiceTypeAssetLookup.cs b/Mutagen.Bethesda.Skyrim/Records/Assets/VoiceType/VoiceTypeAssetLookup.cs index 2e69f7642..8e28442ee 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Assets/VoiceType/VoiceTypeAssetLookup.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Assets/VoiceType/VoiceTypeAssetLookup.cs @@ -149,6 +149,15 @@ public void Prep(IAssetLinkCache linkCache) var quest = topic.Quest.TryResolve(_formLinkCache); if (quest == null) return null; + //When the quest doesn't allow export return no voices + if ((quest.Flags & Quest.Flag.ExcludeFromDialogExport) != 0) return new VoiceContainer(); + + //When all responses use a sound override, return no voices + if (response.Responses.All(r => !r.Sound.IsNull)) return new VoiceContainer(); + + //If this is a shared info and it's not used, return no voices + if (topic.Subtype == DialogTopic.SubtypeEnum.SharedInfo && !_sharedInfosCache.ContainsKey(response.FormKey)) return new VoiceContainer(); + //Get quest voices VoiceContainer questVoices; if (_questCache.TryGetValue(quest.FormKey, out var questVoiceContainer)) @@ -160,9 +169,6 @@ public void Prep(IAssetLinkCache linkCache) _questCache.Add(quest.FormKey, questVoices); } - //If this is a shared info and it's not used, return no voices - if (topic.Subtype == DialogTopic.SubtypeEnum.SharedInfo && !_sharedInfosCache.ContainsKey(response.FormKey)) return new VoiceContainer(); - //If we have selected default voices, make sure the quest voices are being checked first - they might not be part of default voices var voices = GetVoices(topic, response, quest); if (!questVoices.IsDefault) From b1f76c7d4793ab28e9ecd3932d1cd2b096987235 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 23 Jun 2023 21:57:32 -0500 Subject: [PATCH 056/135] CI update --- .github/workflows/ci-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index a340acca8..1a008847d 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -5,6 +5,7 @@ on: branches: - dev - release + - prerelease pull_request: release: types: [published] From 452b28499053280ca420f6b1ab1fbcc9a7d345f1 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 4 Jul 2023 21:53:44 -0500 Subject: [PATCH 057/135] nuget bump --- Directory.Packages.props | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 4666e2ec6..099f18229 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,10 +24,10 @@ - [2.56.0.1-CI-20230619-045454] + [2.59.0.1-nightly-20230704-193765] - [2.56.0.1-CI-20230619-045454] + [2.59.0.1-nightly-20230704-193765] @@ -39,16 +39,16 @@ - [2.58.0.1-CI-20230619-041947] + [2.59.0.1-nightly-20230704-091177] - [2.58.0.1-CI-20230619-041947] + [2.59.0.1-nightly-20230704-091177] - [2.58.0.1-CI-20230619-041947] + [2.59.0.1-nightly-20230704-091177] - [2.58.0.1-CI-20230619-041947] + [2.59.0.1-nightly-20230704-091177] From 99fe4befce7a893bb1e3e1a6df34256730fa4a33 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 4 Jul 2023 22:02:03 -0500 Subject: [PATCH 058/135] CI updates --- .github/workflows/ci-build.yml | 48 +----------- .github/workflows/ci-publish.yml | 125 +++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/ci-publish.yml diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 1a008847d..ec4421eeb 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -7,13 +7,10 @@ on: - release - prerelease pull_request: - release: - types: [published] - inputs: - is_release_event: - description: Should this be a release or a preview package - required: true - default: 'false' + branches: + - dev + - release + - prerelease jobs: build-test: @@ -45,40 +42,3 @@ jobs: - name: Test run: dotnet test ${{ matrix.sln }} -c Release --no-build - build-test-push: - needs: build-test - runs-on: windows-latest - steps: - - name: Get timestamp - uses: 1466587594/get-current-time@v1 - id: current-time - with: - format: YYYYMMDD-HHmmSS - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Install dependencies - run: | - dotnet clean Mutagen.Records.sln -c Release && dotnet nuget locals all --clear - dotnet restore Mutagen.Records.sln - - name: Build - run: dotnet build Mutagen.Records.sln -c Release --no-restore /p:GeneratePackageOnBuild=false - - name: Pack Preview - if: ${{ success() && (github.event.inputs.is_release_event != 'true' || github.ref != 'refs/heads/release') }} - run: | - dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out --version-suffix "CI-${{ steps.current-time.outputs.formattedTime }}" - - name: Pack Release - if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/release' }} - run: | - dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out - - name: Publish to Github - uses: svenstaro/upload-release-action@v2 - if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/release' }} - with: - file: "**/*.nupkg" - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.event.release.tag_name }} - file_glob: "true" - - name: Publish to Nuget.org - run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --no-symbols - diff --git a/.github/workflows/ci-publish.yml b/.github/workflows/ci-publish.yml new file mode 100644 index 000000000..e44cbc646 --- /dev/null +++ b/.github/workflows/ci-publish.yml @@ -0,0 +1,125 @@ +name: Publish + +on: + schedule: + - cron: '40 9 * * *' + workflow_dispatch: + release: + types: [published] + inputs: + is_release_event: + description: Should this be a release or a preview package + required: true + default: 'false' + +jobs: + activity-short-circuit: + runs-on: ubuntu-latest + outputs: + same_sha: ${{ steps.check.outputs.same_sha }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get Activity Short Circuit + id: check + run: | + git branch -a + git fetch origin nightly:nightly + head_sha=$(git rev-parse --verify HEAD) + nightly_sha=$(git rev-parse --verify nightly) + if [[ "$head_sha" == "$nightly_sha" ]]; then + same_sha=true; + else + same_sha=false; + fi + echo "head_sha=$head_sha" + echo "nightly_sha=$nightly_sha" + echo "same_sha=${same_sha}" + echo "same_sha=${same_sha}" >> $GITHUB_OUTPUT + + build-test: + needs: activity-short-circuit + if: needs.activity-short-circuit.outputs.same_sha == 'false' + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + sln: + - Mutagen.Records.sln + - Mutagen.Records.Linux.sln + exclude: + - os: ubuntu-latest + sln: Mutagen.Records.sln + - os: macos-latest + sln: Mutagen.Records.sln + - os: windows-latest + sln: Mutagen.Records.Linux.sln + + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + dotnet clean ${{ matrix.sln }} -c Release && dotnet nuget locals all --clear + dotnet restore + - name: Build + run: dotnet build ${{ matrix.sln }} -c Release --no-restore + - name: Test + run: dotnet test ${{ matrix.sln }} -c Release --no-build + + build-test-push: + needs: [build-test, activity-short-circuit] + if: needs.activity-short-circuit.outputs.same_sha == 'false' + runs-on: windows-latest + steps: + - name: Get timestamp + uses: 1466587594/get-current-time@v1 + id: current-time + with: + format: YYYYMMDD-HHmmSS + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install dependencies + run: | + dotnet clean Mutagen.Records.sln -c Release && dotnet nuget locals all --clear + dotnet restore Mutagen.Records.sln + - name: Build + run: dotnet build -c Release --no-restore /p:GeneratePackageOnBuild=false + - name: Pack Preview + if: ${{ success() && (github.event.inputs.is_release_event != 'true' || github.ref != 'refs/heads/master') }} + run: | + dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out --version-suffix "nightly-${{ steps.current-time.outputs.formattedTime }}" + - name: Pack Release + if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/master' }} + run: | + dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out + - name: Publish to Github + uses: svenstaro/upload-release-action@v2 + if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/master' }} + with: + file: "**/*.nupkg" + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.release.tag_name }} + file_glob: "true" + - name: Publish to Nuget.org + run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --no-symbols + + update-nightly: + needs: [build-test-push, activity-short-circuit] + if: needs.activity-short-circuit.outputs.same_sha == 'false' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Reset nightly to master + run: | + head_sha=$(git rev-parse --verify HEAD) + echo "head_sha=$head_sha" + git checkout nightly + git reset --hard $head_sha + git push \ No newline at end of file From b34e5aa07235d521c3e30321121ae0e85fc6bbbe Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 4 Jul 2023 22:09:11 -0500 Subject: [PATCH 059/135] Mark nugetizer assets private --- Directory.Packages.props | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 099f18229..de358caa9 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -50,7 +50,11 @@ [2.59.0.1-nightly-20230704-091177] - + + 0.9.5 + all + runtime; build; native; contentfiles; analyzers; buildtransitive + 18.4.26 From 9a39f61e48c9282dd377ddf8dd02f1a95886bdbc Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Tue, 4 Jul 2023 22:10:53 -0500 Subject: [PATCH 060/135] GitInfo assets private --- Directory.Build.props | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index f15889324..77e557900 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,10 +7,13 @@ preview true - - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + From 0bfc66abd4a2ca09c80678d6e37c821be4063084 Mon Sep 17 00:00:00 2001 From: nickp Date: Wed, 5 Jul 2023 22:14:55 +0200 Subject: [PATCH 061/135] Fixed test for latest changes that made topics without responses auto abort --- .../Skyrim/Assets/VoiceTypeAssetLookupTestSkyrim.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/VoiceTypeAssetLookupTestSkyrim.cs b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/VoiceTypeAssetLookupTestSkyrim.cs index c017fe48a..ac27b9482 100644 --- a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/VoiceTypeAssetLookupTestSkyrim.cs +++ b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/VoiceTypeAssetLookupTestSkyrim.cs @@ -27,6 +27,7 @@ public void TestAliasAdditionalVoicesNPCList( SkyrimMod mod, Scene scene, DialogTopic topic, + DialogResponse dialogResponse, Quest quest, DialogResponses dialogResponses, VoiceType voiceType, @@ -38,6 +39,7 @@ public void TestAliasAdditionalVoicesNPCList( string edid2, uint aliasId) { + dialogResponses.Responses.Add(dialogResponse); topic.Responses.Add(dialogResponses); topic.Category = DialogTopic.CategoryEnum.Scene; topic.Quest.SetTo(quest); From a8d98b78afa35b181d75d57688f17781441cb479 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 6 Jul 2023 12:31:05 -0500 Subject: [PATCH 062/135] CI fix --- .github/workflows/ci-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-publish.yml b/.github/workflows/ci-publish.yml index e44cbc646..a4629f008 100644 --- a/.github/workflows/ci-publish.yml +++ b/.github/workflows/ci-publish.yml @@ -64,7 +64,7 @@ jobs: - name: Install dependencies run: | dotnet clean ${{ matrix.sln }} -c Release && dotnet nuget locals all --clear - dotnet restore + dotnet restore ${{ matrix.sln }} - name: Build run: dotnet build ${{ matrix.sln }} -c Release --no-restore - name: Test From 9e1bc4fef6701549ef6eccb7fbc7b39db1f4d7fd Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 6 Jul 2023 14:13:05 -0500 Subject: [PATCH 063/135] AssetLink autofixture support --- .../AutoData/AssetLinkBuilderTests.cs | 49 ++++++++++++++++++ .../AutoData/AssetLinkBuilder.cs | 51 +++++++++++++++++++ .../AutoData/MutagenBaseCustomization.cs | 1 + 3 files changed, 101 insertions(+) create mode 100644 Mutagen.Bethesda.Core.UnitTests/AutoData/AssetLinkBuilderTests.cs create mode 100644 Mutagen.Bethesda.Testing/AutoData/AssetLinkBuilder.cs diff --git a/Mutagen.Bethesda.Core.UnitTests/AutoData/AssetLinkBuilderTests.cs b/Mutagen.Bethesda.Core.UnitTests/AutoData/AssetLinkBuilderTests.cs new file mode 100644 index 000000000..4568dfcdd --- /dev/null +++ b/Mutagen.Bethesda.Core.UnitTests/AutoData/AssetLinkBuilderTests.cs @@ -0,0 +1,49 @@ +using System.IO.Abstractions; +using AutoFixture.Kernel; +using FluentAssertions; +using Mutagen.Bethesda.Assets; +using Mutagen.Bethesda.Plugins.Assets; +using Mutagen.Bethesda.Testing.AutoData; +using Xunit; + +namespace Mutagen.Bethesda.UnitTests.AutoData; + +public class AssetLinkBuilderTests +{ + public class TestAssetType : IAssetType + { +#if NET7_0_OR_GREATER + public static IAssetType Instance { get; } = new TestAssetType(); +#else + public static readonly TestAssetType Instance = new(); +#endif + public string BaseFolder => "TestFolder"; + public IEnumerable FileExtensions => new []{ ".test" }; + } + + [Theory, BasicAutoData] + public void Typical( + ISpecimenContext context, + AssetLinkBuilder sut) + { + var assetLink = (IAssetLinkGetter)sut.Create(typeof(AssetLink), context); + assetLink.RawPath.Should().Contain(Path.Combine("Data", TestAssetType.Instance.BaseFolder)); + Path.GetExtension(assetLink.RawPath).Should().Be(TestAssetType.Instance.FileExtensions.First()); + } + + [Theory, MutagenAutoData] + public void DifferentPaths( + AssetLink link, + AssetLink link2) + { + link.RawPath.Should().NotBe(link2.RawPath); + } + + [Theory, MutagenAutoData] + public void Existing( + IFileSystem fileSystem, + AssetLink existingLink) + { + fileSystem.File.Exists(existingLink.RawPath).Should().BeTrue(); + } +} \ No newline at end of file diff --git a/Mutagen.Bethesda.Testing/AutoData/AssetLinkBuilder.cs b/Mutagen.Bethesda.Testing/AutoData/AssetLinkBuilder.cs new file mode 100644 index 000000000..dc7a6b64c --- /dev/null +++ b/Mutagen.Bethesda.Testing/AutoData/AssetLinkBuilder.cs @@ -0,0 +1,51 @@ +using System; +using System.IO.Abstractions; +using System.Reflection; +using AutoFixture; +using AutoFixture.Kernel; +using Mutagen.Bethesda.Plugins.Assets; +using Noggog; +using Noggog.Testing.IO; + +namespace Mutagen.Bethesda.Testing.AutoData; + +public class AssetLinkBuilder : ISpecimenBuilder +{ + public object Create(object request, ISpecimenContext context) + { + Type type; + string? name; + if (request is ParameterInfo p) + { + if (p.Name == null) return new NoSpecimen(); + type = p.ParameterType; + name = p.Name; + } + else if (request is Type t) + { + type = t; + name = null; + } + else + { + return new NoSpecimen(); + } + + if (!type.InheritsFrom(typeof(IAssetLinkGetter))) return new NoSpecimen(); + + var link = (IAssetLink)Activator.CreateInstance(type); + + var existing = name != null && name.ContainsInsensitive("existing"); + var fileName = + $"{name}{Path.GetFileNameWithoutExtension(Path.GetRandomFileName())}{link.Type.FileExtensions.First()}"; + + link.RawPath = Path.Combine($"{PathingUtil.DrivePrefix}Data", link.Type.BaseFolder, fileName); + if (existing) + { + var fs = context.Create(); + fs.Directory.CreateDirectory(Path.GetDirectoryName(link.RawPath)); + fs.File.WriteAllText(link.RawPath, string.Empty); + } + return link; + } +} \ No newline at end of file diff --git a/Mutagen.Bethesda.Testing/AutoData/MutagenBaseCustomization.cs b/Mutagen.Bethesda.Testing/AutoData/MutagenBaseCustomization.cs index e08daa800..99cf4943d 100644 --- a/Mutagen.Bethesda.Testing/AutoData/MutagenBaseCustomization.cs +++ b/Mutagen.Bethesda.Testing/AutoData/MutagenBaseCustomization.cs @@ -24,6 +24,7 @@ public void Customize(IFixture fixture) fixture.Customizations.Add(new ModPathBuilder()); fixture.Customizations.Add(new OrderBuilder()); fixture.Customizations.Add(new AbstractSubclassBuilder()); + fixture.Customizations.Add(new AssetLinkBuilder()); fixture.Inject(MutagenEncodingProvider.Instance); } } \ No newline at end of file From c1eb80380e164cdd2d1f0bc1a59a5b739f6a3b98 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 7 Jul 2023 01:43:17 -0500 Subject: [PATCH 064/135] CI fix --- .github/workflows/ci-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-publish.yml b/.github/workflows/ci-publish.yml index a4629f008..ad2496775 100644 --- a/.github/workflows/ci-publish.yml +++ b/.github/workflows/ci-publish.yml @@ -88,7 +88,7 @@ jobs: dotnet clean Mutagen.Records.sln -c Release && dotnet nuget locals all --clear dotnet restore Mutagen.Records.sln - name: Build - run: dotnet build -c Release --no-restore /p:GeneratePackageOnBuild=false + run: dotnet build Mutagen.Records.sln -c Release --no-restore /p:GeneratePackageOnBuild=false - name: Pack Preview if: ${{ success() && (github.event.inputs.is_release_event != 'true' || github.ref != 'refs/heads/master') }} run: | From 8dc1692a2182db583d776ef0cffe306cf86bb1cb Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Mon, 10 Jul 2023 13:04:26 -0500 Subject: [PATCH 065/135] Static Lod handling of overflow bytes internalized --- .../Records/Major Records/DistantLod.cs | 42 ++- .../Major Records/DistantLod_Generated.cs | 116 +------ .../Records/Major Records/Static.cs | 3 +- .../Records/Major Records/Static.xml | 3 +- .../Records/Major Records/Lod.cs | 23 +- .../Records/Major Records/Lod_Generated.cs | 292 +----------------- .../Records/Major Records/Static.xml | 4 - .../Processing/Fallout4Processor.cs | 26 ++ .../Processing/SkyrimProcessor.cs | 20 ++ 9 files changed, 91 insertions(+), 438 deletions(-) diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/DistantLod.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/DistantLod.cs index ae2de6c35..675967f98 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/DistantLod.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/DistantLod.cs @@ -1,4 +1,6 @@ -using Mutagen.Bethesda.Plugins.Binary.Streams; +using Mutagen.Bethesda.Plugins.Binary.Overlay; +using Mutagen.Bethesda.Plugins.Binary.Streams; +using Mutagen.Bethesda.Plugins.Binary.Translations; using Mutagen.Bethesda.Translations.Binary; using Noggog; @@ -6,9 +8,14 @@ namespace Mutagen.Bethesda.Fallout4; internal partial class DistantLodBinaryCreateTranslation { - public static partial void FillBinaryDataCustom(MutagenFrame frame, IDistantLod item) + public static partial void FillBinaryMeshCustom(MutagenFrame frame, IDistantLod item) { - item.Data = ByteArrayBinaryTranslation.Instance.Parse(reader: frame); + item.Mesh = StringBinaryTranslation.Instance.Parse( + reader: frame, + stringBinaryType: StringBinaryType.NullTerminate, + parseWhole: false); + if (frame.Complete) return; + ByteArrayBinaryTranslation.Instance.Parse(reader: frame); } } @@ -16,32 +23,21 @@ public partial class DistantLodBinaryWriteTranslation { private const uint DataLength = 260; - public static partial void WriteBinaryDataCustom(MutagenWriter writer, IDistantLodGetter item) + public static partial void WriteBinaryMeshCustom(MutagenWriter writer, IDistantLodGetter item) { - if (item.Data == null) - { - var len = DataLength - item.Mesh.Length - 1; - if (len > 0) - { - writer.WriteZeros((uint)len); - } - } - else - { - var len = item.Data.Value.Length + item.Mesh.Length + 1; - if (len != DataLength) - { - throw new ArgumentException($"Distant Lod string and data size did not add up to expected length. {len} != 260"); - } - writer.Write(item.Data.Value); - } + var mesh = item.Mesh; + StringBinaryTranslation.Instance.Write( + writer: writer, + item: mesh, + binaryType: StringBinaryType.NullTerminate); + writer.WriteZeros((uint)(DataLength - mesh.Length - 1)); } } internal partial class DistantLodBinaryOverlay { - public partial ReadOnlyMemorySlice? GetDataCustom(int location) + partial void CustomFactoryEnd(OverlayStream stream, int finalPos, int offset) { - return _structData.Span.Slice(MeshEndingPos).ToArray(); + Mesh = BinaryStringUtility.ParseUnknownLengthString(_structData, _package.MetaData.Encodings.NonTranslated); } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/DistantLod_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/DistantLod_Generated.cs index ba9aa3a73..d3765213b 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/DistantLod_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/DistantLod_Generated.cs @@ -52,17 +52,6 @@ public DistantLod() #region Mesh public String Mesh { get; set; } = string.Empty; #endregion - #region Data - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected MemorySlice? _Data; - public MemorySlice? Data - { - get => this._Data; - set => this._Data = value; - } - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - ReadOnlyMemorySlice? IDistantLodGetter.Data => this.Data; - #endregion #region To String @@ -100,18 +89,9 @@ public class Mask : IMask { #region Ctors - public Mask(TItem initialValue) - { - this.Mesh = initialValue; - this.Data = initialValue; - } - - public Mask( - TItem Mesh, - TItem Data) + public Mask(TItem Mesh) { this.Mesh = Mesh; - this.Data = Data; } #pragma warning disable CS8618 @@ -124,7 +104,6 @@ protected Mask() #region Members public TItem Mesh; - public TItem Data; #endregion #region Equals @@ -138,14 +117,12 @@ public bool Equals(Mask? rhs) { if (rhs == null) return false; if (!object.Equals(this.Mesh, rhs.Mesh)) return false; - if (!object.Equals(this.Data, rhs.Data)) return false; return true; } public override int GetHashCode() { var hash = new HashCode(); hash.Add(this.Mesh); - hash.Add(this.Data); return hash.ToHashCode(); } @@ -155,7 +132,6 @@ public override int GetHashCode() public bool All(Func eval) { if (!eval(this.Mesh)) return false; - if (!eval(this.Data)) return false; return true; } #endregion @@ -164,7 +140,6 @@ public bool All(Func eval) public bool Any(Func eval) { if (eval(this.Mesh)) return true; - if (eval(this.Data)) return true; return false; } #endregion @@ -180,7 +155,6 @@ public Mask Translate(Func eval) protected void Translate_InternalFill(Mask obj, Func eval) { obj.Mesh = eval(this.Mesh); - obj.Data = eval(this.Data); } #endregion @@ -203,10 +177,6 @@ public void Print(StructuredStringBuilder sb, DistantLod.Mask? printMask = { sb.AppendItem(Mesh, "Mesh"); } - if (printMask?.Data ?? true) - { - sb.AppendItem(Data, "Data"); - } } } #endregion @@ -232,7 +202,6 @@ public List Warnings } } public Exception? Mesh; - public Exception? Data; #endregion #region IErrorMask @@ -243,8 +212,6 @@ public List Warnings { case DistantLod_FieldIndex.Mesh: return Mesh; - case DistantLod_FieldIndex.Data: - return Data; default: throw new ArgumentException($"Index is out of range: {index}"); } @@ -258,9 +225,6 @@ public void SetNthException(int index, Exception ex) case DistantLod_FieldIndex.Mesh: this.Mesh = ex; break; - case DistantLod_FieldIndex.Data: - this.Data = ex; - break; default: throw new ArgumentException($"Index is out of range: {index}"); } @@ -274,9 +238,6 @@ public void SetNthMask(int index, object obj) case DistantLod_FieldIndex.Mesh: this.Mesh = (Exception?)obj; break; - case DistantLod_FieldIndex.Data: - this.Data = (Exception?)obj; - break; default: throw new ArgumentException($"Index is out of range: {index}"); } @@ -286,7 +247,6 @@ public bool IsInError() { if (Overall != null) return true; if (Mesh != null) return true; - if (Data != null) return true; return false; } #endregion @@ -315,9 +275,6 @@ protected void PrintFillInternal(StructuredStringBuilder sb) { sb.AppendItem(Mesh, "Mesh"); } - { - sb.AppendItem(Data, "Data"); - } } #endregion @@ -327,7 +284,6 @@ public ErrorMask Combine(ErrorMask? rhs) if (rhs == null) return this; var ret = new ErrorMask(); ret.Mesh = this.Mesh.Combine(rhs.Mesh); - ret.Data = this.Data.Combine(rhs.Data); return ret; } public static ErrorMask? Combine(ErrorMask? lhs, ErrorMask? rhs) @@ -352,7 +308,6 @@ public class TranslationMask : ITranslationMask public readonly bool DefaultOn; public bool OnOverall; public bool Mesh; - public bool Data; #endregion #region Ctors @@ -363,7 +318,6 @@ public TranslationMask( this.DefaultOn = defaultOn; this.OnOverall = onOverall; this.Mesh = defaultOn; - this.Data = defaultOn; } #endregion @@ -380,7 +334,6 @@ public TranslationCrystal GetCrystal() protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret) { ret.Add((Mesh, null)); - ret.Add((Data, null)); } public static implicit operator TranslationMask(bool defaultOn) @@ -454,7 +407,6 @@ public partial interface IDistantLod : ILoquiObjectSetter { new String Mesh { get; set; } - new MemorySlice? Data { get; set; } } public partial interface IDistantLodGetter : @@ -470,7 +422,6 @@ public partial interface IDistantLodGetter : object CommonSetterTranslationInstance(); static ILoquiRegistration StaticRegistration => DistantLod_Registration.Instance; String Mesh { get; } - ReadOnlyMemorySlice? Data { get; } } @@ -641,7 +592,6 @@ namespace Mutagen.Bethesda.Fallout4 internal enum DistantLod_FieldIndex { Mesh = 0, - Data = 1, } #endregion @@ -659,9 +609,9 @@ internal partial class DistantLod_Registration : ILoquiRegistration public const string GUID = "795bff20-ec22-4c22-a3f5-bfb3b2ee105e"; - public const ushort AdditionalFieldCount = 2; + public const ushort AdditionalFieldCount = 1; - public const ushort FieldCount = 2; + public const ushort FieldCount = 1; public static readonly Type MaskType = typeof(DistantLod.Mask<>); @@ -730,7 +680,6 @@ public void Clear(IDistantLod item) { ClearPartial(); item.Mesh = string.Empty; - item.Data = default; } #region Mutagen @@ -781,7 +730,6 @@ public void FillEqualsMask( EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) { ret.Mesh = string.Equals(item.Mesh, rhs.Mesh); - ret.Data = MemorySliceExt.SequenceEqual(item.Data, rhs.Data); } public string Print( @@ -830,11 +778,6 @@ protected static void ToStringFields( { sb.AppendItem(item.Mesh, "Mesh"); } - if ((printMask?.Data ?? true) - && item.Data is {} DataItem) - { - sb.AppendLine($"Data => {SpanExt.ToHexString(DataItem)}"); - } } #region Equals and Hash @@ -848,10 +791,6 @@ public virtual bool Equals( { if (!string.Equals(lhs.Mesh, rhs.Mesh)) return false; } - if ((equalsMask?.GetShouldTranslate((int)DistantLod_FieldIndex.Data) ?? true)) - { - if (!MemorySliceExt.SequenceEqual(lhs.Data, rhs.Data)) return false; - } return true; } @@ -859,10 +798,6 @@ public virtual int GetHashCode(IDistantLodGetter item) { var hash = new HashCode(); hash.Add(item.Mesh); - if (item.Data is {} DataItem) - { - hash.Add(DataItem); - } return hash.ToHashCode(); } @@ -899,17 +834,6 @@ public void DeepCopyIn( { item.Mesh = rhs.Mesh; } - if ((copyMask?.GetShouldTranslate((int)DistantLod_FieldIndex.Data) ?? true)) - { - if(rhs.Data is {} Datarhs) - { - item.Data = Datarhs.ToArray(); - } - else - { - item.Data = default; - } - } } #endregion @@ -1006,24 +930,20 @@ public static void WriteEmbedded( IDistantLodGetter item, MutagenWriter writer) { - StringBinaryTranslation.Instance.Write( - writer: writer, - item: item.Mesh, - binaryType: StringBinaryType.NullTerminate); - DistantLodBinaryWriteTranslation.WriteBinaryData( + DistantLodBinaryWriteTranslation.WriteBinaryMesh( writer: writer, item: item); } - public static partial void WriteBinaryDataCustom( + public static partial void WriteBinaryMeshCustom( MutagenWriter writer, IDistantLodGetter item); - public static void WriteBinaryData( + public static void WriteBinaryMesh( MutagenWriter writer, IDistantLodGetter item) { - WriteBinaryDataCustom( + WriteBinaryMeshCustom( writer: writer, item: item); } @@ -1059,17 +979,12 @@ public static void FillBinaryStructs( IDistantLod item, MutagenFrame frame) { - item.Mesh = StringBinaryTranslation.Instance.Parse( - reader: frame, - stringBinaryType: StringBinaryType.NullTerminate, - parseWhole: false); - if (frame.Complete) return; - DistantLodBinaryCreateTranslation.FillBinaryDataCustom( + DistantLodBinaryCreateTranslation.FillBinaryMeshCustom( frame: frame, item: item); } - public static partial void FillBinaryDataCustom( + public static partial void FillBinaryMeshCustom( MutagenFrame frame, IDistantLod item); @@ -1139,12 +1054,7 @@ void IBinaryItem.WriteToBinary( #region Mesh public String Mesh { get; private set; } = string.Empty; protected int MeshEndingPos; - #endregion - #region Data - public partial ReadOnlyMemorySlice? GetDataCustom(int location); - public ReadOnlyMemorySlice? Data => GetDataCustom(location: MeshEndingPos); - protected int DataEndingPos; - partial void CustomDataEndPos(); + partial void CustomMeshEndPos(); #endregion partial void CustomFactoryEnd( OverlayStream stream, @@ -1177,10 +1087,8 @@ public static IDistantLodGetter DistantLodFactory( var ret = new DistantLodBinaryOverlay( memoryPair: memoryPair, package: package); - ret.Mesh = BinaryStringUtility.ParseUnknownLengthString(ret._structData, package.MetaData.Encodings.NonTranslated); - ret.MeshEndingPos = ret.Mesh.Length + 1; - ret.CustomDataEndPos(); - stream.Position += ret.DataEndingPos; + ret.CustomMeshEndPos(); + stream.Position += ret.MeshEndingPos; ret.CustomFactoryEnd( stream: stream, finalPos: stream.Length, diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Static.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Static.cs index 01fed881d..bf64d8a06 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Static.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Static.cs @@ -99,11 +99,10 @@ public static DistantLod Parse(T frame) reader: frame, stringBinaryType: StringBinaryType.NullTerminate, parseWhole: false); - var bytes = frame.ReadBytes(260 - str.Length - 1); + frame.ReadBytes(260 - str.Length - 1); return new DistantLod() { Mesh = str, - Data = bytes }; } } diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Static.xml b/Mutagen.Bethesda.Fallout4/Records/Major Records/Static.xml index 2dbb71787..6c1359382 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Static.xml +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Static.xml @@ -32,8 +32,7 @@
- - + diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod.cs index e476cd342..c2f4e0944 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod.cs @@ -14,13 +14,9 @@ partial class LodBinaryCreateTranslation public static partial void FillBinaryLevel0Custom(MutagenFrame frame, ILod item) { item.Level0.RawPath = ReadString(frame, out var bytes); - item.Level0Extra = bytes; item.Level1.RawPath = ReadString(frame, out bytes); - item.Level1Extra = bytes; item.Level2.RawPath = ReadString(frame, out bytes); - item.Level2Extra = bytes; item.Level3.RawPath = ReadString(frame, out bytes); - item.Level3Extra = bytes; } public static string ReadString(MutagenFrame frame, out MemorySlice extraBytes) @@ -35,26 +31,19 @@ partial class LodBinaryWriteTranslation { public static partial void WriteBinaryLevel0Custom(MutagenWriter writer, ILodGetter item) { - WriteString(writer, item.Level0.RawPath, item.Level0Extra); - WriteString(writer, item.Level1.RawPath, item.Level1Extra); - WriteString(writer, item.Level2.RawPath, item.Level2Extra); - WriteString(writer, item.Level3.RawPath, item.Level3Extra); + WriteString(writer, item.Level0.RawPath); + WriteString(writer, item.Level1.RawPath); + WriteString(writer, item.Level2.RawPath); + WriteString(writer, item.Level3.RawPath); } - public static void WriteString(MutagenWriter writer, string str, ReadOnlyMemorySlice? bytes) + public static void WriteString(MutagenWriter writer, string str) { if (str.Length >= LodBinaryCreateTranslation.TotalLen) { } writer.Write(str, StringBinaryType.NullTerminate, writer.MetaData.Encodings.NonTranslated); - if (bytes == null) - { - writer.WriteZeros((uint)(LodBinaryCreateTranslation.TotalLen - str.Length - 1)); - } - else - { - writer.Write(bytes.Value); - } + writer.WriteZeros((uint)(LodBinaryCreateTranslation.TotalLen - str.Length - 1)); } } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs index e42af1dca..8fc3808b4 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs @@ -57,62 +57,18 @@ public Lod() public AssetLink Level0 { get; set; } = new AssetLink(); AssetLinkGetter ILodGetter.Level0 => this.Level0; #endregion - #region Level0Extra - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected MemorySlice? _Level0Extra; - public MemorySlice? Level0Extra - { - get => this._Level0Extra; - set => this._Level0Extra = value; - } - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - ReadOnlyMemorySlice? ILodGetter.Level0Extra => this.Level0Extra; - #endregion #region Level1 public AssetLink Level1 { get; set; } = new AssetLink(); AssetLinkGetter ILodGetter.Level1 => this.Level1; #endregion - #region Level1Extra - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected MemorySlice? _Level1Extra; - public MemorySlice? Level1Extra - { - get => this._Level1Extra; - set => this._Level1Extra = value; - } - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - ReadOnlyMemorySlice? ILodGetter.Level1Extra => this.Level1Extra; - #endregion #region Level2 public AssetLink Level2 { get; set; } = new AssetLink(); AssetLinkGetter ILodGetter.Level2 => this.Level2; #endregion - #region Level2Extra - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected MemorySlice? _Level2Extra; - public MemorySlice? Level2Extra - { - get => this._Level2Extra; - set => this._Level2Extra = value; - } - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - ReadOnlyMemorySlice? ILodGetter.Level2Extra => this.Level2Extra; - #endregion #region Level3 public AssetLink Level3 { get; set; } = new AssetLink(); AssetLinkGetter ILodGetter.Level3 => this.Level3; #endregion - #region Level3Extra - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected MemorySlice? _Level3Extra; - public MemorySlice? Level3Extra - { - get => this._Level3Extra; - set => this._Level3Extra = value; - } - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - ReadOnlyMemorySlice? ILodGetter.Level3Extra => this.Level3Extra; - #endregion #region To String @@ -153,33 +109,21 @@ public class Mask : public Mask(TItem initialValue) { this.Level0 = initialValue; - this.Level0Extra = initialValue; this.Level1 = initialValue; - this.Level1Extra = initialValue; this.Level2 = initialValue; - this.Level2Extra = initialValue; this.Level3 = initialValue; - this.Level3Extra = initialValue; } public Mask( TItem Level0, - TItem Level0Extra, TItem Level1, - TItem Level1Extra, TItem Level2, - TItem Level2Extra, - TItem Level3, - TItem Level3Extra) + TItem Level3) { this.Level0 = Level0; - this.Level0Extra = Level0Extra; this.Level1 = Level1; - this.Level1Extra = Level1Extra; this.Level2 = Level2; - this.Level2Extra = Level2Extra; this.Level3 = Level3; - this.Level3Extra = Level3Extra; } #pragma warning disable CS8618 @@ -192,13 +136,9 @@ protected Mask() #region Members public TItem Level0; - public TItem Level0Extra; public TItem Level1; - public TItem Level1Extra; public TItem Level2; - public TItem Level2Extra; public TItem Level3; - public TItem Level3Extra; #endregion #region Equals @@ -212,26 +152,18 @@ public bool Equals(Mask? rhs) { if (rhs == null) return false; if (!object.Equals(this.Level0, rhs.Level0)) return false; - if (!object.Equals(this.Level0Extra, rhs.Level0Extra)) return false; if (!object.Equals(this.Level1, rhs.Level1)) return false; - if (!object.Equals(this.Level1Extra, rhs.Level1Extra)) return false; if (!object.Equals(this.Level2, rhs.Level2)) return false; - if (!object.Equals(this.Level2Extra, rhs.Level2Extra)) return false; if (!object.Equals(this.Level3, rhs.Level3)) return false; - if (!object.Equals(this.Level3Extra, rhs.Level3Extra)) return false; return true; } public override int GetHashCode() { var hash = new HashCode(); hash.Add(this.Level0); - hash.Add(this.Level0Extra); hash.Add(this.Level1); - hash.Add(this.Level1Extra); hash.Add(this.Level2); - hash.Add(this.Level2Extra); hash.Add(this.Level3); - hash.Add(this.Level3Extra); return hash.ToHashCode(); } @@ -241,13 +173,9 @@ public override int GetHashCode() public bool All(Func eval) { if (!eval(this.Level0)) return false; - if (!eval(this.Level0Extra)) return false; if (!eval(this.Level1)) return false; - if (!eval(this.Level1Extra)) return false; if (!eval(this.Level2)) return false; - if (!eval(this.Level2Extra)) return false; if (!eval(this.Level3)) return false; - if (!eval(this.Level3Extra)) return false; return true; } #endregion @@ -256,13 +184,9 @@ public bool All(Func eval) public bool Any(Func eval) { if (eval(this.Level0)) return true; - if (eval(this.Level0Extra)) return true; if (eval(this.Level1)) return true; - if (eval(this.Level1Extra)) return true; if (eval(this.Level2)) return true; - if (eval(this.Level2Extra)) return true; if (eval(this.Level3)) return true; - if (eval(this.Level3Extra)) return true; return false; } #endregion @@ -278,13 +202,9 @@ public Mask Translate(Func eval) protected void Translate_InternalFill(Mask obj, Func eval) { obj.Level0 = eval(this.Level0); - obj.Level0Extra = eval(this.Level0Extra); obj.Level1 = eval(this.Level1); - obj.Level1Extra = eval(this.Level1Extra); obj.Level2 = eval(this.Level2); - obj.Level2Extra = eval(this.Level2Extra); obj.Level3 = eval(this.Level3); - obj.Level3Extra = eval(this.Level3Extra); } #endregion @@ -307,34 +227,18 @@ public void Print(StructuredStringBuilder sb, Lod.Mask? printMask = null) { sb.AppendItem(Level0, "Level0"); } - if (printMask?.Level0Extra ?? true) - { - sb.AppendItem(Level0Extra, "Level0Extra"); - } if (printMask?.Level1 ?? true) { sb.AppendItem(Level1, "Level1"); } - if (printMask?.Level1Extra ?? true) - { - sb.AppendItem(Level1Extra, "Level1Extra"); - } if (printMask?.Level2 ?? true) { sb.AppendItem(Level2, "Level2"); } - if (printMask?.Level2Extra ?? true) - { - sb.AppendItem(Level2Extra, "Level2Extra"); - } if (printMask?.Level3 ?? true) { sb.AppendItem(Level3, "Level3"); } - if (printMask?.Level3Extra ?? true) - { - sb.AppendItem(Level3Extra, "Level3Extra"); - } } } #endregion @@ -360,13 +264,9 @@ public List Warnings } } public Exception? Level0; - public Exception? Level0Extra; public Exception? Level1; - public Exception? Level1Extra; public Exception? Level2; - public Exception? Level2Extra; public Exception? Level3; - public Exception? Level3Extra; #endregion #region IErrorMask @@ -377,20 +277,12 @@ public List Warnings { case Lod_FieldIndex.Level0: return Level0; - case Lod_FieldIndex.Level0Extra: - return Level0Extra; case Lod_FieldIndex.Level1: return Level1; - case Lod_FieldIndex.Level1Extra: - return Level1Extra; case Lod_FieldIndex.Level2: return Level2; - case Lod_FieldIndex.Level2Extra: - return Level2Extra; case Lod_FieldIndex.Level3: return Level3; - case Lod_FieldIndex.Level3Extra: - return Level3Extra; default: throw new ArgumentException($"Index is out of range: {index}"); } @@ -404,27 +296,15 @@ public void SetNthException(int index, Exception ex) case Lod_FieldIndex.Level0: this.Level0 = ex; break; - case Lod_FieldIndex.Level0Extra: - this.Level0Extra = ex; - break; case Lod_FieldIndex.Level1: this.Level1 = ex; break; - case Lod_FieldIndex.Level1Extra: - this.Level1Extra = ex; - break; case Lod_FieldIndex.Level2: this.Level2 = ex; break; - case Lod_FieldIndex.Level2Extra: - this.Level2Extra = ex; - break; case Lod_FieldIndex.Level3: this.Level3 = ex; break; - case Lod_FieldIndex.Level3Extra: - this.Level3Extra = ex; - break; default: throw new ArgumentException($"Index is out of range: {index}"); } @@ -438,27 +318,15 @@ public void SetNthMask(int index, object obj) case Lod_FieldIndex.Level0: this.Level0 = (Exception?)obj; break; - case Lod_FieldIndex.Level0Extra: - this.Level0Extra = (Exception?)obj; - break; case Lod_FieldIndex.Level1: this.Level1 = (Exception?)obj; break; - case Lod_FieldIndex.Level1Extra: - this.Level1Extra = (Exception?)obj; - break; case Lod_FieldIndex.Level2: this.Level2 = (Exception?)obj; break; - case Lod_FieldIndex.Level2Extra: - this.Level2Extra = (Exception?)obj; - break; case Lod_FieldIndex.Level3: this.Level3 = (Exception?)obj; break; - case Lod_FieldIndex.Level3Extra: - this.Level3Extra = (Exception?)obj; - break; default: throw new ArgumentException($"Index is out of range: {index}"); } @@ -468,13 +336,9 @@ public bool IsInError() { if (Overall != null) return true; if (Level0 != null) return true; - if (Level0Extra != null) return true; if (Level1 != null) return true; - if (Level1Extra != null) return true; if (Level2 != null) return true; - if (Level2Extra != null) return true; if (Level3 != null) return true; - if (Level3Extra != null) return true; return false; } #endregion @@ -503,27 +367,15 @@ protected void PrintFillInternal(StructuredStringBuilder sb) { sb.AppendItem(Level0, "Level0"); } - { - sb.AppendItem(Level0Extra, "Level0Extra"); - } { sb.AppendItem(Level1, "Level1"); } - { - sb.AppendItem(Level1Extra, "Level1Extra"); - } { sb.AppendItem(Level2, "Level2"); } - { - sb.AppendItem(Level2Extra, "Level2Extra"); - } { sb.AppendItem(Level3, "Level3"); } - { - sb.AppendItem(Level3Extra, "Level3Extra"); - } } #endregion @@ -533,13 +385,9 @@ public ErrorMask Combine(ErrorMask? rhs) if (rhs == null) return this; var ret = new ErrorMask(); ret.Level0 = this.Level0.Combine(rhs.Level0); - ret.Level0Extra = this.Level0Extra.Combine(rhs.Level0Extra); ret.Level1 = this.Level1.Combine(rhs.Level1); - ret.Level1Extra = this.Level1Extra.Combine(rhs.Level1Extra); ret.Level2 = this.Level2.Combine(rhs.Level2); - ret.Level2Extra = this.Level2Extra.Combine(rhs.Level2Extra); ret.Level3 = this.Level3.Combine(rhs.Level3); - ret.Level3Extra = this.Level3Extra.Combine(rhs.Level3Extra); return ret; } public static ErrorMask? Combine(ErrorMask? lhs, ErrorMask? rhs) @@ -564,13 +412,9 @@ public class TranslationMask : ITranslationMask public readonly bool DefaultOn; public bool OnOverall; public bool Level0; - public bool Level0Extra; public bool Level1; - public bool Level1Extra; public bool Level2; - public bool Level2Extra; public bool Level3; - public bool Level3Extra; #endregion #region Ctors @@ -581,13 +425,9 @@ public TranslationMask( this.DefaultOn = defaultOn; this.OnOverall = onOverall; this.Level0 = defaultOn; - this.Level0Extra = defaultOn; this.Level1 = defaultOn; - this.Level1Extra = defaultOn; this.Level2 = defaultOn; - this.Level2Extra = defaultOn; this.Level3 = defaultOn; - this.Level3Extra = defaultOn; } #endregion @@ -604,13 +444,9 @@ public TranslationCrystal GetCrystal() protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret) { ret.Add((Level0, null)); - ret.Add((Level0Extra, null)); ret.Add((Level1, null)); - ret.Add((Level1Extra, null)); ret.Add((Level2, null)); - ret.Add((Level2Extra, null)); ret.Add((Level3, null)); - ret.Add((Level3Extra, null)); } public static implicit operator TranslationMask(bool defaultOn) @@ -691,13 +527,9 @@ public partial interface ILod : ILoquiObjectSetter { new AssetLink Level0 { get; set; } - new MemorySlice? Level0Extra { get; set; } new AssetLink Level1 { get; set; } - new MemorySlice? Level1Extra { get; set; } new AssetLink Level2 { get; set; } - new MemorySlice? Level2Extra { get; set; } new AssetLink Level3 { get; set; } - new MemorySlice? Level3Extra { get; set; } } public partial interface ILodGetter : @@ -714,13 +546,9 @@ public partial interface ILodGetter : object CommonSetterTranslationInstance(); static ILoquiRegistration StaticRegistration => Lod_Registration.Instance; AssetLinkGetter Level0 { get; } - ReadOnlyMemorySlice? Level0Extra { get; } AssetLinkGetter Level1 { get; } - ReadOnlyMemorySlice? Level1Extra { get; } AssetLinkGetter Level2 { get; } - ReadOnlyMemorySlice? Level2Extra { get; } AssetLinkGetter Level3 { get; } - ReadOnlyMemorySlice? Level3Extra { get; } } @@ -891,13 +719,9 @@ namespace Mutagen.Bethesda.Skyrim internal enum Lod_FieldIndex { Level0 = 0, - Level0Extra = 1, - Level1 = 2, - Level1Extra = 3, - Level2 = 4, - Level2Extra = 5, - Level3 = 6, - Level3Extra = 7, + Level1 = 1, + Level2 = 2, + Level3 = 3, } #endregion @@ -915,9 +739,9 @@ internal partial class Lod_Registration : ILoquiRegistration public const string GUID = "a708745a-1c62-4a97-afcc-345a6c66ad64"; - public const ushort AdditionalFieldCount = 8; + public const ushort AdditionalFieldCount = 4; - public const ushort FieldCount = 8; + public const ushort FieldCount = 4; public static readonly Type MaskType = typeof(Lod.Mask<>); @@ -993,13 +817,9 @@ public void Clear(ILod item) { ClearPartial(); item.Level0.SetToNull(); - item.Level0Extra = default; item.Level1.SetToNull(); - item.Level1Extra = default; item.Level2.SetToNull(); - item.Level2Extra = default; item.Level3.SetToNull(); - item.Level3Extra = default; } #region Mutagen @@ -1071,13 +891,9 @@ public void FillEqualsMask( EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) { ret.Level0 = object.Equals(item.Level0, rhs.Level0); - ret.Level0Extra = MemorySliceExt.SequenceEqual(item.Level0Extra, rhs.Level0Extra); ret.Level1 = object.Equals(item.Level1, rhs.Level1); - ret.Level1Extra = MemorySliceExt.SequenceEqual(item.Level1Extra, rhs.Level1Extra); ret.Level2 = object.Equals(item.Level2, rhs.Level2); - ret.Level2Extra = MemorySliceExt.SequenceEqual(item.Level2Extra, rhs.Level2Extra); ret.Level3 = object.Equals(item.Level3, rhs.Level3); - ret.Level3Extra = MemorySliceExt.SequenceEqual(item.Level3Extra, rhs.Level3Extra); } public string Print( @@ -1126,38 +942,18 @@ protected static void ToStringFields( { sb.AppendItem(item.Level0, "Level0"); } - if ((printMask?.Level0Extra ?? true) - && item.Level0Extra is {} Level0ExtraItem) - { - sb.AppendLine($"Level0Extra => {SpanExt.ToHexString(Level0ExtraItem)}"); - } if (printMask?.Level1 ?? true) { sb.AppendItem(item.Level1, "Level1"); } - if ((printMask?.Level1Extra ?? true) - && item.Level1Extra is {} Level1ExtraItem) - { - sb.AppendLine($"Level1Extra => {SpanExt.ToHexString(Level1ExtraItem)}"); - } if (printMask?.Level2 ?? true) { sb.AppendItem(item.Level2, "Level2"); } - if ((printMask?.Level2Extra ?? true) - && item.Level2Extra is {} Level2ExtraItem) - { - sb.AppendLine($"Level2Extra => {SpanExt.ToHexString(Level2ExtraItem)}"); - } if (printMask?.Level3 ?? true) { sb.AppendItem(item.Level3, "Level3"); } - if ((printMask?.Level3Extra ?? true) - && item.Level3Extra is {} Level3ExtraItem) - { - sb.AppendLine($"Level3Extra => {SpanExt.ToHexString(Level3ExtraItem)}"); - } } #region Equals and Hash @@ -1171,34 +967,18 @@ public virtual bool Equals( { if (!object.Equals(lhs.Level0, rhs.Level0)) return false; } - if ((equalsMask?.GetShouldTranslate((int)Lod_FieldIndex.Level0Extra) ?? true)) - { - if (!MemorySliceExt.SequenceEqual(lhs.Level0Extra, rhs.Level0Extra)) return false; - } if ((equalsMask?.GetShouldTranslate((int)Lod_FieldIndex.Level1) ?? true)) { if (!object.Equals(lhs.Level1, rhs.Level1)) return false; } - if ((equalsMask?.GetShouldTranslate((int)Lod_FieldIndex.Level1Extra) ?? true)) - { - if (!MemorySliceExt.SequenceEqual(lhs.Level1Extra, rhs.Level1Extra)) return false; - } if ((equalsMask?.GetShouldTranslate((int)Lod_FieldIndex.Level2) ?? true)) { if (!object.Equals(lhs.Level2, rhs.Level2)) return false; } - if ((equalsMask?.GetShouldTranslate((int)Lod_FieldIndex.Level2Extra) ?? true)) - { - if (!MemorySliceExt.SequenceEqual(lhs.Level2Extra, rhs.Level2Extra)) return false; - } if ((equalsMask?.GetShouldTranslate((int)Lod_FieldIndex.Level3) ?? true)) { if (!object.Equals(lhs.Level3, rhs.Level3)) return false; } - if ((equalsMask?.GetShouldTranslate((int)Lod_FieldIndex.Level3Extra) ?? true)) - { - if (!MemorySliceExt.SequenceEqual(lhs.Level3Extra, rhs.Level3Extra)) return false; - } return true; } @@ -1206,25 +986,9 @@ public virtual int GetHashCode(ILodGetter item) { var hash = new HashCode(); hash.Add(item.Level0); - if (item.Level0Extra is {} Level0ExtraItem) - { - hash.Add(Level0ExtraItem); - } hash.Add(item.Level1); - if (item.Level1Extra is {} Level1ExtraItem) - { - hash.Add(Level1ExtraItem); - } hash.Add(item.Level2); - if (item.Level2Extra is {} Level2ExtraItem) - { - hash.Add(Level2ExtraItem); - } hash.Add(item.Level3); - if (item.Level3Extra is {} Level3ExtraItem) - { - hash.Add(Level3ExtraItem); - } return hash.ToHashCode(); } @@ -1270,53 +1034,9 @@ public void DeepCopyIn( bool deepCopy) { item.Level0.RawPath = rhs.Level0.RawPath; - if ((copyMask?.GetShouldTranslate((int)Lod_FieldIndex.Level0Extra) ?? true)) - { - if(rhs.Level0Extra is {} Level0Extrarhs) - { - item.Level0Extra = Level0Extrarhs.ToArray(); - } - else - { - item.Level0Extra = default; - } - } item.Level1.RawPath = rhs.Level1.RawPath; - if ((copyMask?.GetShouldTranslate((int)Lod_FieldIndex.Level1Extra) ?? true)) - { - if(rhs.Level1Extra is {} Level1Extrarhs) - { - item.Level1Extra = Level1Extrarhs.ToArray(); - } - else - { - item.Level1Extra = default; - } - } item.Level2.RawPath = rhs.Level2.RawPath; - if ((copyMask?.GetShouldTranslate((int)Lod_FieldIndex.Level2Extra) ?? true)) - { - if(rhs.Level2Extra is {} Level2Extrarhs) - { - item.Level2Extra = Level2Extrarhs.ToArray(); - } - else - { - item.Level2Extra = default; - } - } item.Level3.RawPath = rhs.Level3.RawPath; - if ((copyMask?.GetShouldTranslate((int)Lod_FieldIndex.Level3Extra) ?? true)) - { - if(rhs.Level3Extra is {} Level3Extrarhs) - { - item.Level3Extra = Level3Extrarhs.ToArray(); - } - else - { - item.Level3Extra = default; - } - } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Static.xml b/Mutagen.Bethesda.Skyrim/Records/Major Records/Static.xml index cde50bc3e..c128f3332 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Static.xml +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Static.xml @@ -24,13 +24,9 @@ - - - - diff --git a/Mutagen.Bethesda.Tests/Processing/Fallout4Processor.cs b/Mutagen.Bethesda.Tests/Processing/Fallout4Processor.cs index 16a6f2d1c..30b57d28f 100644 --- a/Mutagen.Bethesda.Tests/Processing/Fallout4Processor.cs +++ b/Mutagen.Bethesda.Tests/Processing/Fallout4Processor.cs @@ -30,6 +30,7 @@ protected override void AddDynamicProcessorInstructions() AddDynamicProcessing(RecordTypes.TRNS, ProcessTransforms); AddDynamicProcessing(RecordTypes.RACE, ProcessRaces); AddDynamicProcessing(RecordTypes.SCOL, ProcessStaticCollections); + AddDynamicProcessing(RecordTypes.STAT, ProcessStatics); AddDynamicProcessing(RecordTypes.FURN, ProcessFurniture); AddDynamicProcessing(RecordTypes.WEAP, ProcessWeapons); AddDynamicProcessing(RecordTypes.NPC_, ProcessNpcs); @@ -185,6 +186,31 @@ private void ProcessStaticCollections( } } + private void ProcessStatics( + MajorRecordFrame majorFrame, + long fileOffset) + { + if (majorFrame.FormID.ID == 0x05D672) + { + int wer = 23; + wer++; + } + + const int blockSize = 0x104; + foreach (var mnam in majorFrame.FindEnumerateSubrecords(RecordTypes.MNAM)) + { + var bytes = mnam.Content; + for (int i = 0; i < bytes.Length; i += blockSize) + { + var zeroIndex = bytes.Span.Slice(i).IndexOf((byte)0); + if (zeroIndex == -1) break; + var index = fileOffset + mnam.Location + mnam.HeaderLength + zeroIndex + i; + var byteSize = blockSize - zeroIndex; + _instructions.SetSubstitution(index, new byte[byteSize]); + } + } + } + private void ProcessFurniture( MajorRecordFrame majorFrame, long fileOffset) diff --git a/Mutagen.Bethesda.Tests/Processing/SkyrimProcessor.cs b/Mutagen.Bethesda.Tests/Processing/SkyrimProcessor.cs index eac65cf4c..129253a09 100644 --- a/Mutagen.Bethesda.Tests/Processing/SkyrimProcessor.cs +++ b/Mutagen.Bethesda.Tests/Processing/SkyrimProcessor.cs @@ -61,6 +61,7 @@ protected override void AddDynamicProcessorInstructions() AddDynamicProcessing(RecordTypes.LSCR, ProcessLoadScreens); AddDynamicProcessing(RecordTypes.ACTI, ProcessActivators); AddDynamicProcessing(RecordTypes.WTHR, ProcessWeathers); + AddDynamicProcessing(RecordTypes.STAT, ProcessStatics); } private void ProcessGameSettings( @@ -824,6 +825,25 @@ private void ProcessWeathers( } } + private void ProcessStatics( + MajorRecordFrame majorFrame, + long fileOffset) + { + const int blockSize = 0x104; + foreach (var mnam in majorFrame.FindEnumerateSubrecords(RecordTypes.MNAM)) + { + var bytes = mnam.Content; + for (int i = 0; i < bytes.Length; i += blockSize) + { + var zeroIndex = bytes.Span.Slice(i).IndexOf((byte)0); + if (zeroIndex == -1) break; + var index = fileOffset + mnam.Location + mnam.HeaderLength + zeroIndex + i; + var byteSize = blockSize - zeroIndex; + _instructions.SetSubstitution(index, new byte[byteSize]); + } + } + } + public void PerkStringHandler( IMutagenReadStream stream, MajorRecordHeader major, From a16b15d2933bb5378795228b52a08d2d7ac6b5c4 Mon Sep 17 00:00:00 2001 From: nickp Date: Tue, 11 Jul 2023 21:14:45 +0200 Subject: [PATCH 066/135] Make Instance virtual to fix current bug with static abstract types when used in generics --- Mutagen.Bethesda.Core/Assets/IAssetType.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Core/Assets/IAssetType.cs b/Mutagen.Bethesda.Core/Assets/IAssetType.cs index 2833c9164..d8dbe71a6 100644 --- a/Mutagen.Bethesda.Core/Assets/IAssetType.cs +++ b/Mutagen.Bethesda.Core/Assets/IAssetType.cs @@ -9,7 +9,7 @@ namespace Mutagen.Bethesda.Assets; public interface IAssetType { #if NET7_0_OR_GREATER - static abstract IAssetType Instance { get; } + static virtual IAssetType Instance => null!; #endif /// From 4420283d1daf491fd23846a85f769aa76097c1bb Mon Sep 17 00:00:00 2001 From: nickp Date: Tue, 11 Jul 2023 22:19:38 +0200 Subject: [PATCH 067/135] Don't use inheritance for asset types --- Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs | 2 +- Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs index 60e5c20c9..766086b6e 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBehaviorAssetType.cs @@ -1,7 +1,7 @@ using Mutagen.Bethesda.Assets; namespace Mutagen.Bethesda.Skyrim.Assets; -public class SkyrimBehaviorAssetType : SkyrimModelAssetType +public class SkyrimBehaviorAssetType : IAssetType { #if NET7_0_OR_GREATER public static IAssetType Instance { get; } = new SkyrimBehaviorAssetType(); diff --git a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs index 84805ecc8..f56f95e6d 100644 --- a/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs +++ b/Mutagen.Bethesda.Skyrim/Assets/SkyrimBodyTextureAssetType.cs @@ -1,7 +1,7 @@ using Mutagen.Bethesda.Assets; namespace Mutagen.Bethesda.Skyrim.Assets; -public class SkyrimBodyTextureAssetType : SkyrimModelAssetType +public class SkyrimBodyTextureAssetType : IAssetType { #if NET7_0_OR_GREATER public static IAssetType Instance { get; } = new SkyrimBodyTextureAssetType(); From 5ca34dbfaf618f722a06ec7096cb34be51223c4f Mon Sep 17 00:00:00 2001 From: nickp Date: Tue, 11 Jul 2023 22:19:44 +0200 Subject: [PATCH 068/135] Add asset type tests --- .../Skyrim/Assets/AssetTypeTests.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs diff --git a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs new file mode 100644 index 000000000..f085802b8 --- /dev/null +++ b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs @@ -0,0 +1,44 @@ +using FluentAssertions; +using Mutagen.Bethesda.Assets; +using Noggog; +using Xunit; + +namespace Mutagen.Bethesda.UnitTests.Skyrim.Assets; + +public class AssetTypeTests +{ +#if NET7_0_OR_GREATER + public IAssetType GetInstance() + where TAssetType : class, IAssetType + { + return TAssetType.Instance; + } + + [Fact] + public void TestAllImplementationsAreNotNull() + { + var methodInfo = typeof(AssetTypeTests).GetMethod("GetInstance"); + + foreach (var implementation in typeof(IAssetType).GetInheritingFromInterface()) + { + var method = methodInfo?.MakeGenericMethod(implementation); + + var instance = method?.Invoke(this, null); + + instance.Should().NotBeNull(); + } + + } + + [Fact] + public void TestAllImplementationsHaveNoBaseClass() + { + var objectType = typeof(object); + + foreach (var implementation in typeof(IAssetType).GetInheritingFromInterface()) + { + implementation.BaseType.Should().Be(objectType); + } + } +#endif +} From f523d2ae3178396678358e63ad0930a7658c9c05 Mon Sep 17 00:00:00 2001 From: nickp Date: Mon, 17 Jul 2023 22:36:21 +0200 Subject: [PATCH 069/135] Add GetAssetType() --- Mutagen.Bethesda.Core/Assets/IAssetType.cs | 86 +++++++++++++------ .../Plugins/Assets/AssetLink.cs | 43 ++++++++++ .../Skyrim/Assets/AssetTypeTests.cs | 35 ++++++++ 3 files changed, 137 insertions(+), 27 deletions(-) diff --git a/Mutagen.Bethesda.Core/Assets/IAssetType.cs b/Mutagen.Bethesda.Core/Assets/IAssetType.cs index d8dbe71a6..e56df28ba 100644 --- a/Mutagen.Bethesda.Core/Assets/IAssetType.cs +++ b/Mutagen.Bethesda.Core/Assets/IAssetType.cs @@ -1,6 +1,6 @@ -using System; -using System.Collections.Generic; - +using System.Reflection; +using Mutagen.Bethesda.Plugins.Assets; +using Noggog; namespace Mutagen.Bethesda.Assets; /// @@ -22,36 +22,68 @@ public interface IAssetType /// IEnumerable FileExtensions { get; } + private static readonly Dictionary>> Types; + + static IAssetType() + { + Types = new Dictionary>>(); + + var assetTypeType = typeof(IAssetType); + foreach (var type in assetTypeType.GetInheritingFromInterface()) + { + if (type.Namespace == null) continue; + + GameCategory gameCategory; + switch (type.Namespace.TrimStart("Mutagen.Bethesda.")) { + case "Oblivion.Assets": + gameCategory = GameCategory.Oblivion; + break; + case "Skyrim.Assets": + gameCategory = GameCategory.Skyrim; + break; + case "Fallout4.Assets": + gameCategory = GameCategory.Fallout4; + break; + default: + continue; + } + + var instanceProperty = type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static); + if (instanceProperty?.GetValue(null) is not IAssetType assetType) continue; + + var gameTypes = Types.GetOrAdd(gameCategory); + foreach (var extension in assetType.FileExtensions) + { + var baseFolders = gameTypes.GetOrAdd(extension, () => new Dictionary()); + baseFolders.TryAdd(assetType.BaseFolder, assetType); + } + } + } + /// /// Parse asset type by game release and path /// - /// Release of the game this asset comes from + /// Release of the game this asset comes from /// Path of the asset /// Instance of the parsed asset type or null if no asset type could be determined - public static IAssetType? GetAssetType(GameRelease gameRelease, string path) { -#if NET7_0_OR_GREATER - switch (gameRelease) { - case GameRelease.Oblivion: - break; - case GameRelease.SkyrimLE: - case GameRelease.SkyrimSE: - case GameRelease.SkyrimSEGog: - case GameRelease.SkyrimVR: - case GameRelease.EnderalLE: - case GameRelease.EnderalSE: - - break; - case GameRelease.Fallout4: - break; - default: - throw new ArgumentOutOfRangeException(nameof(gameRelease), gameRelease, null); + public static IAssetType? GetAssetType(GameCategory gameCategory, string path) + { + // Get dictionary for game category + if (!Types.TryGetValue(gameCategory, out var gameTypes)) return null; + + // Get dictionary for file extension + if (!gameTypes.TryGetValue(Path.GetExtension(path), out var folders)) return null; + + // Get asset type from base folder + var dataRelativePath = AssetLink.ConvertToDataRelativePath(path); + foreach (var (baseFolder, assetType) in folders) + { + if (dataRelativePath.StartsWith(baseFolder, AssetLink.PathComparison)) + { + return assetType; + } } -#else -#endif - throw new NotImplementedException(); - } - static IAssetType() { - + return null; } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index c88abb103..2321a9049 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -17,6 +17,49 @@ public static class AssetLink public static readonly string DataInfix = Path.DirectorySeparatorChar + DataDirectory + Path.DirectorySeparatorChar; public static readonly string DataInfixAlt = Path.AltDirectorySeparatorChar + DataDirectory + Path.AltDirectorySeparatorChar; public static readonly int DataPrefixLength = DataDirectory.Length + 1; + + public static string ConvertToDataRelativePath(ReadOnlySpan inputPath) + { + Span mySpan = stackalloc char[inputPath.Length]; + inputPath.CopyTo(mySpan); + IFileSystemExt.CleanDirectorySeparators(mySpan); + + ReadOnlySpan path = mySpan; + + // Reduce all absolute paths to the path under data directory + if (path.Contains(Path.VolumeSeparatorChar)) + { + var dataDirectoryIndex = path.IndexOf(DataInfix, PathComparison); + if (dataDirectoryIndex != -1) + { + path = path[(dataDirectoryIndex + DataInfix.Length)..]; + } + else + { + dataDirectoryIndex = path.IndexOf(DataInfixAlt, PathComparison); + if (dataDirectoryIndex != -1) + { + path = path[(dataDirectoryIndex + DataInfixAlt.Length)..]; + } + } + } + + path = path + .TrimStart(Path.DirectorySeparatorChar) + .TrimStart(Path.AltDirectorySeparatorChar); + + // Can be replaced with a version of TrimStart that takes the string comparison into account + if (path.StartsWith(DataPrefix, PathComparison)) + { + path = path[DataPrefixLength..]; + } + else if (path.StartsWith(DataPrefixAlt, PathComparison)) + { + path = path[DataPrefixLength..]; + } + + return path.ToString(); + } } /// diff --git a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs index f085802b8..4a69fafbf 100644 --- a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs +++ b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs @@ -1,5 +1,6 @@ using FluentAssertions; using Mutagen.Bethesda.Assets; +using Mutagen.Bethesda.Skyrim.Assets; using Noggog; using Xunit; @@ -41,4 +42,38 @@ public void TestAllImplementationsHaveNoBaseClass() } } #endif + + [Fact] + public void TestGetAssetType() + { + IAssetType.GetAssetType(GameCategory.Skyrim, "Music\\Special\\Dungeon\\DungeonBoss01.xwm").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Music\\Special\\Dungeon\\DungeonBoss01.wav").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "XMusic\\Special\\Dungeon\\DungeonBoss01.wav").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Music\\Special\\Dungeon\\DungeonBoss01.mp3").Should().BeNull(); + + IAssetType.GetAssetType(GameCategory.Skyrim, "Meshes\\Armor\\Iron\\IronGauntlets.nif").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "XMeshes\\Armor\\Iron\\IronGauntlets.nif").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Meshes\\Armor\\Iron\\IronGauntlets.abc").Should().BeNull(); + + IAssetType.GetAssetType(GameCategory.Skyrim, "Textures\\Armor\\Iron\\IronGauntlets.dds").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "XTextures\\Armor\\Iron\\IronGauntlets.dds").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Textures\\Armor\\Iron\\IronGauntlets.abc").Should().BeNull(); + + IAssetType.GetAssetType(GameCategory.Skyrim, "Sound\\FX\\IronGauntlets.wav").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "XSound\\FX\\IronGauntlets.wav").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Sound\\FX\\IronGauntlets.abc").Should().BeNull(); + + IAssetType.GetAssetType(GameCategory.Skyrim, "SEQ\\Skyrim.seq").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "seq\\Skyrim.seq").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "s3q\\Skyrim.abc").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, "SEQ\\Skyrim.abc").Should().BeNull(); + + IAssetType.GetAssetType(GameCategory.Skyrim, "Scripts\\Source\\HelloWorld.psc").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Script\\Source\\HelloWorld.psc").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Scripts\\Source\\HelloWorld.abc").Should().BeNull(); + + IAssetType.GetAssetType(GameCategory.Skyrim, "Scripts\\HelloWorld.pex").Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Script\\HelloWorld.pex").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, "Scripts\\HelloWorld.abc").Should().BeNull(); + } } From eb21e7f1377553ba69fe07ffbb2ecfc48d4ea187 Mon Sep 17 00:00:00 2001 From: nickp Date: Tue, 18 Jul 2023 19:50:53 +0200 Subject: [PATCH 070/135] Use Path.Combine --- .../Skyrim/Assets/AssetTypeTests.cs | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs index 4a69fafbf..35437618b 100644 --- a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs +++ b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs @@ -46,34 +46,34 @@ public void TestAllImplementationsHaveNoBaseClass() [Fact] public void TestGetAssetType() { - IAssetType.GetAssetType(GameCategory.Skyrim, "Music\\Special\\Dungeon\\DungeonBoss01.xwm").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Music\\Special\\Dungeon\\DungeonBoss01.wav").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "XMusic\\Special\\Dungeon\\DungeonBoss01.wav").Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Music\\Special\\Dungeon\\DungeonBoss01.mp3").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.xwm")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.wav")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("XMusic", "Special", "Dungeon", "DungeonBoss01.wav")).Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.mp3")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Meshes\\Armor\\Iron\\IronGauntlets.nif").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "XMeshes\\Armor\\Iron\\IronGauntlets.nif").Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Meshes\\Armor\\Iron\\IronGauntlets.abc").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Meshes", "Armor", "Iron", "IronGauntlets.nif")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("XMeshes", "Armor", "Iron", "IronGauntlets.nif")).Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Meshes", "Armor", "Iron", "IronGauntlets.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Textures\\Armor\\Iron\\IronGauntlets.dds").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "XTextures\\Armor\\Iron\\IronGauntlets.dds").Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Textures\\Armor\\Iron\\IronGauntlets.abc").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Textures", "Armor", "Iron", "IronGauntlets.dds")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("XTextures", "Armor", "Iron", "IronGauntlets.dds")).Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Textures", "Armor", "Iron", "IronGauntlets.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Sound\\FX\\IronGauntlets.wav").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "XSound\\FX\\IronGauntlets.wav").Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Sound\\FX\\IronGauntlets.abc").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Sound", "FX", "IronGauntlets.wav")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("XSound", "FX", "IronGauntlets.wav")).Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Sound", "FX", "IronGauntlets.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "SEQ\\Skyrim.seq").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "seq\\Skyrim.seq").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "s3q\\Skyrim.abc").Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "SEQ\\Skyrim.abc").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("SEQ", "Skyrim.seq")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("seq", "Skyrim.seq")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("s3q", "Skyrim.abc")).Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("SEQ", "Skyrim.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Scripts\\Source\\HelloWorld.psc").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Script\\Source\\HelloWorld.psc").Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Scripts\\Source\\HelloWorld.abc").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "Source", "HelloWorld.psc")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Script", "Source", "HelloWorld.psc")).Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "Source", "HelloWorld.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Scripts\\HelloWorld.pex").Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Script\\HelloWorld.pex").Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, "Scripts\\HelloWorld.abc").Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "HelloWorld.pex")).Should().BeOfType(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Script", "HelloWorld.pex")).Should().BeNull(); + IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "HelloWorld.abc")).Should().BeNull(); } } From 355bc9cf8456f39a477fd51c2c92a0fba5548e1c Mon Sep 17 00:00:00 2001 From: nickp Date: Tue, 18 Jul 2023 20:00:51 +0200 Subject: [PATCH 071/135] Move GetAssetType to AssetTypeLocator and rename to TryGet --- .../Assets/AssetTypeLocator.cs | 72 +++++++++++++++++++ Mutagen.Bethesda.Core/Assets/IAssetType.cs | 70 +----------------- .../Mutagen.Bethesda.Core.csproj | 1 + .../Skyrim/Assets/AssetTypeTests.cs | 46 ++++++------ 4 files changed, 97 insertions(+), 92 deletions(-) create mode 100644 Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs diff --git a/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs b/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs new file mode 100644 index 000000000..78ff281c1 --- /dev/null +++ b/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs @@ -0,0 +1,72 @@ +using System.Reflection; +using Mutagen.Bethesda.Plugins.Assets; +using Noggog; +namespace Mutagen.Bethesda.Assets; + +public class AssetTypeLocator +{ + private static readonly Dictionary>> Types; + + static AssetTypeLocator() + { + Types = new Dictionary>>(); + + foreach (var type in typeof(IAssetType).GetInheritingFromInterface()) + { + if (type.Namespace == null) continue; + + GameCategory gameCategory; + switch (type.Namespace.TrimStart("Mutagen.Bethesda.")) + { + case "Oblivion.Assets": + gameCategory = GameCategory.Oblivion; + break; + case "Skyrim.Assets": + gameCategory = GameCategory.Skyrim; + break; + case "Fallout4.Assets": + gameCategory = GameCategory.Fallout4; + break; + default: + continue; + } + + var instanceProperty = type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static); + if (instanceProperty?.GetValue(null) is not IAssetType assetType) continue; + + var gameTypes = Types.GetOrAdd(gameCategory); + foreach (var extension in assetType.FileExtensions) + { + var baseFolders = gameTypes.GetOrAdd(extension, () => new Dictionary()); + baseFolders.TryAdd(assetType.BaseFolder, assetType); + } + } + } + + /// + /// Parse asset type by game release and path + /// + /// Release of the game this asset comes from + /// Path of the asset + /// Instance of the parsed asset type or null if no asset type could be determined + public static IAssetType? TryGetGetAssetType(GameCategory gameCategory, string path) + { + // Get dictionary for game category + if (!Types.TryGetValue(gameCategory, out var gameTypes)) return null; + + // Get dictionary for file extension + if (!gameTypes.TryGetValue(Path.GetExtension(path), out var folders)) return null; + + // Get asset type from base folder + var dataRelativePath = AssetLink.ConvertToDataRelativePath(path); + foreach (var (baseFolder, assetType) in folders) + { + if (dataRelativePath.StartsWith(baseFolder, AssetLink.PathComparison)) + { + return assetType; + } + } + + return null; + } +} diff --git a/Mutagen.Bethesda.Core/Assets/IAssetType.cs b/Mutagen.Bethesda.Core/Assets/IAssetType.cs index e56df28ba..39d3d5531 100644 --- a/Mutagen.Bethesda.Core/Assets/IAssetType.cs +++ b/Mutagen.Bethesda.Core/Assets/IAssetType.cs @@ -1,7 +1,4 @@ -using System.Reflection; -using Mutagen.Bethesda.Plugins.Assets; -using Noggog; -namespace Mutagen.Bethesda.Assets; +namespace Mutagen.Bethesda.Assets; /// /// File types that can be associated with Asset type @@ -21,69 +18,4 @@ public interface IAssetType /// File extension this asset type is associated with /// IEnumerable FileExtensions { get; } - - private static readonly Dictionary>> Types; - - static IAssetType() - { - Types = new Dictionary>>(); - - var assetTypeType = typeof(IAssetType); - foreach (var type in assetTypeType.GetInheritingFromInterface()) - { - if (type.Namespace == null) continue; - - GameCategory gameCategory; - switch (type.Namespace.TrimStart("Mutagen.Bethesda.")) { - case "Oblivion.Assets": - gameCategory = GameCategory.Oblivion; - break; - case "Skyrim.Assets": - gameCategory = GameCategory.Skyrim; - break; - case "Fallout4.Assets": - gameCategory = GameCategory.Fallout4; - break; - default: - continue; - } - - var instanceProperty = type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static); - if (instanceProperty?.GetValue(null) is not IAssetType assetType) continue; - - var gameTypes = Types.GetOrAdd(gameCategory); - foreach (var extension in assetType.FileExtensions) - { - var baseFolders = gameTypes.GetOrAdd(extension, () => new Dictionary()); - baseFolders.TryAdd(assetType.BaseFolder, assetType); - } - } - } - - /// - /// Parse asset type by game release and path - /// - /// Release of the game this asset comes from - /// Path of the asset - /// Instance of the parsed asset type or null if no asset type could be determined - public static IAssetType? GetAssetType(GameCategory gameCategory, string path) - { - // Get dictionary for game category - if (!Types.TryGetValue(gameCategory, out var gameTypes)) return null; - - // Get dictionary for file extension - if (!gameTypes.TryGetValue(Path.GetExtension(path), out var folders)) return null; - - // Get asset type from base folder - var dataRelativePath = AssetLink.ConvertToDataRelativePath(path); - foreach (var (baseFolder, assetType) in folders) - { - if (dataRelativePath.StartsWith(baseFolder, AssetLink.PathComparison)) - { - return assetType; - } - } - - return null; - } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj b/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj index 3ee1aef58..8fe38a1fa 100644 --- a/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj +++ b/Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj @@ -85,6 +85,7 @@ + diff --git a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs index 35437618b..d54d3ea94 100644 --- a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs +++ b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs @@ -46,34 +46,34 @@ public void TestAllImplementationsHaveNoBaseClass() [Fact] public void TestGetAssetType() { - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.xwm")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.wav")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("XMusic", "Special", "Dungeon", "DungeonBoss01.wav")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.mp3")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.xwm")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.wav")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("XMusic", "Special", "Dungeon", "DungeonBoss01.wav")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Music", "Special", "Dungeon", "DungeonBoss01.mp3")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Meshes", "Armor", "Iron", "IronGauntlets.nif")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("XMeshes", "Armor", "Iron", "IronGauntlets.nif")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Meshes", "Armor", "Iron", "IronGauntlets.abc")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Meshes", "Armor", "Iron", "IronGauntlets.nif")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("XMeshes", "Armor", "Iron", "IronGauntlets.nif")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Meshes", "Armor", "Iron", "IronGauntlets.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Textures", "Armor", "Iron", "IronGauntlets.dds")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("XTextures", "Armor", "Iron", "IronGauntlets.dds")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Textures", "Armor", "Iron", "IronGauntlets.abc")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Textures", "Armor", "Iron", "IronGauntlets.dds")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("XTextures", "Armor", "Iron", "IronGauntlets.dds")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Textures", "Armor", "Iron", "IronGauntlets.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Sound", "FX", "IronGauntlets.wav")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("XSound", "FX", "IronGauntlets.wav")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Sound", "FX", "IronGauntlets.abc")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Sound", "FX", "IronGauntlets.wav")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("XSound", "FX", "IronGauntlets.wav")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Sound", "FX", "IronGauntlets.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("SEQ", "Skyrim.seq")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("seq", "Skyrim.seq")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("s3q", "Skyrim.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("SEQ", "Skyrim.abc")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("SEQ", "Skyrim.seq")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("seq", "Skyrim.seq")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("s3q", "Skyrim.abc")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("SEQ", "Skyrim.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "Source", "HelloWorld.psc")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Script", "Source", "HelloWorld.psc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "Source", "HelloWorld.abc")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "Source", "HelloWorld.psc")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Script", "Source", "HelloWorld.psc")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "Source", "HelloWorld.abc")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "HelloWorld.pex")).Should().BeOfType(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Script", "HelloWorld.pex")).Should().BeNull(); - IAssetType.GetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "HelloWorld.abc")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "HelloWorld.pex")).Should().BeOfType(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Script", "HelloWorld.pex")).Should().BeNull(); + AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "HelloWorld.abc")).Should().BeNull(); } } From 27e6f102d0554c38a0cdfee27b2d06b7b49bcde5 Mon Sep 17 00:00:00 2001 From: nickp Date: Tue, 18 Jul 2023 20:01:09 +0200 Subject: [PATCH 072/135] Add GetAssetType that throws on null --- .../Assets/AssetTypeLocator.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs b/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs index 78ff281c1..405ff89ae 100644 --- a/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs +++ b/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs @@ -43,6 +43,23 @@ static AssetTypeLocator() } } + /// + /// Parse asset type by game release and path + /// + /// Release of the game this asset comes from + /// Path of the asset + /// Instance of the parsed asset type + /// When the asset type couldn't be determined + public static IAssetType GetAssetType(GameCategory gameCategory, string path) { + var assetType = TryGetGetAssetType(gameCategory, path); + + if (assetType is null) { + throw new ArgumentException($"Could not determine asset type for {path} in {gameCategory}"); + } + + return assetType; + } + /// /// Parse asset type by game release and path /// From 4d05bc463e0ba62b4479a798384cd24920e01903 Mon Sep 17 00:00:00 2001 From: nickp Date: Tue, 18 Jul 2023 20:47:35 +0200 Subject: [PATCH 073/135] Limit AssetTypeLocator to dotnet 7 or greater --- Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs | 2 ++ Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs b/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs index 405ff89ae..cb5b55b94 100644 --- a/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs +++ b/Mutagen.Bethesda.Core/Assets/AssetTypeLocator.cs @@ -3,6 +3,7 @@ using Noggog; namespace Mutagen.Bethesda.Assets; +#if NET7_0_OR_GREATER public class AssetTypeLocator { private static readonly Dictionary>> Types; @@ -87,3 +88,4 @@ public static IAssetType GetAssetType(GameCategory gameCategory, string path) { return null; } } +#endif \ No newline at end of file diff --git a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs index d54d3ea94..ee0abf0db 100644 --- a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs +++ b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTypeTests.cs @@ -41,7 +41,6 @@ public void TestAllImplementationsHaveNoBaseClass() implementation.BaseType.Should().Be(objectType); } } -#endif [Fact] public void TestGetAssetType() @@ -76,4 +75,5 @@ public void TestGetAssetType() AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Script", "HelloWorld.pex")).Should().BeNull(); AssetTypeLocator.TryGetGetAssetType(GameCategory.Skyrim, Path.Combine("Scripts", "HelloWorld.abc")).Should().BeNull(); } +#endif } From 1f320c21f800ef06a7980939facf7aaffb8b1aa5 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 16 Jul 2023 00:17:40 -0500 Subject: [PATCH 074/135] ToCategory ext function moved to kernel --- Directory.Packages.props | 8 ++-- .../Extensions/GameReleaseExt.cs | 32 ---------------- Mutagen.Bethesda.Kernel/GameCategory.cs | 37 ++++++++++++++++++- 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index de358caa9..f54ec6453 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -39,16 +39,16 @@ - [2.59.0.1-nightly-20230704-091177] + [2.59.0.1-nightly-20230715-044535] - [2.59.0.1-nightly-20230704-091177] + [2.59.0.1-nightly-20230715-044535] - [2.59.0.1-nightly-20230704-091177] + [2.59.0.1-nightly-20230715-044535] - [2.59.0.1-nightly-20230704-091177] + [2.59.0.1-nightly-20230715-044535] 0.9.5 diff --git a/Mutagen.Bethesda.Core/Extensions/GameReleaseExt.cs b/Mutagen.Bethesda.Core/Extensions/GameReleaseExt.cs index 67c5b15c5..e13b6ee04 100644 --- a/Mutagen.Bethesda.Core/Extensions/GameReleaseExt.cs +++ b/Mutagen.Bethesda.Core/Extensions/GameReleaseExt.cs @@ -4,38 +4,6 @@ namespace Mutagen.Bethesda; public static class GameReleaseExt { - public static GameCategory ToCategory(this GameRelease release) - { - return release switch - { - GameRelease.Oblivion => GameCategory.Oblivion, - GameRelease.SkyrimLE => GameCategory.Skyrim, - GameRelease.SkyrimSE => GameCategory.Skyrim, - GameRelease.SkyrimSEGog => GameCategory.Skyrim, - GameRelease.SkyrimVR => GameCategory.Skyrim, - GameRelease.EnderalLE => GameCategory.Skyrim, - GameRelease.EnderalSE => GameCategory.Skyrim, - GameRelease.Fallout4 => GameCategory.Fallout4, - _ => throw new NotImplementedException(), - }; - } - - public static ushort? GetDefaultFormVersion(this GameRelease release) - { - return release switch - { - GameRelease.Oblivion => default, - GameRelease.SkyrimLE => 43, - GameRelease.EnderalLE => 43, - GameRelease.SkyrimSE => 44, - GameRelease.SkyrimSEGog => 44, - GameRelease.EnderalSE => 44, - GameRelease.SkyrimVR => 44, - GameRelease.Fallout4 => 131, - _ => throw new NotImplementedException(), - }; - } - public static StringsLanguageFormat GetLanguageFormat(this GameRelease release) { switch (release) diff --git a/Mutagen.Bethesda.Kernel/GameCategory.cs b/Mutagen.Bethesda.Kernel/GameCategory.cs index 4d84af042..df64cd40e 100644 --- a/Mutagen.Bethesda.Kernel/GameCategory.cs +++ b/Mutagen.Bethesda.Kernel/GameCategory.cs @@ -13,4 +13,39 @@ public enum GameCategory Skyrim, [Description("Fallout4")] Fallout4, -} \ No newline at end of file +} + +public static class GameReleaseKernelExt +{ + public static GameCategory ToCategory(this GameRelease release) + { + return release switch + { + GameRelease.Oblivion => GameCategory.Oblivion, + GameRelease.SkyrimLE => GameCategory.Skyrim, + GameRelease.SkyrimSE => GameCategory.Skyrim, + GameRelease.SkyrimSEGog => GameCategory.Skyrim, + GameRelease.SkyrimVR => GameCategory.Skyrim, + GameRelease.EnderalLE => GameCategory.Skyrim, + GameRelease.EnderalSE => GameCategory.Skyrim, + GameRelease.Fallout4 => GameCategory.Fallout4, + _ => throw new NotImplementedException(), + }; + } + + public static ushort? GetDefaultFormVersion(this GameRelease release) + { + return release switch + { + GameRelease.Oblivion => default, + GameRelease.SkyrimLE => 43, + GameRelease.EnderalLE => 43, + GameRelease.SkyrimSE => 44, + GameRelease.SkyrimSEGog => 44, + GameRelease.EnderalSE => 44, + GameRelease.SkyrimVR => 44, + GameRelease.Fallout4 => 131, + _ => throw new NotImplementedException(), + }; + } +} From cff522cf6f3a0b246d24bec119c6aecd9eea05a4 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 16 Jul 2023 00:25:49 -0500 Subject: [PATCH 075/135] zdev suffix for version sorting --- Directory.Build.props | 2 +- Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 77e557900..d90b8e470 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -30,7 +30,7 @@ DependsOnTargets="GitVersion" Returns="$(PackageVersion)"> - .1-dev + .1-zdev .1-$(VersionSuffix) .1 $(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel) diff --git a/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj b/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj index 524a3e4b2..28b3f2d01 100644 --- a/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj +++ b/Mutagen.Bethesda.WPF/Mutagen.Bethesda.WPF.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0 @@ -56,7 +56,7 @@ - .1-dev + .1-zdev .1-$(VersionSuffix) $(GitSemVerDashLabel) .1 From e56a572e6dce100a77d4799f17e504a1dd4cc912 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Wed, 19 Jul 2023 01:38:34 -0500 Subject: [PATCH 076/135] GetInferredAssetLinks should return getter only interface closes #453 --- .../Modules/Plugin/ContainedAssetLinksModule.cs | 4 ++-- .../Records/Common Subrecords/ScriptEntry.cs | 2 +- .../Records/Common Subrecords/ScriptEntry_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs | 2 +- .../Records/Major Records/ArmorAddon_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs | 2 +- .../Records/Major Records/Book_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic.cs | 2 +- .../Records/Major Records/DialogTopic_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/Npc.cs | 2 +- .../Records/Major Records/Npc_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs | 2 +- .../Records/Major Records/Quest_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs index 70aa69dcd..56016ba8e 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs @@ -61,11 +61,11 @@ public override async Task GenerateInCommon(ObjectGeneration obj, StructuredStri { if (obj.GetObjectData().HasInferredAssets) { - fg.AppendLine($"public static partial IEnumerable GetInferredAssetLinks({obj.Interface(getter: true)} obj, Type? assetType);"); + fg.AppendLine($"public static partial IEnumerable<{nameof(IAssetLinkGetter)}> GetInferredAssetLinks({obj.Interface(getter: true)} obj, Type? assetType);"); } if (obj.GetObjectData().HasResolvedAssets) { - fg.AppendLine($"public static partial IEnumerable GetResolvedAssetLinks({obj.Interface(getter: true)} obj, {nameof(IAssetLinkCache)} linkCache, Type? assetType);"); + fg.AppendLine($"public static partial IEnumerable<{nameof(IAssetLinkGetter)}> GetResolvedAssetLinks({obj.Interface(getter: true)} obj, {nameof(IAssetLinkCache)} linkCache, Type? assetType);"); } fg.AppendLine($"public IEnumerable<{nameof(IAssetLinkGetter)}> EnumerateAssetLinks({obj.Interface(getter: true)} obj, {nameof(AssetLinkQuery)} queryCategories, {nameof(IAssetLinkCache)}? linkCache, Type? assetType)"); diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs index 5bb1f7f3f..27b02dd2c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs @@ -18,7 +18,7 @@ public enum Flag : byte partial class ScriptEntryCommon { - public static partial IEnumerable GetInferredAssetLinks(IScriptEntryGetter obj, Type? assetType) + public static partial IEnumerable GetInferredAssetLinks(IScriptEntryGetter obj, Type? assetType) { if (string.IsNullOrWhiteSpace(obj.Name)) yield break; diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs index bf56b1ad8..458141746 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs @@ -1049,7 +1049,7 @@ public IEnumerable EnumerateFormLinks(IScriptEntryGetter obj) yield break; } - public static partial IEnumerable GetInferredAssetLinks(IScriptEntryGetter obj, Type? assetType); + public static partial IEnumerable GetInferredAssetLinks(IScriptEntryGetter obj, Type? assetType); public IEnumerable EnumerateAssetLinks(IScriptEntryGetter obj, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) { if (queryCategories.HasFlag(AssetLinkQuery.Inferred)) diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs index 051de3734..ad35022e6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs @@ -69,7 +69,7 @@ public void Print(StructuredStringBuilder fg, string? name = null) partial class ArmorAddonCommon { - public static partial IEnumerable GetInferredAssetLinks(IArmorAddonGetter obj, Type? assetType) + public static partial IEnumerable GetInferredAssetLinks(IArmorAddonGetter obj, Type? assetType) { if (assetType != null && assetType != typeof(SkyrimModelAssetType)) yield break; diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs index 32d7f3c9e..22c2c9355 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs @@ -2052,7 +2052,7 @@ public IEnumerable EnumerateFormLinks(IArmorAddonGetter obj) yield break; } - public static partial IEnumerable GetInferredAssetLinks(IArmorAddonGetter obj, Type? assetType); + public static partial IEnumerable GetInferredAssetLinks(IArmorAddonGetter obj, Type? assetType); public IEnumerable EnumerateAssetLinks(IArmorAddonGetter obj, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) { foreach (var item in base.EnumerateAssetLinks(obj, queryCategories, linkCache, assetType)) diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs index 0342f087d..959bf99ed 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs @@ -152,7 +152,7 @@ partial class BookCommon private const string Pattern = @"(); - -if (link.TryResolve(state.LinkCache, out var foundRecord)) +if (state.LinkCache.TryResolve(FormKey.Factory("123456:Skyrim.esm"), out var foundRecord)) { // Found the specific record we were looking for } From 76476a9d86350d365e738212fd6b54bbd14e2241 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 21:32:56 -0500 Subject: [PATCH 079/135] docs theming --- docs/{Home.md => index.md} | 0 docs/requirements.txt | 1 + mkdocs.yml | 6 +++--- 3 files changed, 4 insertions(+), 3 deletions(-) rename docs/{Home.md => index.md} (100%) create mode 100644 docs/requirements.txt diff --git a/docs/Home.md b/docs/index.md similarity index 100% rename from docs/Home.md rename to docs/index.md diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 000000000..3d336bd01 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +mkdocs-redirects \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index f2b7092fb..da540b809 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -36,14 +36,14 @@ plugins: theme: name: material palette: - primary: red - accent: red + primary: deep purple + accent: deep orange scheme: slate features: - navigation.instant nav: - - Home: Home.md + - Home: index.md - Big Cheat Sheet: Big-Cheat-Sheet.md - Plugin Record Suite: - Generated Classes: Generated-Classes.md From 91aa23059cf5502963fe5eb256fa43b72b45132e Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 21:35:40 -0500 Subject: [PATCH 080/135] RemapListedAssetLinks -> RemapAssetLinks --- .../Placeholders/TestMajorRecord.cs | 2 +- .../Extensions/AssetLinkRemappingMixIn.cs | 16 +-- .../Plugins/Assets/IAssetLinkContainer.cs | 2 +- .../Plugins/Records/AGroup.cs | 2 +- .../Plugins/Records/AListGroup.cs | 2 +- .../Plugins/Records/MajorRecord_Generated.cs | 4 +- .../Records/Fallout4Group_Generated.cs | 6 +- .../Records/Fallout4ListGroup_Generated.cs | 6 +- .../Records/Fallout4MajorRecord_Generated.cs | 6 +- .../Records/Fallout4Mod_Generated.cs | 8 +- .../Major Records/CellBlock_Generated.cs | 6 +- .../Major Records/CellSubBlock_Generated.cs | 6 +- .../Records/Major Records/Cell_Generated.cs | 10 +- .../WorldspaceBlock_Generated.cs | 6 +- .../WorldspaceSubBlock_Generated.cs | 6 +- .../Major Records/Worldspace_Generated.cs | 10 +- .../Plugin/ContainedAssetLinksModule.cs | 74 +++++------ .../Major Records/CellBlock_Generated.cs | 6 +- .../Major Records/CellSubBlock_Generated.cs | 6 +- .../Records/Major Records/Cell_Generated.cs | 12 +- .../WorldspaceBlock_Generated.cs | 6 +- .../WorldspaceSubBlock_Generated.cs | 6 +- .../Major Records/Worldspace_Generated.cs | 10 +- .../Records/OblivionGroup_Generated.cs | 6 +- .../Records/OblivionListGroup_Generated.cs | 6 +- .../Records/OblivionMajorRecord_Generated.cs | 6 +- .../Records/OblivionMod_Generated.cs | 8 +- .../AVirtualMachineAdapter_Generated.cs | 6 +- .../Destructible_Generated.cs | 6 +- .../DestructionStage_Generated.cs | 6 +- .../Common Subrecords/Icons_Generated.cs | 11 +- .../ScriptEntry_Generated.cs | 4 +- .../SimpleModel_Generated.cs | 9 +- .../Major Records/APlacedTrap_Generated.cs | 8 +- .../Major Records/Activator_Generated.cs | 12 +- .../Major Records/AddonNode_Generated.cs | 8 +- .../AlchemicalApparatus_Generated.cs | 14 +- .../Major Records/Ammunition_Generated.cs | 12 +- .../Major Records/AnimatedObject_Generated.cs | 8 +- .../Major Records/ArmorAddon_Generated.cs | 10 +- .../Major Records/ArmorModel_Generated.cs | 8 +- .../Records/Major Records/Armor_Generated.cs | 12 +- .../Major Records/ArtObject_Generated.cs | 8 +- .../Major Records/BodyData_Generated.cs | 6 +- .../Major Records/BodyPartData_Generated.cs | 8 +- .../Records/Major Records/Book_Generated.cs | 14 +- .../Major Records/CameraShot_Generated.cs | 8 +- .../Major Records/CellBlock_Generated.cs | 6 +- .../Major Records/CellSubBlock_Generated.cs | 6 +- .../Records/Major Records/Cell_Generated.cs | 10 +- .../Major Records/Climate_Generated.cs | 15 ++- .../Major Records/Container_Generated.cs | 12 +- .../Major Records/DebrisModel_Generated.cs | 9 +- .../Records/Major Records/Debris_Generated.cs | 8 +- .../DialogResponses_Generated.cs | 8 +- .../Major Records/DialogTopic_Generated.cs | 8 +- .../Records/Major Records/Door_Generated.cs | 12 +- .../Major Records/EffectShader_Generated.cs | 19 +-- .../Major Records/Explosion_Generated.cs | 10 +- .../Records/Major Records/Eyes_Generated.cs | 11 +- .../Records/Major Records/Flora_Generated.cs | 12 +- .../Major Records/Furniture_Generated.cs | 17 ++- .../Records/Major Records/Grass_Generated.cs | 8 +- .../Records/Major Records/Hazard_Generated.cs | 8 +- .../Major Records/HeadData_Generated.cs | 8 +- .../Major Records/HeadPart_Generated.cs | 10 +- .../Major Records/IdleAnimation_Generated.cs | 11 +- .../Major Records/IdleMarker_Generated.cs | 8 +- .../Records/Major Records/Impact_Generated.cs | 8 +- .../Major Records/Ingestible_Generated.cs | 12 +- .../Major Records/Ingredient_Generated.cs | 14 +- .../Records/Major Records/Key_Generated.cs | 14 +- .../LensFlareSprite_Generated.cs | 9 +- .../Major Records/LensFlare_Generated.cs | 8 +- .../Major Records/LeveledNpc_Generated.cs | 8 +- .../Records/Major Records/Light_Generated.cs | 14 +- .../Major Records/LoadScreen_Generated.cs | 13 +- .../Records/Major Records/Lod_Generated.cs | 15 ++- .../Major Records/MagicEffect_Generated.cs | 8 +- .../Major Records/MaterialObject_Generated.cs | 8 +- .../Major Records/MiscItem_Generated.cs | 14 +- .../Major Records/MoveableStatic_Generated.cs | 10 +- .../Major Records/MusicTrack_Generated.cs | 13 +- .../Records/Major Records/Npc_Generated.cs | 10 +- .../Major Records/Package_Generated.cs | 8 +- .../Records/Major Records/Part_Generated.cs | 9 +- .../Records/Major Records/Perk_Generated.cs | 10 +- .../Major Records/PlacedNpc_Generated.cs | 8 +- .../Major Records/PlacedObject_Generated.cs | 8 +- .../Major Records/Projectile_Generated.cs | 15 ++- .../Major Records/QuestAdapter_Generated.cs | 8 +- .../QuestFragmentAlias_Generated.cs | 6 +- .../Records/Major Records/Quest_Generated.cs | 8 +- .../Records/Major Records/Race_Generated.cs | 14 +- .../Major Records/RegionData_Generated.cs | 6 +- .../Records/Major Records/Region_Generated.cs | 20 +-- .../Records/Major Records/Scene_Generated.cs | 8 +- .../Records/Major Records/Scroll_Generated.cs | 10 +- .../ShaderParticleGeometry_Generated.cs | 11 +- .../Major Records/SoulGem_Generated.cs | 12 +- .../SoundDescriptor_Generated.cs | 6 +- .../Records/Major Records/Static_Generated.cs | 10 +- .../TalkingActivator_Generated.cs | 12 +- .../Major Records/TextureSet_Generated.cs | 27 ++-- .../Major Records/TintAssets_Generated.cs | 9 +- .../Records/Major Records/Tree_Generated.cs | 10 +- .../Records/Major Records/Water_Generated.cs | 17 ++- .../Records/Major Records/Weapon_Generated.cs | 16 +-- .../Major Records/Weather_Generated.cs | 8 +- .../WorldspaceBlock_Generated.cs | 6 +- .../WorldspaceSubBlock_Generated.cs | 6 +- .../Major Records/Worldspace_Generated.cs | 29 +++-- .../Records/SkyrimGroup_Generated.cs | 6 +- .../Records/SkyrimListGroup_Generated.cs | 6 +- .../Records/SkyrimMajorRecord_Generated.cs | 6 +- .../Records/SkyrimMod_Generated.cs | 122 +++++++++--------- 116 files changed, 662 insertions(+), 611 deletions(-) diff --git a/Mutagen.Bethesda.Core.UnitTests/Placeholders/TestMajorRecord.cs b/Mutagen.Bethesda.Core.UnitTests/Placeholders/TestMajorRecord.cs index 15e4f5ff6..99a1925ac 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Placeholders/TestMajorRecord.cs +++ b/Mutagen.Bethesda.Core.UnitTests/Placeholders/TestMajorRecord.cs @@ -164,7 +164,7 @@ IEnumerable IMajorRecordGetterEnumerable.EnumerateMajorRecor public Type Type => throw new NotImplementedException(); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) { throw new NotImplementedException(); } diff --git a/Mutagen.Bethesda.Core/Extensions/AssetLinkRemappingMixIn.cs b/Mutagen.Bethesda.Core/Extensions/AssetLinkRemappingMixIn.cs index 9d521e03e..4fc2d4ffe 100644 --- a/Mutagen.Bethesda.Core/Extensions/AssetLinkRemappingMixIn.cs +++ b/Mutagen.Bethesda.Core/Extensions/AssetLinkRemappingMixIn.cs @@ -41,22 +41,22 @@ public static void RemapListedAssetLinks(this IList(this IList linkList, IReadOnlyDictionary mapping) + public static void RemapAssetLinks(this IList linkList, IReadOnlyDictionary mapping, AssetLinkQuery query) { foreach (var item in linkList) { - item.RemapListedAssetLinks(mapping); + item.RemapAssetLinks(mapping, query); } } - public static void RemapListedAssetLinks(this IGenderedItemGetter gendered, IReadOnlyDictionary mapping) + public static void RemapAssetLinks(this IGenderedItemGetter gendered, IReadOnlyDictionary mapping, AssetLinkQuery query) where TItem : class, IAssetLinkContainer { - gendered.Male?.RemapListedAssetLinks(mapping); - gendered.Female?.RemapListedAssetLinks(mapping); + gendered.Male?.RemapAssetLinks(mapping, query); + gendered.Female?.RemapAssetLinks(mapping, query); } - public static void RemapListedAssetLinks(this IGenderedItem gendered, IReadOnlyDictionary mapping) + public static void RemapAssetLinks(this IGenderedItem gendered, IReadOnlyDictionary mapping) where TLinkType : IAssetLink, new() where TAssetType : IAssetType { @@ -64,12 +64,12 @@ public static void RemapListedAssetLinks(this IGenderedIt gendered.Female = gendered.Female.RelinkToNew(mapping); } - public static void RemapListedAssetLinks(this IReadOnlyCache cache, IReadOnlyDictionary mapping) + public static void RemapAssetLinks(this IReadOnlyCache cache, IReadOnlyDictionary mapping, AssetLinkQuery query) where TMajorGetter : class, IMajorRecordGetter, IAssetLinkContainer { foreach (var item in cache.Items) { - item.RemapListedAssetLinks(mapping); + item.RemapAssetLinks(mapping, query); } } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs index 5f6a8b76c..a7db55ab9 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs @@ -11,7 +11,7 @@ public interface IAssetLinkContainer : IAssetLinkContainerGetter /// /// Swaps out all links to point to new assets /// - void RemapListedAssetLinks(IReadOnlyDictionary mapping); + void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query); /// /// Enumerates only AssetLinks that are explicitly listed in the record and can be modified directly. diff --git a/Mutagen.Bethesda.Core/Plugins/Records/AGroup.cs b/Mutagen.Bethesda.Core/Plugins/Records/AGroup.cs index 7e9915b30..e53640674 100644 --- a/Mutagen.Bethesda.Core/Plugins/Records/AGroup.cs +++ b/Mutagen.Bethesda.Core/Plugins/Records/AGroup.cs @@ -158,7 +158,7 @@ public void AddUntyped(IMajorRecord record) public abstract IEnumerable EnumerateListedAssetLinks(); /// - public abstract void RemapListedAssetLinks(IReadOnlyDictionary mapping); + public abstract void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query); public abstract IEnumerable EnumerateAssetLinks( AssetLinkQuery queryCategories = AssetLinkQuery.Listed, diff --git a/Mutagen.Bethesda.Core/Plugins/Records/AListGroup.cs b/Mutagen.Bethesda.Core/Plugins/Records/AListGroup.cs index b6165e839..28d226fd6 100644 --- a/Mutagen.Bethesda.Core/Plugins/Records/AListGroup.cs +++ b/Mutagen.Bethesda.Core/Plugins/Records/AListGroup.cs @@ -83,7 +83,7 @@ private TObject ConfirmCorrectType(IMajorRecord record, string paramName) public void Move(int original, int destination) => ProtectedList.Move(original, destination); /// - public abstract void RemapListedAssetLinks(IReadOnlyDictionary mapping); + public abstract void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query); /// public abstract IEnumerable EnumerateListedAssetLinks(); diff --git a/Mutagen.Bethesda.Core/Plugins/Records/MajorRecord_Generated.cs b/Mutagen.Bethesda.Core/Plugins/Records/MajorRecord_Generated.cs index ad25ab991..c5eb909d2 100644 --- a/Mutagen.Bethesda.Core/Plugins/Records/MajorRecord_Generated.cs +++ b/Mutagen.Bethesda.Core/Plugins/Records/MajorRecord_Generated.cs @@ -512,7 +512,7 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public virtual IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MajorRecordCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public virtual IEnumerable EnumerateListedAssetLinks() => MajorRecordSetterCommon.Instance.EnumerateListedAssetLinks(this); - public virtual void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MajorRecordSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public virtual void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1181,7 +1181,7 @@ public IEnumerable EnumerateListedAssetLinks(IMajorRecord obj) yield break; } - public void RemapListedAssetLinks(IMajorRecord obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IMajorRecord obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { } diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs index 1f5452196..2f38cc4d5 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs @@ -151,7 +151,7 @@ public bool Equals(IFallout4GroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => Fallout4GroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => Fallout4GroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => Fallout4GroupSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => Fallout4GroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -872,9 +872,9 @@ public IEnumerable EnumerateListedAssetLinks(IFallout4Group obj) yield break; } - public void RemapListedAssetLinks(IFallout4Group obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IFallout4Group obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.RecordCache.RemapListedAssetLinks(mapping); + obj.RecordCache.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs index b75bdc13b..84f036e5c 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs @@ -153,7 +153,7 @@ public bool Equals(IFallout4ListGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => Fallout4ListGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => Fallout4ListGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => Fallout4ListGroupSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => Fallout4ListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -872,9 +872,9 @@ public IEnumerable EnumerateListedAssetLinks(IFallout4ListGroup o yield break; } - public void RemapListedAssetLinks(IFallout4ListGroup obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IFallout4ListGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Records.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4MajorRecord_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4MajorRecord_Generated.cs index de49c9f41..b738016c1 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4MajorRecord_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4MajorRecord_Generated.cs @@ -481,7 +481,7 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => Fallout4MajorRecordCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => Fallout4MajorRecordSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => Fallout4MajorRecordSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => Fallout4MajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1136,9 +1136,9 @@ public IEnumerable EnumerateListedAssetLinks(IFallout4MajorRecord ob yield break; } - public void RemapListedAssetLinks(IFallout4MajorRecord obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IFallout4MajorRecord obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); + base.RemapAssetLinks(obj, mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs index 8e9095f2b..2681d548d 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs @@ -6654,7 +6654,7 @@ public uint GetRecordCount() IEnumerable> IMajorRecordSimpleContextEnumerable.EnumerateMajorRecordSimpleContexts(Type type, bool throwIfUnknown) => this.EnumerateMajorRecordContexts(linkCache: null!, type: type, throwIfUnknown: throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => Fallout4ModCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => Fallout4ModSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => Fallout4ModSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => Fallout4ModSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -9932,10 +9932,10 @@ public IEnumerable EnumerateListedAssetLinks(IFallout4Mod obj) yield break; } - public void RemapListedAssetLinks(IFallout4Mod obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IFallout4Mod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Cells.RemapListedAssetLinks(mapping); - obj.Worldspaces.RemapListedAssetLinks(mapping); + obj.Cells.RemapAssetLinks(mapping, query); + obj.Worldspaces.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs index 9811889d9..5532d7e7e 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs @@ -602,7 +602,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1413,9 +1413,9 @@ public IEnumerable EnumerateListedAssetLinks(ICellBlock obj) yield break; } - public void RemapListedAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.SubBlocks.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs index b8a2f31c5..efad90d33 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs @@ -602,7 +602,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSubBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1398,9 +1398,9 @@ public IEnumerable EnumerateListedAssetLinks(ICellSubBlock obj) yield break; } - public void RemapListedAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Cells.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs index 88caf1681..871f0c7b5 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs @@ -2558,7 +2558,7 @@ public MajorFlag MajorFlags void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => CellSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -3613,11 +3613,11 @@ public IEnumerable EnumerateListedAssetLinks(ICell obj) yield break; } - public void RemapListedAssetLinks(ICell obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICell obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Persistent.ForEach(x => x.RemapListedAssetLinks(mapping)); - obj.Temporary.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs index 3e99e43f0..82e0b0b28 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs @@ -635,7 +635,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1450,9 +1450,9 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceBlock obj) yield break; } - public void RemapListedAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Items.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs index 9c3e98c75..ef6ac6cdf 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -635,7 +635,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSubBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1435,9 +1435,9 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceSubBlock obj yield break; } - public void RemapListedAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Items.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs index 4e91351cc..f6fba1fc0 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs @@ -1878,7 +1878,7 @@ public MajorFlag MajorFlags void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WorldspaceSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -3070,11 +3070,11 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspace obj) yield break; } - public void RemapListedAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.TopCell?.RemapListedAssetLinks(mapping); - obj.SubCells.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.TopCell?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs index d8fa36777..03e808058 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs @@ -78,7 +78,7 @@ public override async Task GenerateInCommon(ObjectGeneration obj, StructuredStri if (maskTypes.Applicable(LoquiInterfaceType.ISetter, CommonGenerics.Class)) { - await GenerateRemapListedAssetLinks(obj, fg); + await GenerateRemapAssetLinks(obj, fg); } } @@ -360,43 +360,28 @@ private async Task GenerateEnumerateListedAssetLinks(ObjectGeneration obj, Struc fg.AppendLine(); } - private async Task GenerateRemapListedAssetLinks(ObjectGeneration obj, StructuredStringBuilder fg) + private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStringBuilder fg) { fg.AppendLine( - $"public void {nameof(IAssetLinkContainer.RemapListedAssetLinks)}({obj.Interface(getter: false)} obj, IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping)"); + $"public void {nameof(IAssetLinkContainer.RemapAssetLinks)}({obj.Interface(getter: false)} obj, IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping, {nameof(AssetLinkQuery)} query)"); using (fg.CurlyBrace()) { foreach (var baseClass in obj.BaseClassTrail()) { if (await HasLinks(baseClass, includeBaseClass: true) != Case.No) { - fg.AppendLine($"base.{nameof(IAssetLinkContainer.RemapListedAssetLinks)}(obj, mapping);"); + fg.AppendLine($"base.{nameof(IAssetLinkContainer.RemapAssetLinks)}(obj, mapping, query);"); break; } } - + var startCount = fg.Count; + var subFg = new StructuredStringBuilder(); foreach (var field in obj.IterateFields(nonIntegrated: true)) { if (field is AssetLinkType) { - fg.AppendLine($"obj.{field.Name}{field.NullChar}.Relink(mapping);"); - } - else if (field is LoquiType loqui) - { - Case subLinkCase; - if (loqui.TargetObjectGeneration != null) - { - subLinkCase = await HasLinks(loqui, includeBaseClass: true); - } - else - { - subLinkCase = Case.Maybe; - } - - if (subLinkCase == Case.No) continue; - fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapListedAssetLinks)}(mapping);"); + subFg.AppendLine($"obj.{field.Name}{field.NullChar}.Relink(mapping);"); } else if (field is WrapperType cont) { @@ -404,7 +389,7 @@ private async Task GenerateRemapListedAssetLinks(ObjectGeneration obj, Structure && await HasLinks(contLoqui, includeBaseClass: true) != Case.No)) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.ForEach(x => x{contLoqui.NullChar}.{nameof(IAssetLinkContainer.RemapListedAssetLinks)}(mapping));"); + $"obj.{field.Name}{field.NullChar}.ForEach(x => x{contLoqui.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, query));"); } else if (cont.SubTypeGeneration is AssetLinkType subAsset) { @@ -419,34 +404,42 @@ private async Task GenerateRemapListedAssetLinks(ObjectGeneration obj, Structure && await HasLinks(dictLoqui, includeBaseClass: true) != Case.No) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapListedAssetLinks)}(mapping);"); + $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, query);"); } else if (dict.ValueTypeGen is FormLinkType formIDType) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapListedAssetLinks)}(mapping);"); - } - } - else if (field is BreakType breakType) - { - if (fg.Count > startCount) - { - fg.AppendLine( - $"if (obj.{VersioningModule.VersioningFieldName}.HasFlag({obj.Name}.{VersioningModule.VersioningEnumName}.Break{breakType.Index})) return;"); + $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, query);"); } } } - // Remove trailing breaks - while (fg.Count > startCount) + if (subFg.Count > 0) { - if (fg[^1].AsSpan().TrimStart().StartsWith($"if (obj.{VersioningModule.VersioningFieldName}")) + fg.AppendLine($"if (queryCategories.HasFlag({nameof(AssetLinkQuery)}.{nameof(AssetLinkQuery.Listed)}))"); + using (fg.CurlyBrace()) { - fg.RemoveAt(fg.Count - 1); + fg.AppendLines(subFg); } - else + } + + foreach (var field in obj.IterateFields(nonIntegrated: true)) + { + if (field is LoquiType loqui) { - break; + Case subLinkCase; + if (loqui.TargetObjectGeneration != null) + { + subLinkCase = await HasLinks(loqui, includeBaseClass: true); + } + else + { + subLinkCase = Case.Maybe; + } + + if (subLinkCase == Case.No) continue; + fg.AppendLine( + $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, query);"); } } } @@ -454,6 +447,7 @@ private async Task GenerateRemapListedAssetLinks(ObjectGeneration obj, Structure fg.AppendLine(); } + private async Task YieldReturnListedAssets(ObjectGeneration obj, StructuredStringBuilder fg) { var startCount = fg.Count; @@ -670,7 +664,7 @@ public async Task GenerateInterfaceImplementation(ObjectGeneration obj, Structur if (!getter) { fg.AppendLine($"public{await obj.FunctionOverride(shouldAlwaysOverride, async (o) => await HasLinks(o, includeBaseClass: false) != Case.No)}IEnumerable<{nameof(IAssetLink)}> {nameof(IAssetLinkContainer.EnumerateListedAssetLinks)}() => {obj.CommonClass(LoquiInterfaceType.ISetter, CommonGenerics.Class)}.Instance.{nameof(IAssetLinkContainer.EnumerateListedAssetLinks)}(this);"); - fg.AppendLine($"public{await obj.FunctionOverride(shouldAlwaysOverride, async (o) => await HasLinks(o, includeBaseClass: false) != Case.No)}void {nameof(IAssetLinkContainer.RemapListedAssetLinks)}(IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping) => {obj.CommonClass(LoquiInterfaceType.ISetter, CommonGenerics.Class)}.Instance.RemapListedAssetLinks(this, mapping);"); + fg.AppendLine($"public{await obj.FunctionOverride(shouldAlwaysOverride, async (o) => await HasLinks(o, includeBaseClass: false) != Case.No)}void {nameof(IAssetLinkContainer.RemapAssetLinks)}(IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping, {nameof(AssetLinkQuery)} query) => {obj.CommonClass(LoquiInterfaceType.ISetter, CommonGenerics.Class)}.Instance.RemapAssetLinks(this, mapping, query);"); } } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs index af5cb3b06..20c29ca7e 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs @@ -569,7 +569,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1295,9 +1295,9 @@ public IEnumerable EnumerateListedAssetLinks(ICellBlock obj) yield break; } - public void RemapListedAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.SubBlocks.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs index 2cb7ec7ed..5bd273568 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs @@ -569,7 +569,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSubBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1287,9 +1287,9 @@ public IEnumerable EnumerateListedAssetLinks(ICellSubBlock obj) yield break; } - public void RemapListedAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Cells.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs index fffd88f13..bf1095164 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs @@ -1476,7 +1476,7 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => CellSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -2360,12 +2360,12 @@ public IEnumerable EnumerateListedAssetLinks(ICell obj) yield break; } - public void RemapListedAssetLinks(ICell obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICell obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Persistent.ForEach(x => x.RemapListedAssetLinks(mapping)); - obj.Temporary.ForEach(x => x.RemapListedAssetLinks(mapping)); - obj.VisibleWhenDistant.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.VisibleWhenDistant.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs index a0f885407..ae716f205 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs @@ -602,7 +602,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1332,9 +1332,9 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceBlock obj) yield break; } - public void RemapListedAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Items.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs index 20c70d318..10a7b1f98 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -602,7 +602,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSubBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1324,9 +1324,9 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceSubBlock obj yield break; } - public void RemapListedAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Items.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs index aa3a87719..1b0514288 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs @@ -1043,7 +1043,7 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WorldspaceSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1977,11 +1977,11 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspace obj) yield break; } - public void RemapListedAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.TopCell?.RemapListedAssetLinks(mapping); - obj.SubCells.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.TopCell?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs index bcba31dab..1e938ee41 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs @@ -148,7 +148,7 @@ public bool Equals(IOblivionGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => OblivionGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => OblivionGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => OblivionGroupSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => OblivionGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -865,9 +865,9 @@ public IEnumerable EnumerateListedAssetLinks(IOblivionGroup obj) yield break; } - public void RemapListedAssetLinks(IOblivionGroup obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IOblivionGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.RecordCache.RemapListedAssetLinks(mapping); + obj.RecordCache.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs index 542494f1b..caa575ffe 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs @@ -150,7 +150,7 @@ public bool Equals(IOblivionListGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => OblivionListGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => OblivionListGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => OblivionListGroupSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => OblivionListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -865,9 +865,9 @@ public IEnumerable EnumerateListedAssetLinks(IOblivionListGroup o yield break; } - public void RemapListedAssetLinks(IOblivionListGroup obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IOblivionListGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Records.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionMajorRecord_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionMajorRecord_Generated.cs index 6b7479177..92f26669a 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionMajorRecord_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionMajorRecord_Generated.cs @@ -405,7 +405,7 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => OblivionMajorRecordCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => OblivionMajorRecordSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => OblivionMajorRecordSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => OblivionMajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1052,9 +1052,9 @@ public IEnumerable EnumerateListedAssetLinks(IOblivionMajorRecord ob yield break; } - public void RemapListedAssetLinks(IOblivionMajorRecord obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IOblivionMajorRecord obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); + base.RemapAssetLinks(obj, mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs index f85c30403..753006087 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs @@ -3224,7 +3224,7 @@ public uint GetRecordCount() IEnumerable> IMajorRecordSimpleContextEnumerable.EnumerateMajorRecordSimpleContexts(Type type, bool throwIfUnknown) => this.EnumerateMajorRecordContexts(linkCache: null!, type: type, throwIfUnknown: throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => OblivionModCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => OblivionModSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => OblivionModSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => OblivionModSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -5075,10 +5075,10 @@ public IEnumerable EnumerateListedAssetLinks(IOblivionMod obj) yield break; } - public void RemapListedAssetLinks(IOblivionMod obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IOblivionMod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Cells.RemapListedAssetLinks(mapping); - obj.Worldspaces.RemapListedAssetLinks(mapping); + obj.Cells.RemapAssetLinks(mapping, query); + obj.Worldspaces.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs index 52c88f3e2..a9394330d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs @@ -506,7 +506,7 @@ public static implicit operator TranslationMask(bool defaultOn) public virtual void RemapLinks(IReadOnlyDictionary mapping) => AVirtualMachineAdapterSetterCommon.Instance.RemapLinks(this, mapping); public virtual IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AVirtualMachineAdapterCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public virtual IEnumerable EnumerateListedAssetLinks() => AVirtualMachineAdapterSetterCommon.Instance.EnumerateListedAssetLinks(this); - public virtual void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AVirtualMachineAdapterSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public virtual void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AVirtualMachineAdapterSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -861,9 +861,9 @@ public IEnumerable EnumerateListedAssetLinks(IAVirtualMachineAdapter yield break; } - public void RemapListedAssetLinks(IAVirtualMachineAdapter obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IAVirtualMachineAdapter obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Scripts.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs index 6aa654b00..7a695d1b1 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs @@ -481,7 +481,7 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => DestructibleSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DestructibleCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => DestructibleSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DestructibleSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DestructibleSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -861,9 +861,9 @@ public IEnumerable EnumerateListedAssetLinks(IDestructible obj) yield break; } - public void RemapListedAssetLinks(IDestructible obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IDestructible obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Stages.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Stages.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/DestructionStage_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/DestructionStage_Generated.cs index 5594bb224..61ceb5b38 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/DestructionStage_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/DestructionStage_Generated.cs @@ -426,7 +426,7 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => DestructionStageSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DestructionStageCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => DestructionStageSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DestructionStageSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DestructionStageSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -828,9 +828,9 @@ public IEnumerable EnumerateListedAssetLinks(IDestructionStage obj) yield break; } - public void RemapListedAssetLinks(IDestructionStage obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IDestructionStage obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Model?.RemapListedAssetLinks(mapping); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs index c9a7e7b64..b9bc08998 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs @@ -393,7 +393,7 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IconsCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => IconsSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IconsSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IconsSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -765,10 +765,13 @@ public IEnumerable EnumerateListedAssetLinks(IIcons obj) yield break; } - public void RemapListedAssetLinks(IIcons obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IIcons obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.LargeIconFilename.Relink(mapping); - obj.SmallIconFilename?.Relink(mapping); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.LargeIconFilename.Relink(mapping); + obj.SmallIconFilename?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs index 458141746..ed0298020 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs @@ -505,7 +505,7 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => ScriptEntrySetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ScriptEntryCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => ScriptEntrySetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ScriptEntrySetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ScriptEntrySetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -879,7 +879,7 @@ public IEnumerable EnumerateListedAssetLinks(IScriptEntry obj) yield break; } - public void RemapListedAssetLinks(IScriptEntry obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IScriptEntry obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { } diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs index 3ac155de5..a5171fe5c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs @@ -404,7 +404,7 @@ public static implicit operator TranslationMask(bool defaultOn) public virtual void RemapLinks(IReadOnlyDictionary mapping) => SimpleModelSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SimpleModelCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => SimpleModelSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SimpleModelSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SimpleModelSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -780,9 +780,12 @@ public IEnumerable EnumerateListedAssetLinks(ISimpleModel obj) yield break; } - public void RemapListedAssetLinks(ISimpleModel obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ISimpleModel obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.File.Relink(mapping); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.File.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/APlacedTrap_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/APlacedTrap_Generated.cs index fa7f413ea..9db8ef478 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/APlacedTrap_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/APlacedTrap_Generated.cs @@ -1384,7 +1384,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => APlacedTrapCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => APlacedTrapSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => APlacedTrapSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => APlacedTrapSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1937,10 +1937,10 @@ public IEnumerable EnumerateListedAssetLinks(IAPlacedTrap obj) yield break; } - public void RemapListedAssetLinks(IAPlacedTrap obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IAPlacedTrap obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Activator_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Activator_Generated.cs index 9cb21b8d1..685375433 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Activator_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Activator_Generated.cs @@ -1030,7 +1030,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ActivatorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ActivatorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ActivatorSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ActivatorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1606,12 +1606,12 @@ public IEnumerable EnumerateListedAssetLinks(IActivator obj) yield break; } - public void RemapListedAssetLinks(IActivator obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IActivator obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/AddonNode_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/AddonNode_Generated.cs index 7c31f4541..8b5acdd2d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/AddonNode_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/AddonNode_Generated.cs @@ -613,7 +613,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AddonNodeCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => AddonNodeSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AddonNodeSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AddonNodeSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1080,10 +1080,10 @@ public IEnumerable EnumerateListedAssetLinks(IAddonNode obj) yield break; } - public void RemapListedAssetLinks(IAddonNode obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IAddonNode obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/AlchemicalApparatus_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/AlchemicalApparatus_Generated.cs index a95f0b283..5b2b97bbd 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/AlchemicalApparatus_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/AlchemicalApparatus_Generated.cs @@ -910,7 +910,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AlchemicalApparatusCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => AlchemicalApparatusSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AlchemicalApparatusSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AlchemicalApparatusSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1481,13 +1481,13 @@ public IEnumerable EnumerateListedAssetLinks(IAlchemicalApparatus ob yield break; } - public void RemapListedAssetLinks(IAlchemicalApparatus obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IAlchemicalApparatus obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ammunition_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ammunition_Generated.cs index 0340e3c10..8d1b886a2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ammunition_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ammunition_Generated.cs @@ -1133,7 +1133,7 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AmmunitionCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => AmmunitionSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AmmunitionSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AmmunitionSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1723,12 +1723,12 @@ public IEnumerable EnumerateListedAssetLinks(IAmmunition obj) yield break; } - public void RemapListedAssetLinks(IAmmunition obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IAmmunition obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/AnimatedObject_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/AnimatedObject_Generated.cs index 87730765d..94bf81f6f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/AnimatedObject_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/AnimatedObject_Generated.cs @@ -454,7 +454,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AnimatedObjectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => AnimatedObjectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AnimatedObjectSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AnimatedObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -887,10 +887,10 @@ public IEnumerable EnumerateListedAssetLinks(IAnimatedObject obj) yield break; } - public void RemapListedAssetLinks(IAnimatedObject obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IAnimatedObject obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs index 22c2c9355..94062e053 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs @@ -1006,7 +1006,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ArmorAddonCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ArmorAddonSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ArmorAddonSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ArmorAddonSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1566,11 +1566,11 @@ public IEnumerable EnumerateListedAssetLinks(IArmorAddon obj) yield break; } - public void RemapListedAssetLinks(IArmorAddon obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IArmorAddon obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.WorldModel?.ForEach(x => x?.RemapListedAssetLinks(mapping)); - obj.FirstPersonModel?.ForEach(x => x?.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, query)); + obj.FirstPersonModel?.ForEach(x => x?.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorModel_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorModel_Generated.cs index b21506726..b701f54dd 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorModel_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorModel_Generated.cs @@ -433,7 +433,7 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => ArmorModelSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ArmorModelCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => ArmorModelSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ArmorModelSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ArmorModelSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -835,10 +835,10 @@ public IEnumerable EnumerateListedAssetLinks(IArmorModel obj) yield break; } - public void RemapListedAssetLinks(IArmorModel obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IArmorModel obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs index 92c713c45..03a071533 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs @@ -1434,7 +1434,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ArmorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ArmorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ArmorSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ArmorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -2099,12 +2099,12 @@ public IEnumerable EnumerateListedAssetLinks(IArmor obj) yield break; } - public void RemapListedAssetLinks(IArmor obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IArmor obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.WorldModel?.ForEach(x => x?.RemapListedAssetLinks(mapping)); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, query)); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArtObject_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArtObject_Generated.cs index 4f39cd1bf..8c41b67bb 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArtObject_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArtObject_Generated.cs @@ -509,7 +509,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ArtObjectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ArtObjectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ArtObjectSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ArtObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -961,10 +961,10 @@ public IEnumerable EnumerateListedAssetLinks(IArtObject obj) yield break; } - public void RemapListedAssetLinks(IArtObject obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IArtObject obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyData_Generated.cs index 10af5f143..f65a61b37 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyData_Generated.cs @@ -415,7 +415,7 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => BodyDataSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => BodyDataCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => BodyDataSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => BodyDataSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => BodyDataSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -800,9 +800,9 @@ public IEnumerable EnumerateListedAssetLinks(IBodyData obj) yield break; } - public void RemapListedAssetLinks(IBodyData obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IBodyData obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Model?.RemapListedAssetLinks(mapping); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyPartData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyPartData_Generated.cs index 60de99445..98c906ba5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyPartData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyPartData_Generated.cs @@ -528,7 +528,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => BodyPartDataCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => BodyPartDataSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => BodyPartDataSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => BodyPartDataSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -970,10 +970,10 @@ public IEnumerable EnumerateListedAssetLinks(IBodyPartData obj) yield break; } - public void RemapListedAssetLinks(IBodyPartData obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IBodyPartData obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs index 25681a82f..80cb70353 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs @@ -1212,7 +1212,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => BookCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => BookSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => BookSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => BookSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1825,13 +1825,13 @@ public IEnumerable EnumerateListedAssetLinks(IBook obj) yield break; } - public void RemapListedAssetLinks(IBook obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IBook obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/CameraShot_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/CameraShot_Generated.cs index bb3f78832..d77769c51 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/CameraShot_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/CameraShot_Generated.cs @@ -870,7 +870,7 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CameraShotCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => CameraShotSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CameraShotSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CameraShotSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1353,10 +1353,10 @@ public IEnumerable EnumerateListedAssetLinks(ICameraShot obj) yield break; } - public void RemapListedAssetLinks(ICameraShot obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICameraShot obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs index 2c34f47d9..e67df9ba3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs @@ -602,7 +602,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1399,9 +1399,9 @@ public IEnumerable EnumerateListedAssetLinks(ICellBlock obj) yield break; } - public void RemapListedAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.SubBlocks.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs index 8387db804..23fe94348 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs @@ -602,7 +602,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSubBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1384,9 +1384,9 @@ public IEnumerable EnumerateListedAssetLinks(ICellSubBlock obj) yield break; } - public void RemapListedAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Cells.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs index dd9b12f8c..80f7f3757 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs @@ -2079,7 +2079,7 @@ public MajorFlag MajorFlags void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => CellSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -3083,11 +3083,11 @@ public IEnumerable EnumerateListedAssetLinks(ICell obj) yield break; } - public void RemapListedAssetLinks(ICell obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ICell obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Persistent.ForEach(x => x.RemapListedAssetLinks(mapping)); - obj.Temporary.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs index ef6e5a145..da5b52a3f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs @@ -831,7 +831,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ClimateCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ClimateSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ClimateSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ClimateSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1312,12 +1312,15 @@ public IEnumerable EnumerateListedAssetLinks(IClimate obj) yield break; } - public void RemapListedAssetLinks(IClimate obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IClimate obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.SunTexture?.Relink(mapping); - obj.SunGlareTexture?.Relink(mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.SunTexture?.Relink(mapping); + obj.SunGlareTexture?.Relink(mapping); + } + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Container_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Container_Generated.cs index e9cd7a10d..697be20aa 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Container_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Container_Generated.cs @@ -901,7 +901,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ContainerCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ContainerSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ContainerSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ContainerSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1450,12 +1450,12 @@ public IEnumerable EnumerateListedAssetLinks(IContainer obj) yield break; } - public void RemapListedAssetLinks(IContainer obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IContainer obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs index 24152aa8e..7b3787ed5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs @@ -513,7 +513,7 @@ public enum DATADataType } public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DebrisModelCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => DebrisModelSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DebrisModelSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DebrisModelSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -893,9 +893,12 @@ public IEnumerable EnumerateListedAssetLinks(IDebrisModel obj) yield break; } - public void RemapListedAssetLinks(IDebrisModel obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IDebrisModel obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.ModelFilename.Relink(mapping); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.ModelFilename.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs index 7b425621d..1e726432c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs @@ -472,7 +472,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DebrisCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => DebrisSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DebrisSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DebrisSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -885,10 +885,10 @@ public IEnumerable EnumerateListedAssetLinks(IDebris obj) yield break; } - public void RemapListedAssetLinks(IDebris obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IDebris obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Models.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.Models.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses_Generated.cs index 1ce2f9795..3365c7770 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses_Generated.cs @@ -1254,7 +1254,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DialogResponsesCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => DialogResponsesSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DialogResponsesSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DialogResponsesSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1778,10 +1778,10 @@ public IEnumerable EnumerateListedAssetLinks(IDialogResponses obj) yield break; } - public void RemapListedAssetLinks(IDialogResponses obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IDialogResponses obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs index 53658cad7..17f8cfe91 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs @@ -887,7 +887,7 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DialogTopicCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => DialogTopicSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DialogTopicSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DialogTopicSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1674,10 +1674,10 @@ public IEnumerable EnumerateListedAssetLinks(IDialogTopic obj) yield break; } - public void RemapListedAssetLinks(IDialogTopic obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IDialogTopic obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Responses.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.Responses.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Door_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Door_Generated.cs index 1cf4659ee..90066ce25 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Door_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Door_Generated.cs @@ -799,7 +799,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DoorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => DoorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DoorSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DoorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1342,12 +1342,12 @@ public IEnumerable EnumerateListedAssetLinks(IDoor obj) yield break; } - public void RemapListedAssetLinks(IDoor obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IDoor obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs index c07480b2f..aaa35ebf7 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs @@ -4162,7 +4162,7 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => EffectShaderCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => EffectShaderSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => EffectShaderSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => EffectShaderSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -5019,14 +5019,17 @@ public IEnumerable EnumerateListedAssetLinks(IEffectShader obj) yield break; } - public void RemapListedAssetLinks(IEffectShader obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IEffectShader obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.FillTexture?.Relink(mapping); - obj.ParticleShaderTexture?.Relink(mapping); - obj.HolesTexture?.Relink(mapping); - obj.MembranePaletteTexture?.Relink(mapping); - obj.ParticlePaletteTexture?.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.FillTexture?.Relink(mapping); + obj.ParticleShaderTexture?.Relink(mapping); + obj.HolesTexture?.Relink(mapping); + obj.MembranePaletteTexture?.Relink(mapping); + obj.ParticlePaletteTexture?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Explosion_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Explosion_Generated.cs index f1fc3d9a7..b45c4351d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Explosion_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Explosion_Generated.cs @@ -1219,7 +1219,7 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ExplosionCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ExplosionSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ExplosionSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ExplosionSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1785,11 +1785,11 @@ public IEnumerable EnumerateListedAssetLinks(IExplosion obj) yield break; } - public void RemapListedAssetLinks(IExplosion obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IExplosion obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs index 414ca040e..0655632ec 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs @@ -493,7 +493,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => EyesCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => EyesSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => EyesSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => EyesSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -932,10 +932,13 @@ public IEnumerable EnumerateListedAssetLinks(IEyes obj) yield break; } - public void RemapListedAssetLinks(IEyes obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IEyes obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Icon.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.Icon.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Flora_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Flora_Generated.cs index 3f287a8a9..b30e66f28 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Flora_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Flora_Generated.cs @@ -991,7 +991,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => FloraCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => FloraSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => FloraSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => FloraSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1548,12 +1548,12 @@ public IEnumerable EnumerateListedAssetLinks(IFlora obj) yield break; } - public void RemapListedAssetLinks(IFlora obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IFlora obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs index fee3e8334..75a53c7e4 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs @@ -1111,7 +1111,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => FurnitureCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => FurnitureSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => FurnitureSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => FurnitureSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1693,13 +1693,16 @@ public IEnumerable EnumerateListedAssetLinks(IFurniture obj) yield break; } - public void RemapListedAssetLinks(IFurniture obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IFurniture obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); - obj.ModelFilename?.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.ModelFilename?.Relink(mapping); + } + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Grass_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Grass_Generated.cs index 4ed6b3f9b..71dd0eff2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Grass_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Grass_Generated.cs @@ -911,7 +911,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => GrassCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => GrassSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => GrassSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => GrassSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1409,10 +1409,10 @@ public IEnumerable EnumerateListedAssetLinks(IGrass obj) yield break; } - public void RemapListedAssetLinks(IGrass obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IGrass obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Hazard_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Hazard_Generated.cs index 14d2d917b..761be41f1 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Hazard_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Hazard_Generated.cs @@ -939,7 +939,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => HazardCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => HazardSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => HazardSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => HazardSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1460,10 +1460,10 @@ public IEnumerable EnumerateListedAssetLinks(IHazard obj) yield break; } - public void RemapListedAssetLinks(IHazard obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IHazard obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs index a7671a9f0..99782a9b4 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs @@ -1017,7 +1017,7 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => HeadDataSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => HeadDataCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => HeadDataSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => HeadDataSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => HeadDataSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1449,10 +1449,10 @@ public IEnumerable EnumerateListedAssetLinks(IHeadData obj) yield break; } - public void RemapListedAssetLinks(IHeadData obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IHeadData obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.TintMasks.ForEach(x => x.RemapListedAssetLinks(mapping)); - obj.Model?.RemapListedAssetLinks(mapping); + obj.TintMasks.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs index c3d9fd0c1..de8c51470 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs @@ -899,7 +899,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => HeadPartCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => HeadPartSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => HeadPartSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => HeadPartSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1400,11 +1400,11 @@ public IEnumerable EnumerateListedAssetLinks(IHeadPart obj) yield break; } - public void RemapListedAssetLinks(IHeadPart obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IHeadPart obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Parts.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.Parts.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs index 72e6f549a..607bf7e99 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs @@ -821,7 +821,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IdleAnimationCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => IdleAnimationSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IdleAnimationSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IdleAnimationSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1277,10 +1277,13 @@ public IEnumerable EnumerateListedAssetLinks(IIdleAnimation obj) yield break; } - public void RemapListedAssetLinks(IIdleAnimation obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IIdleAnimation obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Filename?.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.Filename?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleMarker_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleMarker_Generated.cs index a13637222..0a126bb6a 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleMarker_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleMarker_Generated.cs @@ -660,7 +660,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IdleMarkerCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => IdleMarkerSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IdleMarkerSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IdleMarkerSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1136,10 +1136,10 @@ public IEnumerable EnumerateListedAssetLinks(IIdleMarker obj) yield break; } - public void RemapListedAssetLinks(IIdleMarker obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IIdleMarker obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Impact_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Impact_Generated.cs index 692777b55..227b4013e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Impact_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Impact_Generated.cs @@ -929,7 +929,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ImpactCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ImpactSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ImpactSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ImpactSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1425,10 +1425,10 @@ public IEnumerable EnumerateListedAssetLinks(IImpact obj) yield break; } - public void RemapListedAssetLinks(IImpact obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IImpact obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingestible_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingestible_Generated.cs index f2be5dfc4..f52b4d288 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingestible_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingestible_Generated.cs @@ -1239,7 +1239,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IngestibleCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => IngestibleSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IngestibleSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IngestibleSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1846,12 +1846,12 @@ public IEnumerable EnumerateListedAssetLinks(IIngestible obj) yield break; } - public void RemapListedAssetLinks(IIngestible obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IIngestible obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingredient_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingredient_Generated.cs index 26ea370b2..b521ae8d7 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingredient_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingredient_Generated.cs @@ -1173,7 +1173,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IngredientCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => IngredientSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IngredientSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IngredientSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1780,13 +1780,13 @@ public IEnumerable EnumerateListedAssetLinks(IIngredient obj) yield break; } - public void RemapListedAssetLinks(IIngredient obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IIngredient obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Key_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Key_Generated.cs index b866d93d0..a6d57608c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Key_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Key_Generated.cs @@ -952,7 +952,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => KeyCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => KeySetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => KeySetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => KeySetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1536,13 +1536,13 @@ public IEnumerable EnumerateListedAssetLinks(IKey obj) yield break; } - public void RemapListedAssetLinks(IKey obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IKey obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs index 38f201bae..d0bc77676 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs @@ -441,7 +441,7 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LensFlareSpriteCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => LensFlareSpriteSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LensFlareSpriteSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LensFlareSpriteSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -815,9 +815,12 @@ public IEnumerable EnumerateListedAssetLinks(ILensFlareSprite obj) yield break; } - public void RemapListedAssetLinks(ILensFlareSprite obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ILensFlareSprite obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Texture?.Relink(mapping); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.Texture?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs index b37aedd06..a8fcc4610 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs @@ -542,7 +542,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LensFlareCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => LensFlareSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LensFlareSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LensFlareSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -969,10 +969,10 @@ public IEnumerable EnumerateListedAssetLinks(ILensFlare obj) yield break; } - public void RemapListedAssetLinks(ILensFlare obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ILensFlare obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Sprites?.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.Sprites?.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LeveledNpc_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LeveledNpc_Generated.cs index 7b665a165..f0994ec9f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LeveledNpc_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LeveledNpc_Generated.cs @@ -689,7 +689,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LeveledNpcCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => LeveledNpcSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LeveledNpcSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LeveledNpcSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1160,10 +1160,10 @@ public IEnumerable EnumerateListedAssetLinks(ILeveledNpc obj) yield break; } - public void RemapListedAssetLinks(ILeveledNpc obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ILeveledNpc obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Light_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Light_Generated.cs index c5e552d66..bf9fad333 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Light_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Light_Generated.cs @@ -1169,7 +1169,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LightCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => LightSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LightSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LightSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1781,13 +1781,13 @@ public IEnumerable EnumerateListedAssetLinks(ILight obj) yield break; } - public void RemapListedAssetLinks(ILight obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ILight obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs index 74351256e..7e7efebbb 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs @@ -795,7 +795,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LoadScreenCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => LoadScreenSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LoadScreenSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LoadScreenSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1278,11 +1278,14 @@ public IEnumerable EnumerateListedAssetLinks(ILoadScreen obj) yield break; } - public void RemapListedAssetLinks(ILoadScreen obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ILoadScreen obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.CameraPath?.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.CameraPath?.Relink(mapping); + } + obj.Icons?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs index 8fc3808b4..f92104cf2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs @@ -460,7 +460,7 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LodCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => LodSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LodSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LodSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -836,12 +836,15 @@ public IEnumerable EnumerateListedAssetLinks(ILod obj) yield break; } - public void RemapListedAssetLinks(ILod obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ILod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Level0.Relink(mapping); - obj.Level1.Relink(mapping); - obj.Level2.Relink(mapping); - obj.Level3.Relink(mapping); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.Level0.Relink(mapping); + obj.Level1.Relink(mapping); + obj.Level2.Relink(mapping); + obj.Level3.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MagicEffect_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MagicEffect_Generated.cs index 5f7e5fc4c..36e0ed109 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MagicEffect_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MagicEffect_Generated.cs @@ -2312,7 +2312,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MagicEffectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MagicEffectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MagicEffectSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MagicEffectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -2974,10 +2974,10 @@ public IEnumerable EnumerateListedAssetLinks(IMagicEffect obj) yield break; } - public void RemapListedAssetLinks(IMagicEffect obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IMagicEffect obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MaterialObject_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MaterialObject_Generated.cs index 568ac873b..295577329 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MaterialObject_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MaterialObject_Generated.cs @@ -912,7 +912,7 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MaterialObjectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MaterialObjectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MaterialObjectSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MaterialObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1386,10 +1386,10 @@ public IEnumerable EnumerateListedAssetLinks(IMaterialObject obj) yield break; } - public void RemapListedAssetLinks(IMaterialObject obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IMaterialObject obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MiscItem_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MiscItem_Generated.cs index c38e69738..45e1b6661 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MiscItem_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MiscItem_Generated.cs @@ -963,7 +963,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MiscItemCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MiscItemSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MiscItemSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MiscItemSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1551,13 +1551,13 @@ public IEnumerable EnumerateListedAssetLinks(IMiscItem obj) yield break; } - public void RemapListedAssetLinks(IMiscItem obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IMiscItem obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MoveableStatic_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MoveableStatic_Generated.cs index cc4deacad..4f87b09a5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MoveableStatic_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MoveableStatic_Generated.cs @@ -665,7 +665,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MoveableStaticCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MoveableStaticSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MoveableStaticSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MoveableStaticSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1173,11 +1173,11 @@ public IEnumerable EnumerateListedAssetLinks(IMoveableStatic obj) yield break; } - public void RemapListedAssetLinks(IMoveableStatic obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IMoveableStatic obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs index ff0ad0ac2..624249848 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs @@ -916,7 +916,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MusicTrackCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MusicTrackSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MusicTrackSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MusicTrackSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1379,11 +1379,14 @@ public IEnumerable EnumerateListedAssetLinks(IMusicTrack obj) yield break; } - public void RemapListedAssetLinks(IMusicTrack obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IMusicTrack obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.TrackFilename?.Relink(mapping); - obj.FinaleFilename?.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.TrackFilename?.Relink(mapping); + obj.FinaleFilename?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs index 1fd87d3e8..45530cb39 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs @@ -2857,7 +2857,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => NpcCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => NpcSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => NpcSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => NpcSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -3619,11 +3619,11 @@ public IEnumerable EnumerateListedAssetLinks(INpc obj) yield break; } - public void RemapListedAssetLinks(INpc obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(INpc obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Package_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Package_Generated.cs index f975356fe..50b1474cc 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Package_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Package_Generated.cs @@ -1658,7 +1658,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PackageCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => PackageSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PackageSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PackageSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -2226,10 +2226,10 @@ public IEnumerable EnumerateListedAssetLinks(IPackage obj) yield break; } - public void RemapListedAssetLinks(IPackage obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IPackage obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs index 3c0e1b233..711229857 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs @@ -394,7 +394,7 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PartCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => PartSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PartSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PartSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -763,9 +763,12 @@ public IEnumerable EnumerateListedAssetLinks(IPart obj) yield break; } - public void RemapListedAssetLinks(IPart obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IPart obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.FileName?.Relink(mapping); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.FileName?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Perk_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Perk_Generated.cs index 6a5d9f807..25a7607f5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Perk_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Perk_Generated.cs @@ -995,7 +995,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PerkCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => PerkSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PerkSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PerkSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1519,11 +1519,11 @@ public IEnumerable EnumerateListedAssetLinks(IPerk obj) yield break; } - public void RemapListedAssetLinks(IPerk obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IPerk obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedNpc_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedNpc_Generated.cs index 42d7f463d..0b6cd0d9e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedNpc_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedNpc_Generated.cs @@ -1663,7 +1663,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PlacedNpcCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => PlacedNpcSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PlacedNpcSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PlacedNpcSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -2263,10 +2263,10 @@ public IEnumerable EnumerateListedAssetLinks(IPlacedNpc obj) yield break; } - public void RemapListedAssetLinks(IPlacedNpc obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IPlacedNpc obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedObject_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedObject_Generated.cs index 6dd3ebc4b..f6ce22e72 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedObject_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedObject_Generated.cs @@ -3169,7 +3169,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PlacedObjectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => PlacedObjectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PlacedObjectSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PlacedObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -3926,10 +3926,10 @@ public IEnumerable EnumerateListedAssetLinks(IPlacedObject obj) yield break; } - public void RemapListedAssetLinks(IPlacedObject obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IPlacedObject obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs index c35c673eb..6221fe275 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs @@ -1590,7 +1590,7 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ProjectileCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ProjectileSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ProjectileSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ProjectileSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -2201,12 +2201,15 @@ public IEnumerable EnumerateListedAssetLinks(IProjectile obj) yield break; } - public void RemapListedAssetLinks(IProjectile obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IProjectile obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); - obj.MuzzleFlashModel.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.MuzzleFlashModel.Relink(mapping); + } + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs index be3ad71fe..80162527b 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs @@ -644,7 +644,7 @@ public enum VersioningBreaks public override void RemapLinks(IReadOnlyDictionary mapping) => QuestAdapterSetterCommon.Instance.RemapLinks(this, mapping); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => QuestAdapterCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => QuestAdapterSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => QuestAdapterSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => QuestAdapterSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1009,10 +1009,10 @@ public IEnumerable EnumerateListedAssetLinks(IQuestAdapter obj) yield break; } - public void RemapListedAssetLinks(IQuestAdapter obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IQuestAdapter obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Aliases.ForEach(x => x.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.Aliases.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs index 12ceebd00..947bb40c9 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs @@ -543,7 +543,7 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => QuestFragmentAliasSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => QuestFragmentAliasCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => QuestFragmentAliasSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => QuestFragmentAliasSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => QuestFragmentAliasSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -916,9 +916,9 @@ public IEnumerable EnumerateListedAssetLinks(IQuestFragmentAlias obj yield break; } - public void RemapListedAssetLinks(IQuestFragmentAlias obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IQuestFragmentAlias obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Scripts.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs index 7e38092a2..a8ed83ca0 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs @@ -1407,7 +1407,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => QuestCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => QuestSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => QuestSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => QuestSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1967,10 +1967,10 @@ public IEnumerable EnumerateListedAssetLinks(IQuest obj) yield break; } - public void RemapListedAssetLinks(IQuest obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IQuest obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs index 9e91628a7..8a3f22a7a 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs @@ -3995,7 +3995,7 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => RaceCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => RaceSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => RaceSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => RaceSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -4865,13 +4865,13 @@ public IEnumerable EnumerateListedAssetLinks(IRace obj) yield break; } - public void RemapListedAssetLinks(IRace obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IRace obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.SkeletalModel?.ForEach(x => x?.RemapListedAssetLinks(mapping)); - obj.BodyData.ForEach(x => x?.RemapListedAssetLinks(mapping)); - obj.BehaviorGraph.ForEach(x => x?.RemapListedAssetLinks(mapping)); - obj.HeadData?.ForEach(x => x?.RemapListedAssetLinks(mapping)); + base.RemapAssetLinks(obj, mapping, query); + obj.SkeletalModel?.ForEach(x => x?.RemapAssetLinks(mapping, query)); + obj.BodyData.ForEach(x => x?.RemapAssetLinks(mapping, query)); + obj.BehaviorGraph.ForEach(x => x?.RemapAssetLinks(mapping, query)); + obj.HeadData?.ForEach(x => x?.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/RegionData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/RegionData_Generated.cs index 49a9e86dc..35e22c13c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/RegionData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/RegionData_Generated.cs @@ -449,7 +449,7 @@ public static implicit operator TranslationMask(bool defaultOn) public virtual void RemapLinks(IReadOnlyDictionary mapping) => RegionDataSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => RegionDataCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => RegionDataSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => RegionDataSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => RegionDataSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -819,9 +819,9 @@ public IEnumerable EnumerateListedAssetLinks(IRegionData obj) yield break; } - public void RemapListedAssetLinks(IRegionData obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IRegionData obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Icons?.RemapListedAssetLinks(mapping); + obj.Icons?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Region_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Region_Generated.cs index 81fc176e4..e85b8c9b4 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Region_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Region_Generated.cs @@ -831,7 +831,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => RegionCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => RegionSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => RegionSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => RegionSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1334,15 +1334,15 @@ public IEnumerable EnumerateListedAssetLinks(IRegion obj) yield break; } - public void RemapListedAssetLinks(IRegion obj, IReadOnlyDictionary mapping) - { - base.RemapListedAssetLinks(obj, mapping); - obj.Objects?.RemapListedAssetLinks(mapping); - obj.Weather?.RemapListedAssetLinks(mapping); - obj.Map?.RemapListedAssetLinks(mapping); - obj.Land?.RemapListedAssetLinks(mapping); - obj.Grasses?.RemapListedAssetLinks(mapping); - obj.Sounds?.RemapListedAssetLinks(mapping); + public void RemapAssetLinks(IRegion obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + { + base.RemapAssetLinks(obj, mapping, query); + obj.Objects?.RemapAssetLinks(mapping, query); + obj.Weather?.RemapAssetLinks(mapping, query); + obj.Map?.RemapAssetLinks(mapping, query); + obj.Land?.RemapAssetLinks(mapping, query); + obj.Grasses?.RemapAssetLinks(mapping, query); + obj.Sounds?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Scene_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Scene_Generated.cs index 4a813cdf4..246a42ab8 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Scene_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Scene_Generated.cs @@ -1092,7 +1092,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SceneCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SceneSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SceneSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SceneSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1589,10 +1589,10 @@ public IEnumerable EnumerateListedAssetLinks(IScene obj) yield break; } - public void RemapListedAssetLinks(IScene obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IScene obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Scroll_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Scroll_Generated.cs index f69cf5c9a..7bef5279c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Scroll_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Scroll_Generated.cs @@ -1379,7 +1379,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ScrollCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ScrollSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ScrollSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ScrollSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1979,11 +1979,11 @@ public IEnumerable EnumerateListedAssetLinks(IScroll obj) yield break; } - public void RemapListedAssetLinks(IScroll obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IScroll obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs index 0f0b352d8..c9bbcca6c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs @@ -853,7 +853,7 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ShaderParticleGeometryCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ShaderParticleGeometrySetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ShaderParticleGeometrySetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ShaderParticleGeometrySetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1318,10 +1318,13 @@ public IEnumerable EnumerateListedAssetLinks(IShaderParticleGeometry yield break; } - public void RemapListedAssetLinks(IShaderParticleGeometry obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IShaderParticleGeometry obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.ParticleTexture?.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.ParticleTexture?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoulGem_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoulGem_Generated.cs index 637945d2d..094b28c7d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoulGem_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoulGem_Generated.cs @@ -1013,7 +1013,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SoulGemCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SoulGemSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SoulGemSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SoulGemSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1590,12 +1590,12 @@ public IEnumerable EnumerateListedAssetLinks(ISoulGem obj) yield break; } - public void RemapListedAssetLinks(ISoulGem obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ISoulGem obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs index af17fb911..73ac839cc 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs @@ -987,7 +987,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SoundDescriptorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SoundDescriptorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SoundDescriptorSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SoundDescriptorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1465,9 +1465,9 @@ public IEnumerable EnumerateListedAssetLinks(ISoundDescriptor obj) yield break; } - public void RemapListedAssetLinks(ISoundDescriptor obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ISoundDescriptor obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); + base.RemapAssetLinks(obj, mapping, query); obj.SoundFiles.ForEach(x => x.Relink(mapping)); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Static_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Static_Generated.cs index d4ba55430..31b2bc6fe 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Static_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Static_Generated.cs @@ -722,7 +722,7 @@ public enum DNAMDataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => StaticCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => StaticSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => StaticSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => StaticSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1217,11 +1217,11 @@ public IEnumerable EnumerateListedAssetLinks(IStatic obj) yield break; } - public void RemapListedAssetLinks(IStatic obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IStatic obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Lod?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Lod?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TalkingActivator_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TalkingActivator_Generated.cs index ac80bc75f..1307b0922 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TalkingActivator_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TalkingActivator_Generated.cs @@ -914,7 +914,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => TalkingActivatorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => TalkingActivatorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => TalkingActivatorSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => TalkingActivatorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1471,12 +1471,12 @@ public IEnumerable EnumerateListedAssetLinks(ITalkingActivator obj) yield break; } - public void RemapListedAssetLinks(ITalkingActivator obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ITalkingActivator obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs index 92f68874a..93bd9311c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs @@ -781,7 +781,7 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => TextureSetCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => TextureSetSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => TextureSetSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => TextureSetSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1289,17 +1289,20 @@ public IEnumerable EnumerateListedAssetLinks(ITextureSet obj) yield break; } - public void RemapListedAssetLinks(ITextureSet obj, IReadOnlyDictionary mapping) - { - base.RemapListedAssetLinks(obj, mapping); - obj.Diffuse?.Relink(mapping); - obj.NormalOrGloss?.Relink(mapping); - obj.EnvironmentMaskOrSubsurfaceTint?.Relink(mapping); - obj.GlowOrDetailMap?.Relink(mapping); - obj.Height?.Relink(mapping); - obj.Environment?.Relink(mapping); - obj.Multilayer?.Relink(mapping); - obj.BacklightMaskOrSpecular?.Relink(mapping); + public void RemapAssetLinks(ITextureSet obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + { + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.Diffuse?.Relink(mapping); + obj.NormalOrGloss?.Relink(mapping); + obj.EnvironmentMaskOrSubsurfaceTint?.Relink(mapping); + obj.GlowOrDetailMap?.Relink(mapping); + obj.Height?.Relink(mapping); + obj.Environment?.Relink(mapping); + obj.Multilayer?.Relink(mapping); + obj.BacklightMaskOrSpecular?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs index 5103f297f..9828be26b 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs @@ -581,7 +581,7 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => TintAssetsSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => TintAssetsCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => TintAssetsSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => TintAssetsSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => TintAssetsSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -971,9 +971,12 @@ public IEnumerable EnumerateListedAssetLinks(ITintAssets obj) yield break; } - public void RemapListedAssetLinks(ITintAssets obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ITintAssets obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.FileName?.Relink(mapping); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.FileName?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Tree_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Tree_Generated.cs index 6f612dd19..a6ae03f9d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Tree_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Tree_Generated.cs @@ -899,7 +899,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => TreeCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => TreeSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => TreeSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => TreeSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1444,11 +1444,11 @@ public IEnumerable EnumerateListedAssetLinks(ITree obj) yield break; } - public void RemapListedAssetLinks(ITree obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ITree obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs index 585b7e9f7..40579ecd6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs @@ -2823,7 +2823,7 @@ public enum DNAMDataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WaterCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WaterSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WaterSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WaterSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -3554,13 +3554,16 @@ public IEnumerable EnumerateListedAssetLinks(IWater obj) yield break; } - public void RemapListedAssetLinks(IWater obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWater obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.NoiseLayerOneTexture?.Relink(mapping); - obj.NoiseLayerTwoTexture?.Relink(mapping); - obj.NoiseLayerThreeTexture?.Relink(mapping); - obj.FlowNormalsNoiseTexture?.Relink(mapping); + base.RemapAssetLinks(obj, mapping, query); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.NoiseLayerOneTexture?.Relink(mapping); + obj.NoiseLayerTwoTexture?.Relink(mapping); + obj.NoiseLayerThreeTexture?.Relink(mapping); + obj.FlowNormalsNoiseTexture?.Relink(mapping); + } } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weapon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weapon_Generated.cs index e245d69e7..dae84ea26 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weapon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weapon_Generated.cs @@ -1787,7 +1787,7 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WeaponCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WeaponSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WeaponSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WeaponSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -2515,14 +2515,14 @@ public IEnumerable EnumerateListedAssetLinks(IWeapon obj) yield break; } - public void RemapListedAssetLinks(IWeapon obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWeapon obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); - obj.VirtualMachineAdapter?.RemapListedAssetLinks(mapping); - obj.Model?.RemapListedAssetLinks(mapping); - obj.Icons?.RemapListedAssetLinks(mapping); - obj.Destructible?.RemapListedAssetLinks(mapping); - obj.ScopeModel?.RemapListedAssetLinks(mapping); + base.RemapAssetLinks(obj, mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, query); + obj.Destructible?.RemapAssetLinks(mapping, query); + obj.ScopeModel?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs index fd97d0056..fb45b759f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs @@ -2953,7 +2953,7 @@ public enum NAM0DataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WeatherCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WeatherSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WeatherSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WeatherSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -3646,11 +3646,11 @@ public IEnumerable EnumerateListedAssetLinks(IWeather obj) yield break; } - public void RemapListedAssetLinks(IWeather obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWeather obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); + base.RemapAssetLinks(obj, mapping, query); obj.CloudTextures.ForEach(x => x?.Relink(mapping)); - obj.Aurora?.RemapListedAssetLinks(mapping); + obj.Aurora?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs index 9919d2c15..8b67830e5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs @@ -635,7 +635,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1436,9 +1436,9 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceBlock obj) yield break; } - public void RemapListedAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Items.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs index 80164a474..c3694e802 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -635,7 +635,7 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSubBlockSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -1421,9 +1421,9 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceSubBlock obj yield break; } - public void RemapListedAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Items.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs index 30d740886..8f216e3c3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs @@ -1834,7 +1834,7 @@ public MajorFlag MajorFlags void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WorldspaceSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -3013,18 +3013,21 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspace obj) yield break; } - public void RemapListedAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping) - { - base.RemapListedAssetLinks(obj, mapping); - obj.MapImage?.Relink(mapping); - obj.CloudModel?.RemapListedAssetLinks(mapping); - obj.CanopyShadow?.Relink(mapping); - obj.WaterNoiseTexture?.Relink(mapping); - obj.HdLodDiffuseTexture?.Relink(mapping); - obj.HdLodNormalTexture?.Relink(mapping); - obj.WaterEnvironmentMap?.Relink(mapping); - obj.TopCell?.RemapListedAssetLinks(mapping); - obj.SubCells.ForEach(x => x.RemapListedAssetLinks(mapping)); + public void RemapAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + { + base.RemapAssetLinks(obj, mapping, query); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, query)); + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + obj.MapImage?.Relink(mapping); + obj.CanopyShadow?.Relink(mapping); + obj.WaterNoiseTexture?.Relink(mapping); + obj.HdLodDiffuseTexture?.Relink(mapping); + obj.HdLodNormalTexture?.Relink(mapping); + obj.WaterEnvironmentMap?.Relink(mapping); + } + obj.CloudModel?.RemapAssetLinks(mapping, query); + obj.TopCell?.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimGroup_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimGroup_Generated.cs index fae5ee549..d4fbb6eb8 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimGroup_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimGroup_Generated.cs @@ -151,7 +151,7 @@ public bool Equals(ISkyrimGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SkyrimGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SkyrimGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SkyrimGroupSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SkyrimGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -872,9 +872,9 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimGroup obj) yield break; } - public void RemapListedAssetLinks(ISkyrimGroup obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ISkyrimGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.RecordCache.RemapListedAssetLinks(mapping); + obj.RecordCache.RemapAssetLinks(mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs index 013df14ea..e6d393db8 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs @@ -153,7 +153,7 @@ public bool Equals(ISkyrimListGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SkyrimListGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SkyrimListGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SkyrimListGroupSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SkyrimListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -872,9 +872,9 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimListGroup obj yield break; } - public void RemapListedAssetLinks(ISkyrimListGroup obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ISkyrimListGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.Records.ForEach(x => x.RemapListedAssetLinks(mapping)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, query)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMajorRecord_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMajorRecord_Generated.cs index 5be553885..17914d9b3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMajorRecord_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMajorRecord_Generated.cs @@ -488,7 +488,7 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SkyrimMajorRecordCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SkyrimMajorRecordSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SkyrimMajorRecordSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SkyrimMajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #region Equals and Hash public override bool Equals(object? obj) { @@ -1143,9 +1143,9 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimMajorRecord obj) yield break; } - public void RemapListedAssetLinks(ISkyrimMajorRecord obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ISkyrimMajorRecord obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - base.RemapListedAssetLinks(obj, mapping); + base.RemapAssetLinks(obj, mapping, query); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs index 24b63b491..41db49453 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs @@ -6021,7 +6021,7 @@ public uint GetRecordCount() IEnumerable> IMajorRecordSimpleContextEnumerable.EnumerateMajorRecordSimpleContexts(Type type, bool throwIfUnknown) => this.EnumerateMajorRecordContexts(linkCache: null!, type: type, throwIfUnknown: throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SkyrimModCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => SkyrimModSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SkyrimModSetterCommon.Instance.RemapListedAssetLinks(this, mapping); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SkyrimModSetterCommon.Instance.RemapAssetLinks(this, mapping, query); #endregion #region Binary Translation @@ -9409,67 +9409,67 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimMod obj) yield break; } - public void RemapListedAssetLinks(ISkyrimMod obj, IReadOnlyDictionary mapping) + public void RemapAssetLinks(ISkyrimMod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - obj.TextureSets.RemapListedAssetLinks(mapping); - obj.HeadParts.RemapListedAssetLinks(mapping); - obj.Eyes.RemapListedAssetLinks(mapping); - obj.Races.RemapListedAssetLinks(mapping); - obj.MagicEffects.RemapListedAssetLinks(mapping); - obj.Scrolls.RemapListedAssetLinks(mapping); - obj.Activators.RemapListedAssetLinks(mapping); - obj.TalkingActivators.RemapListedAssetLinks(mapping); - obj.Armors.RemapListedAssetLinks(mapping); - obj.Books.RemapListedAssetLinks(mapping); - obj.Containers.RemapListedAssetLinks(mapping); - obj.Doors.RemapListedAssetLinks(mapping); - obj.Ingredients.RemapListedAssetLinks(mapping); - obj.Lights.RemapListedAssetLinks(mapping); - obj.MiscItems.RemapListedAssetLinks(mapping); - obj.AlchemicalApparatuses.RemapListedAssetLinks(mapping); - obj.Statics.RemapListedAssetLinks(mapping); - obj.MoveableStatics.RemapListedAssetLinks(mapping); - obj.Grasses.RemapListedAssetLinks(mapping); - obj.Trees.RemapListedAssetLinks(mapping); - obj.Florae.RemapListedAssetLinks(mapping); - obj.Furniture.RemapListedAssetLinks(mapping); - obj.Weapons.RemapListedAssetLinks(mapping); - obj.Ammunitions.RemapListedAssetLinks(mapping); - obj.Npcs.RemapListedAssetLinks(mapping); - obj.LeveledNpcs.RemapListedAssetLinks(mapping); - obj.Keys.RemapListedAssetLinks(mapping); - obj.Ingestibles.RemapListedAssetLinks(mapping); - obj.IdleMarkers.RemapListedAssetLinks(mapping); - obj.Projectiles.RemapListedAssetLinks(mapping); - obj.Hazards.RemapListedAssetLinks(mapping); - obj.SoulGems.RemapListedAssetLinks(mapping); - obj.Weathers.RemapListedAssetLinks(mapping); - obj.Climates.RemapListedAssetLinks(mapping); - obj.ShaderParticleGeometries.RemapListedAssetLinks(mapping); - obj.Regions.RemapListedAssetLinks(mapping); - obj.Cells.RemapListedAssetLinks(mapping); - obj.Worldspaces.RemapListedAssetLinks(mapping); - obj.DialogTopics.RemapListedAssetLinks(mapping); - obj.Quests.RemapListedAssetLinks(mapping); - obj.IdleAnimations.RemapListedAssetLinks(mapping); - obj.Packages.RemapListedAssetLinks(mapping); - obj.LoadScreens.RemapListedAssetLinks(mapping); - obj.AnimatedObjects.RemapListedAssetLinks(mapping); - obj.Waters.RemapListedAssetLinks(mapping); - obj.EffectShaders.RemapListedAssetLinks(mapping); - obj.Explosions.RemapListedAssetLinks(mapping); - obj.Debris.RemapListedAssetLinks(mapping); - obj.Perks.RemapListedAssetLinks(mapping); - obj.BodyParts.RemapListedAssetLinks(mapping); - obj.AddonNodes.RemapListedAssetLinks(mapping); - obj.CameraShots.RemapListedAssetLinks(mapping); - obj.Impacts.RemapListedAssetLinks(mapping); - obj.ArmorAddons.RemapListedAssetLinks(mapping); - obj.MusicTracks.RemapListedAssetLinks(mapping); - obj.Scenes.RemapListedAssetLinks(mapping); - obj.ArtObjects.RemapListedAssetLinks(mapping); - obj.MaterialObjects.RemapListedAssetLinks(mapping); - obj.SoundDescriptors.RemapListedAssetLinks(mapping); + obj.TextureSets.RemapAssetLinks(mapping, query); + obj.HeadParts.RemapAssetLinks(mapping, query); + obj.Eyes.RemapAssetLinks(mapping, query); + obj.Races.RemapAssetLinks(mapping, query); + obj.MagicEffects.RemapAssetLinks(mapping, query); + obj.Scrolls.RemapAssetLinks(mapping, query); + obj.Activators.RemapAssetLinks(mapping, query); + obj.TalkingActivators.RemapAssetLinks(mapping, query); + obj.Armors.RemapAssetLinks(mapping, query); + obj.Books.RemapAssetLinks(mapping, query); + obj.Containers.RemapAssetLinks(mapping, query); + obj.Doors.RemapAssetLinks(mapping, query); + obj.Ingredients.RemapAssetLinks(mapping, query); + obj.Lights.RemapAssetLinks(mapping, query); + obj.MiscItems.RemapAssetLinks(mapping, query); + obj.AlchemicalApparatuses.RemapAssetLinks(mapping, query); + obj.Statics.RemapAssetLinks(mapping, query); + obj.MoveableStatics.RemapAssetLinks(mapping, query); + obj.Grasses.RemapAssetLinks(mapping, query); + obj.Trees.RemapAssetLinks(mapping, query); + obj.Florae.RemapAssetLinks(mapping, query); + obj.Furniture.RemapAssetLinks(mapping, query); + obj.Weapons.RemapAssetLinks(mapping, query); + obj.Ammunitions.RemapAssetLinks(mapping, query); + obj.Npcs.RemapAssetLinks(mapping, query); + obj.LeveledNpcs.RemapAssetLinks(mapping, query); + obj.Keys.RemapAssetLinks(mapping, query); + obj.Ingestibles.RemapAssetLinks(mapping, query); + obj.IdleMarkers.RemapAssetLinks(mapping, query); + obj.Projectiles.RemapAssetLinks(mapping, query); + obj.Hazards.RemapAssetLinks(mapping, query); + obj.SoulGems.RemapAssetLinks(mapping, query); + obj.Weathers.RemapAssetLinks(mapping, query); + obj.Climates.RemapAssetLinks(mapping, query); + obj.ShaderParticleGeometries.RemapAssetLinks(mapping, query); + obj.Regions.RemapAssetLinks(mapping, query); + obj.Cells.RemapAssetLinks(mapping, query); + obj.Worldspaces.RemapAssetLinks(mapping, query); + obj.DialogTopics.RemapAssetLinks(mapping, query); + obj.Quests.RemapAssetLinks(mapping, query); + obj.IdleAnimations.RemapAssetLinks(mapping, query); + obj.Packages.RemapAssetLinks(mapping, query); + obj.LoadScreens.RemapAssetLinks(mapping, query); + obj.AnimatedObjects.RemapAssetLinks(mapping, query); + obj.Waters.RemapAssetLinks(mapping, query); + obj.EffectShaders.RemapAssetLinks(mapping, query); + obj.Explosions.RemapAssetLinks(mapping, query); + obj.Debris.RemapAssetLinks(mapping, query); + obj.Perks.RemapAssetLinks(mapping, query); + obj.BodyParts.RemapAssetLinks(mapping, query); + obj.AddonNodes.RemapAssetLinks(mapping, query); + obj.CameraShots.RemapAssetLinks(mapping, query); + obj.Impacts.RemapAssetLinks(mapping, query); + obj.ArmorAddons.RemapAssetLinks(mapping, query); + obj.MusicTracks.RemapAssetLinks(mapping, query); + obj.Scenes.RemapAssetLinks(mapping, query); + obj.ArtObjects.RemapAssetLinks(mapping, query); + obj.MaterialObjects.RemapAssetLinks(mapping, query); + obj.SoundDescriptors.RemapAssetLinks(mapping, query); } #endregion From 76e0e91cf81b770749a6eb03004b00f4686d74a5 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 22:05:14 -0500 Subject: [PATCH 081/135] Docs testing --- docs/Big-Cheat-Sheet.md | 47 +++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/Big-Cheat-Sheet.md b/docs/Big-Cheat-Sheet.md index c5c721eb9..098a0274e 100644 --- a/docs/Big-Cheat-Sheet.md +++ b/docs/Big-Cheat-Sheet.md @@ -1,21 +1,22 @@ -# Overview +# Big Cheat Sheet +## Overview A massive list of code snippets without much contextual explanation. -## Related Reading +### Related Reading Relevant wikis for more detailed reading will be linked. -## Target Game +### Target Game Most code snippets will assume Skyrim SE, but code should work for any game, generally. -## Preparing the Examples +### Preparing the Examples When `...` is seen, that generally means the example will not cover how that object might have been made. `...` is not actually valid code to be copied and pasted. -## Missing Namespaces +### Missing Namespaces If you're just copy pasting code, often it will not compile because some required namespaces are missing. You can have the IDE import them by clicking on the red object in question and activating quick fixes (`Ctrl - .` in Visual Studio). [More Reading](https://github.com/Mutagen-Modding/Mutagen/wiki/Namespaces) -# Construct an Environment +## Construct an Environment ```cs using var env = GameEnvironment.Typical.Skyrim(SkyrimRelease.SkyrimSE); @@ -29,7 +30,7 @@ foreach (var listing in state.LoadOrder.ListedOrder) [Read About Environments](https://github.com/Mutagen-Modding/Mutagen/wiki/Environment) -# Retrieve a Mod From a Load Order +## Retrieve a Mod From a Load Order ```cs var mod = myLoadOrder["MyMod.esp"]; ``` @@ -43,15 +44,15 @@ if (myLoadOrder.TryGetValue("MyMod.esp", out var mod)) [Read About Mod Retrieval](https://github.com/Mutagen-Modding/Mutagen/wiki/Load-Order#accessing-specific-listings) -# Construct a ModKey +## Construct a ModKey ```cs var modKey = ModKey.FromFileName("Skyrim.esm"); modKey = new ModKey("Skyrim", ModType.Plugin); ``` [Read About ModKeys](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#modkey) -# Get List of Masters From A Mod -## Via MasterReferenceCollection +## Get List of Masters From A Mod +### Via MasterReferenceCollection ```cs var masterCollection = MasterReferenceCollection.FromPath(pathToMod, GameRelease.SkyrimSE); @@ -61,7 +62,7 @@ foreach (var master in masterCollection.Masters) Console.WriteLine($" {master.Master.FileName}"); } ``` -## Via Mod Object +### Via Mod Object ```cs using var mod = SkyrimMod.CreateFromBinaryOverlay(pathToMod, SkyrimRelease.SkyrimSE); @@ -72,7 +73,7 @@ foreach (var master in mod.ModHeader.MasterReferences) } ``` -# Get Access to Record Data +## Get Access to Record Data If you don't know what records you want to process, and just want to process everything the load order has, then this is typical: ``` foreach (var formList in loadOrder.PriorityOrder.FormList.WinningOverrides()) @@ -90,8 +91,8 @@ if (state.LinkCache.TryResolve(FormKey.Factory("123456:Skyrim.e ``` Using the [FormKey Generator](https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys) project output is better than hand writing, in this case. -# Convert FormKey to FormID -## Via MasterReferenceCollection +## Convert FormKey to FormID +### Via MasterReferenceCollection ```cs FormKey formKey = ...; IMasterReferenceCollection masterCollection = ...; @@ -101,7 +102,7 @@ FormID formID = masterCollection.GetFormID(formKey); [Read About FormKeys](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formkey) -# Convert FormKey to FormLink +## Convert FormKey to FormLink ```cs FormKey formKey = ...; // NOTE: Typically want to use the "getter" interfaces for FormLinks @@ -110,7 +111,7 @@ var npcLink = formKey.ToLink(); [Read About FormKeys](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formkey) -# Convert MajorRecord to FormLink +## Convert MajorRecord to FormLink ```cs INpcGetter npcGetter = ...; var npcLink = npcGetter.ToLink(); @@ -123,7 +124,7 @@ var npcLink2 = npcSetter.ToLink(); IFormLinkGetter npcLink3 = npcSetter.ToLink(); ``` -# Iterate Winning Overrides +## Iterate Winning Overrides ```cs // Load order is typically retrieved via Synthesis state or Environment systems foreach (var keywordGetter in loadOrder.PriorityOrder.Keywords().WinningOverrides()) @@ -132,7 +133,7 @@ foreach (var keywordGetter in loadOrder.PriorityOrder.Keywords().WinningOverride } ``` -# Iterate Records' Original Definitions +## Iterate Records' Original Definitions ```cs // By swapping to ListedOrder, the loop will now iterate over the original definitions of each record // By viewing the load order "backwards", is sees the original mods as the winning override to return @@ -142,8 +143,8 @@ foreach (var keywordGetter in loadOrder.ListedOrder.Keywords().WinningOverrides( } ``` -# Check If A FormLink Points to a Specific Record -## By FormKey +## Check If A FormLink Points to a Specific Record +### By FormKey ```cs INpcGetter npc = ...; var target = FormKey.Factory("013745:Skyrim.esm"); // Khajiit Race @@ -154,7 +155,7 @@ if (target.FormKey.Equals(npc.Race)) [Read About FormKeys](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formkey) -## By FormLink +### By FormLink ```cs INpcGetter npc = ...; var targetFormLink = FormKey @@ -167,7 +168,7 @@ if (target.Equals(npc.Race)) [Read About FormLinks](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formlink) -## Using FormKey Mapping Library +### Using FormKey Mapping Library ```cs INpcGetter npc = ...; if (Skyrim.Race.KhajiitRace.Equals(npc.Race)) @@ -177,7 +178,7 @@ if (Skyrim.Race.KhajiitRace.Equals(npc.Race)) [Read About FormLink Mapping](https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys) -# Duplicate a Record +## Duplicate a Record _Copy an existing record with a new FormKey_ ```cs var dup = someRecord.Duplicate(newFormKey); From d0adec271de79cf83091e03aa6f18a50dce0569b Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 22:22:35 -0500 Subject: [PATCH 082/135] More docs --- docs/Abstract-Subclassing.md | 14 +++++----- docs/AssetLink.md | 12 ++++----- docs/Big-Cheat-Sheet.md | 2 +- docs/Binary-Exporting.md | 8 +++--- docs/Binary-Format-Complexity-Abstraction.md | 20 +++++++------- docs/Binary-Overlay.md | 8 +++--- docs/Copy-Functionality.md | 8 +++--- docs/Create,-Duplicate,-and-Override.md | 16 +++++------ docs/Equality-Checks.md | 4 +-- docs/Flags-and-Enums.md | 6 ++--- docs/Generated-Classes.md | 8 +----- docs/Interfaces-(Aspect-Link-Getters).md | 23 ++++++++-------- docs/Printing.md | 4 +-- docs/Translation-Masks.md | 16 +++++------ .../Typical-Mod-Construction-and-Importing.md | 27 +++++++++++++++++++ mkdocs.yml | 4 ++- 16 files changed, 102 insertions(+), 78 deletions(-) create mode 100644 docs/Typical-Mod-Construction-and-Importing.md diff --git a/docs/Abstract-Subclassing.md b/docs/Abstract-Subclassing.md index f5d032994..3184b895f 100644 --- a/docs/Abstract-Subclassing.md +++ b/docs/Abstract-Subclassing.md @@ -1,4 +1,4 @@ -# What is Abstract Subclassing +## What is Abstract Subclassing Occasionally records will have an Abstract subobject. This article will go over the concepts of Abstract Subclassing through the lens of looking at a specific example found in Skyrim Npc. Other records have similar but different concepts. @@ -18,7 +18,7 @@ public interface INpcConfigurationGetter ``` -# Why is it Needed? +## Why is it Needed? Why is the concept of `Level` a weird `ANpcLevel` object? @@ -30,7 +30,7 @@ Mutagen exposes this by using subclassing. `ANpcLevel` has two subclasses: - `NpcLevel`, with `Level` as an integer - `PcLevelMult`, with `Level` as a float -# Setting an Abstract Subclass Member +## Setting an Abstract Subclass Member You will notice Mutagen does not expose the `Pc Level Mult` flag. Instead, you simultaneously control both the "mode" that the `Level` is in, as well as `Level`'s value by choosing the appropriate subclass. ```cs @@ -50,7 +50,7 @@ n.Configuration.Level = new PcLevelMult() Now, it's very clear when `Level` is an integer, and when it is a float. The flag's value and `Level`'s type are "bundled" as one choice, depending on which subclass you make. -# Reading an Abstract Subclass Member +## Reading an Abstract Subclass Member Reading needs to respect/consider these subclasses in the same way. One easy way to do this is using a C# type switch: ```cs INpcGetter n = ... @@ -76,12 +76,12 @@ int level = ((INpcLevelGetter)n.Configuration.Level).Level; ``` This will break if you are processing an Npc with the `PC Level Mult` flag on, as the subobject won't be of type `INpcLevelGetter`. -# Summary +## Summary Abstract Subclassing is used when a concept is complex enough to warrant the need for extra control. It often helps when a field's type can change based on the context, and it helps bundle the different typing WITH that context, so that there is no potential for desync. In the above example, you will never accidentally deal with a `Level` that is of type `float` unless it is in `Pc Level Mult` mode, and vice versa. That is not the biggest deal, but in many other situations the concepts/differences are more extreme. -# Other Records with Abstract Subclassing +## Other Records with Abstract Subclassing Skyrim Npc is not the only record type that uses these concepts. There are many other records that have the need for data structure to change depending on context, and they will use Abstract Subclassing to help expose that. Some other examples include: @@ -93,7 +93,7 @@ These show a more extreme example where the fields that a Perk Effect contains v An effect can reference many different types of records, where some effect types can point to records of type ABC, while another effect type can only point to records of type XYZ. The subclassing again helps expose only the correct typing depending on the effect type you're dealing with. -# Documentation +## Documentation Each subclassing situation is different and is trying to solve a different complexity specific to that record. As things mature, documentation outlining each specific structure will probably be written. In the meantime, you can: diff --git a/docs/AssetLink.md b/docs/AssetLink.md index ab382001f..9db4a496b 100644 --- a/docs/AssetLink.md +++ b/docs/AssetLink.md @@ -1,17 +1,17 @@ -# What is an AssetLink +## What is an AssetLink An AssetLink is a strongly typed object wrapping what is normally a `string` subpath pointing to an asset. For example, a Skyrim Weapon's Model has a `File` member, which is the `MODL` subrecord, which contains a string relative to the `Data/Meshes` folder. Rather than exposing this as a `string`, Mutagen exposes this as an `AssetLink`. If you're just after the path, you can still get it via an AssetLink's `RawPath` member. But the AssetLink now comes with a bunch of additional features and convenience -# AssetLink Members +## AssetLink Members ## RawPath `RawPath` is the string that is present on disk in the record itself as it appears. This is also the field that you can set when you want to modify an AssetLink to point to a different path. `AssetLink`s are implicitly convertible to/from `string`, which uses `RawPath` as the string to return. This is in place to provide some backwards compatibility -## DataRelativePath +### DataRelativePath `DataRelativePath` is a `get` only member that does some checking/trimming of `RawPath` to try to standardize it to be relative to a game's Data folder. It will trim a prefixed "Data" folder in the path, while also ensuring the appropriate asset subfolder is present. Some examples: @@ -24,17 +24,17 @@ It will trim a prefixed "Data" folder in the path, while also ensuring the appro In all examples, the `DataRelativePath` remains the same, as that is what it's attempting to do: keep it standardized to be relative the Data folder, no matter the RawPath's contents. -# AssetTypes - AssetLink's Generic Type +## AssetTypes - AssetLink's Generic Type An `AssetLink`'s generic type is the type of asset it relates to. So, for example, a Skyrim Model path will be of type `AssetLink`, where `SkyrimModelAssetType` is a meta class containing information about Skyrim Model assets: - `BaseFolder`, what subfolder underneath /Data/ these assests are expected to live - `FileExtensions`, what expected file extensions these types of meta files will have With this generic, each AssetLink knows that related information for the type of asset it is linking to. -# Asset Enumeration +## Asset Enumeration Similar to FormLinks, a mod can enumerate AssetLinks of a desired type. The details are slightly different, though. -## Typical Usage +### Typical Usage ```cs ILinkCache linkCache = ...; diff --git a/docs/Big-Cheat-Sheet.md b/docs/Big-Cheat-Sheet.md index 098a0274e..45e67f1fe 100644 --- a/docs/Big-Cheat-Sheet.md +++ b/docs/Big-Cheat-Sheet.md @@ -1,6 +1,6 @@ # Big Cheat Sheet ## Overview -A massive list of code snippets without much contextual explanation. +A massive list of code snippets without much contextual explaination. ### Related Reading Relevant wikis for more detailed reading will be linked. diff --git a/docs/Binary-Exporting.md b/docs/Binary-Exporting.md index 60b942567..9393bea6d 100644 --- a/docs/Binary-Exporting.md +++ b/docs/Binary-Exporting.md @@ -1,4 +1,4 @@ -# Typical Export +## Typical Export A basic mod write call is pretty straightforward: ``` mod.WriteToBinary(desiredFilePath); @@ -16,12 +16,12 @@ mod.WriteToBinary( This extra information helps keep the masters in proper order, as the load order information is provided for the write call to use. More information can be found about the details in the following sections. -## Master Content +### Master Content Mutagen automatically handles the logic to determine which masters are required. It will iterate all records for: - Overridden -## Master Ordering +### Master Ordering Typically, the order that masters are written -# Master Sync Options +## Master Sync Options diff --git a/docs/Binary-Format-Complexity-Abstraction.md b/docs/Binary-Format-Complexity-Abstraction.md index 0f0725dc1..1a207951b 100644 --- a/docs/Binary-Format-Complexity-Abstraction.md +++ b/docs/Binary-Format-Complexity-Abstraction.md @@ -1,9 +1,9 @@ Bethesda's binary format contains a lot implementation complexities that are unrelated to the actual content of the records. A lot of times the exposure of these details are a source of confusion, and don't add much upside in the way of flexibility or power into the hands of the user. Mutagen attempts to abstract these complexities away so that the end user is dealing with the distilled record content more directly, rather than wading through the gritty specifics that only matter in the context of their binary format on disk. -# FormKeys and FormLinks +## FormKeys and FormLinks This topic was covered in detail in the [ModKey, FormKey, FormLink](ModKey%2C-FormKey%2C-FormLink#formkeys) section, and so will not be covered here. -# Record Types +## Record Types ### Four Character Headers Most seasoned modders are familiar with the 4 character record headers. `EDID` is `Editor ID`. `FULL` is `Name`. `MODL` is `Model`. @@ -14,7 +14,7 @@ Additionally, some common Record Types have alternate versions to denote differe (finish writing) -# List Mechanics +## List Mechanics ## Item Storage There are a lot of varying ways that lists are stored in the binary format: - Repeated subrecords, with their Record Header as the delimiter. Unknown amount. @@ -36,10 +36,10 @@ IList> Keywords { get; set; } IList AlternateTextures { get; set; } ``` -## Count Subrecords +### Count Subrecords (finish writing) -# Global/Gamesetting types +## Global/Gamesetting types The Global and Gamesetting records contain many different types of data while each having their own unique rules of communicating what type of data they contain. For example, `Global` records have a special subrecord `FNAM` with a single char `i`, `f`, `s` to symbolize the float field it contains should be interpreted as an `int`, `float`, or `short`. `GameSetting` on the other hand prepends a character to its EditorID to communicate what type of data is stored in its `DATA` subrecord. This complexity is abstracted away by Mutagen by offering strongly typed subclasses for Globals and Gamesettings. `GlobalInt`, `GlobalFloat`, `GameSettingInt`, `GameSettingString`, `GameSettingBool`, etc. These subclasses expose a strongly typed member of the correct type to the user while internally handling the most of the details. @@ -92,7 +92,7 @@ foreach (GameSetting setting in mod.GameSettings.Records) } ``` -# Markers +## Markers Some subrecords have specialized "marker" subrecords that precede them. Sometimes they just mark the location of a section of subrecords, while other times they affect the context of the following subrecords. A good specific example can be found in Skyrim's `Race`'s Body Data subrecords. A `Race` has a body data struct for males, and a body data struct for females. These records are first "marked" by an empty `NAM0` record. They are then further "marked" by empty `MNAM` or `FNAM` subrecords, to indicate if the following data is for males or females. The binary might follow this pattern: @@ -108,15 +108,15 @@ MODL: Body Data content for females Mutagen abstracts the concepts of markers away from the user completely. No concepts of markers exist in the API exposed. A user can just directly access the data they're interested in, and if a marker-related field is set for exporting, the marker systems will be handled automatically during export internally. -# PathGrid Point Zipping +## PathGrid Point Zipping Path grid information in records such as Oblivion's `Road` are stored in two separate subrecord lists that need to be considered together in order to get the complete structure. The points themselves are stored in the list `PGRP`, while the information about the connections between points is stored in `PGRR`. If you want to know what points have what connections, you need to offset your queries into the `PGRR` subrecord properly. Each Point exposes the number of connections it has. Then, to find the connections for Point #7, you have to offset your query into `PGRR` by 12 * the number of connections Points #1-6 had. You then have to extract the number of connection floats appropriate for Point #7, based on the number of connections it says it has. Mutagen abstracts this "zipping" work for you and offers a simple `IList Points;` member on `Road`. Each `RoadPoint` has a `IList Connections;` with all the connections related to that point. All the complexity of the dual subrecords is hidden from the user, and they can just manipulate these lists directly in a more straightforward and familiar fashion. -# Multiple Flag Consolidation +## Multiple Flag Consolidation Some records have so many flags that they overflow above the typical 4 bytes. Bethesda will then put a second set of flags elsewhere in the record with the overflow flag values. One example of this happening is in Skyrim's Race record. Mutagen merges the overflow into one Flag field exposing all of the values in one place. -# GenderedItem +## GenderedItem Bethesda records have a lot of fields that come in a Male/Female pair. While not too much of a problem by itself, most of the complexity comes in the variety of ways that these pairs can be organized. Sometimes the M/F data is held in dedicated `MNAM`/`FNAM` records. Sometimes those records are prepended by a marker, as mentioned above. Sometimes instead both are found in a single subrecord, with the data just back to back. Mutagen standardizes all the various cases, and exposes the male/female alternatives using a `GenderedItem` struct in the public API: @@ -134,7 +134,7 @@ race.Height.Male = 1.5f; float femaleHeight = race.Height.Female; ``` -# Pseudo Enum Dictionaries +## Pseudo Enum Dictionaries Skyrim's Race record has a hacky binary implementation for its `Biped Object Names` field. This field is supposed to expose the names associated with the different values of this enum: diff --git a/docs/Binary-Overlay.md b/docs/Binary-Overlay.md index 61e33a7ec..cfa29e979 100644 --- a/docs/Binary-Overlay.md +++ b/docs/Binary-Overlay.md @@ -1,6 +1,6 @@ Binary Overlays are an alternative to the more simplistic [[Binary Importing]] concepts. -# Reasoning for an Alternate Pattern +## Reasoning for an Alternate Pattern ### Memory Usage is Frontloaded One of the downsides of typical importing is that all the data must be read into an object upfront and continues existing in memory until the object is released to the GC. Many operations only want to process each record once and then move on. They do not need all the records to exist in memory at the same time and would actually prefer if they weren't. @@ -10,7 +10,7 @@ Additionally, the user must specify to the import function all of the record typ ### All Records are Parsed (for Interest Groups) When a specific Group is marked for interest and imported, all aspects of those Records are parsed and created in memory with no regard to whether the user will actually make use of them all. This is a lot of wasted work and memory usage for data that will go unused. -# Introduction to Overlay Concepts +## Introduction to Overlay Concepts The Binary Overlay concept is an alternate method of importing/reading mods in an on-demand and transient way. One of its main features is that only fields that are accessed get parsed, which saves a lot of time and work. ```cs @@ -30,7 +30,7 @@ With the overlay pattern, a mod object is returned almost immediately for use af ### No Persistent References to Records or Memory Binary Overlays keep no internal references to any record objects. This means that when a user is done working with something and discards it, the GC is allowed to immediately clean it up. -# Concrete Example +## Concrete Example It might be useful to walk through a concrete example, and some of the mechanics going on under the hood. Consider this code: ```cs using (IOblivionModGetter mod = OblivionMod.CreateFromBinaryOverlay(pathToMod)) @@ -67,7 +67,7 @@ This code is intended to print each Potion's Editor ID to the console. - No object had a reference to all the Potion records, so as to keep their contents in memory. The Group object simply has a list of locations. The user has the only reference to any Potion record at any given moment, and as soon as they were done with it was cleaned up. - No extra code was written by the user to help indicate they were only interested in Potions or EditorIDs. Writing code that accessed them was the implicit indication of interest itself. -# Summary Overview +## Summary Overview The Binary Overlay concept is a powerful tool that can be used for vast speed/memory improvements for certain jobs. It is suggested for use in most importing scenarios. Actual normal record objects should generally be reserved for use when constructing new/modified records for output. ### Pros diff --git a/docs/Copy-Functionality.md b/docs/Copy-Functionality.md index 61df4daa0..becfbe73c 100644 --- a/docs/Copy-Functionality.md +++ b/docs/Copy-Functionality.md @@ -1,6 +1,6 @@ Mutagen provides functionality for copying in data to an already existing object. -# DeepCopy +## DeepCopy **This call will create a new object, and copy all fields.** This will be done in a "deep" fashion, where duplicate objects will be made for each subobject and their fields copied over as well. No references to the original object or any subobjects from the original will exist in the object copied to. This separates the new object from the original object so that modifying either has no effect on the other. @@ -16,7 +16,7 @@ Some things to note: - The new record will not be a part of any Mod or Group unless added explicity. - The cast is required currently, but will hopefully be unnecessary eventually. -# DeepCopyIn +## DeepCopyIn **This call will copy in all fields from a second object to an already existing object** ```cs @@ -29,7 +29,7 @@ Some things to note: - `FormKey`s are immutable, and will never be changed even with a copy in. If you want a second record with the original's `FormKey`, use DeepCopy instead. - Changes to either object will not affect the other -# Translation Masks +## Translation Masks As with many other translational tasks in Mutagen, Copy functionality comes with the option to provide Masks to control what will get copied. ```cs @@ -42,7 +42,7 @@ potion.DeepCopyIn(otherPotion, onlyScriptsMask); ``` This code will replace `potion`'s script data with the values from `otherPotion`. All other subrecords will remain untouched. -# CopyInFrom[Binary] +## CopyInFrom[Binary] In addition to being able to copy in fields from another object via DeepCopyIn, you can also CopyIn from other serialization sources such as from a Binary file on the disk. This mainly only applies to Mod objects, rather than individual Major Records. It is also less granular than other translation sources, and only lets you mask per Group type. diff --git a/docs/Create,-Duplicate,-and-Override.md b/docs/Create,-Duplicate,-and-Override.md index 162666bb8..692b77fbf 100644 --- a/docs/Create,-Duplicate,-and-Override.md +++ b/docs/Create,-Duplicate,-and-Override.md @@ -1,6 +1,6 @@ -# Create New Records +## Create New Records New records can be constructed in a few ways. Note that a record's FormKey is required during construction, and immutable. If you want to change the FormKey of a record, a new one should be made. Any desired fields can be brought over via [CopyIn](Copy-Functionality#deepcopyin) mechanics. -## By Constructor +### By Constructor Any standalone record can be made by using its constructor. ```cs // Verbose example, showing all the components @@ -8,14 +8,14 @@ var modKey = ModKey.Factory("Oblivion", master: true); var formKey = new FormKey(modKey, 0x123456); var potion = new Potion(formKey); ``` -## From a Mod's Group +### From a Mod's Group If you have an `IMod` object that you want the record to originate from, you can easily make one from the corresponding `Group`. ```cs var potion = mod.Potions.AddNew(); ``` The new record will have the next available `FormKey` from that mod based on the metadata in its header, and automatically be added to the Group it originated from. Note this is not applicable to Binary Overlays, as they are getter only interfaces, so this concept is not applicable. This is instead meant for new Mod objects that have been created for the purpose of modification and eventual export. -## By Duplication +### By Duplication Duplicating a record is the equivalent of creating a fresh record, and then copying in data to match a different record. This can be done via [CopyIn](Copy-Functionality#deepcopyin) API, but there are some convenience methods for this as well ```csharp @@ -26,10 +26,10 @@ var copy = myMod.Npcs.DuplicateInAsNewRecord(sourceNpc); copy.Name = "My Name"; ``` -# Overriding Records +## Overriding Records It is very common to want to modify a record that is from another mod. This just entails making a copy of the original record and adding it to your output mod. The fact that the FormKey doesn't originate from your output mod implicitly means that it's an override. -## GetOrAddAsOverride +### GetOrAddAsOverride The quick any easy way to override a record is to utilize a Group.GetOrAddAsOverride call. This will check if the record already exists as an override in your group, and return it if so. Otherwise, it will copy the source record to a new object, and add it to your mod for you. ```csharp INpcGetter sourceNpc = ...; @@ -41,7 +41,7 @@ override.Name = "My New Name"; NOTE: With this pattern, it is preferable to call `GetOrAddAsOverride` as late as possible, after all filtering has been done and you know you want to override and modify the record. This avoids adding records to your mod that have no changes. -## Deep Copy Then Insert +### Deep Copy Then Insert This pattern is an alternative to `GetOrAddAsOverride`. It is sometimes preferable if it's hard to delay the `GetOrAddAsOverride` call, and you want more control over when a record actually gets added to the outgoing mod. ```csharp @@ -58,5 +58,5 @@ outputMod.Npcs.Add(npcCopy); This strategy works well if you might change your mind and not add the copied record to the outgoing mod. It lets you get a mutable version of the record without adding it to your outgoing mod until you are certain you want to include it. -## Nested Records +### Nested Records Some records like Placed Objects and Cells are often nested underneath other records. This makes it harder to follow the above patterns. For these you will want to make use of the [[ModContexts]] concepts. diff --git a/docs/Equality-Checks.md b/docs/Equality-Checks.md index 68cd24f04..858e97bb2 100644 --- a/docs/Equality-Checks.md +++ b/docs/Equality-Checks.md @@ -1,4 +1,4 @@ -# Basic Equality +## Basic Equality Mutagen generates Equals and Hash functions for all classes based on record content. Normal C# equality checks can be used: ```cs bool isEqual = npc1.Equals(npc2); @@ -6,7 +6,7 @@ bool isEqual2 = object.Equals(npc1, npc2); int hash = npc1.GetHashCode(); ``` -# Equals Mask +## Equals Mask Mutagen generates additional helper classes called "Masks". These can be used to help specify what fields a user wants to check for equality, or hash with. ```cs // Create a mask that will only check EditorID and Name diff --git a/docs/Flags-and-Enums.md b/docs/Flags-and-Enums.md index 0d4838e34..bb8a26bca 100644 --- a/docs/Flags-and-Enums.md +++ b/docs/Flags-and-Enums.md @@ -1,5 +1,5 @@ A lot of Record data is exposed via flags and enums. All of known enum types and their options are defined explicitly for strongly typed use. -### Normal Enum +## Normal Enum Certain fields have a certain subset of valid options. These are exposed as enums, where only one choice can be made. For example, Oblivion's `Creature` has an enum that looks like this: @@ -38,7 +38,7 @@ switch (creature.CreatureType) break; } ``` -#### Unknown Flags +### Unknown Flags Enums only list the values that are known and have "nicknames". Sometimes mods have values for things that are "unknown" and don't have a name. Rather than listing these, Mutagen opts to only list known values to keep things clean. You can still get at and set these values, though. Enums in C# are backed by `int` (or other numeric primitives), and so you can write code like this: @@ -53,7 +53,7 @@ if (e == (CreatureType)13) With this style API, you can still access all unknown values as needed. -### Flags Enum +## Flags Enum Certain fields are allowed to have several values, and so make use of C#'s [Flags] enum systems. For example, Oblivion `NPC`'s flags look like this: diff --git a/docs/Generated-Classes.md b/docs/Generated-Classes.md index 187505791..b61e50d58 100644 --- a/docs/Generated-Classes.md +++ b/docs/Generated-Classes.md @@ -1,10 +1,4 @@ - - - - - - - +# Generated Classes Mutagen provides C# classes, as well as matching interfaces for all records it supports. Here's an example of what an interface for the `Potion` record might look like: diff --git a/docs/Interfaces-(Aspect-Link-Getters).md b/docs/Interfaces-(Aspect-Link-Getters).md index c7c868f38..f589f085e 100644 --- a/docs/Interfaces-(Aspect-Link-Getters).md +++ b/docs/Interfaces-(Aspect-Link-Getters).md @@ -1,9 +1,10 @@ +# Interfaces Mutagen exposes a few categories of interfaces: - **[Getters and Setters](#getters-and-setters)** _(Immutable vs Mutable)_ - **[Aspect](#aspect-interfaces)** _(Expose aspects common to many records)_ - **[Link](#link-interfaces)** _(Enables FormLinks to point to an umbrella of record types)_ -# Getters and Setters +## Getters and Setters Each autogenerated class also gets accompanying Getter/Setter interfaces ```cs @@ -32,9 +33,9 @@ public interface IPotion : IPotionGetter These are created mainly to expose objects in a readonly manner when appropriate. The Getter interfaces, specifically, are heavily used when reading data from a mod on-disk. -# Aspect Interfaces +## Aspect Interfaces Aspect Interfaces expose common fields that are shared among many records. They are used to help write code that is more generic and can process more than just a single record type. -## Problem to Solve +### Problem to Solve ```cs public static void PrintName(Armor armor) { @@ -54,7 +55,7 @@ public interface INamed ``` This is an interface that any record that contains a `Name` can implement. Now we can tweak our `PrintName` function to apply to any of these records, no matter what they are. -## Typical Usage +### Typical Usage ### Using Aspect Interfaces as a Parameter In the problem described above, a common use case is wanting to write a function that applies to multiple record types: ```cs @@ -65,7 +66,7 @@ public static void PrintName(INamedGetter namedRecord) ``` Using the Aspect Interface `INamed`, we have written a function that can apply to any record that has a name. Could be an Armor, Npc, Weapon, etc. -### Weaving Multiple Aspect Interfaces Using Generics +#### Weaving Multiple Aspect Interfaces Using Generics The above example using one Aspect Interface as the parameter type is great if you're only interested in a single aspect. What if you wanted to write a function that could process any record that had a name, and had a model? Well, then we need to combine multiple aspects. @@ -86,15 +87,15 @@ This function uses C# Generics to specify that `TRecord` should be any record th Now this function can directly access those aspects of records that are passed in. Additionally, this function will automatically only accept records that have all these aspects. A `Footstep` record, for example, which isn't named and doesn't have a model, would not be allowed to be passed to this function: C# would give a compiler error. -## Evolution +### Evolution The list of Aspect Interfaces is an evolution. Many more Aspect Interfaces could be created to expose fields that are common to many records. **If you see one that would be nice to add, please create an issue and ask for it to be added!** Over time, the list of Aspect Interfaces will be more and more complete. Additionally, Aspect Interfaces can be made to apply to cross-game records. These of course will be more limited, as concepts that are shared across different games are less than those shared within the same game. -# Link Interfaces +## Link Interfaces Link Interfaces have a different goal. They act more as markers, rather than a vehicle to expose common fields. -## Problem to Solve +### Problem to Solve Mutagen's [FormLinks](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formlinks) can specify a record type that the FormKey they represent is allowed to match against. It provides type safety to FormID/FormKey concepts. What happens when a FormLink should be able to point to multiple record types? A container object can contain many different record types: Armor, Weapons, etc. @@ -108,7 +109,7 @@ public interface IItem Notice it doesn't have any fields. It is just a marker that Armor, Weapons, etc can implement. Now FormLink can target that interface instead: `FormLink`. This link can now point to any of those records that are marked with `IItem` -## Typical Usage +### Typical Usage ### Knowing Types Allowed into a FormLink Typical interaction with Link Interfaces are when users try to assign a record to a FormLink, and the compiler tells them it's not allowed. They offer type safety, and block users from messing up and assigning a `Potion` to an Npc's `Race` field. @@ -123,10 +124,10 @@ Here is an example of `F12` being used to investigate `IConstructibleGetter` and A list of mappings also exists here on the wiki https://github.com/Mutagen-Modding/Mutagen/wiki/Skyrim-Link-Interfaces#iconstructible -## Evolution +### Evolution New Link Interfaces are rarely defined. These are usually known ahead of time and new ones aren't added. However, over time they can/could take on more of an Aspect Interface role, where common fields that are shared by all records implementing a Link Interface could be listed. This would be Link Interfaces becoming more than just a simple marker, and becoming their own Aspect Interfaces of sorts. **If there are some fields common to all records of a Link Interface that you think should be exposed, please make an issue!** -# Documentation +## Documentation Mutagen autogenerates some documentation on what Aspect/Link interfaces exist, and what implements what. You can find these in the Game Specific section of the Wiki. diff --git a/docs/Printing.md b/docs/Printing.md index fc178ace3..fcd3b933d 100644 --- a/docs/Printing.md +++ b/docs/Printing.md @@ -1,11 +1,11 @@ (Latest version of Mutagen does not match these docs. Will soon be updated to match this documentation) -# Normal ToString +## Normal ToString If you call `ToString()` on a Mutagen object, you will typically not see any content within the string. You will usually get just the class name, or some short but informative identifying string, such as Major Records returning their FormKey: `Skyrim.Npc 123456:Skyrim.esm` -# IPrintable and StructuredStringBuilder +## IPrintable and StructuredStringBuilder All Mutagen objects implement `IPrintable`, which exposes a `Print()` method. Calling this will do a more verbose printing of the content: ```cs var str = npc.Print(); diff --git a/docs/Translation-Masks.md b/docs/Translation-Masks.md index e0bade6c5..2d19254ad 100644 --- a/docs/Translation-Masks.md +++ b/docs/Translation-Masks.md @@ -1,6 +1,6 @@ Several functionalities such as Equality, DeepCopy, and a few others have support for a concept called Translation Masks. These allow for customization of what members are involved in those operations. -# Equality +## Equality Providing a translation mask to an Equality call will control what members are compared when determining equality. ```cs @@ -15,7 +15,7 @@ npc.Equals(npc2, mask); The above would compare equality of the Height and Weight of the two Npcs. All other members would not be considered. -# DeepCopy(In) +## DeepCopy(In) ```cs var mask = new Npc.TranslationMask(defaultOn: false) @@ -30,10 +30,10 @@ npc.DeepCopyIn(npc2, mask); The above would copy in the values of the `Height`, `Weight`, and `Destructible` subobject from `npc2` into `npc`. All other members of `npc` would be left untouched. -# Translation Mask Construction +## Translation Mask Construction The above examples are very simple mask constructions. They can get more complex when there are subobjects and/or lists involved. -## defaultOn Parameter +### defaultOn Parameter When creating a mask, you can either give it `defaultOn: true` where all the fields will be marked `true` by default, and then you can selectively mark fields false as desired. Inversely, you can give it `defaultOn: false` where all the fields will be marked `false` by default, and you'll need to turn specific fields `true` as needed. Copy of only one field: @@ -54,7 +54,7 @@ var mask = new Npc.TranslationMask(defaultOn: true) }; ``` -## Subobjects +### Subobjects When a record has subobjects, the subobject field is itself a Translation mask letting you set members within that subobject ```cs // Copy destructible subobject, but not its Stages field @@ -67,7 +67,7 @@ var mask = new Npc.TranslationMask(defaultOn: true) }; ``` -## onOverall Parameter +### onOverall Parameter This one has a lot more nuance. It relates to behavior for a nullable subobject, and gives the user more control as to how those are handled. It does not have any effect if it is the top level mask. It only has an effect if it's a submask used within another mask. @@ -131,7 +131,7 @@ This setup has `onOverall` of true, and so the mask will be applied and consider As you can see, `defaultOn = false` still means the mask has effects during the copy job. `onOverall = false` is what we'd set if we did not want it to have any effects, and wanted `Destructible` to not be considered whatsoever. -# Subobject Shorthand +## Subobject Shorthand When dealing with subobjects, the above API can get a bit verbose. For the basic situations of inclusion/exclusion, Translation Masks are implicitly convertible from `bool`s. So you can do something like this: ```cs @@ -146,6 +146,6 @@ rec.DeepCopy(new Npc.TranslationMask(true) This would copy over everything but the `Destructible` member, but is much easier to write. Similarly, you can just provide `true` to include it in a false-by-default mask. -# Best Practices +## Best Practices ## Create Once, Use Many It's best practice to not create a translation mask per call. As in, try to not make a new mask for every equality call, but rather make the desired mask once ahead of time and reuse it for each equality call if possible. diff --git a/docs/Typical-Mod-Construction-and-Importing.md b/docs/Typical-Mod-Construction-and-Importing.md new file mode 100644 index 000000000..831f31778 --- /dev/null +++ b/docs/Typical-Mod-Construction-and-Importing.md @@ -0,0 +1,27 @@ +If you're only dealing with one game, then code like this is typical: +```cs +public void SomeFunction() +{ + var newMod = new SkyrimMod(ModKey.FromFileName("MyMod.esp"), SkyrimRelease.SkyrimSE); + + var mutableInputMod = SkyrimMod.CreateFromBinary(inputPath, SkyrimRelease.SkyrimSE); + + using var readOnlyInputMod = SkyrimMod.CreateFromBinaryOverlay(inputPath, SkyrimRelease.SkyrimSE); +} +``` + +## Generic Variants +If you're intending to work on many game types in generic code, then the above code won't work well. Instead, it looks like: +```cs +public void SomeFunction(GameRelease release, ModPath inputPath) + where TMod : IModGetter +{ + var newMod = ModInstantiator.Activator(ModKey.FromFileName("MyMod.esp"), release); + + var importedMod = ModInstantiator.Importer(inputPath, release); +} +``` +In this way, this function does not need to know whether it's a SkyrimMod, or a Fallout4Mod. This of course, comes with the downside of only being able to interact with the object as much as the TMod constraint allows. You would not be able to access the Water group, for example, as it's uncertain if the mod in question has those. + +### Getter vs Setter +If the constraint `TMod` is only a Getter interface, then `ModInstantiator.Importer` will return a binary overlay underlying object. If it's a setter constraint, then it must be backed by a fully imported mutable object. diff --git a/mkdocs.yml b/mkdocs.yml index da540b809..82766c821 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -41,11 +41,13 @@ theme: scheme: slate features: - navigation.instant + - navigation.tracking + - navigation.sections nav: - Home: index.md - Big Cheat Sheet: Big-Cheat-Sheet.md - - Plugin Record Suite: + - Plugin Record Suite: Plugin-Record-Suite.md - Generated Classes: Generated-Classes.md - Binary Importing: Binary-Importing.md - Binary Overlay: Binary-Overlay.md From 6f3753ce8a1887e963e599a48a2c4635f67ed84f Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 22:23:00 -0500 Subject: [PATCH 083/135] More asset link remapping prep --- .../Modules/Plugin/ContainedAssetLinksModule.cs | 3 +-- .../Records/Common Subrecords/Icons_Generated.cs | 2 +- .../Records/Common Subrecords/SimpleModel_Generated.cs | 2 +- .../Records/Major Records/Climate_Generated.cs | 2 +- .../Records/Major Records/DebrisModel_Generated.cs | 2 +- .../Records/Major Records/EffectShader_Generated.cs | 2 +- .../Records/Major Records/Eyes_Generated.cs | 2 +- .../Records/Major Records/Furniture_Generated.cs | 2 +- .../Records/Major Records/IdleAnimation_Generated.cs | 2 +- .../Records/Major Records/LensFlareSprite_Generated.cs | 2 +- .../Records/Major Records/LoadScreen_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs | 2 +- .../Records/Major Records/MusicTrack_Generated.cs | 2 +- .../Records/Major Records/Part_Generated.cs | 2 +- .../Records/Major Records/Projectile_Generated.cs | 2 +- .../Records/Major Records/ShaderParticleGeometry_Generated.cs | 2 +- .../Records/Major Records/TextureSet_Generated.cs | 2 +- .../Records/Major Records/TintAssets_Generated.cs | 2 +- .../Records/Major Records/Water_Generated.cs | 2 +- .../Records/Major Records/Worldspace_Generated.cs | 2 +- 20 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs index 03e808058..24229fe7d 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs @@ -375,7 +375,6 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin } } - var startCount = fg.Count; var subFg = new StructuredStringBuilder(); foreach (var field in obj.IterateFields(nonIntegrated: true)) { @@ -416,7 +415,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin if (subFg.Count > 0) { - fg.AppendLine($"if (queryCategories.HasFlag({nameof(AssetLinkQuery)}.{nameof(AssetLinkQuery.Listed)}))"); + fg.AppendLine($"if (query.HasFlag({nameof(AssetLinkQuery)}.{nameof(AssetLinkQuery.Listed)}))"); using (fg.CurlyBrace()) { fg.AppendLines(subFg); diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs index b9bc08998..50a620d14 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs @@ -767,7 +767,7 @@ public IEnumerable EnumerateListedAssetLinks(IIcons obj) public void RemapAssetLinks(IIcons obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.LargeIconFilename.Relink(mapping); obj.SmallIconFilename?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs index a5171fe5c..3f2bca938 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs @@ -782,7 +782,7 @@ public IEnumerable EnumerateListedAssetLinks(ISimpleModel obj) public void RemapAssetLinks(ISimpleModel obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.File.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs index da5b52a3f..9068fddf5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs @@ -1315,7 +1315,7 @@ public IEnumerable EnumerateListedAssetLinks(IClimate obj) public void RemapAssetLinks(IClimate obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.SunTexture?.Relink(mapping); obj.SunGlareTexture?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs index 7b3787ed5..29fcd58ea 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs @@ -895,7 +895,7 @@ public IEnumerable EnumerateListedAssetLinks(IDebrisModel obj) public void RemapAssetLinks(IDebrisModel obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.ModelFilename.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs index aaa35ebf7..d3ce8b363 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs @@ -5022,7 +5022,7 @@ public IEnumerable EnumerateListedAssetLinks(IEffectShader obj) public void RemapAssetLinks(IEffectShader obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.FillTexture?.Relink(mapping); obj.ParticleShaderTexture?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs index 0655632ec..bc9c47dcd 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs @@ -935,7 +935,7 @@ public IEnumerable EnumerateListedAssetLinks(IEyes obj) public void RemapAssetLinks(IEyes obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.Icon.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs index 75a53c7e4..324372fab 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs @@ -1696,7 +1696,7 @@ public IEnumerable EnumerateListedAssetLinks(IFurniture obj) public void RemapAssetLinks(IFurniture obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.ModelFilename?.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs index 607bf7e99..397f00a8c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs @@ -1280,7 +1280,7 @@ public IEnumerable EnumerateListedAssetLinks(IIdleAnimation obj) public void RemapAssetLinks(IIdleAnimation obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.Filename?.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs index d0bc77676..9697c10c2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs @@ -817,7 +817,7 @@ public IEnumerable EnumerateListedAssetLinks(ILensFlareSprite obj) public void RemapAssetLinks(ILensFlareSprite obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.Texture?.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs index 7e7efebbb..fde82cf1b 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs @@ -1281,7 +1281,7 @@ public IEnumerable EnumerateListedAssetLinks(ILoadScreen obj) public void RemapAssetLinks(ILoadScreen obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.CameraPath?.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs index f92104cf2..dde731f6c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs @@ -838,7 +838,7 @@ public IEnumerable EnumerateListedAssetLinks(ILod obj) public void RemapAssetLinks(ILod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.Level0.Relink(mapping); obj.Level1.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs index 624249848..bb465433e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs @@ -1382,7 +1382,7 @@ public IEnumerable EnumerateListedAssetLinks(IMusicTrack obj) public void RemapAssetLinks(IMusicTrack obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.TrackFilename?.Relink(mapping); obj.FinaleFilename?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs index 711229857..9bfdc351b 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs @@ -765,7 +765,7 @@ public IEnumerable EnumerateListedAssetLinks(IPart obj) public void RemapAssetLinks(IPart obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.FileName?.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs index 6221fe275..047375db2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs @@ -2204,7 +2204,7 @@ public IEnumerable EnumerateListedAssetLinks(IProjectile obj) public void RemapAssetLinks(IProjectile obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.MuzzleFlashModel.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs index c9bbcca6c..793d46708 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs @@ -1321,7 +1321,7 @@ public IEnumerable EnumerateListedAssetLinks(IShaderParticleGeometry public void RemapAssetLinks(IShaderParticleGeometry obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.ParticleTexture?.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs index 93bd9311c..a9939ac47 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs @@ -1292,7 +1292,7 @@ public IEnumerable EnumerateListedAssetLinks(ITextureSet obj) public void RemapAssetLinks(ITextureSet obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.Diffuse?.Relink(mapping); obj.NormalOrGloss?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs index 9828be26b..a733ec743 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs @@ -973,7 +973,7 @@ public IEnumerable EnumerateListedAssetLinks(ITintAssets obj) public void RemapAssetLinks(ITintAssets obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.FileName?.Relink(mapping); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs index 40579ecd6..52e4e3862 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs @@ -3557,7 +3557,7 @@ public IEnumerable EnumerateListedAssetLinks(IWater obj) public void RemapAssetLinks(IWater obj, IReadOnlyDictionary mapping, AssetLinkQuery query) { base.RemapAssetLinks(obj, mapping, query); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.NoiseLayerOneTexture?.Relink(mapping); obj.NoiseLayerTwoTexture?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs index 8f216e3c3..866beae18 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs @@ -3017,7 +3017,7 @@ public void RemapAssetLinks(IWorldspace obj, IReadOnlyDictionary x.RemapAssetLinks(mapping, query)); - if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + if (query.HasFlag(AssetLinkQuery.Listed)) { obj.MapImage?.Relink(mapping); obj.CanopyShadow?.Relink(mapping); From 7a9eb70cb07203ada10248a5f70a765dfb4d76e1 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 22:34:15 -0500 Subject: [PATCH 084/135] More docs --- docs/Abstract-Subclassing.md | 1 + docs/AssetLink.md | 1 + docs/Binary-Exporting.md | 1 + docs/Binary-Format-Complexity-Abstraction.md | 1 + docs/Binary-Overlay.md | 1 + docs/Copy-Functionality.md | 1 + docs/Create,-Duplicate,-and-Override.md | 1 + docs/Equality-Checks.md | 1 + docs/Flags-and-Enums.md | 1 + docs/Interfaces-(Aspect-Link-Getters).md | 2 +- docs/Printing.md | 1 + docs/Translation-Masks.md | 1 + docs/Typical-Mod-Construction-and-Importing.md | 1 + mkdocs.yml | 3 ++- 14 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/Abstract-Subclassing.md b/docs/Abstract-Subclassing.md index 3184b895f..9a60739e1 100644 --- a/docs/Abstract-Subclassing.md +++ b/docs/Abstract-Subclassing.md @@ -1,3 +1,4 @@ +# Abstract Subclassing ## What is Abstract Subclassing Occasionally records will have an Abstract subobject. diff --git a/docs/AssetLink.md b/docs/AssetLink.md index 9db4a496b..3fe1bd145 100644 --- a/docs/AssetLink.md +++ b/docs/AssetLink.md @@ -1,3 +1,4 @@ +# Asset Links ## What is an AssetLink An AssetLink is a strongly typed object wrapping what is normally a `string` subpath pointing to an asset. diff --git a/docs/Binary-Exporting.md b/docs/Binary-Exporting.md index 9393bea6d..96f1cc059 100644 --- a/docs/Binary-Exporting.md +++ b/docs/Binary-Exporting.md @@ -1,3 +1,4 @@ +# Binary Exporting ## Typical Export A basic mod write call is pretty straightforward: ``` diff --git a/docs/Binary-Format-Complexity-Abstraction.md b/docs/Binary-Format-Complexity-Abstraction.md index 1a207951b..0b2cdb06e 100644 --- a/docs/Binary-Format-Complexity-Abstraction.md +++ b/docs/Binary-Format-Complexity-Abstraction.md @@ -1,3 +1,4 @@ +# Binary Format Complexity Abstraction Bethesda's binary format contains a lot implementation complexities that are unrelated to the actual content of the records. A lot of times the exposure of these details are a source of confusion, and don't add much upside in the way of flexibility or power into the hands of the user. Mutagen attempts to abstract these complexities away so that the end user is dealing with the distilled record content more directly, rather than wading through the gritty specifics that only matter in the context of their binary format on disk. ## FormKeys and FormLinks diff --git a/docs/Binary-Overlay.md b/docs/Binary-Overlay.md index cfa29e979..5c62bc2d1 100644 --- a/docs/Binary-Overlay.md +++ b/docs/Binary-Overlay.md @@ -1,3 +1,4 @@ +# Binary Overlay Binary Overlays are an alternative to the more simplistic [[Binary Importing]] concepts. ## Reasoning for an Alternate Pattern diff --git a/docs/Copy-Functionality.md b/docs/Copy-Functionality.md index becfbe73c..f5c2345ce 100644 --- a/docs/Copy-Functionality.md +++ b/docs/Copy-Functionality.md @@ -1,3 +1,4 @@ +# Copy Functionality Mutagen provides functionality for copying in data to an already existing object. ## DeepCopy diff --git a/docs/Create,-Duplicate,-and-Override.md b/docs/Create,-Duplicate,-and-Override.md index 692b77fbf..1d3480516 100644 --- a/docs/Create,-Duplicate,-and-Override.md +++ b/docs/Create,-Duplicate,-and-Override.md @@ -1,3 +1,4 @@ +# Create, Duplicate, and Override ## Create New Records New records can be constructed in a few ways. Note that a record's FormKey is required during construction, and immutable. If you want to change the FormKey of a record, a new one should be made. Any desired fields can be brought over via [CopyIn](Copy-Functionality#deepcopyin) mechanics. ### By Constructor diff --git a/docs/Equality-Checks.md b/docs/Equality-Checks.md index 858e97bb2..e4df4f349 100644 --- a/docs/Equality-Checks.md +++ b/docs/Equality-Checks.md @@ -1,3 +1,4 @@ +# Equality Checks ## Basic Equality Mutagen generates Equals and Hash functions for all classes based on record content. Normal C# equality checks can be used: ```cs diff --git a/docs/Flags-and-Enums.md b/docs/Flags-and-Enums.md index bb8a26bca..30ba93394 100644 --- a/docs/Flags-and-Enums.md +++ b/docs/Flags-and-Enums.md @@ -1,3 +1,4 @@ +# Flags and Enums A lot of Record data is exposed via flags and enums. All of known enum types and their options are defined explicitly for strongly typed use. ## Normal Enum Certain fields have a certain subset of valid options. These are exposed as enums, where only one choice can be made. diff --git a/docs/Interfaces-(Aspect-Link-Getters).md b/docs/Interfaces-(Aspect-Link-Getters).md index f589f085e..e15a7fd70 100644 --- a/docs/Interfaces-(Aspect-Link-Getters).md +++ b/docs/Interfaces-(Aspect-Link-Getters).md @@ -56,7 +56,7 @@ public interface INamed This is an interface that any record that contains a `Name` can implement. Now we can tweak our `PrintName` function to apply to any of these records, no matter what they are. ### Typical Usage -### Using Aspect Interfaces as a Parameter +#### Using Aspect Interfaces as a Parameter In the problem described above, a common use case is wanting to write a function that applies to multiple record types: ```cs public static void PrintName(INamedGetter namedRecord) diff --git a/docs/Printing.md b/docs/Printing.md index fcd3b933d..cf5078329 100644 --- a/docs/Printing.md +++ b/docs/Printing.md @@ -1,3 +1,4 @@ +# Printing (Latest version of Mutagen does not match these docs. Will soon be updated to match this documentation) ## Normal ToString diff --git a/docs/Translation-Masks.md b/docs/Translation-Masks.md index 2d19254ad..4e6b2974e 100644 --- a/docs/Translation-Masks.md +++ b/docs/Translation-Masks.md @@ -1,3 +1,4 @@ +# Translation Masks Several functionalities such as Equality, DeepCopy, and a few others have support for a concept called Translation Masks. These allow for customization of what members are involved in those operations. ## Equality diff --git a/docs/Typical-Mod-Construction-and-Importing.md b/docs/Typical-Mod-Construction-and-Importing.md index 831f31778..84886bac4 100644 --- a/docs/Typical-Mod-Construction-and-Importing.md +++ b/docs/Typical-Mod-Construction-and-Importing.md @@ -1,3 +1,4 @@ +# Typical Mod Construction and Importing If you're only dealing with one game, then code like this is typical: ```cs public void SomeFunction() diff --git a/mkdocs.yml b/mkdocs.yml index 82766c821..a36239a0c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -47,7 +47,8 @@ theme: nav: - Home: index.md - Big Cheat Sheet: Big-Cheat-Sheet.md - - Plugin Record Suite: Plugin-Record-Suite.md + - Plugin Record Suite: + - Plugin-Record-Suite.md - Generated Classes: Generated-Classes.md - Binary Importing: Binary-Importing.md - Binary Overlay: Binary-Overlay.md From 4a9895fc2a0a588d74da944bebb9c88adee15a76 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 22:37:43 -0500 Subject: [PATCH 085/135] More docs --- mkdocs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index a36239a0c..e3a1dcf92 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,12 +43,12 @@ theme: - navigation.instant - navigation.tracking - navigation.sections + - navigation.indexes nav: - Home: index.md - Big Cheat Sheet: Big-Cheat-Sheet.md - - Plugin Record Suite: - - Plugin-Record-Suite.md + - Plugin Record Suite: Plugin-Record-Suite.md - Generated Classes: Generated-Classes.md - Binary Importing: Binary-Importing.md - Binary Overlay: Binary-Overlay.md From c5e78b9328909c97773b01e91d4797496d4715ea Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 23:24:08 -0500 Subject: [PATCH 086/135] Partial AssetLink remapping functionality closes #454 --- .../Extensions/AssetLinkRemappingMixIn.cs | 16 +-- .../Plugins/Assets/IAssetLinkContainer.cs | 11 +- .../Plugins/Records/AGroup.cs | 5 +- .../Plugins/Records/AListGroup.cs | 5 +- .../Plugins/Records/MajorRecord_Generated.cs | 9 +- .../Records/Fallout4Group_Generated.cs | 11 +- .../Records/Fallout4ListGroup_Generated.cs | 11 +- .../Records/Fallout4MajorRecord_Generated.cs | 11 +- .../Records/Fallout4Mod_Generated.cs | 13 +- .../Major Records/CellBlock_Generated.cs | 11 +- .../Major Records/CellSubBlock_Generated.cs | 11 +- .../Records/Major Records/Cell_Generated.cs | 17 ++- .../WorldspaceBlock_Generated.cs | 11 +- .../WorldspaceSubBlock_Generated.cs | 11 +- .../Major Records/Worldspace_Generated.cs | 17 ++- .../Plugin/ContainedAssetLinksModule.cs | 61 ++++++-- .../Major Records/CellBlock_Generated.cs | 11 +- .../Major Records/CellSubBlock_Generated.cs | 11 +- .../Records/Major Records/Cell_Generated.cs | 17 ++- .../WorldspaceBlock_Generated.cs | 11 +- .../WorldspaceSubBlock_Generated.cs | 11 +- .../Major Records/Worldspace_Generated.cs | 15 +- .../Records/OblivionGroup_Generated.cs | 11 +- .../Records/OblivionListGroup_Generated.cs | 11 +- .../Records/OblivionMajorRecord_Generated.cs | 11 +- .../Records/OblivionMod_Generated.cs | 13 +- .../AVirtualMachineAdapter_Generated.cs | 11 +- .../Destructible_Generated.cs | 11 +- .../DestructionStage_Generated.cs | 11 +- .../Common Subrecords/Icons_Generated.cs | 9 +- .../ScriptEntry_Generated.cs | 16 ++- .../SimpleModel_Generated.cs | 9 +- .../Major Records/APlacedTrap_Generated.cs | 15 +- .../Major Records/Activator_Generated.cs | 19 ++- .../Major Records/AddonNode_Generated.cs | 15 +- .../AlchemicalApparatus_Generated.cs | 21 +-- .../Major Records/Ammunition_Generated.cs | 19 ++- .../Major Records/AnimatedObject_Generated.cs | 15 +- .../Major Records/ArmorAddon_Generated.cs | 24 +++- .../Major Records/ArmorModel_Generated.cs | 13 +- .../Records/Major Records/Armor_Generated.cs | 19 ++- .../Major Records/ArtObject_Generated.cs | 15 +- .../Major Records/BodyData_Generated.cs | 11 +- .../Major Records/BodyPartData_Generated.cs | 15 +- .../Records/Major Records/Book_Generated.cs | 28 ++-- .../Major Records/CameraShot_Generated.cs | 15 +- .../Major Records/CellBlock_Generated.cs | 11 +- .../Major Records/CellSubBlock_Generated.cs | 11 +- .../Records/Major Records/Cell_Generated.cs | 17 ++- .../Major Records/Climate_Generated.cs | 13 +- .../Major Records/Container_Generated.cs | 19 ++- .../Major Records/DebrisModel_Generated.cs | 9 +- .../Records/Major Records/Debris_Generated.cs | 15 +- .../DialogResponses_Generated.cs | 15 +- .../Major Records/DialogTopic_Generated.cs | 22 ++- .../Records/Major Records/Door_Generated.cs | 19 ++- .../Major Records/EffectShader_Generated.cs | 11 +- .../Major Records/Explosion_Generated.cs | 17 ++- .../Records/Major Records/Eyes_Generated.cs | 11 +- .../Records/Major Records/Flora_Generated.cs | 19 ++- .../Major Records/Furniture_Generated.cs | 17 ++- .../Records/Major Records/Grass_Generated.cs | 15 +- .../Records/Major Records/Hazard_Generated.cs | 15 +- .../Major Records/HeadData_Generated.cs | 15 +- .../Major Records/HeadPart_Generated.cs | 17 ++- .../Major Records/IdleAnimation_Generated.cs | 11 +- .../Major Records/IdleMarker_Generated.cs | 15 +- .../Records/Major Records/Impact_Generated.cs | 15 +- .../Major Records/Ingestible_Generated.cs | 19 ++- .../Major Records/Ingredient_Generated.cs | 21 +-- .../Records/Major Records/Key_Generated.cs | 21 +-- .../LensFlareSprite_Generated.cs | 9 +- .../Major Records/LensFlare_Generated.cs | 15 +- .../Major Records/LeveledNpc_Generated.cs | 15 +- .../Records/Major Records/Light_Generated.cs | 21 +-- .../Major Records/LoadScreen_Generated.cs | 13 +- .../Records/Major Records/Lod_Generated.cs | 9 +- .../Major Records/MagicEffect_Generated.cs | 13 +- .../Major Records/MaterialObject_Generated.cs | 15 +- .../Major Records/MiscItem_Generated.cs | 21 +-- .../Major Records/MoveableStatic_Generated.cs | 17 ++- .../Major Records/MusicTrack_Generated.cs | 11 +- .../Records/Major Records/Npc_Generated.cs | 22 ++- .../Major Records/Package_Generated.cs | 13 +- .../Records/Major Records/Part_Generated.cs | 9 +- .../Records/Major Records/Perk_Generated.cs | 17 ++- .../Major Records/PlacedNpc_Generated.cs | 13 +- .../Major Records/PlacedObject_Generated.cs | 15 +- .../Major Records/Projectile_Generated.cs | 15 +- .../Major Records/QuestAdapter_Generated.cs | 15 +- .../QuestFragmentAlias_Generated.cs | 11 +- .../Records/Major Records/Quest_Generated.cs | 22 ++- .../Records/Major Records/Race_Generated.cs | 21 +-- .../Major Records/RegionData_Generated.cs | 11 +- .../Records/Major Records/Region_Generated.cs | 25 ++-- .../Records/Major Records/Scene_Generated.cs | 15 +- .../Records/Major Records/Scroll_Generated.cs | 17 ++- .../ShaderParticleGeometry_Generated.cs | 11 +- .../Major Records/SoulGem_Generated.cs | 19 ++- .../SoundDescriptor_Generated.cs | 11 +- .../Records/Major Records/Static_Generated.cs | 17 ++- .../TalkingActivator_Generated.cs | 19 ++- .../Major Records/TextureSet_Generated.cs | 11 +- .../Major Records/TintAssets_Generated.cs | 9 +- .../Records/Major Records/Tree_Generated.cs | 17 ++- .../Records/Major Records/Water_Generated.cs | 11 +- .../Records/Major Records/Weapon_Generated.cs | 21 +-- .../Major Records/Weather_Generated.cs | 13 +- .../WorldspaceBlock_Generated.cs | 11 +- .../WorldspaceSubBlock_Generated.cs | 11 +- .../Major Records/Worldspace_Generated.cs | 19 ++- .../Records/SkyrimGroup_Generated.cs | 11 +- .../Records/SkyrimListGroup_Generated.cs | 11 +- .../Records/SkyrimMajorRecord_Generated.cs | 11 +- .../Records/SkyrimMod_Generated.cs | 134 ++++++++++-------- 115 files changed, 1239 insertions(+), 582 deletions(-) diff --git a/Mutagen.Bethesda.Core/Extensions/AssetLinkRemappingMixIn.cs b/Mutagen.Bethesda.Core/Extensions/AssetLinkRemappingMixIn.cs index 4fc2d4ffe..abad7e62c 100644 --- a/Mutagen.Bethesda.Core/Extensions/AssetLinkRemappingMixIn.cs +++ b/Mutagen.Bethesda.Core/Extensions/AssetLinkRemappingMixIn.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using Mutagen.Bethesda.Assets; using Mutagen.Bethesda.Plugins; using Mutagen.Bethesda.Plugins.Assets; @@ -41,19 +39,19 @@ public static void RemapListedAssetLinks(this IList(this IList linkList, IReadOnlyDictionary mapping, AssetLinkQuery query) + public static void RemapAssetLinks(this IList linkList, IReadOnlyDictionary mapping, AssetLinkQuery query, IAssetLinkCache? linkCache) { foreach (var item in linkList) { - item.RemapAssetLinks(mapping, query); + item.RemapAssetLinks(mapping, query, linkCache); } } - public static void RemapAssetLinks(this IGenderedItemGetter gendered, IReadOnlyDictionary mapping, AssetLinkQuery query) + public static void RemapAssetLinks(this IGenderedItemGetter gendered, IReadOnlyDictionary mapping, AssetLinkQuery query, IAssetLinkCache? linkCache) where TItem : class, IAssetLinkContainer { - gendered.Male?.RemapAssetLinks(mapping, query); - gendered.Female?.RemapAssetLinks(mapping, query); + gendered.Male?.RemapAssetLinks(mapping, query, linkCache); + gendered.Female?.RemapAssetLinks(mapping, query, linkCache); } public static void RemapAssetLinks(this IGenderedItem gendered, IReadOnlyDictionary mapping) @@ -64,12 +62,12 @@ public static void RemapAssetLinks(this IGenderedItem(mapping); } - public static void RemapAssetLinks(this IReadOnlyCache cache, IReadOnlyDictionary mapping, AssetLinkQuery query) + public static void RemapAssetLinks(this IReadOnlyCache cache, IReadOnlyDictionary mapping, AssetLinkQuery query, IAssetLinkCache? linkCache) where TMajorGetter : class, IMajorRecordGetter, IAssetLinkContainer { foreach (var item in cache.Items) { - item.RemapAssetLinks(mapping, query); + item.RemapAssetLinks(mapping, query, linkCache); } } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs index a7db55ab9..253ef5c97 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs @@ -11,7 +11,16 @@ public interface IAssetLinkContainer : IAssetLinkContainerGetter /// /// Swaps out all links to point to new assets /// - void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query); + /// Mapping to carry out + /// Types of asset links to apply the remapping to + /// Asset Link Cache, which is required for Resolved asset links + void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query, IAssetLinkCache? linkCache); + + /// + /// Swaps out all listed links to point to new assets + /// + /// Mapping to carry out + void RemapListedAssetLinks(IReadOnlyDictionary mapping); /// /// Enumerates only AssetLinks that are explicitly listed in the record and can be modified directly. diff --git a/Mutagen.Bethesda.Core/Plugins/Records/AGroup.cs b/Mutagen.Bethesda.Core/Plugins/Records/AGroup.cs index e53640674..c8b73d5b6 100644 --- a/Mutagen.Bethesda.Core/Plugins/Records/AGroup.cs +++ b/Mutagen.Bethesda.Core/Plugins/Records/AGroup.cs @@ -158,7 +158,10 @@ public void AddUntyped(IMajorRecord record) public abstract IEnumerable EnumerateListedAssetLinks(); /// - public abstract void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query); + public abstract void RemapListedAssetLinks(IReadOnlyDictionary mapping); + + /// + public abstract void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query, IAssetLinkCache? linkCache); public abstract IEnumerable EnumerateAssetLinks( AssetLinkQuery queryCategories = AssetLinkQuery.Listed, diff --git a/Mutagen.Bethesda.Core/Plugins/Records/AListGroup.cs b/Mutagen.Bethesda.Core/Plugins/Records/AListGroup.cs index 28d226fd6..e3d9f7346 100644 --- a/Mutagen.Bethesda.Core/Plugins/Records/AListGroup.cs +++ b/Mutagen.Bethesda.Core/Plugins/Records/AListGroup.cs @@ -81,9 +81,12 @@ private TObject ConfirmCorrectType(IMajorRecord record, string paramName) /// public void Move(int original, int destination) => ProtectedList.Move(original, destination); + + /// + public abstract void RemapListedAssetLinks(IReadOnlyDictionary mapping); /// - public abstract void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query); + public abstract void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query, IAssetLinkCache? linkCache); /// public abstract IEnumerable EnumerateListedAssetLinks(); diff --git a/Mutagen.Bethesda.Core/Plugins/Records/MajorRecord_Generated.cs b/Mutagen.Bethesda.Core/Plugins/Records/MajorRecord_Generated.cs index c5eb909d2..607e9fb78 100644 --- a/Mutagen.Bethesda.Core/Plugins/Records/MajorRecord_Generated.cs +++ b/Mutagen.Bethesda.Core/Plugins/Records/MajorRecord_Generated.cs @@ -512,7 +512,8 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public virtual IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MajorRecordCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public virtual IEnumerable EnumerateListedAssetLinks() => MajorRecordSetterCommon.Instance.EnumerateListedAssetLinks(this); - public virtual void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public virtual void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => MajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public virtual void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1181,7 +1182,11 @@ public IEnumerable EnumerateListedAssetLinks(IMajorRecord obj) yield break; } - public void RemapAssetLinks(IMajorRecord obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IMajorRecord obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { } diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs index 2f38cc4d5..ba11b411f 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs @@ -151,7 +151,8 @@ public bool Equals(IFallout4GroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => Fallout4GroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => Fallout4GroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => Fallout4GroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => Fallout4GroupSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => Fallout4GroupSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -872,9 +873,13 @@ public IEnumerable EnumerateListedAssetLinks(IFallout4Group obj) yield break; } - public void RemapAssetLinks(IFallout4Group obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IFallout4Group obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.RecordCache.RemapAssetLinks(mapping, query); + obj.RecordCache.RemapAssetLinks(mapping, queryCategories); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs index 84f036e5c..06006cfd9 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs @@ -153,7 +153,8 @@ public bool Equals(IFallout4ListGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => Fallout4ListGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => Fallout4ListGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => Fallout4ListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => Fallout4ListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => Fallout4ListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -872,9 +873,13 @@ public IEnumerable EnumerateListedAssetLinks(IFallout4ListGroup o yield break; } - public void RemapAssetLinks(IFallout4ListGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IFallout4ListGroup obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Records.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4MajorRecord_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4MajorRecord_Generated.cs index b738016c1..ca62808d0 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4MajorRecord_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4MajorRecord_Generated.cs @@ -481,7 +481,8 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => Fallout4MajorRecordCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => Fallout4MajorRecordSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => Fallout4MajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => Fallout4MajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => Fallout4MajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1136,9 +1137,13 @@ public IEnumerable EnumerateListedAssetLinks(IFallout4MajorRecord ob yield break; } - public void RemapAssetLinks(IFallout4MajorRecord obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IFallout4MajorRecord obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs index 2681d548d..0dcc43fd4 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4Mod_Generated.cs @@ -6654,7 +6654,8 @@ public uint GetRecordCount() IEnumerable> IMajorRecordSimpleContextEnumerable.EnumerateMajorRecordSimpleContexts(Type type, bool throwIfUnknown) => this.EnumerateMajorRecordContexts(linkCache: null!, type: type, throwIfUnknown: throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => Fallout4ModCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => Fallout4ModSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => Fallout4ModSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => Fallout4ModSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => Fallout4ModSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -9932,10 +9933,14 @@ public IEnumerable EnumerateListedAssetLinks(IFallout4Mod obj) yield break; } - public void RemapAssetLinks(IFallout4Mod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IFallout4Mod obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Cells.RemapAssetLinks(mapping, query); - obj.Worldspaces.RemapAssetLinks(mapping, query); + obj.Cells.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Worldspaces.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs index 5532d7e7e..f3d82c23e 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs @@ -602,7 +602,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1413,9 +1414,13 @@ public IEnumerable EnumerateListedAssetLinks(ICellBlock obj) yield break; } - public void RemapAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ICellBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs index efad90d33..1bf4ff976 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs @@ -602,7 +602,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1398,9 +1399,13 @@ public IEnumerable EnumerateListedAssetLinks(ICellSubBlock obj) yield break; } - public void RemapAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ICellSubBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs index 871f0c7b5..098900a96 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs @@ -2558,7 +2558,8 @@ public MajorFlag MajorFlags void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => CellSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -3613,11 +3614,15 @@ public IEnumerable EnumerateListedAssetLinks(ICell obj) yield break; } - public void RemapAssetLinks(ICell obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, query)); - obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, query)); + public void RemapAssetLinks( + ICell obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs index 82e0b0b28..626e00444 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs @@ -635,7 +635,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1450,9 +1451,13 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceBlock obj) yield break; } - public void RemapAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWorldspaceBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs index ef6ac6cdf..9e8d4917d 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -635,7 +635,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1435,9 +1436,13 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceSubBlock obj yield break; } - public void RemapAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWorldspaceSubBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs index f6fba1fc0..39bcb7dbf 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs @@ -1878,7 +1878,8 @@ public MajorFlag MajorFlags void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WorldspaceSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -3070,11 +3071,15 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspace obj) yield break; } - public void RemapAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, query)); - obj.TopCell?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IWorldspace obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.TopCell?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs index 24229fe7d..2e55bff74 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs @@ -362,19 +362,63 @@ private async Task GenerateEnumerateListedAssetLinks(ObjectGeneration obj, Struc private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStringBuilder fg) { - fg.AppendLine( - $"public void {nameof(IAssetLinkContainer.RemapAssetLinks)}({obj.Interface(getter: false)} obj, IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping, {nameof(AssetLinkQuery)} query)"); + if (obj.GetObjectData().HasInferredAssets) + { + using (var f = fg.Function( + $"public static partial IEnumerable<{nameof(IAssetLinkGetter)}> RemapInferredAssetLinks", + semiColon: true)) + { + f.Add($"{obj.Interface(getter: false)} obj"); + f.Add($"IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping"); + f.Add($"{nameof(IAssetLinkCache)}? linkCache"); + f.Add($"{nameof(AssetLinkQuery)} queryCategories"); + } + fg.AppendLine(); + } + + if (obj.GetObjectData().HasResolvedAssets) + { + using (var f = fg.Function( + $"public static partial IEnumerable<{nameof(IAssetLinkGetter)}> RemapResolvedAssetLinks", + semiColon: true)) + { + f.Add($"{obj.Interface(getter: false)} obj"); + f.Add($"IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping"); + f.Add($"{nameof(IAssetLinkCache)}? linkCache"); + f.Add($"{nameof(AssetLinkQuery)} queryCategories"); + } + fg.AppendLine(); + } + + using (var f = fg.Function( + $"public void {nameof(IAssetLinkContainer.RemapAssetLinks)}")) + { + f.Add($"{obj.Interface(getter: false)} obj"); + f.Add($"IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping"); + f.Add($"{nameof(IAssetLinkCache)}? linkCache"); + f.Add($"{nameof(AssetLinkQuery)} queryCategories"); + } using (fg.CurlyBrace()) { foreach (var baseClass in obj.BaseClassTrail()) { if (await HasLinks(baseClass, includeBaseClass: true) != Case.No) { - fg.AppendLine($"base.{nameof(IAssetLinkContainer.RemapAssetLinks)}(obj, mapping, query);"); + fg.AppendLine($"base.{nameof(IAssetLinkContainer.RemapAssetLinks)}(obj, mapping, linkCache, queryCategories);"); break; } } + if (obj.GetObjectData().HasInferredAssets) + { + fg.AppendLine("RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories);"); + } + + if (obj.GetObjectData().HasResolvedAssets) + { + fg.AppendLine("RemapResolvedAssetLinks(obj, mapping, linkCache, queryCategories);"); + } + var subFg = new StructuredStringBuilder(); foreach (var field in obj.IterateFields(nonIntegrated: true)) { @@ -388,7 +432,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin && await HasLinks(contLoqui, includeBaseClass: true) != Case.No)) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.ForEach(x => x{contLoqui.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, query));"); + $"obj.{field.Name}{field.NullChar}.ForEach(x => x{contLoqui.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories));"); } else if (cont.SubTypeGeneration is AssetLinkType subAsset) { @@ -403,12 +447,12 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin && await HasLinks(dictLoqui, includeBaseClass: true) != Case.No) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, query);"); + $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories);"); } else if (dict.ValueTypeGen is FormLinkType formIDType) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, query);"); + $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories);"); } } } @@ -438,7 +482,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin if (subLinkCase == Case.No) continue; fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, query);"); + $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories, linkCache);"); } } } @@ -663,7 +707,8 @@ public async Task GenerateInterfaceImplementation(ObjectGeneration obj, Structur if (!getter) { fg.AppendLine($"public{await obj.FunctionOverride(shouldAlwaysOverride, async (o) => await HasLinks(o, includeBaseClass: false) != Case.No)}IEnumerable<{nameof(IAssetLink)}> {nameof(IAssetLinkContainer.EnumerateListedAssetLinks)}() => {obj.CommonClass(LoquiInterfaceType.ISetter, CommonGenerics.Class)}.Instance.{nameof(IAssetLinkContainer.EnumerateListedAssetLinks)}(this);"); - fg.AppendLine($"public{await obj.FunctionOverride(shouldAlwaysOverride, async (o) => await HasLinks(o, includeBaseClass: false) != Case.No)}void {nameof(IAssetLinkContainer.RemapAssetLinks)}(IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping, {nameof(AssetLinkQuery)} query) => {obj.CommonClass(LoquiInterfaceType.ISetter, CommonGenerics.Class)}.Instance.RemapAssetLinks(this, mapping, query);"); + fg.AppendLine($"public{await obj.FunctionOverride(shouldAlwaysOverride, async (o) => await HasLinks(o, includeBaseClass: false) != Case.No)}void {nameof(IAssetLinkContainer.RemapAssetLinks)}(IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping, {nameof(AssetLinkQuery)} queryCategories, IAssetLinkCache? linkCache) => {obj.CommonClass(LoquiInterfaceType.ISetter, CommonGenerics.Class)}.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories);"); + fg.AppendLine($"public{await obj.FunctionOverride(shouldAlwaysOverride, async (o) => await HasLinks(o, includeBaseClass: false) != Case.No)}void {nameof(IAssetLinkContainer.RemapListedAssetLinks)}(IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping) => {obj.CommonClass(LoquiInterfaceType.ISetter, CommonGenerics.Class)}.Instance.RemapAssetLinks(this, mapping, null, {nameof(AssetLinkQuery)}.{nameof(AssetLinkQuery.Listed)});"); } } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs index 20c29ca7e..20e573d99 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs @@ -569,7 +569,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1295,9 +1296,13 @@ public IEnumerable EnumerateListedAssetLinks(ICellBlock obj) yield break; } - public void RemapAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ICellBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs index 5bd273568..b978e8e9e 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs @@ -569,7 +569,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1287,9 +1288,13 @@ public IEnumerable EnumerateListedAssetLinks(ICellSubBlock obj) yield break; } - public void RemapAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ICellSubBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs index bf1095164..a522b881d 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs @@ -1476,7 +1476,8 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => CellSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -2360,12 +2361,16 @@ public IEnumerable EnumerateListedAssetLinks(ICell obj) yield break; } - public void RemapAssetLinks(ICell obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ICell obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); - obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, query)); - obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, query)); - obj.VisibleWhenDistant.ForEach(x => x.RemapAssetLinks(mapping, query)); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.VisibleWhenDistant.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs index ae716f205..1683d5110 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs @@ -602,7 +602,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1332,9 +1333,13 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceBlock obj) yield break; } - public void RemapAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWorldspaceBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs index 10a7b1f98..d9f2fd4aa 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -602,7 +602,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1324,9 +1325,13 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceSubBlock obj yield break; } - public void RemapAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWorldspaceSubBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs index 1b0514288..b40f6b091 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs @@ -1043,7 +1043,8 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WorldspaceSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1977,11 +1978,15 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspace obj) yield break; } - public void RemapAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWorldspace obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); - obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, query)); - obj.TopCell?.RemapAssetLinks(mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.TopCell?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs index 1e938ee41..2f7adf52e 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs @@ -148,7 +148,8 @@ public bool Equals(IOblivionGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => OblivionGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => OblivionGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => OblivionGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => OblivionGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => OblivionGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -865,9 +866,13 @@ public IEnumerable EnumerateListedAssetLinks(IOblivionGroup obj) yield break; } - public void RemapAssetLinks(IOblivionGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IOblivionGroup obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.RecordCache.RemapAssetLinks(mapping, query); + obj.RecordCache.RemapAssetLinks(mapping, queryCategories); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs index caa575ffe..f7e2c0993 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs @@ -150,7 +150,8 @@ public bool Equals(IOblivionListGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => OblivionListGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => OblivionListGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => OblivionListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => OblivionListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => OblivionListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -865,9 +866,13 @@ public IEnumerable EnumerateListedAssetLinks(IOblivionListGroup o yield break; } - public void RemapAssetLinks(IOblivionListGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IOblivionListGroup obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Records.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionMajorRecord_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionMajorRecord_Generated.cs index 92f26669a..cabccb57e 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionMajorRecord_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionMajorRecord_Generated.cs @@ -405,7 +405,8 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => OblivionMajorRecordCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => OblivionMajorRecordSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => OblivionMajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => OblivionMajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => OblivionMajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1052,9 +1053,13 @@ public IEnumerable EnumerateListedAssetLinks(IOblivionMajorRecord ob yield break; } - public void RemapAssetLinks(IOblivionMajorRecord obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IOblivionMajorRecord obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs index 753006087..b985fd8c3 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionMod_Generated.cs @@ -3224,7 +3224,8 @@ public uint GetRecordCount() IEnumerable> IMajorRecordSimpleContextEnumerable.EnumerateMajorRecordSimpleContexts(Type type, bool throwIfUnknown) => this.EnumerateMajorRecordContexts(linkCache: null!, type: type, throwIfUnknown: throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => OblivionModCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => OblivionModSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => OblivionModSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => OblivionModSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => OblivionModSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -5075,10 +5076,14 @@ public IEnumerable EnumerateListedAssetLinks(IOblivionMod obj) yield break; } - public void RemapAssetLinks(IOblivionMod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IOblivionMod obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Cells.RemapAssetLinks(mapping, query); - obj.Worldspaces.RemapAssetLinks(mapping, query); + obj.Cells.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Worldspaces.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs index a9394330d..239778bbb 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs @@ -506,7 +506,8 @@ public static implicit operator TranslationMask(bool defaultOn) public virtual void RemapLinks(IReadOnlyDictionary mapping) => AVirtualMachineAdapterSetterCommon.Instance.RemapLinks(this, mapping); public virtual IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AVirtualMachineAdapterCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public virtual IEnumerable EnumerateListedAssetLinks() => AVirtualMachineAdapterSetterCommon.Instance.EnumerateListedAssetLinks(this); - public virtual void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AVirtualMachineAdapterSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public virtual void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => AVirtualMachineAdapterSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public virtual void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AVirtualMachineAdapterSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -861,9 +862,13 @@ public IEnumerable EnumerateListedAssetLinks(IAVirtualMachineAdapter yield break; } - public void RemapAssetLinks(IAVirtualMachineAdapter obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IAVirtualMachineAdapter obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs index 7a695d1b1..ae86c22c2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs @@ -481,7 +481,8 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => DestructibleSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DestructibleCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => DestructibleSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DestructibleSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => DestructibleSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DestructibleSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -861,9 +862,13 @@ public IEnumerable EnumerateListedAssetLinks(IDestructible obj) yield break; } - public void RemapAssetLinks(IDestructible obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IDestructible obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Stages.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Stages.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/DestructionStage_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/DestructionStage_Generated.cs index 61ceb5b38..86623aa82 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/DestructionStage_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/DestructionStage_Generated.cs @@ -426,7 +426,8 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => DestructionStageSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DestructionStageCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => DestructionStageSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DestructionStageSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => DestructionStageSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DestructionStageSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -828,9 +829,13 @@ public IEnumerable EnumerateListedAssetLinks(IDestructionStage obj) yield break; } - public void RemapAssetLinks(IDestructionStage obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IDestructionStage obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Model?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs index 50a620d14..67477ceec 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Icons_Generated.cs @@ -393,7 +393,8 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IconsCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => IconsSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IconsSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => IconsSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IconsSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -765,7 +766,11 @@ public IEnumerable EnumerateListedAssetLinks(IIcons obj) yield break; } - public void RemapAssetLinks(IIcons obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IIcons obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { if (query.HasFlag(AssetLinkQuery.Listed)) { diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs index ed0298020..a09e86812 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs @@ -505,7 +505,8 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => ScriptEntrySetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ScriptEntryCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => ScriptEntrySetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ScriptEntrySetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ScriptEntrySetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ScriptEntrySetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -879,8 +880,19 @@ public IEnumerable EnumerateListedAssetLinks(IScriptEntry obj) yield break; } - public void RemapAssetLinks(IScriptEntry obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public static partial IEnumerable RemapInferredAssetLinks( + IScriptEntry obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories); + + public void RemapAssetLinks( + IScriptEntry obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { + RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs index 3f2bca938..81fc02e29 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/SimpleModel_Generated.cs @@ -404,7 +404,8 @@ public static implicit operator TranslationMask(bool defaultOn) public virtual void RemapLinks(IReadOnlyDictionary mapping) => SimpleModelSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SimpleModelCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => SimpleModelSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SimpleModelSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => SimpleModelSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SimpleModelSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -780,7 +781,11 @@ public IEnumerable EnumerateListedAssetLinks(ISimpleModel obj) yield break; } - public void RemapAssetLinks(ISimpleModel obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ISimpleModel obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { if (query.HasFlag(AssetLinkQuery.Listed)) { diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/APlacedTrap_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/APlacedTrap_Generated.cs index 9db8ef478..7da4de8b5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/APlacedTrap_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/APlacedTrap_Generated.cs @@ -1384,7 +1384,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => APlacedTrapCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => APlacedTrapSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => APlacedTrapSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => APlacedTrapSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => APlacedTrapSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1937,10 +1938,14 @@ public IEnumerable EnumerateListedAssetLinks(IAPlacedTrap obj) yield break; } - public void RemapAssetLinks(IAPlacedTrap obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IAPlacedTrap obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Activator_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Activator_Generated.cs index 685375433..c7a4d6bf3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Activator_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Activator_Generated.cs @@ -1030,7 +1030,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ActivatorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ActivatorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ActivatorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ActivatorSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ActivatorSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1606,12 +1607,16 @@ public IEnumerable EnumerateListedAssetLinks(IActivator obj) yield break; } - public void RemapAssetLinks(IActivator obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IActivator obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/AddonNode_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/AddonNode_Generated.cs index 8b5acdd2d..8cde8b90f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/AddonNode_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/AddonNode_Generated.cs @@ -613,7 +613,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AddonNodeCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => AddonNodeSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AddonNodeSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => AddonNodeSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AddonNodeSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1080,10 +1081,14 @@ public IEnumerable EnumerateListedAssetLinks(IAddonNode obj) yield break; } - public void RemapAssetLinks(IAddonNode obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IAddonNode obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/AlchemicalApparatus_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/AlchemicalApparatus_Generated.cs index 5b2b97bbd..0b4fbb461 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/AlchemicalApparatus_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/AlchemicalApparatus_Generated.cs @@ -910,7 +910,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AlchemicalApparatusCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => AlchemicalApparatusSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AlchemicalApparatusSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => AlchemicalApparatusSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AlchemicalApparatusSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1481,13 +1482,17 @@ public IEnumerable EnumerateListedAssetLinks(IAlchemicalApparatus ob yield break; } - public void RemapAssetLinks(IAlchemicalApparatus obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IAlchemicalApparatus obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ammunition_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ammunition_Generated.cs index 8d1b886a2..5aff62a20 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ammunition_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ammunition_Generated.cs @@ -1133,7 +1133,8 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AmmunitionCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => AmmunitionSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AmmunitionSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => AmmunitionSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AmmunitionSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1723,12 +1724,16 @@ public IEnumerable EnumerateListedAssetLinks(IAmmunition obj) yield break; } - public void RemapAssetLinks(IAmmunition obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IAmmunition obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/AnimatedObject_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/AnimatedObject_Generated.cs index 94bf81f6f..f1f08646e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/AnimatedObject_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/AnimatedObject_Generated.cs @@ -454,7 +454,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => AnimatedObjectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => AnimatedObjectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => AnimatedObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => AnimatedObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => AnimatedObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -887,10 +888,14 @@ public IEnumerable EnumerateListedAssetLinks(IAnimatedObject obj) yield break; } - public void RemapAssetLinks(IAnimatedObject obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IAnimatedObject obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs index 94062e053..9053773bd 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs @@ -1006,7 +1006,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ArmorAddonCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ArmorAddonSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ArmorAddonSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ArmorAddonSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ArmorAddonSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1566,11 +1567,22 @@ public IEnumerable EnumerateListedAssetLinks(IArmorAddon obj) yield break; } - public void RemapAssetLinks(IArmorAddon obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, query)); - obj.FirstPersonModel?.ForEach(x => x?.RemapAssetLinks(mapping, query)); + public static partial IEnumerable RemapInferredAssetLinks( + IArmorAddon obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories); + + public void RemapAssetLinks( + IArmorAddon obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); + obj.FirstPersonModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorModel_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorModel_Generated.cs index b701f54dd..a9017a096 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorModel_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorModel_Generated.cs @@ -433,7 +433,8 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => ArmorModelSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ArmorModelCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => ArmorModelSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ArmorModelSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ArmorModelSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ArmorModelSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -835,10 +836,14 @@ public IEnumerable EnumerateListedAssetLinks(IArmorModel obj) yield break; } - public void RemapAssetLinks(IArmorModel obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IArmorModel obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs index 03a071533..e4418de42 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs @@ -1434,7 +1434,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ArmorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ArmorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ArmorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ArmorSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ArmorSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -2099,12 +2100,16 @@ public IEnumerable EnumerateListedAssetLinks(IArmor obj) yield break; } - public void RemapAssetLinks(IArmor obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, query)); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IArmor obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArtObject_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArtObject_Generated.cs index 8c41b67bb..f7c50434c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArtObject_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArtObject_Generated.cs @@ -509,7 +509,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ArtObjectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ArtObjectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ArtObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ArtObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ArtObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -961,10 +962,14 @@ public IEnumerable EnumerateListedAssetLinks(IArtObject obj) yield break; } - public void RemapAssetLinks(IArtObject obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IArtObject obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyData_Generated.cs index f65a61b37..0d8d79f97 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyData_Generated.cs @@ -415,7 +415,8 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => BodyDataSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => BodyDataCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => BodyDataSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => BodyDataSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => BodyDataSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => BodyDataSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -800,9 +801,13 @@ public IEnumerable EnumerateListedAssetLinks(IBodyData obj) yield break; } - public void RemapAssetLinks(IBodyData obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IBodyData obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Model?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyPartData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyPartData_Generated.cs index 98c906ba5..e6be17f55 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyPartData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/BodyPartData_Generated.cs @@ -528,7 +528,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => BodyPartDataCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => BodyPartDataSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => BodyPartDataSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => BodyPartDataSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => BodyPartDataSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -970,10 +971,14 @@ public IEnumerable EnumerateListedAssetLinks(IBodyPartData obj) yield break; } - public void RemapAssetLinks(IBodyPartData obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IBodyPartData obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs index 80cb70353..2a49a226a 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs @@ -1212,7 +1212,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => BookCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => BookSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => BookSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => BookSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => BookSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1825,13 +1826,24 @@ public IEnumerable EnumerateListedAssetLinks(IBook obj) yield break; } - public void RemapAssetLinks(IBook obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public static partial IEnumerable RemapInferredAssetLinks( + IBook obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories); + + public void RemapAssetLinks( + IBook obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/CameraShot_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/CameraShot_Generated.cs index d77769c51..53acf8f94 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/CameraShot_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/CameraShot_Generated.cs @@ -870,7 +870,8 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CameraShotCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => CameraShotSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CameraShotSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CameraShotSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CameraShotSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1353,10 +1354,14 @@ public IEnumerable EnumerateListedAssetLinks(ICameraShot obj) yield break; } - public void RemapAssetLinks(ICameraShot obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + ICameraShot obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs index e67df9ba3..67c7d46d2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs @@ -602,7 +602,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1399,9 +1400,13 @@ public IEnumerable EnumerateListedAssetLinks(ICellBlock obj) yield break; } - public void RemapAssetLinks(ICellBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ICellBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs index 23fe94348..fa9d69fb5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs @@ -602,7 +602,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => CellSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1384,9 +1385,13 @@ public IEnumerable EnumerateListedAssetLinks(ICellSubBlock obj) yield break; } - public void RemapAssetLinks(ICellSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ICellSubBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs index 80f7f3757..fa2f4b9d1 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs @@ -2079,7 +2079,8 @@ public MajorFlag MajorFlags void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => CellCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => CellSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => CellSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -3083,11 +3084,15 @@ public IEnumerable EnumerateListedAssetLinks(ICell obj) yield break; } - public void RemapAssetLinks(ICell obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, query)); - obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, query)); + public void RemapAssetLinks( + ICell obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs index 9068fddf5..01b4f5e38 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs @@ -831,7 +831,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ClimateCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ClimateSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ClimateSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ClimateSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ClimateSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1312,15 +1313,19 @@ public IEnumerable EnumerateListedAssetLinks(IClimate obj) yield break; } - public void RemapAssetLinks(IClimate obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IClimate obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.SunTexture?.Relink(mapping); obj.SunGlareTexture?.Relink(mapping); } - obj.Model?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Container_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Container_Generated.cs index 697be20aa..e456e5ed7 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Container_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Container_Generated.cs @@ -901,7 +901,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ContainerCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ContainerSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ContainerSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ContainerSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ContainerSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1450,12 +1451,16 @@ public IEnumerable EnumerateListedAssetLinks(IContainer obj) yield break; } - public void RemapAssetLinks(IContainer obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IContainer obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs index 29fcd58ea..08ca430a5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DebrisModel_Generated.cs @@ -513,7 +513,8 @@ public enum DATADataType } public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DebrisModelCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => DebrisModelSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DebrisModelSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => DebrisModelSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DebrisModelSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -893,7 +894,11 @@ public IEnumerable EnumerateListedAssetLinks(IDebrisModel obj) yield break; } - public void RemapAssetLinks(IDebrisModel obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IDebrisModel obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { if (query.HasFlag(AssetLinkQuery.Listed)) { diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs index 1e726432c..f9bae9ebf 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs @@ -472,7 +472,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DebrisCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => DebrisSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DebrisSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => DebrisSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DebrisSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -885,10 +886,14 @@ public IEnumerable EnumerateListedAssetLinks(IDebris obj) yield break; } - public void RemapAssetLinks(IDebris obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Models.ForEach(x => x.RemapAssetLinks(mapping, query)); + public void RemapAssetLinks( + IDebris obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Models.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses_Generated.cs index 3365c7770..029c2ef42 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogResponses_Generated.cs @@ -1254,7 +1254,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DialogResponsesCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => DialogResponsesSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DialogResponsesSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => DialogResponsesSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DialogResponsesSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1778,10 +1779,14 @@ public IEnumerable EnumerateListedAssetLinks(IDialogResponses obj) yield break; } - public void RemapAssetLinks(IDialogResponses obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IDialogResponses obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs index 17f8cfe91..e193f4072 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs @@ -887,7 +887,8 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DialogTopicCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => DialogTopicSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DialogTopicSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => DialogTopicSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DialogTopicSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1674,10 +1675,21 @@ public IEnumerable EnumerateListedAssetLinks(IDialogTopic obj) yield break; } - public void RemapAssetLinks(IDialogTopic obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Responses.ForEach(x => x.RemapAssetLinks(mapping, query)); + public static partial IEnumerable RemapResolvedAssetLinks( + IDialogTopic obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories); + + public void RemapAssetLinks( + IDialogTopic obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + RemapResolvedAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Responses.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Door_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Door_Generated.cs index 90066ce25..2da2f0b92 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Door_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Door_Generated.cs @@ -799,7 +799,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => DoorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => DoorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => DoorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => DoorSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => DoorSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1342,12 +1343,16 @@ public IEnumerable EnumerateListedAssetLinks(IDoor obj) yield break; } - public void RemapAssetLinks(IDoor obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IDoor obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs index d3ce8b363..4e2df7fbb 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/EffectShader_Generated.cs @@ -4162,7 +4162,8 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => EffectShaderCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => EffectShaderSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => EffectShaderSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => EffectShaderSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => EffectShaderSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -5019,9 +5020,13 @@ public IEnumerable EnumerateListedAssetLinks(IEffectShader obj) yield break; } - public void RemapAssetLinks(IEffectShader obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IEffectShader obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.FillTexture?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Explosion_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Explosion_Generated.cs index b45c4351d..07fb49394 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Explosion_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Explosion_Generated.cs @@ -1219,7 +1219,8 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ExplosionCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ExplosionSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ExplosionSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ExplosionSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ExplosionSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1785,11 +1786,15 @@ public IEnumerable EnumerateListedAssetLinks(IExplosion obj) yield break; } - public void RemapAssetLinks(IExplosion obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IExplosion obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs index bc9c47dcd..2c540b8e2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Eyes_Generated.cs @@ -493,7 +493,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => EyesCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => EyesSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => EyesSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => EyesSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => EyesSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -932,9 +933,13 @@ public IEnumerable EnumerateListedAssetLinks(IEyes obj) yield break; } - public void RemapAssetLinks(IEyes obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IEyes obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.Icon.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Flora_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Flora_Generated.cs index b30e66f28..c0816de9f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Flora_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Flora_Generated.cs @@ -991,7 +991,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => FloraCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => FloraSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => FloraSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => FloraSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => FloraSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1548,12 +1549,16 @@ public IEnumerable EnumerateListedAssetLinks(IFlora obj) yield break; } - public void RemapAssetLinks(IFlora obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IFlora obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs index 324372fab..89e3f1a46 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Furniture_Generated.cs @@ -1111,7 +1111,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => FurnitureCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => FurnitureSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => FurnitureSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => FurnitureSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => FurnitureSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1693,16 +1694,20 @@ public IEnumerable EnumerateListedAssetLinks(IFurniture obj) yield break; } - public void RemapAssetLinks(IFurniture obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IFurniture obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.ModelFilename?.Relink(mapping); } - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Grass_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Grass_Generated.cs index 71dd0eff2..0c2df766c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Grass_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Grass_Generated.cs @@ -911,7 +911,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => GrassCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => GrassSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => GrassSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => GrassSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => GrassSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1409,10 +1410,14 @@ public IEnumerable EnumerateListedAssetLinks(IGrass obj) yield break; } - public void RemapAssetLinks(IGrass obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IGrass obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Hazard_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Hazard_Generated.cs index 761be41f1..5c13acf65 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Hazard_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Hazard_Generated.cs @@ -939,7 +939,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => HazardCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => HazardSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => HazardSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => HazardSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => HazardSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1460,10 +1461,14 @@ public IEnumerable EnumerateListedAssetLinks(IHazard obj) yield break; } - public void RemapAssetLinks(IHazard obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IHazard obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs index 99782a9b4..c5e58f806 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs @@ -1017,7 +1017,8 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => HeadDataSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => HeadDataCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => HeadDataSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => HeadDataSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => HeadDataSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => HeadDataSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1449,10 +1450,14 @@ public IEnumerable EnumerateListedAssetLinks(IHeadData obj) yield break; } - public void RemapAssetLinks(IHeadData obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - obj.TintMasks.ForEach(x => x.RemapAssetLinks(mapping, query)); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IHeadData obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + obj.TintMasks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs index de8c51470..efcf46be8 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs @@ -899,7 +899,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => HeadPartCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => HeadPartSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => HeadPartSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => HeadPartSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => HeadPartSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1400,11 +1401,15 @@ public IEnumerable EnumerateListedAssetLinks(IHeadPart obj) yield break; } - public void RemapAssetLinks(IHeadPart obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Parts.ForEach(x => x.RemapAssetLinks(mapping, query)); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IHeadPart obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Parts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs index 397f00a8c..059616dbd 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleAnimation_Generated.cs @@ -821,7 +821,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IdleAnimationCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => IdleAnimationSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IdleAnimationSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => IdleAnimationSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IdleAnimationSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1277,9 +1278,13 @@ public IEnumerable EnumerateListedAssetLinks(IIdleAnimation obj) yield break; } - public void RemapAssetLinks(IIdleAnimation obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IIdleAnimation obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.Filename?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleMarker_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleMarker_Generated.cs index 0a126bb6a..eef9cbdc4 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleMarker_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/IdleMarker_Generated.cs @@ -660,7 +660,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IdleMarkerCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => IdleMarkerSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IdleMarkerSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => IdleMarkerSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IdleMarkerSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1136,10 +1137,14 @@ public IEnumerable EnumerateListedAssetLinks(IIdleMarker obj) yield break; } - public void RemapAssetLinks(IIdleMarker obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IIdleMarker obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Impact_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Impact_Generated.cs index 227b4013e..f517adfa3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Impact_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Impact_Generated.cs @@ -929,7 +929,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ImpactCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ImpactSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ImpactSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ImpactSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ImpactSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1425,10 +1426,14 @@ public IEnumerable EnumerateListedAssetLinks(IImpact obj) yield break; } - public void RemapAssetLinks(IImpact obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IImpact obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingestible_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingestible_Generated.cs index f52b4d288..58ae7f89c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingestible_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingestible_Generated.cs @@ -1239,7 +1239,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IngestibleCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => IngestibleSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IngestibleSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => IngestibleSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IngestibleSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1846,12 +1847,16 @@ public IEnumerable EnumerateListedAssetLinks(IIngestible obj) yield break; } - public void RemapAssetLinks(IIngestible obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IIngestible obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingredient_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingredient_Generated.cs index b521ae8d7..822ae8a59 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingredient_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Ingredient_Generated.cs @@ -1173,7 +1173,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => IngredientCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => IngredientSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => IngredientSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => IngredientSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => IngredientSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1780,13 +1781,17 @@ public IEnumerable EnumerateListedAssetLinks(IIngredient obj) yield break; } - public void RemapAssetLinks(IIngredient obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IIngredient obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Key_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Key_Generated.cs index a6d57608c..90c58b349 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Key_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Key_Generated.cs @@ -952,7 +952,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => KeyCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => KeySetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => KeySetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => KeySetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => KeySetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1536,13 +1537,17 @@ public IEnumerable EnumerateListedAssetLinks(IKey obj) yield break; } - public void RemapAssetLinks(IKey obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IKey obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs index 9697c10c2..9327325a2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlareSprite_Generated.cs @@ -441,7 +441,8 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LensFlareSpriteCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => LensFlareSpriteSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LensFlareSpriteSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => LensFlareSpriteSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LensFlareSpriteSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -815,7 +816,11 @@ public IEnumerable EnumerateListedAssetLinks(ILensFlareSprite obj) yield break; } - public void RemapAssetLinks(ILensFlareSprite obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ILensFlareSprite obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { if (query.HasFlag(AssetLinkQuery.Listed)) { diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs index a8fcc4610..faf2f4767 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs @@ -542,7 +542,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LensFlareCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => LensFlareSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LensFlareSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => LensFlareSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LensFlareSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -969,10 +970,14 @@ public IEnumerable EnumerateListedAssetLinks(ILensFlare obj) yield break; } - public void RemapAssetLinks(ILensFlare obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Sprites?.ForEach(x => x.RemapAssetLinks(mapping, query)); + public void RemapAssetLinks( + ILensFlare obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Sprites?.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LeveledNpc_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LeveledNpc_Generated.cs index f0994ec9f..20016b60e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LeveledNpc_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LeveledNpc_Generated.cs @@ -689,7 +689,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LeveledNpcCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => LeveledNpcSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LeveledNpcSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => LeveledNpcSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LeveledNpcSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1160,10 +1161,14 @@ public IEnumerable EnumerateListedAssetLinks(ILeveledNpc obj) yield break; } - public void RemapAssetLinks(ILeveledNpc obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + ILeveledNpc obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Light_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Light_Generated.cs index bf9fad333..f793b0432 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Light_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Light_Generated.cs @@ -1169,7 +1169,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LightCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => LightSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LightSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => LightSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LightSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1781,13 +1782,17 @@ public IEnumerable EnumerateListedAssetLinks(ILight obj) yield break; } - public void RemapAssetLinks(ILight obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + ILight obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs index fde82cf1b..d37fe719a 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LoadScreen_Generated.cs @@ -795,7 +795,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LoadScreenCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => LoadScreenSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LoadScreenSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => LoadScreenSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LoadScreenSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1278,14 +1279,18 @@ public IEnumerable EnumerateListedAssetLinks(ILoadScreen obj) yield break; } - public void RemapAssetLinks(ILoadScreen obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ILoadScreen obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.CameraPath?.Relink(mapping); } - obj.Icons?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs index dde731f6c..01bdedf16 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Lod_Generated.cs @@ -460,7 +460,8 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => LodCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => LodSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => LodSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => LodSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => LodSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -836,7 +837,11 @@ public IEnumerable EnumerateListedAssetLinks(ILod obj) yield break; } - public void RemapAssetLinks(ILod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ILod obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { if (query.HasFlag(AssetLinkQuery.Listed)) { diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MagicEffect_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MagicEffect_Generated.cs index 36e0ed109..dc7bbf1ea 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MagicEffect_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MagicEffect_Generated.cs @@ -2312,7 +2312,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MagicEffectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MagicEffectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MagicEffectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => MagicEffectSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MagicEffectSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -2974,10 +2975,14 @@ public IEnumerable EnumerateListedAssetLinks(IMagicEffect obj) yield break; } - public void RemapAssetLinks(IMagicEffect obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IMagicEffect obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MaterialObject_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MaterialObject_Generated.cs index 295577329..a7ccf5885 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MaterialObject_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MaterialObject_Generated.cs @@ -912,7 +912,8 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MaterialObjectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MaterialObjectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MaterialObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => MaterialObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MaterialObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1386,10 +1387,14 @@ public IEnumerable EnumerateListedAssetLinks(IMaterialObject obj) yield break; } - public void RemapAssetLinks(IMaterialObject obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IMaterialObject obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MiscItem_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MiscItem_Generated.cs index 45e1b6661..d895c7eb0 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MiscItem_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MiscItem_Generated.cs @@ -963,7 +963,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MiscItemCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MiscItemSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MiscItemSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => MiscItemSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MiscItemSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1551,13 +1552,17 @@ public IEnumerable EnumerateListedAssetLinks(IMiscItem obj) yield break; } - public void RemapAssetLinks(IMiscItem obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IMiscItem obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MoveableStatic_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MoveableStatic_Generated.cs index 4f87b09a5..e86d4907f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MoveableStatic_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MoveableStatic_Generated.cs @@ -665,7 +665,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MoveableStaticCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MoveableStaticSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MoveableStaticSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => MoveableStaticSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MoveableStaticSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1173,11 +1174,15 @@ public IEnumerable EnumerateListedAssetLinks(IMoveableStatic obj) yield break; } - public void RemapAssetLinks(IMoveableStatic obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IMoveableStatic obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs index bb465433e..351bfa933 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/MusicTrack_Generated.cs @@ -916,7 +916,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => MusicTrackCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => MusicTrackSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => MusicTrackSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => MusicTrackSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => MusicTrackSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1379,9 +1380,13 @@ public IEnumerable EnumerateListedAssetLinks(IMusicTrack obj) yield break; } - public void RemapAssetLinks(IMusicTrack obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IMusicTrack obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.TrackFilename?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs index 45530cb39..b561d9310 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs @@ -2857,7 +2857,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => NpcCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => NpcSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => NpcSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => NpcSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => NpcSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -3619,11 +3620,22 @@ public IEnumerable EnumerateListedAssetLinks(INpc obj) yield break; } - public void RemapAssetLinks(INpc obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public static partial IEnumerable RemapResolvedAssetLinks( + INpc obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories); + + public void RemapAssetLinks( + INpc obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + RemapResolvedAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Package_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Package_Generated.cs index 50b1474cc..fd25a459c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Package_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Package_Generated.cs @@ -1658,7 +1658,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PackageCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => PackageSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PackageSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => PackageSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PackageSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -2226,10 +2227,14 @@ public IEnumerable EnumerateListedAssetLinks(IPackage obj) yield break; } - public void RemapAssetLinks(IPackage obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IPackage obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs index 9bfdc351b..3ccc27351 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Part_Generated.cs @@ -394,7 +394,8 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PartCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => PartSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PartSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => PartSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PartSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -763,7 +764,11 @@ public IEnumerable EnumerateListedAssetLinks(IPart obj) yield break; } - public void RemapAssetLinks(IPart obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IPart obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { if (query.HasFlag(AssetLinkQuery.Listed)) { diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Perk_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Perk_Generated.cs index 25a7607f5..21b51932c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Perk_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Perk_Generated.cs @@ -995,7 +995,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PerkCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => PerkSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PerkSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => PerkSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PerkSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1519,11 +1520,15 @@ public IEnumerable EnumerateListedAssetLinks(IPerk obj) yield break; } - public void RemapAssetLinks(IPerk obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IPerk obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedNpc_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedNpc_Generated.cs index 0b6cd0d9e..680c00080 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedNpc_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedNpc_Generated.cs @@ -1663,7 +1663,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PlacedNpcCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => PlacedNpcSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PlacedNpcSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => PlacedNpcSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PlacedNpcSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -2263,10 +2264,14 @@ public IEnumerable EnumerateListedAssetLinks(IPlacedNpc obj) yield break; } - public void RemapAssetLinks(IPlacedNpc obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IPlacedNpc obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedObject_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedObject_Generated.cs index f6ce22e72..a7c463e85 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedObject_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/PlacedObject_Generated.cs @@ -3169,7 +3169,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => PlacedObjectCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => PlacedObjectSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => PlacedObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => PlacedObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => PlacedObjectSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -3926,10 +3927,14 @@ public IEnumerable EnumerateListedAssetLinks(IPlacedObject obj) yield break; } - public void RemapAssetLinks(IPlacedObject obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IPlacedObject obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs index 047375db2..63aa73cc3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Projectile_Generated.cs @@ -1590,7 +1590,8 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ProjectileCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ProjectileSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ProjectileSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ProjectileSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ProjectileSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -2201,15 +2202,19 @@ public IEnumerable EnumerateListedAssetLinks(IProjectile obj) yield break; } - public void RemapAssetLinks(IProjectile obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IProjectile obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.MuzzleFlashModel.Relink(mapping); } - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs index 80162527b..93f0b3dc5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs @@ -644,7 +644,8 @@ public enum VersioningBreaks public override void RemapLinks(IReadOnlyDictionary mapping) => QuestAdapterSetterCommon.Instance.RemapLinks(this, mapping); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => QuestAdapterCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => QuestAdapterSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => QuestAdapterSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => QuestAdapterSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => QuestAdapterSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1009,10 +1010,14 @@ public IEnumerable EnumerateListedAssetLinks(IQuestAdapter obj) yield break; } - public void RemapAssetLinks(IQuestAdapter obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Aliases.ForEach(x => x.RemapAssetLinks(mapping, query)); + public void RemapAssetLinks( + IQuestAdapter obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Aliases.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs index 947bb40c9..caf949ee0 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs @@ -543,7 +543,8 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => QuestFragmentAliasSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => QuestFragmentAliasCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => QuestFragmentAliasSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => QuestFragmentAliasSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => QuestFragmentAliasSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => QuestFragmentAliasSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -916,9 +917,13 @@ public IEnumerable EnumerateListedAssetLinks(IQuestFragmentAlias obj yield break; } - public void RemapAssetLinks(IQuestFragmentAlias obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IQuestFragmentAlias obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs index a8ed83ca0..5b8a0196e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs @@ -1407,7 +1407,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => QuestCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => QuestSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => QuestSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => QuestSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => QuestSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1967,10 +1968,21 @@ public IEnumerable EnumerateListedAssetLinks(IQuest obj) yield break; } - public void RemapAssetLinks(IQuest obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + public static partial IEnumerable RemapInferredAssetLinks( + IQuest obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories); + + public void RemapAssetLinks( + IQuest obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs index 8a3f22a7a..08287c46e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs @@ -3995,7 +3995,8 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => RaceCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => RaceSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => RaceSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => RaceSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => RaceSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -4865,13 +4866,17 @@ public IEnumerable EnumerateListedAssetLinks(IRace obj) yield break; } - public void RemapAssetLinks(IRace obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.SkeletalModel?.ForEach(x => x?.RemapAssetLinks(mapping, query)); - obj.BodyData.ForEach(x => x?.RemapAssetLinks(mapping, query)); - obj.BehaviorGraph.ForEach(x => x?.RemapAssetLinks(mapping, query)); - obj.HeadData?.ForEach(x => x?.RemapAssetLinks(mapping, query)); + public void RemapAssetLinks( + IRace obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.SkeletalModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); + obj.BodyData.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); + obj.BehaviorGraph.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); + obj.HeadData?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/RegionData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/RegionData_Generated.cs index 35e22c13c..a32636da5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/RegionData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/RegionData_Generated.cs @@ -449,7 +449,8 @@ public static implicit operator TranslationMask(bool defaultOn) public virtual void RemapLinks(IReadOnlyDictionary mapping) => RegionDataSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => RegionDataCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => RegionDataSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => RegionDataSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => RegionDataSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => RegionDataSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -819,9 +820,13 @@ public IEnumerable EnumerateListedAssetLinks(IRegionData obj) yield break; } - public void RemapAssetLinks(IRegionData obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IRegionData obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Icons?.RemapAssetLinks(mapping, query); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Region_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Region_Generated.cs index e85b8c9b4..2b26969d6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Region_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Region_Generated.cs @@ -831,7 +831,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => RegionCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => RegionSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => RegionSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => RegionSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => RegionSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1334,15 +1335,19 @@ public IEnumerable EnumerateListedAssetLinks(IRegion obj) yield break; } - public void RemapAssetLinks(IRegion obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Objects?.RemapAssetLinks(mapping, query); - obj.Weather?.RemapAssetLinks(mapping, query); - obj.Map?.RemapAssetLinks(mapping, query); - obj.Land?.RemapAssetLinks(mapping, query); - obj.Grasses?.RemapAssetLinks(mapping, query); - obj.Sounds?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IRegion obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Objects?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Weather?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Map?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Land?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Grasses?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Sounds?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Scene_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Scene_Generated.cs index 246a42ab8..4bfd18096 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Scene_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Scene_Generated.cs @@ -1092,7 +1092,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SceneCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SceneSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SceneSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => SceneSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SceneSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1589,10 +1590,14 @@ public IEnumerable EnumerateListedAssetLinks(IScene obj) yield break; } - public void RemapAssetLinks(IScene obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IScene obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Scroll_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Scroll_Generated.cs index 7bef5279c..0b97ac0e3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Scroll_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Scroll_Generated.cs @@ -1379,7 +1379,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ScrollCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ScrollSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ScrollSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ScrollSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ScrollSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1979,11 +1980,15 @@ public IEnumerable EnumerateListedAssetLinks(IScroll obj) yield break; } - public void RemapAssetLinks(IScroll obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IScroll obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs index 793d46708..993b29e6f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ShaderParticleGeometry_Generated.cs @@ -853,7 +853,8 @@ public enum DATADataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ShaderParticleGeometryCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => ShaderParticleGeometrySetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => ShaderParticleGeometrySetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ShaderParticleGeometrySetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ShaderParticleGeometrySetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1318,9 +1319,13 @@ public IEnumerable EnumerateListedAssetLinks(IShaderParticleGeometry yield break; } - public void RemapAssetLinks(IShaderParticleGeometry obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IShaderParticleGeometry obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.ParticleTexture?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoulGem_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoulGem_Generated.cs index 094b28c7d..4c8c1f617 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoulGem_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoulGem_Generated.cs @@ -1013,7 +1013,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SoulGemCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SoulGemSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SoulGemSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => SoulGemSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SoulGemSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1590,12 +1591,16 @@ public IEnumerable EnumerateListedAssetLinks(ISoulGem obj) yield break; } - public void RemapAssetLinks(ISoulGem obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + ISoulGem obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs index 73ac839cc..4b3c06ff9 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/SoundDescriptor_Generated.cs @@ -987,7 +987,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SoundDescriptorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SoundDescriptorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SoundDescriptorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => SoundDescriptorSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SoundDescriptorSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1465,9 +1466,13 @@ public IEnumerable EnumerateListedAssetLinks(ISoundDescriptor obj) yield break; } - public void RemapAssetLinks(ISoundDescriptor obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ISoundDescriptor obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); obj.SoundFiles.ForEach(x => x.Relink(mapping)); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Static_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Static_Generated.cs index 31b2bc6fe..51784e2b6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Static_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Static_Generated.cs @@ -722,7 +722,8 @@ public enum DNAMDataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => StaticCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => StaticSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => StaticSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => StaticSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => StaticSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1217,11 +1218,15 @@ public IEnumerable EnumerateListedAssetLinks(IStatic obj) yield break; } - public void RemapAssetLinks(IStatic obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Lod?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + IStatic obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Lod?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TalkingActivator_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TalkingActivator_Generated.cs index 1307b0922..bf73c13a3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TalkingActivator_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TalkingActivator_Generated.cs @@ -914,7 +914,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => TalkingActivatorCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => TalkingActivatorSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => TalkingActivatorSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => TalkingActivatorSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => TalkingActivatorSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1471,12 +1472,16 @@ public IEnumerable EnumerateListedAssetLinks(ITalkingActivator obj) yield break; } - public void RemapAssetLinks(ITalkingActivator obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + ITalkingActivator obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs index a9939ac47..d7ca5bb70 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TextureSet_Generated.cs @@ -781,7 +781,8 @@ public override string ToString() public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => TextureSetCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => TextureSetSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => TextureSetSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => TextureSetSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => TextureSetSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1289,9 +1290,13 @@ public IEnumerable EnumerateListedAssetLinks(ITextureSet obj) yield break; } - public void RemapAssetLinks(ITextureSet obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ITextureSet obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.Diffuse?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs index a733ec743..4b812b49d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/TintAssets_Generated.cs @@ -581,7 +581,8 @@ public static implicit operator TranslationMask(bool defaultOn) public void RemapLinks(IReadOnlyDictionary mapping) => TintAssetsSetterCommon.Instance.RemapLinks(this, mapping); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => TintAssetsCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => TintAssetsSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => TintAssetsSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => TintAssetsSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => TintAssetsSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -971,7 +972,11 @@ public IEnumerable EnumerateListedAssetLinks(ITintAssets obj) yield break; } - public void RemapAssetLinks(ITintAssets obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ITintAssets obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { if (query.HasFlag(AssetLinkQuery.Listed)) { diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Tree_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Tree_Generated.cs index a6ae03f9d..35434135d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Tree_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Tree_Generated.cs @@ -899,7 +899,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => TreeCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => TreeSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => TreeSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => TreeSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => TreeSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1444,11 +1445,15 @@ public IEnumerable EnumerateListedAssetLinks(ITree obj) yield break; } - public void RemapAssetLinks(ITree obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); + public void RemapAssetLinks( + ITree obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs index 52e4e3862..2a9554bd2 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Water_Generated.cs @@ -2823,7 +2823,8 @@ public enum DNAMDataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WaterCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WaterSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WaterSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WaterSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WaterSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -3554,9 +3555,13 @@ public IEnumerable EnumerateListedAssetLinks(IWater obj) yield break; } - public void RemapAssetLinks(IWater obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWater obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.NoiseLayerOneTexture?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weapon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weapon_Generated.cs index dae84ea26..92542e794 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weapon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weapon_Generated.cs @@ -1787,7 +1787,8 @@ public MajorFlag MajorFlags } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WeaponCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WeaponSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WeaponSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WeaponSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WeaponSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -2515,14 +2516,18 @@ public IEnumerable EnumerateListedAssetLinks(IWeapon obj) yield break; } - public void RemapAssetLinks(IWeapon obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWeapon obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); - obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, query); - obj.Model?.RemapAssetLinks(mapping, query); - obj.Icons?.RemapAssetLinks(mapping, query); - obj.Destructible?.RemapAssetLinks(mapping, query); - obj.ScopeModel?.RemapAssetLinks(mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.ScopeModel?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs index fb45b759f..dc2c0f163 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Weather_Generated.cs @@ -2953,7 +2953,8 @@ public enum NAM0DataType } public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WeatherCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WeatherSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WeatherSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WeatherSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WeatherSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -3646,11 +3647,15 @@ public IEnumerable EnumerateListedAssetLinks(IWeather obj) yield break; } - public void RemapAssetLinks(IWeather obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWeather obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); obj.CloudTextures.ForEach(x => x?.Relink(mapping)); - obj.Aurora?.RemapAssetLinks(mapping, query); + obj.Aurora?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs index 8b67830e5..99aeef83b 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs @@ -635,7 +635,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1436,9 +1437,13 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceBlock obj) yield break; } - public void RemapAssetLinks(IWorldspaceBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWorldspaceBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs index c3694e802..faa7b72b6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -635,7 +635,8 @@ public static implicit operator TranslationMask(bool defaultOn) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceSubBlockCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => WorldspaceSubBlockSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSubBlockSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -1421,9 +1422,13 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspaceSubBlock obj yield break; } - public void RemapAssetLinks(IWorldspaceSubBlock obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + IWorldspaceSubBlock obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs index 866beae18..eaf566429 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs @@ -1834,7 +1834,8 @@ public MajorFlag MajorFlags void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => WorldspaceCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => WorldspaceSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => WorldspaceSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -3013,10 +3014,14 @@ public IEnumerable EnumerateListedAssetLinks(IWorldspace obj) yield break; } - public void RemapAssetLinks(IWorldspace obj, IReadOnlyDictionary mapping, AssetLinkQuery query) - { - base.RemapAssetLinks(obj, mapping, query); - obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, query)); + public void RemapAssetLinks( + IWorldspace obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.MapImage?.Relink(mapping); @@ -3026,8 +3031,8 @@ public void RemapAssetLinks(IWorldspace obj, IReadOnlyDictionary? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SkyrimGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SkyrimGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SkyrimGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => SkyrimGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SkyrimGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -872,9 +873,13 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimGroup obj) yield break; } - public void RemapAssetLinks(ISkyrimGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ISkyrimGroup obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.RecordCache.RemapAssetLinks(mapping, query); + obj.RecordCache.RemapAssetLinks(mapping, queryCategories); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs index e6d393db8..9bc1f2855 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs @@ -153,7 +153,8 @@ public bool Equals(ISkyrimListGroupGetter? obj) void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SkyrimListGroupCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SkyrimListGroupSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SkyrimListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => SkyrimListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SkyrimListGroupSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -872,9 +873,13 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimListGroup obj yield break; } - public void RemapAssetLinks(ISkyrimListGroup obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ISkyrimListGroup obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.Records.ForEach(x => x.RemapAssetLinks(mapping, query)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMajorRecord_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMajorRecord_Generated.cs index 17914d9b3..64cc9960d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMajorRecord_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMajorRecord_Generated.cs @@ -488,7 +488,8 @@ public override string ToString() void IMajorRecordEnumerable.Remove(IEnumerable records, bool throwIfUnknown) => this.Remove(records, throwIfUnknown); public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SkyrimMajorRecordCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public override IEnumerable EnumerateListedAssetLinks() => SkyrimMajorRecordSetterCommon.Instance.EnumerateListedAssetLinks(this); - public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SkyrimMajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => SkyrimMajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SkyrimMajorRecordSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -1143,9 +1144,13 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimMajorRecord obj) yield break; } - public void RemapAssetLinks(ISkyrimMajorRecord obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks( + ISkyrimMajorRecord obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - base.RemapAssetLinks(obj, mapping, query); + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs index 41db49453..d5202e9a4 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs @@ -6021,7 +6021,8 @@ public uint GetRecordCount() IEnumerable> IMajorRecordSimpleContextEnumerable.EnumerateMajorRecordSimpleContexts(Type type, bool throwIfUnknown) => this.EnumerateMajorRecordContexts(linkCache: null!, type: type, throwIfUnknown: throwIfUnknown); public IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => SkyrimModCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); public IEnumerable EnumerateListedAssetLinks() => SkyrimModSetterCommon.Instance.EnumerateListedAssetLinks(this); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) => SkyrimModSetterCommon.Instance.RemapAssetLinks(this, mapping, query); + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => SkyrimModSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) => SkyrimModSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #endregion #region Binary Translation @@ -9409,67 +9410,78 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimMod obj) yield break; } - public void RemapAssetLinks(ISkyrimMod obj, IReadOnlyDictionary mapping, AssetLinkQuery query) + public static partial IEnumerable RemapInferredAssetLinks( + ISkyrimMod obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories); + + public void RemapAssetLinks( + ISkyrimMod obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) { - obj.TextureSets.RemapAssetLinks(mapping, query); - obj.HeadParts.RemapAssetLinks(mapping, query); - obj.Eyes.RemapAssetLinks(mapping, query); - obj.Races.RemapAssetLinks(mapping, query); - obj.MagicEffects.RemapAssetLinks(mapping, query); - obj.Scrolls.RemapAssetLinks(mapping, query); - obj.Activators.RemapAssetLinks(mapping, query); - obj.TalkingActivators.RemapAssetLinks(mapping, query); - obj.Armors.RemapAssetLinks(mapping, query); - obj.Books.RemapAssetLinks(mapping, query); - obj.Containers.RemapAssetLinks(mapping, query); - obj.Doors.RemapAssetLinks(mapping, query); - obj.Ingredients.RemapAssetLinks(mapping, query); - obj.Lights.RemapAssetLinks(mapping, query); - obj.MiscItems.RemapAssetLinks(mapping, query); - obj.AlchemicalApparatuses.RemapAssetLinks(mapping, query); - obj.Statics.RemapAssetLinks(mapping, query); - obj.MoveableStatics.RemapAssetLinks(mapping, query); - obj.Grasses.RemapAssetLinks(mapping, query); - obj.Trees.RemapAssetLinks(mapping, query); - obj.Florae.RemapAssetLinks(mapping, query); - obj.Furniture.RemapAssetLinks(mapping, query); - obj.Weapons.RemapAssetLinks(mapping, query); - obj.Ammunitions.RemapAssetLinks(mapping, query); - obj.Npcs.RemapAssetLinks(mapping, query); - obj.LeveledNpcs.RemapAssetLinks(mapping, query); - obj.Keys.RemapAssetLinks(mapping, query); - obj.Ingestibles.RemapAssetLinks(mapping, query); - obj.IdleMarkers.RemapAssetLinks(mapping, query); - obj.Projectiles.RemapAssetLinks(mapping, query); - obj.Hazards.RemapAssetLinks(mapping, query); - obj.SoulGems.RemapAssetLinks(mapping, query); - obj.Weathers.RemapAssetLinks(mapping, query); - obj.Climates.RemapAssetLinks(mapping, query); - obj.ShaderParticleGeometries.RemapAssetLinks(mapping, query); - obj.Regions.RemapAssetLinks(mapping, query); - obj.Cells.RemapAssetLinks(mapping, query); - obj.Worldspaces.RemapAssetLinks(mapping, query); - obj.DialogTopics.RemapAssetLinks(mapping, query); - obj.Quests.RemapAssetLinks(mapping, query); - obj.IdleAnimations.RemapAssetLinks(mapping, query); - obj.Packages.RemapAssetLinks(mapping, query); - obj.LoadScreens.RemapAssetLinks(mapping, query); - obj.AnimatedObjects.RemapAssetLinks(mapping, query); - obj.Waters.RemapAssetLinks(mapping, query); - obj.EffectShaders.RemapAssetLinks(mapping, query); - obj.Explosions.RemapAssetLinks(mapping, query); - obj.Debris.RemapAssetLinks(mapping, query); - obj.Perks.RemapAssetLinks(mapping, query); - obj.BodyParts.RemapAssetLinks(mapping, query); - obj.AddonNodes.RemapAssetLinks(mapping, query); - obj.CameraShots.RemapAssetLinks(mapping, query); - obj.Impacts.RemapAssetLinks(mapping, query); - obj.ArmorAddons.RemapAssetLinks(mapping, query); - obj.MusicTracks.RemapAssetLinks(mapping, query); - obj.Scenes.RemapAssetLinks(mapping, query); - obj.ArtObjects.RemapAssetLinks(mapping, query); - obj.MaterialObjects.RemapAssetLinks(mapping, query); - obj.SoundDescriptors.RemapAssetLinks(mapping, query); + RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + obj.TextureSets.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.HeadParts.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Eyes.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Races.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.MagicEffects.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Scrolls.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Activators.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.TalkingActivators.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Armors.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Books.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Containers.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Doors.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Ingredients.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Lights.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.MiscItems.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.AlchemicalApparatuses.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Statics.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.MoveableStatics.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Grasses.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Trees.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Florae.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Furniture.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Weapons.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Ammunitions.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Npcs.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.LeveledNpcs.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Keys.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Ingestibles.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.IdleMarkers.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Projectiles.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Hazards.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.SoulGems.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Weathers.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Climates.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.ShaderParticleGeometries.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Regions.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Cells.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Worldspaces.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.DialogTopics.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Quests.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.IdleAnimations.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Packages.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.LoadScreens.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.AnimatedObjects.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Waters.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.EffectShaders.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Explosions.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Debris.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Perks.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.BodyParts.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.AddonNodes.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.CameraShots.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Impacts.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.ArmorAddons.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.MusicTracks.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Scenes.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.ArtObjects.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.MaterialObjects.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.SoundDescriptors.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion From 2dcf526d5813c0ad5a303aacdefd8371ccf675b4 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Thu, 20 Jul 2023 23:24:19 -0500 Subject: [PATCH 087/135] Docs work --- docs/Archives.md | 11 ++++++----- docs/Environment-Construction.md | 25 +++++++++++++------------ docs/Environment.md | 9 +++++---- docs/Game-Locations.md | 13 +++++++------ docs/LinkCache.md | 11 ++++++----- docs/Load-Order.md | 25 +++++++++++++------------ docs/ModContexts.md | 11 ++++++----- docs/Previous-Override-Iteration.md | 7 ++++--- docs/Record-Lookup.md | 7 ++++--- docs/Translated-Strings.md | 13 +++++++------ docs/Winning-Overrides.md | 5 +++-- mkdocs.yml | 14 ++++++++++++++ 12 files changed, 88 insertions(+), 63 deletions(-) diff --git a/docs/Archives.md b/docs/Archives.md index be86b3faa..01de74af6 100644 --- a/docs/Archives.md +++ b/docs/Archives.md @@ -1,15 +1,16 @@ +# Archives (BSAs) Certain Bethesda files like textures, meshes, and similar assets are often stored in zipped up files with extensions like `.bsa` or `b2a`. Mutagen calls these `Archives` and offers API to read the contents from those. Writing new Archives is not something Mutagen can currently do, but is on the list of features to eventually be added. -# Reading -## Archive Reader +## Reading +### Archive Reader To start reading an Archive, you must make an Archive Reader: ```cs var reader = Archive.CreateReader(GameRelease.SkyrimSE, somePathToBSA); ``` -### File Enumeration +#### File Enumeration With an Archive Reader, you can enumerate all the files it contains: ```cs foreach (var file in reader.Files) @@ -21,7 +22,7 @@ foreach (var file in reader.Files) } ``` -### Folder Lookup +#### Folder Lookup Archive Readers can also look up specific folders: ```cs if (reader.TryGetFolder("some/sub/folder", out var archiveFolder)) @@ -32,5 +33,5 @@ if (reader.TryGetFolder("some/sub/folder", out var archiveFolder)) Folders have similar API of looping contained files as an Archive Reader -# Finding Applicable Archives +## Finding Applicable Archives (Todo) diff --git a/docs/Environment-Construction.md b/docs/Environment-Construction.md index c1c946315..9c3204cd3 100644 --- a/docs/Environment-Construction.md +++ b/docs/Environment-Construction.md @@ -1,4 +1,5 @@ -# Single Game Category Construction +# Environment Construction +## Single Game Category Construction As mentioned in the [overview section](Environment), the typical way to construct an environment if you know the game you want to target is: ```cs using (var env = GameEnvironment.Typical.Skyrim(SkyrimRelease.SkyrimSE)) @@ -7,10 +8,10 @@ using (var env = GameEnvironment.Typical.Skyrim(SkyrimRelease.SkyrimSE)) } ``` -## Synthesis Usage +### Synthesis Usage If you're coding within a [Synthesis Patcher](https://github.com/Mutagen-Modding/Synthesis), you should not make your own environment as described here. Synthesis provides its own environment-like `IPatcherState` object in its Run function. [Read More](https://github.com/Mutagen-Modding/Synthesis/wiki/Coding-a-Patcher#synthesis-state-object) -# Unknown Game Construction +## Unknown Game Construction You can construct an environment when you don't know the target game: ```cs using (var env = GameEnvironment.Typical.Construct(someGameRelease)) @@ -21,17 +22,17 @@ using (var env = GameEnvironment.Typical.Construct(someGameRelease)) But this has the downside of not knowing the type of mod it will contain at compile time. This means it will only expose `IModGetter` objects, which will be harder to interact with, depending on your goals -# Game Environment Builder +## Game Environment Builder Lets you fluently tweak the environment that will be built to be customized to your needs. -## Problem +### Problem There are a lot of times when the [Single Game Category Construction](#single-game-category-construction) game environment does not suit your needs. Consider: - Wanting to omit a mod - Wanting to add an output mod, and integrate it with the link cache To do this with the simple bootstapper, you'd have to construct your own LoadOrder/LinkCache objects using the ones it gave you, but with your desired modifications. -## Builder Pattern +### Builder Pattern Instead, you can make use of the `GameEnvironmentBuilder` system: ```cs var outgoing = new SkyrimMod(ModKey.FromFileName("MyMod.esp"), SkyrimRelease.SkyrimSE); @@ -43,23 +44,23 @@ using var env = GameEnvironment.Typical.Builder(Ga ``` It uses a fluent API that lets you mix in the modifications you want to make to the environment as it's being built. In this case the environment given to you will not include any mods that contain "SkipMe", will target a custom data folder specified, and will contain the `outgoing` mod at the end of its LinkCache. -### Transform Load Order +#### Transform Load Order This gives you an Enumerable of mods, and lets you filter some out, or mix some in at your discretion. -#### TransformLoadOrderListings +##### TransformLoadOrderListings This call gives you the listings as they appear in the load order files, before the mod objects get created. Ideally any trimming is done here, rather than after the mods have been created. Order between multiple `TransformLoadOrderListings` is respected. -#### TransformModListings +##### TransformModListings This call gives you the listings after they have been transformed by any `TransformLoadOrderListings` calls, and after mod objects have been created for each listing. As such, this call can interact with the mod objects as part of its transform logic. Order between multiple `TransformModListings` is respected, but will always come after any `TransformLoadOrderListings` calls. -### WithOutputMod +#### WithOutputMod This lets you mix in a mod that you plan on exporting content with. It will be added to the end of the LinkCache as a mutable mod that is safe to change. You can put multiple `WithOutputMod` calls in your builder chain, and the order they appear will determine how they're placed on the Load Order and which ends up being the winning override. -### WithTargetDataFolder +#### WithTargetDataFolder Allows you to customize what game folder the environment will be constructed against. Useful when dealing with [ad-hoc installations](https://github.com/Mutagen-Modding/Mutagen/wiki/Game-Locations#adhoc-installations). -### WithLoadOrder +#### WithLoadOrder This is a `TransformLoadOrderListings` style call that simply discards any existing load order and injects an explicitly provided one. Will respect the ordering alongside other `TransformLoadOrderListings` phase calls. diff --git a/docs/Environment.md b/docs/Environment.md index f8e622044..5d202cdec 100644 --- a/docs/Environment.md +++ b/docs/Environment.md @@ -1,6 +1,7 @@ +# Environment When writing a program that is going to interact with Bethesda mods, there are several things you typically want to interact with. Mutagen comes with a convenience bootstrapper object that constructs them all for a typical installation and exposes them all in one place: -# Typical Single Game Usage +## Typical Single Game Usage ```cs using (var env = GameEnvironment.Typical.Skyrim(SkyrimRelease.SkyrimSE)) { @@ -18,7 +19,7 @@ using (var env = GameEnvironment.Typical.Skyrim(SkyrimRelease.SkyrimSE)) // Environment is now disposed, so all contained objects are no longer accurate or valid ``` -# GameEnvironmentState +## GameEnvironmentState The environment object that is given to you has lots of useful contextual items: - A LoadOrder object with the current load order - ReadOnly Mod objects ready for use on the load order object, when they are found to exist @@ -27,10 +28,10 @@ The environment object that is given to you has lots of useful contextual items: - Load order file path (Plugins.txt) - Creation Club load order file path (Skyrim.ccc) -# Advanced Usage +## Advanced Usage The above example just shows the basic one line environment definition to get the typical environment. Mutagen by default will construct Game Environments relative the game installation registered by Steam, as [described here](https://github.com/Mutagen-Modding/Mutagen/wiki/Game-Locations#sources). If you have custom requirements or want to mix in output mods, etc, be sure to check out the [Environment Construction](https://github.com/Mutagen-Modding/Mutagen/wiki/Environment-Construction) documentation. -# Synthesis Usage +## Synthesis Usage If you're coding within a [Synthesis Patcher](https://github.com/Mutagen-Modding/Synthesis), you should not make your own environment as described here. Synthesis provides its own environment-like `IPatcherState` object in its Run function. [Read More](https://github.com/Mutagen-Modding/Synthesis/wiki/Coding-a-Patcher#synthesis-state-object) diff --git a/docs/Game-Locations.md b/docs/Game-Locations.md index becd88da9..2b34fdcf4 100644 --- a/docs/Game-Locations.md +++ b/docs/Game-Locations.md @@ -1,15 +1,16 @@ -# Use Environments When Possible +# Game Locations +## Use Environments When Possible Game location concepts are somewhat unnecessary to interact with, since usually the preferred entry point is via [Environments](Environment) This section will go over it anyway, as some more complex programs might want direct access to the logic. -# Game Locations +## Game Locations ## Game Folder vs Data Folder The `Game` folder is the one containing the game's exe itself. This is not where mods go, typically. The `Data` folder is usually within the `Game` folder: `%Game%/Data`. This is where mods reside, and as such is the typical folder of interest. -# Get__Folder +## Get__Folder You can query for a Game or Data folder easily: ```cs var dataFolder = GameLocations.GetDataFolder(GameRelease.SkyrimSE); @@ -21,7 +22,7 @@ if (GameLocations.TryGetDataFolder(GameRelease.SkyrimSE, out var dataFolder)) } ``` -# Sources +## Sources Currently, Mutagen locates games via a few sources: - Looks in the registry - Looks in Steam systems (via [GameFinder](https://github.com/erri120/GameFinder)) @@ -33,12 +34,12 @@ if (GameLocations.TryGetGameFolderFromRegistry(GameRelease.SkyrimSE, out var gam } ``` -# AdHoc Installations +## AdHoc Installations Note that this API will NOT locate ad-hoc game folders that exist randomly on your system. It must be registered in one of the two above listed sources in order to be located. Mutagen will not crawl the drives of your computer looking for installations. As such, installations like [Wabbajack](https://github.com/wabbajack-tools/wabbajack) might have a game folder that is "off the grid". In these situations, your tools need to offer some way for the user to define where their target data folder is, as the system will not be able to locate these unregistered folders automatically. -# GetGameFolders +## GetGameFolders There is an enumerable option to get all the Game folders from the above listed sources. Currently that will only return at max two. ```cs foreach (var location in GameLocations.GetGameFolders(GameRelease.SkyrimSE)) diff --git a/docs/LinkCache.md b/docs/LinkCache.md index 6c30110b8..176f2f8d8 100644 --- a/docs/LinkCache.md +++ b/docs/LinkCache.md @@ -1,9 +1,10 @@ +# Link Cache The LinkCache is the record lookup engine. It powers a lot of functionality, such as: - Looking up records by [FormKey/FormLink](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#resolves) - Finding the [Winning Override](Winning-Overrides) in a [Load Order](Load-Order) - [Iterating over all versions of a record](Previous-Override-Iteration) within a [Load Order](Load-Order) -# Context +## Context Every LinkCache is created from a context: - A single mod - A [Load Order](Load-Order) @@ -25,7 +26,7 @@ var linkCacheConnectedToThoseMods = anyListOfMods.ToImmutableLinkCache(); Each of the above link caches will look up and return records relative to their contexts. -# Mutability +## Mutability ## Immutable Link Caches A LinkCache will look up records from a given context. Being that this is a costly operation, it is preferable to cache information so that future lookups can happen faster. However, one of the requirements for this optimization is that the presence of records in mods cannot be modified, or the link cache will potentially return faulty information. @@ -33,7 +34,7 @@ Important Note: When using Immutable Link Caches, it is safe to modify content If you do not plan to add/remove records from the Mods, it is always recommended to use Immutable Link Caches, as they will be much more optimized. -## Mutable Link Caches +### Mutable Link Caches Sometimes it is desirable to have a mod on a Link Cache that you are allowed to modify. [Synthesis](https://github.com/Mutagen-Modding/Synthesis), for example, needs to be able to modify the outgoing Patch Mod object. In these scenarios, we can create a Mutable Link Cache. This is a combination of an Immutable Link Cache for most of the mods in a load order, PLUS a mutable component for the final mods at the end that we want to modify. As such there are a few things to consider: @@ -56,14 +57,14 @@ var npc = mod.Npcs.AddNew(); The result will be a mostly immutable Link Cache, with a mutable component at the end for `mod`. It it safe to add/remove records from `mod`, as the Link Cache will react and continue to return accurate results even after the changes. -# Memory Usage +## Memory Usage When using Immutable Link Caches, references to records will be kept inside the cache. This can lead to memory growth as records are queried. Mutable components of Link Caches do not cache records, and so will not use memory (beyond the memory used by the mutable mod itself). Since the LinkCache is just an object caching records relative to a context, you can easily release this memory by tossing your LinkCache away for the Garbage Collector to pick up once you're done with it, or want to make a new fresh cache. (Perhaps a Clear() call will be added in the future, too) -## Identifier Only Caches +### Identifier Only Caches In some situations like the [FormKey Picker](FormKey-Picker), we only care about the FormKey and EditorID of records. Caching the entire record is a waste of memory. ```cs diff --git a/docs/Load-Order.md b/docs/Load-Order.md index fb5e7777e..de14c58e9 100644 --- a/docs/Load-Order.md +++ b/docs/Load-Order.md @@ -1,11 +1,12 @@ +# Load Order A Load Order represents a set of mods in a given order, where the mods loaded later "win" and override the records from previous mods. -# Getting a Load Order +## Getting a Load Order Typically you will not construct a Load Order object yourself. Most times, using a [Game Environment](Game-Environment-Bootstrapper) is more desirable, and will have a Load Order for you to use. If you want to construct a Load Order object more manually, this will be discussed [later](#retrieving-a-load-order) in the article. -# ModListings +## ModListings A `ModListing` consists of: - A `ModKey` - Whether it's marked as enabled @@ -15,10 +16,10 @@ A `ModListing` can also be generic, such as `ModListing`. Thi - A nullable Mod object, which is present if the Mod in question exists on disk in the Data Folder -# Interacting with LoadOrder +## Interacting with LoadOrder `LoadOrder` as a container has a lot of accessors like `TryGetValue(ModKey, out T item)` or `IndexOf(ModKey)` that make it act simultaneously like a dictionary and a list. -## Priority vs Listed Ordering +### Priority vs Listed Ordering While `LoadOrder` is a "list" of `ModListing` object, two properties are exposed for when you want to enumerate to help clarify behavior: - **ListedOrder** - Enumerates items in the order they were listed - **PriorityOrder** - Enumerates the items so that highest priority comes first (reverse) @@ -31,10 +32,10 @@ foreach (var mod in loadOrder.PriorityOrder) } ``` -## Filtering Listings +### Filtering Listings -## Accessing Specific Listings +### Accessing Specific Listings `LoadOrder` has a lot accessors for checking if certain mods are on the list, and retrieving them. ```cs var modKey = ModKey.FromFilePath("Skyrim.esm"); @@ -63,8 +64,8 @@ loadOrder.Clear(); loadOrder.Add(listing); ``` -# Reading a Load Order -## Getting Listings +## Reading a Load Order +### Getting Listings If you want to load the typical load order that the game itself will use: ```csharp IEnumerable loadOrder = LoadOrder.GetListings(GameRelease.SkyrimSE, pathToDataFolder); @@ -72,7 +73,7 @@ IEnumerable loadOrder = LoadOrder.GetListings(GameRelease.Sky This gives a simple enumerable of the `ModListing` in the order they will be loaded. -## Importing Mods +### Importing Mods Usually you want more than just the list of `ModListings` in order; You want the associated mods as accessible objects to use. `LoadOrder` is just a normal object that you could declare and fill yourself, but there are a few convenience methods to do this for you: @@ -84,10 +85,10 @@ LoadOrder> loadOrder = LoadOrder.Import myListings = ...; @@ -97,7 +98,7 @@ LoadOrder.Write( myListings); ``` -# PluginListings and CreationClubListings +## PluginListings and CreationClubListings The above API abstracts away the complications that a Load Order is driven from a few sources: - Implicit Listings (Mods that don't need to be listed, but are assumed) - Normal Plugins File (Plugins.txt) diff --git a/docs/ModContexts.md b/docs/ModContexts.md index a70373b00..9e6fdfaae 100644 --- a/docs/ModContexts.md +++ b/docs/ModContexts.md @@ -1,3 +1,4 @@ +# Mod Contexts Mod Contexts are an opt-in advanced feature of most LinkCache functionality. They act as storage for contextual information and the wiring and logic needed to perform certain actions in a context aware manner. `ModContext`s contain: @@ -7,10 +8,10 @@ Mod Contexts are an opt-in advanced feature of most LinkCache functionality. Th ModContexts offer additional information as described above, but they also come with many useful features, which will be described in more detail below. -# Retrieving a ModContext +## Retrieving a ModContext ## By Looping WinningOverrides -## By LinkCache Lookups +### By LinkCache Lookups A more typical [Record Lookup](Record-Lookup) call returns the record object directly: ```cs IFormLinkGetter myFormLink = ...; @@ -35,8 +36,8 @@ if (myFormLink.TryResolveContext Note: The API call is much more verbose. More on that [here](https://github.com/Mutagen-Modding/Mutagen/wiki/ModContexts#complex-call-signature). -# Parent Concepts +## Parent Concepts -# Deep Record Insertion and Duplication +## Deep Record Insertion and Duplication -# Complex Call Signature +## Complex Call Signature diff --git a/docs/Previous-Override-Iteration.md b/docs/Previous-Override-Iteration.md index f2d1d6a73..8e6d78a42 100644 --- a/docs/Previous-Override-Iteration.md +++ b/docs/Previous-Override-Iteration.md @@ -1,8 +1,9 @@ +# Previous Override Iteration A lot of functionality like [Record Lookup](Record-Lookup) or [Winning Overrides](Winning-Overrides) deals with the "winning" version of a record, as in the record as it exists in the last Mod to override it on the Load Order. LinkCache offers an easy way to dig deeper into the load order and access the non-winning versions of records from previous mods. -# ResolveAll +## ResolveAll While you can call it on a LinkCache directly, typically the preferred way to tap into this functionality is off a [FormLink](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formlink): ```cs IFormLinkGetter npcLink = ...; @@ -17,7 +18,7 @@ foreach (INpcGetter npcRecord in npcLink.ResolveAll(myLinkCache)) With this pattern, you can loop over and interact with every override a record has from within a load order. -# ResolveAllContexts +## ResolveAllContexts If you look at the above code snippet, it's not as useful as it could be. It will print all the EditorIDs, but if anything interesting happened you would not be able to tell what mod was responsible. This is because `ResolveAll` enumerates over records directly, and records do not have knowledge of what mod contained them. They know what mod defined the record in the first place (as that's part of its FormKey), but that might not be the mod that originated the record's state being interacted with. @@ -37,7 +38,7 @@ This will now print more interesting information, as we can now tell what mod ma However, you will notice that the call is much more complex, and requires you specify a lot more details. You can read about why [here](https://github.com/Mutagen-Modding/Mutagen/wiki/ModContexts#complex-call-signature). -# Lazy Enumeration +## Lazy Enumeration This is discussed in more detail [here](Enumerable-Laziness), but it is important to only loop over what you need. This allows the Link Cache to only parse as deep into the Load Order as it needs. ```cs diff --git a/docs/Record-Lookup.md b/docs/Record-Lookup.md index 0fb86302d..8a08558cf 100644 --- a/docs/Record-Lookup.md +++ b/docs/Record-Lookup.md @@ -1,4 +1,5 @@ -# TryResolve +# Record Lookup +## TryResolve `TryResolve` is the typical call for looking up records pointed to by a FormKey. Similar to how Control-Clicking a FormID in xEdit will bring you to the record a FormID points to. It takes a LinkCache as a parameter to the call, which will inspect the content it is attached to (whether it's a load order or a single mod) and try to locate the record that matches: - The FormKey (FormID) - The type specified @@ -7,7 +8,7 @@ If found, the record returned will be from the mod latest in the load order whic For [Immutable caches](https://github.com/Mutagen-Modding/Mutagen/wiki/LinkCache#immutable-link-caches), the results will be cached, and subsequent lookups will be almost instant. -# FormLink Entry Point +## FormLink Entry Point While the LinkCache is the object doing the work, lookups are typically initiated from FormLink objects. This is because they contain the typing information (Npc/Weapon/etc) already, so the call can be quite succinct: ```cs ILinkCache myLinkCache = ...; @@ -19,7 +20,7 @@ if (myLink.TryResolve(myLinkCache, out var npc)) } ``` -# LinkCache Entry Point +## LinkCache Entry Point You can also initiate off of a LinkCache directly ```cs FormKey myFormKey = ...; diff --git a/docs/Translated-Strings.md b/docs/Translated-Strings.md index 63d040642..7c80159b0 100644 --- a/docs/Translated-Strings.md +++ b/docs/Translated-Strings.md @@ -1,6 +1,7 @@ +# Translated Strings Newer Bethesda titles come with the ability for a single string record to have multiple different translations in different languages. This is provided via the concept of extra `.strings` files, which provide an index to string mapping to alternate translations for a language. On the mod file binary side, string record contents are replaced with an index that can be used to lookup a value in the strings files for the language desired. -# TranslatedString +## TranslatedString Mutagen exposes this functionality via the `TranslatedString` class. It can be used almost as a string, with its basic get/set accessor. This will get/set the for language `TranslatedString.DefaultLanguage`, which is by default set to English. ```csharp @@ -9,7 +10,7 @@ System.Console.WriteLine($"English name: {npc.Name}"); npc.Name = "New English Name"; ``` -## Multi-Language Support +### Multi-Language Support `TranslatedString` also acts as a language dictionary in more advanced usage, allowing access to the alternate strings. ```csharp Npc npc = ...; @@ -21,12 +22,12 @@ if (npc.Name.TryLookup(Language.French, out var frenchString)) npc.Name.Set(Language.French, "Lutin"); ``` -## Data Loading Patterns +### Data Loading Patterns `TranslatedString` queries and loads data in a lazy fashion. Strings files for any given language will not be loaded until they are asked for. Loose strings file located for per language will be used if present, otherwise BSAs will be searched for the applicable strings language file. All operations are threadsafe for `TranslatedString`. -# Internals +## Internals ## StringsLookupOverlay This class lightly wraps the data from a single strings file, indexing the available string keys but doing no parsing on the strings themselves. The raw string byte data is cached internally for easy random access. Strings are parsed from the raw data on lookup, and the results not cached. All operations on `StringsLookupOverlay` are threadsafe. @@ -39,7 +40,7 @@ if (stringsOverlay.TryLookup(key, out var containedString)) } ``` -## StringsFolderLookupOverlay +### StringsFolderLookupOverlay This class overlays on top an entire data folder, allowing lazy access to all strings files within, both loose and inside BSA files. Internal StringLookupOverlays will be created and cached when required to serve a query. Loose strings files for a query will have priority, followed by the first applicable strings files found in the BSAs. All operations on `StringsFolderLookupOverlay` are threadsafe. ```csharp @@ -55,7 +56,7 @@ if (stringsFolderOverlay.TryLookup(source, language, modKey, key, out var contai } ``` -## StringsWriter +### StringsWriter A class for exporting strings of various languages into the appropriate strings files. This currently only supports export into Loose Files, not into a packed BSA. A `StringsWriter` can be loaded with strings, and then exports to disk when disposed. ```csharp ModKey modKey = ...; diff --git a/docs/Winning-Overrides.md b/docs/Winning-Overrides.md index 02e3c521a..c22231973 100644 --- a/docs/Winning-Overrides.md +++ b/docs/Winning-Overrides.md @@ -1,4 +1,5 @@ -# Winning Overrides +# Winning Override Iteration +## Winning Overrides It is very common task to retrieve the "winning override" version of each record. These are the versions of each record as they exist in the mod with the highest priority, and will thus be what's used by the game when running. There are extension methods to streamline this: @@ -13,7 +14,7 @@ foreach (var npc in loadOrder.PriorityOrder.Npc().WinningOverrides()) If you then want to take winning overrides and add them to your mod with some modifications, this topic is covered more in depth [here](https://github.com/Mutagen-Modding/Mutagen/wiki/Create,-Duplicate,-and-Override#getoraddasoverride). -# Winning Context Overrides +## Winning Context Overrides The above loop will just give you each record in the game with it's "winning" content. Sometimes more information is needed, though. You can instead opt to iterate over [ModContexts](https://github.com/Mutagen-Modding/Mutagen/wiki/ModContexts) which is a wrapper object containing the record of interest PLUS other useful information and features. diff --git a/mkdocs.yml b/mkdocs.yml index e3a1dcf92..7a8caf9a3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -64,5 +64,19 @@ nav: - Abstract Subclassing: Abstract-Subclassing.md - Printing: Printing.md - Typical Mod Construction and Importing: Typical-Mod-Construction-and-Importing.md + - Environment: Environment.md + - Environment Construction: Environment-Construction.md + - Game Locations: Game-Locations.md + - Link Cache: LinkCache.md + - Record Lookup: Record-Lookup.md + - Mod Contexts: ModContexts.md + - Previous Override Iteration: Previous-Override-Iteration.md + - Load Order: Load-Order.md + - Winning Override Iteration: Winning-Overrides.md + - Has Mod Assertions + - Live File Monitoring + - Archives (BSAs): Archives.md + - Strings + - Translated Strings: Translated-Strings.md index: Pages/index.md \ No newline at end of file From f10050286a5c3b74e7126e0bbb5048412ed55749 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Jul 2023 02:45:01 -0500 Subject: [PATCH 088/135] More AssetLink remap work --- .../Placeholders/TestMajorRecord.cs | 7 ++++++- .../Records/Fallout4Group_Generated.cs | 2 +- .../Records/Fallout4ListGroup_Generated.cs | 2 +- .../Records/Major Records/CellBlock_Generated.cs | 2 +- .../Records/Major Records/CellSubBlock_Generated.cs | 2 +- .../Records/Major Records/Cell_Generated.cs | 4 ++-- .../Records/Major Records/WorldspaceBlock_Generated.cs | 2 +- .../Major Records/WorldspaceSubBlock_Generated.cs | 2 +- .../Records/Major Records/Worldspace_Generated.cs | 2 +- .../Modules/Plugin/ContainedAssetLinksModule.cs | 10 +++++----- .../Records/Major Records/CellBlock_Generated.cs | 2 +- .../Records/Major Records/CellSubBlock_Generated.cs | 2 +- .../Records/Major Records/Cell_Generated.cs | 6 +++--- .../Records/Major Records/WorldspaceBlock_Generated.cs | 2 +- .../Major Records/WorldspaceSubBlock_Generated.cs | 2 +- .../Records/Major Records/Worldspace_Generated.cs | 2 +- .../Records/OblivionGroup_Generated.cs | 2 +- .../Records/OblivionListGroup_Generated.cs | 2 +- .../AVirtualMachineAdapter_Generated.cs | 2 +- .../Common Subrecords/Destructible_Generated.cs | 2 +- .../Records/Common Subrecords/ScriptEntry_Generated.cs | 2 +- .../Records/Major Records/ArmorAddon.cs | 2 ++ .../Records/Major Records/ArmorAddon_Generated.cs | 6 +++--- .../Records/Major Records/Armor_Generated.cs | 2 +- .../Records/Major Records/Book_Generated.cs | 2 +- .../Records/Major Records/CellBlock_Generated.cs | 2 +- .../Records/Major Records/CellSubBlock_Generated.cs | 2 +- .../Records/Major Records/Cell_Generated.cs | 4 ++-- .../Records/Major Records/Debris_Generated.cs | 2 +- .../Records/Major Records/DialogTopic_Generated.cs | 4 ++-- .../Records/Major Records/HeadData_Generated.cs | 2 +- .../Records/Major Records/HeadPart_Generated.cs | 2 +- .../Records/Major Records/LensFlare_Generated.cs | 2 +- .../Records/Major Records/Npc_Generated.cs | 2 +- .../Records/Major Records/QuestAdapter_Generated.cs | 2 +- .../Major Records/QuestFragmentAlias_Generated.cs | 2 +- .../Records/Major Records/Quest_Generated.cs | 2 +- .../Records/Major Records/Race_Generated.cs | 8 ++++---- .../Records/Major Records/WorldspaceBlock_Generated.cs | 2 +- .../Major Records/WorldspaceSubBlock_Generated.cs | 2 +- .../Records/Major Records/Worldspace_Generated.cs | 2 +- .../Records/SkyrimGroup_Generated.cs | 2 +- .../Records/SkyrimListGroup_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs | 2 +- 44 files changed, 64 insertions(+), 57 deletions(-) diff --git a/Mutagen.Bethesda.Core.UnitTests/Placeholders/TestMajorRecord.cs b/Mutagen.Bethesda.Core.UnitTests/Placeholders/TestMajorRecord.cs index 99a1925ac..659d3ab74 100644 --- a/Mutagen.Bethesda.Core.UnitTests/Placeholders/TestMajorRecord.cs +++ b/Mutagen.Bethesda.Core.UnitTests/Placeholders/TestMajorRecord.cs @@ -164,7 +164,12 @@ IEnumerable IMajorRecordGetterEnumerable.EnumerateMajorRecor public Type Type => throw new NotImplementedException(); - public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query) + public void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery query, IAssetLinkCache? linkCache) + { + throw new NotImplementedException(); + } + + public void RemapListedAssetLinks(IReadOnlyDictionary mapping) { throw new NotImplementedException(); } diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs index ba11b411f..b80df6ad5 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4Group_Generated.cs @@ -879,7 +879,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.RecordCache.RemapAssetLinks(mapping, queryCategories); + obj.RecordCache.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs index 06006cfd9..65ac2bbdd 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Fallout4ListGroup_Generated.cs @@ -879,7 +879,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs index f3d82c23e..43be2eba6 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellBlock_Generated.cs @@ -1420,7 +1420,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs index 1bf4ff976..1cf8ffe64 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/CellSubBlock_Generated.cs @@ -1405,7 +1405,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs index 098900a96..36b1b7507 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Cell_Generated.cs @@ -3621,8 +3621,8 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); - obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs index 626e00444..bd622a3a8 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceBlock_Generated.cs @@ -1457,7 +1457,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs index 9e8d4917d..2224d3f71 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -1442,7 +1442,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs index 39bcb7dbf..c8be8d8b0 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Worldspace_Generated.cs @@ -3078,7 +3078,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); obj.TopCell?.RemapAssetLinks(mapping, queryCategories, linkCache); } diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs index 2e55bff74..cb68e323a 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs @@ -365,7 +365,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin if (obj.GetObjectData().HasInferredAssets) { using (var f = fg.Function( - $"public static partial IEnumerable<{nameof(IAssetLinkGetter)}> RemapInferredAssetLinks", + $"private static partial IEnumerable<{nameof(IAssetLinkGetter)}> RemapInferredAssetLinks", semiColon: true)) { f.Add($"{obj.Interface(getter: false)} obj"); @@ -379,7 +379,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin if (obj.GetObjectData().HasResolvedAssets) { using (var f = fg.Function( - $"public static partial IEnumerable<{nameof(IAssetLinkGetter)}> RemapResolvedAssetLinks", + $"private static partial IEnumerable<{nameof(IAssetLinkGetter)}> RemapResolvedAssetLinks", semiColon: true)) { f.Add($"{obj.Interface(getter: false)} obj"); @@ -432,7 +432,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin && await HasLinks(contLoqui, includeBaseClass: true) != Case.No)) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.ForEach(x => x{contLoqui.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories));"); + $"obj.{field.Name}{field.NullChar}.ForEach(x => x{contLoqui.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories, linkCache));"); } else if (cont.SubTypeGeneration is AssetLinkType subAsset) { @@ -447,12 +447,12 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin && await HasLinks(dictLoqui, includeBaseClass: true) != Case.No) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories);"); + $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories, linkCache);"); } else if (dict.ValueTypeGen is FormLinkType formIDType) { fg.AppendLine( - $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories);"); + $"obj.{field.Name}{field.NullChar}.{nameof(IAssetLinkContainer.RemapAssetLinks)}(mapping, queryCategories, linkCache);"); } } } diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs index 20e573d99..a710e91a1 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellBlock_Generated.cs @@ -1302,7 +1302,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs index b978e8e9e..54e62c498 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/CellSubBlock_Generated.cs @@ -1294,7 +1294,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs index a522b881d..fd062dc7a 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Cell_Generated.cs @@ -2368,9 +2368,9 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); - obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); - obj.VisibleWhenDistant.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.VisibleWhenDistant.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs index 1683d5110..7a4543ce7 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceBlock_Generated.cs @@ -1339,7 +1339,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs index d9f2fd4aa..b45192c92 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -1331,7 +1331,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs index b40f6b091..e5d701e25 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Worldspace_Generated.cs @@ -1985,7 +1985,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); obj.TopCell?.RemapAssetLinks(mapping, queryCategories, linkCache); } diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs index 2f7adf52e..9fe50e6b5 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionGroup_Generated.cs @@ -872,7 +872,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.RecordCache.RemapAssetLinks(mapping, queryCategories); + obj.RecordCache.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs index f7e2c0993..61ac7c7a3 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionListGroup_Generated.cs @@ -872,7 +872,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs index 239778bbb..2a099aa51 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/AVirtualMachineAdapter_Generated.cs @@ -868,7 +868,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs index ae86c22c2..5cb0a98ca 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/Destructible_Generated.cs @@ -868,7 +868,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Stages.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Stages.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs index a09e86812..57bdbb72d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs @@ -880,7 +880,7 @@ public IEnumerable EnumerateListedAssetLinks(IScriptEntry obj) yield break; } - public static partial IEnumerable RemapInferredAssetLinks( + static partial IEnumerable RemapInferredAssetLinks( IScriptEntry obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs index ad35022e6..fa8dc16f6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs @@ -69,6 +69,8 @@ public void Print(StructuredStringBuilder fg, string? name = null) partial class ArmorAddonCommon { + + public static partial IEnumerable GetInferredAssetLinks(IArmorAddonGetter obj, Type? assetType) { if (assetType != null && assetType != typeof(SkyrimModelAssetType)) yield break; diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs index 9053773bd..9ffcc935b 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs @@ -1567,7 +1567,7 @@ public IEnumerable EnumerateListedAssetLinks(IArmorAddon obj) yield break; } - public static partial IEnumerable RemapInferredAssetLinks( + static partial IEnumerable RemapInferredAssetLinks( IArmorAddon obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, @@ -1581,8 +1581,8 @@ public void RemapAssetLinks( { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); - obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); - obj.FirstPersonModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); + obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.FirstPersonModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs index e4418de42..eae810f52 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Armor_Generated.cs @@ -2107,7 +2107,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); + obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs index 2a49a226a..a7aea650d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs @@ -1826,7 +1826,7 @@ public IEnumerable EnumerateListedAssetLinks(IBook obj) yield break; } - public static partial IEnumerable RemapInferredAssetLinks( + static partial IEnumerable RemapInferredAssetLinks( IBook obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs index 67c7d46d2..afef289a8 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellBlock_Generated.cs @@ -1406,7 +1406,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.SubBlocks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs index fa9d69fb5..6d9b796ad 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/CellSubBlock_Generated.cs @@ -1391,7 +1391,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Cells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs index fa2f4b9d1..80e9d76ed 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Cell_Generated.cs @@ -3091,8 +3091,8 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); - obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Persistent.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.Temporary.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs index f9bae9ebf..7f56a3bd0 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Debris_Generated.cs @@ -893,7 +893,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.Models.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Models.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs index e193f4072..fffa082ce 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs @@ -1675,7 +1675,7 @@ public IEnumerable EnumerateListedAssetLinks(IDialogTopic obj) yield break; } - public static partial IEnumerable RemapResolvedAssetLinks( + static partial IEnumerable RemapResolvedAssetLinks( IDialogTopic obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, @@ -1689,7 +1689,7 @@ public void RemapAssetLinks( { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); RemapResolvedAssetLinks(obj, mapping, linkCache, queryCategories); - obj.Responses.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Responses.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs index c5e58f806..dc3f4678f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadData_Generated.cs @@ -1456,7 +1456,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.TintMasks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.TintMasks.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs index efcf46be8..b933e3a34 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/HeadPart_Generated.cs @@ -1408,7 +1408,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.Parts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Parts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs index faf2f4767..58d2fdc4d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/LensFlare_Generated.cs @@ -977,7 +977,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.Sprites?.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Sprites?.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs index b561d9310..06edf4758 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs @@ -3620,7 +3620,7 @@ public IEnumerable EnumerateListedAssetLinks(INpc obj) yield break; } - public static partial IEnumerable RemapResolvedAssetLinks( + static partial IEnumerable RemapResolvedAssetLinks( INpc obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs index 93f0b3dc5..0ee6f8833 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestAdapter_Generated.cs @@ -1017,7 +1017,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.Aliases.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Aliases.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs index caf949ee0..3b8e661f8 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/QuestFragmentAlias_Generated.cs @@ -923,7 +923,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Scripts.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs index 5b8a0196e..1f99fe574 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs @@ -1968,7 +1968,7 @@ public IEnumerable EnumerateListedAssetLinks(IQuest obj) yield break; } - public static partial IEnumerable RemapInferredAssetLinks( + static partial IEnumerable RemapInferredAssetLinks( IQuest obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs index 08287c46e..6f893431e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Race_Generated.cs @@ -4873,10 +4873,10 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.SkeletalModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); - obj.BodyData.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); - obj.BehaviorGraph.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); - obj.HeadData?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories)); + obj.SkeletalModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.BodyData.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.BehaviorGraph.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.HeadData?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs index 99aeef83b..af58e335a 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceBlock_Generated.cs @@ -1443,7 +1443,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs index faa7b72b6..c063a6e01 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/WorldspaceSubBlock_Generated.cs @@ -1428,7 +1428,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Items.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs index eaf566429..dd8f7188d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Worldspace_Generated.cs @@ -3021,7 +3021,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.SubCells.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); if (query.HasFlag(AssetLinkQuery.Listed)) { obj.MapImage?.Relink(mapping); diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimGroup_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimGroup_Generated.cs index 115c323a7..49220de22 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimGroup_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimGroup_Generated.cs @@ -879,7 +879,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.RecordCache.RemapAssetLinks(mapping, queryCategories); + obj.RecordCache.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs index 9bc1f2855..fcf6b98f7 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimListGroup_Generated.cs @@ -879,7 +879,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories)); + obj.Records.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs index d5202e9a4..008bb4dbd 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs @@ -9410,7 +9410,7 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimMod obj) yield break; } - public static partial IEnumerable RemapInferredAssetLinks( + static partial IEnumerable RemapInferredAssetLinks( ISkyrimMod obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, From 0a78be4c627da73c76d76714df1f2801c2bd6d1c Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Jul 2023 02:45:13 -0500 Subject: [PATCH 089/135] Docs work --- ...rmLinks-Always-Target-Getter-Interfaces.md | 7 +++-- docs/FormLinks-vs-EditorID-as-Identifiers.md | 31 ++++++++++--------- docs/Low-Level-Examples.md | 3 +- docs/Namespaces.md | 15 ++++----- ...Nullability-to-Indicate-Record-Presence.md | 15 ++++----- docs/Print-Some-Content.md | 8 +---- mkdocs.yml | 17 ++++++++++ 7 files changed, 56 insertions(+), 40 deletions(-) diff --git a/docs/FormLinks-Always-Target-Getter-Interfaces.md b/docs/FormLinks-Always-Target-Getter-Interfaces.md index 4d23a6af6..9342c035d 100644 --- a/docs/FormLinks-Always-Target-Getter-Interfaces.md +++ b/docs/FormLinks-Always-Target-Getter-Interfaces.md @@ -1,10 +1,11 @@ -# Complication +# FormLinks Always Target Getter Interfaces +## Complication `FormLinks` are `FormKeys` with typing information mixed in as to which record type they should associate with. As such, they require you specify the typing you want to target. Assuming you just wanted to target Npcs, there are still a few options: - `Npc` -> The direct class - `INpc` -> The setter interface - `INpcGetter` -> The readonly interface -# Best Practice +## Best Practice The correct usage (99% of the time) is to always use the `INpcGetter` readonly interface. `IFormLinkGetter` @@ -15,7 +16,7 @@ Or more rarely The above still has the generic targeting the getter interface `INpcGetter`, which is the important part -# Why +## Why Consider a [LinkCache resolve](https://github.com/Mutagen-Modding/Mutagen/wiki/Record-Lookup). A FormLink and a LinkCache are combined to look up a record with a specific FormKey and Type. diff --git a/docs/FormLinks-vs-EditorID-as-Identifiers.md b/docs/FormLinks-vs-EditorID-as-Identifiers.md index 6b97f2aa1..42b022899 100644 --- a/docs/FormLinks-vs-EditorID-as-Identifiers.md +++ b/docs/FormLinks-vs-EditorID-as-Identifiers.md @@ -1,4 +1,5 @@ -# EditorID vs FormLink +# FormLinks vs EditorID as Identifiers +## EditorID vs FormLink When choosing how you want to look up records, or store lists of record identifiers, there's the common choice between EditorIDs and FormLinks. For example, let's say you want to look up Skyrim's `ArmorImperialCuriass` `0136D5:Skyrim.esm`. @@ -33,16 +34,16 @@ armors.Add(Skyrim.Armor.ArmorImperialCuirass); What are the reasons for choosing one over the other? **Generally FormLinks are the recommended route.** This article will go over the differences and reasons why. -# EditorID Upsides -## Readability and FormLink Mapping -### EditorIDs are More Readable +## EditorID Upsides +### Readability and FormLink Mapping +#### EditorIDs are More Readable We're going to start out with the one upside that EditorIDs have: readability. `ArmorImperialCuriass` is much more human readable and understandable compared to `0136D5:Skyrim.esm`. Generally, this is the reason people initially gravitate towards EditorIDs, as lots of other tooling uses EditorIDs as they are more human friendly. -### FormLink Mapping Brings Readability to FormLink-Based Systems +#### FormLink Mapping Brings Readability to FormLink-Based Systems Work has been done to mitigate this readability downside of FormLinks. [FormLink Mapping](https://github.com/Mutagen-Modding/Mutagen/wiki/Reference-FormLinks-By-EditorID) is a system where you can point to a mod and generate mappings so that you can reference and use FormLinks by their EditorID name. This allows for the best of both worlds, where the code is human readable by writing EditorIDs, while still using FormLinks under the hood for the code to use. These systems mostly nullify the readability problem that FormKeys have. @@ -52,9 +53,9 @@ This allows for the best of both worlds, where the code is human readable by wri IFormLinkGetter myFormLink = Skyrim.Armor.ArmorImperialCuriass; ``` -# EditorID Downsides +## EditorID Downsides As far as code is concerned, it is much more preferable to deal with FormLinks. Here are some reasons EditorIDs can cause some problems. -## Overriding Mods Can Ruin Lookups +### Overriding Mods Can Ruin Lookups Let's say you're looking for the Armor in question `ArmorImperialCuirass`. You can look it up by EditorID: ```cs // Looking up to find a winning Armor override with EditorID @@ -80,7 +81,7 @@ myFormLinkSet.Contains(potentialMatchingArmorRecord); ``` These will consistently connect with the record you're looking for no matter what mods have done to them. -## Type Info Is Lost, Potentially Losing Speed +### Type Info Is Lost, Potentially Losing Speed Mutagen gets a lot of its speed by short circuiting work that is unnecessary. One of the ways it does this is by making use of the Type of record involved. For example, if you tell the LinkCache it is an Armor you're looking for, then it can skip parsing 99% of `Skyrim.esm`. EditorIDs are just strings, and so have no type information. So when looking up a record via EditorID, you ideally want to specify the type involved: @@ -98,7 +99,7 @@ FormLinks have type info built into their structure. They are an ID + a Type. var foundArmorRecord = Skyrim.Armor.ArmorImperialCuirass.Resolve(linkCache); ``` -## Requires Decompression, Losing Speed +### Requires Decompression, Losing Speed This is due to a gritty implementation detail of how records are stored on disk. A record's header is never compressed, while all the contents can be. An EditorID is content that gets compressed. FormIDs are always in the same known location in the record header and never compressed. So, when looking up records, a FormLink can simply look at a record to see if its a match at near instant speed. @@ -107,14 +108,14 @@ EditorID lookups, on the other hand, require the entire record's contents to be So, by using EditorIDs as your lookup identifier, you're implicitly losing a good deal of speed by requiring the systems to do a bunch of potentially unnecessary work parsing a record you're not even interested in. -## Some Records Cannot Be Looked Up +### Some Records Cannot Be Looked Up EditorIDs are not actually required. Most of the common records people are interested in have them, but there are plenty of records that do not. This is more applicable for set building. If you're compiling a `HashSet` of EditorIDs of all records that satisfy XYZ, then some records might not be able to be put into the set. FormIDs are fundamental required data for a record to exist, and so are ensured to always be viable. -## Specialized UI Input Systems +### Specialized UI Input Systems The Mutagen ecosystem comes with specialized UI record pickers: ![FormKey Picker](https://i.imgur.com/gtlg5Md.gif) @@ -125,8 +126,8 @@ The system is not currently set up to bind to EditorIDs in the code backend. As Theoretically the work could be done to expose it in a similar UI, but it has not been done because EditorIDs are generally less preferable to use for all the other reasons mentioned. -## Typos -### You Can Make Typos +### Typos +#### You Can Make Typos EditorIDs are just raw strings, and so are vulnerable to typos: ```cs // Will never resolve, as we've misspelled Imperial @@ -141,8 +142,8 @@ As a bonus, the IDE intellisense can suggest EditorIDs for you and autocomplete: ![](https://i.imgur.com/fH7YSEa.gif) -### Your Users Can Make Typos +#### Your Users Can Make Typos Users will also have to deal with typos. With EditorID based input, you're typically going to be exposing these via a list of strings on a UI or in a json file. As they type in their desired records, they will be very vulnerable to making typos. It's highly likely they don't realize and might complain to you the developer that your program is broken. -# String Comparisons Are Slower than Int Comparisons +## String Comparisons Are Slower than Int Comparisons I put this last, as it's a factor, but is minor compared to the other issues. Comparing a long string of an EditorID like "ArmorImprialCuirass" is slower than comparing FormLinks which use integers for comparison. As such, there will be a slight speed penalty. Nothing to worry about too much, but just another small negative to add to the pile. diff --git a/docs/Low-Level-Examples.md b/docs/Low-Level-Examples.md index 98bccf23d..861da03fe 100644 --- a/docs/Low-Level-Examples.md +++ b/docs/Low-Level-Examples.md @@ -1,4 +1,5 @@ -# Record Navigation Using Header Structs +# Low Level Examples +## Record Navigation Using Header Structs The following code will open a _simple_ mod file from disk, and print all EditorIDs. ```cs diff --git a/docs/Namespaces.md b/docs/Namespaces.md index d4ce4cd2e..909f55f07 100644 --- a/docs/Namespaces.md +++ b/docs/Namespaces.md @@ -1,4 +1,5 @@ -# What Are Namespaces +# Namespaces +## What Are Namespaces Namespaces are "sections" of code that you can opt to import so that you have access to. They help organize things and prevent naming collisions. They typically might look like: @@ -10,15 +11,15 @@ using Mutagen.Bethesda.Skyrim; var skyrimMod = new SkyrimMod("Skyrim.esm", SkyrimRelease.SkyrimSE); ``` -# Namespaces, Intellisense, and Compiling +## Namespaces, Intellisense, and Compiling By default, Visual Studio will only show autocomplete for the concepts that exist within the namespaces you have imported. If you have an empty file and start typing `SkyrimMod`, it will not autocomplete. If you type the whole thing out manually, it'll be underlined red saying it does not know what it is. This is because the namespace is not imported, and so it's not showing you SkyrimMod as an option to use. -## Adding a Namespace +### Adding a Namespace Often you want to add a namespace so that the compiler knows about it, and Intellisense shows it in autocomplete. -### Add the Namespace Import Yourself +#### Add the Namespace Import Yourself You can write it out yourself by adding it to the top of your file: ```cs using Mutagen.Bethesda.Skyrim; @@ -28,14 +29,14 @@ var skyrimMod = new SkyrimMod("Skyrim.esm", SkyrimRelease.SkyrimSE); This has the downside that you need to know what the namespace that you're interested in is -### Let the IDE add the Namespace +#### Let the IDE add the Namespace Alternatively, if you know the thing you would like to use, you can write it out, and have the IDE find out what namespace needs to be imported for you. For example, you could type out `SkyrimMod`, and when it highlights red, do the Visual Studio keybind for suggest fixes (Ctrl + .) and it will suggest adding `Mutagen.Bethesda.Skyrim` to your namespaces. Select that option, and the IDE will go ahead and do that. This still has the downside that you need to know what type you are interested in using and type it out by hand. In our case that was `SkyrimMod`. This is vulnerable to typos where the IDE wont be able to locate the namespace if it's misspelled, etc. -## Show Types From Other Namespaces in Intellisense +### Show Types From Other Namespaces in Intellisense The final option is to allow Intellisense to show in its autocomplete ALL types that exist, not just the ones from namespaces you have imported. This is often super nice, as you can then just start typing in `SkyrimMod` and it will show it as an autocomplete option. If you choose to autocomplete it, it will automatically add the necessary namespace, too. This is by far the easiest usability, but of course comes with the downside of having a more "clogged" Intellisense since it is always showing all the types in existence. Usually, though, this is not too much of a problem, as the IDE is able to narrow things down and suggest items pretty intelligently. @@ -48,7 +49,7 @@ To turn this on, you need to go into your `Visual Studio` options: `Rider` has this functionality on by default. -# Namespaces Help With Collisions +## Namespaces Help With Collisions In addition to "scoping" Intellisense as mentioned above, namespaces also help when you have a legitimate name collision. Let's say you're using two libraries that both defined `MyClass`, and you want to use both of them in the same code snippet. How do you do this? ``` var classA = new SomeLibrary.MyClass(); diff --git a/docs/Nullability-to-Indicate-Record-Presence.md b/docs/Nullability-to-Indicate-Record-Presence.md index ecf4eeee8..df49b0292 100644 --- a/docs/Nullability-to-Indicate-Record-Presence.md +++ b/docs/Nullability-to-Indicate-Record-Presence.md @@ -1,4 +1,5 @@ -# Most Subrecords are Optional +# Nullability to Indicate Record Presence +## Most Subrecords are Optional Most Bethesda subrecords are optional; They can be set to a value, or not exist at all. Mutagen uses a field's nullability to indicate which fields/subrecords are optional. This leverages one of C#'s newer concepts of [Nullable References](https://docs.microsoft.com/en-us/dotnet/csharp/nullable-references). **TLDR: Fields can be marked as to whether they are allowed to be null or not**: @@ -13,15 +14,15 @@ Going off the earlier `Potion` interface: - FormKey cannot be null, and must always have a value. - EditorID, Name, Model, Icon are all optional, and will be null if they are not set. -## Dealing with Nullable Fields +### Dealing with Nullable Fields In recent C#, the compiler will error out if you're trying to access or use a value that might be null without ensuring it is not null first. When a field is nullable, you will want to adjust your code to deal with the potential that it might not exist. -### Don't Check Unless Needed +#### Don't Check Unless Needed Not all fields are nullable. If a field's type does not end with a `?` then it cannot be null and thus does not need to be checked. Checking if a non-nullable field is null is unnecessary, and actually confuses the compiler in certain circumstances. Typically the compiler will let you know when something hasn't been checked by giving you an error. You can usually wait until it complains before worrying about writing null checks. -### Skipping if null +#### Skipping if null If you're within a foreach loop you can opt to skip the record if the field you're interested in is null: ```cs IObjectEffect objectEffect = ...; @@ -31,7 +32,7 @@ foreach (var effect in objectEffect.Effects) Console.WriteLine($"Magnitude was: {effect.Data.Magnitude}"); } ``` -### Using a fallback value if null +#### Using a fallback value if null You can also use [Null Conditional Operators](https://www.dotnetperls.com/null-coalescing) to help specify "fallback" values if a field is null ```cs IObjectEffect objectEffect = ...; @@ -42,7 +43,7 @@ foreach (var effect in objectEffect.Effects) Console.WriteLine($"Magnitude was: {magnitude}"); } ``` -### Setting the null field to have a value +#### Setting the null field to have a value Sometimes when you're creating a record, you might need to create the subclasses yourself on the nullable fields so that you can fill them. ```cs IObjectEffect objectEffect = ...; @@ -56,5 +57,5 @@ foreach (var effect in objectEffect.Effects) } ``` -### Other +#### Other There are many other ways to deal with the potential of null values besides the examples given, depending on the circumstances and goals. diff --git a/docs/Print-Some-Content.md b/docs/Print-Some-Content.md index 2dc834725..04ad9f201 100644 --- a/docs/Print-Some-Content.md +++ b/docs/Print-Some-Content.md @@ -1,10 +1,4 @@ - - - - - - - +# Print Some Content This is the quintessential "Hello World" program in Mutagen flavor. Its goal is to load up a mod, and print the names of all the NPCs. diff --git a/mkdocs.yml b/mkdocs.yml index 7a8caf9a3..879413409 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -78,5 +78,22 @@ nav: - Archives (BSAs): Archives.md - Strings - Translated Strings: Translated-Strings.md + - Strings Overlays + - Examples + - Print Some Content: Print-Some-Content.md + - Accessing Known Records + - Record Overrides and Duplication + - Low Level Examples: Low-Level-Examples.md + - Getting Familiar with C# + - Namespaces: Namespaces.md + - Intellisense + - Nullability to Indicate Record Presence: Nullability-to-Indicate-Record-Presence.md + - Inspect Class Definitions + - Debugging + - Best Practices and Optimizations + - Getters Everywhere + - FormLinks Always Target Getter Interfaces: FormLinks-Always-Target-Getter-Interfaces.md + - FormLinks vs EditorID as Identifiers: FormLinks-vs-EditorID-as-Identifiers.md + - FormLinks vs FormID/FormKey as Identifiers index: Pages/index.md \ No newline at end of file From 88bc3bbd71da464aaa87b220c0ae3da92fa87df9 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Jul 2023 02:56:06 -0500 Subject: [PATCH 090/135] Implemented asset link partials with exceptions --- .../Records/Common Subrecords/ScriptEntry.cs | 12 ++++++++++++ .../Common Subrecords/ScriptEntry_Generated.cs | 2 +- .../Records/Major Records/ArmorAddon.cs | 14 ++++++++++++-- .../Records/Major Records/ArmorAddon_Generated.cs | 2 +- .../Records/Major Records/Book.cs | 12 ++++++++++++ .../Records/Major Records/Book_Generated.cs | 2 +- .../Records/Major Records/DialogTopic.cs | 12 ++++++++++++ .../Records/Major Records/DialogTopic_Generated.cs | 2 +- .../Records/Major Records/Npc.cs | 12 ++++++++++++ .../Records/Major Records/Npc_Generated.cs | 2 +- .../Records/Major Records/Quest.cs | 12 ++++++++++++ .../Records/Major Records/Quest_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs | 12 ++++++++++++ .../Records/SkyrimMod_Generated.cs | 2 +- 14 files changed, 91 insertions(+), 9 deletions(-) diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs index 27b02dd2c..0144d2ada 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs @@ -16,6 +16,18 @@ public enum Flag : byte } } +partial class ScriptEntrySetterCommon +{ + private static partial IEnumerable RemapInferredAssetLinks( + IScriptEntry obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + throw new NotImplementedException(); + } +} + partial class ScriptEntryCommon { public static partial IEnumerable GetInferredAssetLinks(IScriptEntryGetter obj, Type? assetType) diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs index 57bdbb72d..525ad7c7d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs @@ -880,7 +880,7 @@ public IEnumerable EnumerateListedAssetLinks(IScriptEntry obj) yield break; } - static partial IEnumerable RemapInferredAssetLinks( + private static partial IEnumerable RemapInferredAssetLinks( IScriptEntry obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs index fa8dc16f6..35113b60b 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs @@ -69,8 +69,6 @@ public void Print(StructuredStringBuilder fg, string? name = null) partial class ArmorAddonCommon { - - public static partial IEnumerable GetInferredAssetLinks(IArmorAddonGetter obj, Type? assetType) { if (assetType != null && assetType != typeof(SkyrimModelAssetType)) yield break; @@ -123,6 +121,18 @@ IAssetLink ReplaceWeightSuffix(string newFileSuffix) } } +partial class ArmorAddonSetterCommon +{ + private static partial IEnumerable RemapInferredAssetLinks( + IArmorAddon obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + throw new NotImplementedException(); + } +} + partial class ArmorAddonBinaryCreateTranslation { public static bool IsEnabled(byte b) => Enums.HasFlag(b, (byte)2); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs index 9ffcc935b..be273a03f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs @@ -1567,7 +1567,7 @@ public IEnumerable EnumerateListedAssetLinks(IArmorAddon obj) yield break; } - static partial IEnumerable RemapInferredAssetLinks( + private static partial IEnumerable RemapInferredAssetLinks( IArmorAddon obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs index 959bf99ed..6688190d6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs @@ -147,6 +147,18 @@ public static partial void WriteBinaryTeachesCustom(MutagenWriter writer, IBookG } } +partial class BookSetterCommon +{ + private static partial IEnumerable RemapInferredAssetLinks( + IBook obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + throw new NotImplementedException(); + } +} + partial class BookCommon { private const string Pattern = @"(); @@ -33,9 +34,9 @@ It will then try to loop to the next item, but C# will throw an exception In C#, you are not allowed to modify a collection as it's being looped. -# Avoiding the Exceptions +## Avoiding the Exceptions There are two routes to avoiding the `Collection was modified` exception -## Create a Temporary Collection +### Create a Temporary Collection This can be as simple as: ```cs foreach (var item in list @@ -47,7 +48,7 @@ foreach (var item in list ``` The reason this works is that the `ToArray` call eagerly copies all the items from `list` to a new array. The `foreach` loop then loops over that array. Then, when you add an item to the list, you're not actually modifying the same collection you are looping, and so it succeeds. -## Stop looping after modification +### Stop looping after modification Sometimes for certain purposes, you want to stop the logic after modifying once. ```cs foreach (var item in list) @@ -58,7 +59,7 @@ foreach (var item in list) ``` This self modification is allowed, because it is not the `list.Add` that is the problem, but rather the foreach loop trying to go to the next item right after. So by breaking out of the loop, this code is safe. -# Applying it to Mutagen +## Applying it to Mutagen Taking these same concepts back to Mutagen, if you're adding/removing/replacing records from a mod/group that you're looping, you can get the same exception. If you're modifying the same record types you are looping, then you can follow the same patterns described above. Just add a `ToArray` to keep yourself from modifying the collections you are looping: diff --git a/docs/Reuse-Translation-Masks.md b/docs/Reuse-Translation-Masks.md index 317198e7f..f6690637e 100644 --- a/docs/Reuse-Translation-Masks.md +++ b/docs/Reuse-Translation-Masks.md @@ -1,10 +1,4 @@ - - - - - - - +# Reuse Translation Masks [[Translation Masks]] are a powerful toolset that give you fine-grained control over things like a Copy or Equality check. They typically look like this: diff --git a/docs/TryGet-Concepts.md b/docs/TryGet-Concepts.md index 725279628..74cac51ee 100644 --- a/docs/TryGet-Concepts.md +++ b/docs/TryGet-Concepts.md @@ -1,3 +1,4 @@ +# TryGet Concepts There are many concepts within Mutagen that are optional, nullable, or may not link up at runtime. It is good practice to code in a way that is able to handle both situations: @@ -6,12 +7,12 @@ It is good practice to code in a way that is able to handle both situations: To facilitate this, most API comes with `Try` alternatives. -# Direct Access +## Direct Access Let's first take a look at the non-Try route. This pattern assumes your lookup will succeed. This is only safe if you checked that it existed earlier. -## Mutagen Example +### Mutagen Example An example: ```cs INpcGetter npc = ...; @@ -21,7 +22,7 @@ IRaceGetter race = npc.Race.Resolve(someLinkCache); This will work in 98% of scenarios, up until some user has an odd Npc that doesn't list a Race. Maybe it was a test Npc that isn't used anymore, so it's not a big deal, except for the fact that your code will now throw an exception. It cannot `Resolve` the race and give you an object back, so it throws. -## Generic C# Example +### Generic C# Example This is equivalent to using the Dictionary indexer directly ```cs Dictionary dict = new(); @@ -31,10 +32,10 @@ dict[23] = "Hello"; var str = dict[45]; ``` -# TryGet Patterns Instead +## TryGet Patterns Instead Instead, a better pattern might be: -## Mutagen Example +### Mutagen Example ```cs INpcGetter npc = ...; @@ -59,7 +60,7 @@ foreach (INpcGetter npc in someCollection) } ``` -## Generic C# Example +### Generic C# Example For the basic C# dictionary example, this would be the equivalent of: ```cs Dictionary dict = new(); @@ -70,7 +71,7 @@ if (dict.TryGetValue(45, out var str)) // Found it } ``` -# Summary +## Summary It is almost always preferable to use the `Try` alternative when available. It will force you to consider both when it finds what it was looking for, as well as the case when it does not. Straight "`Try`-less" calls should only be used when you've previously checked that the value exists. Then you know the call is safe, and so it's proper to not need to `Try`. This is rarely used, as the `Try` pattern both checks that it exists and gets the value in one swoop, so a followup retrieval is usually not needed. diff --git a/mkdocs.yml b/mkdocs.yml index 879413409..db4552057 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -95,5 +95,14 @@ nav: - FormLinks Always Target Getter Interfaces: FormLinks-Always-Target-Getter-Interfaces.md - FormLinks vs EditorID as Identifiers: FormLinks-vs-EditorID-as-Identifiers.md - FormLinks vs FormID/FormKey as Identifiers + - Reference FormLinks By EditorID + - LinkCache Resolution Type Choice + - Lists vs HashSet + - Enumerable Laziness: Enumerable-Laziness.md + - TryGet Concepts: TryGet-Concepts.md + - Access Overlays Once + - ITPO Avoidance: ITPO-Avoidance.md + - Reuse Translation Masks: Reuse-Translation-Masks.md + - Modifying Groups Being Iterated: Modifying-Groups-Being-Iterated.md index: Pages/index.md \ No newline at end of file From 9ee95793af13cff12efee16e3b99082bd08ac3fa Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Jul 2023 03:12:54 -0500 Subject: [PATCH 093/135] Docs --- mkdocs.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index db4552057..c8056eb75 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -48,7 +48,8 @@ theme: nav: - Home: index.md - Big Cheat Sheet: Big-Cheat-Sheet.md - - Plugin Record Suite: Plugin-Record-Suite.md + - Plugin Record Suite: + - Plugin-Record-Suite.md - Generated Classes: Generated-Classes.md - Binary Importing: Binary-Importing.md - Binary Overlay: Binary-Overlay.md @@ -64,14 +65,17 @@ nav: - Abstract Subclassing: Abstract-Subclassing.md - Printing: Printing.md - Typical Mod Construction and Importing: Typical-Mod-Construction-and-Importing.md - - Environment: Environment.md + - Environment: + - Environment.md - Environment Construction: Environment-Construction.md - Game Locations: Game-Locations.md - - Link Cache: LinkCache.md + - Link Cache: + - LinkCache.md - Record Lookup: Record-Lookup.md - Mod Contexts: ModContexts.md - Previous Override Iteration: Previous-Override-Iteration.md - - Load Order: Load-Order.md + - Load Order: + - Load-Order.md - Winning Override Iteration: Winning-Overrides.md - Has Mod Assertions - Live File Monitoring From 3b5f5e601afd1eb78621dc222271eb81e83cd612 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Jul 2023 03:15:10 -0500 Subject: [PATCH 094/135] Docs --- .github/workflows/DeployMkDocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/DeployMkDocs.yml b/.github/workflows/DeployMkDocs.yml index ab8da79a6..524dd1ca5 100644 --- a/.github/workflows/DeployMkDocs.yml +++ b/.github/workflows/DeployMkDocs.yml @@ -8,6 +8,7 @@ on: - dev paths: - 'docs/**' + - 'mkdocs.yml' # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From a61b55e2c293489f10e9b4313dbbe5ca7a51697f Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Jul 2023 13:58:38 -0500 Subject: [PATCH 095/135] RemapInferredAssetLinks does not need linkcache --- .../Modules/Plugin/ContainedAssetLinksModule.cs | 3 +-- .../Records/Common Subrecords/ScriptEntry.cs | 1 - .../Records/Common Subrecords/ScriptEntry_Generated.cs | 3 +-- Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs | 1 - .../Records/Major Records/ArmorAddon_Generated.cs | 3 +-- Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs | 1 - .../Records/Major Records/Book_Generated.cs | 3 +-- Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs | 1 - .../Records/Major Records/Quest_Generated.cs | 3 +-- Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs | 1 - Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs | 3 +-- 11 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs index b2adf2d5f..6314cd8b0 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs @@ -370,7 +370,6 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin { f.Add($"{obj.Interface(getter: false)} obj"); f.Add($"IReadOnlyDictionary<{nameof(IAssetLinkGetter)}, string> mapping"); - f.Add($"{nameof(IAssetLinkCache)}? linkCache"); f.Add($"{nameof(AssetLinkQuery)} queryCategories"); } fg.AppendLine(); @@ -411,7 +410,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin if (obj.GetObjectData().HasInferredAssets) { - fg.AppendLine("RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories);"); + fg.AppendLine("RemapInferredAssetLinks(obj, mapping, queryCategories);"); } if (obj.GetObjectData().HasResolvedAssets) diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs index 0144d2ada..da8f1dada 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs @@ -21,7 +21,6 @@ partial class ScriptEntrySetterCommon private static partial IEnumerable RemapInferredAssetLinks( IScriptEntry obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { throw new NotImplementedException(); diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs index 525ad7c7d..e5ed3c216 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs @@ -883,7 +883,6 @@ public IEnumerable EnumerateListedAssetLinks(IScriptEntry obj) private static partial IEnumerable RemapInferredAssetLinks( IScriptEntry obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories); public void RemapAssetLinks( @@ -892,7 +891,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + RemapInferredAssetLinks(obj, mapping, queryCategories); } #endregion diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs index 35113b60b..2ecbff6c7 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs @@ -126,7 +126,6 @@ partial class ArmorAddonSetterCommon private static partial IEnumerable RemapInferredAssetLinks( IArmorAddon obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { throw new NotImplementedException(); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs index be273a03f..67f12e784 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs @@ -1570,7 +1570,6 @@ public IEnumerable EnumerateListedAssetLinks(IArmorAddon obj) private static partial IEnumerable RemapInferredAssetLinks( IArmorAddon obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories); public void RemapAssetLinks( @@ -1580,7 +1579,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + RemapInferredAssetLinks(obj, mapping, queryCategories); obj.WorldModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); obj.FirstPersonModel?.ForEach(x => x?.RemapAssetLinks(mapping, queryCategories, linkCache)); } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs index 6688190d6..7d80d250c 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs @@ -152,7 +152,6 @@ partial class BookSetterCommon private static partial IEnumerable RemapInferredAssetLinks( IBook obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { throw new NotImplementedException(); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs index a1557ee54..cf88f4488 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs @@ -1829,7 +1829,6 @@ public IEnumerable EnumerateListedAssetLinks(IBook obj) private static partial IEnumerable RemapInferredAssetLinks( IBook obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories); public void RemapAssetLinks( @@ -1839,7 +1838,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + RemapInferredAssetLinks(obj, mapping, queryCategories); obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); obj.Icons?.RemapAssetLinks(mapping, queryCategories, linkCache); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs index 5eb831318..2ca3dcda3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs @@ -50,7 +50,6 @@ partial class QuestSetterCommon private static partial IEnumerable RemapInferredAssetLinks( IQuest obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { throw new NotImplementedException(); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs index 00d4686ba..8345fc2af 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs @@ -1971,7 +1971,6 @@ public IEnumerable EnumerateListedAssetLinks(IQuest obj) private static partial IEnumerable RemapInferredAssetLinks( IQuest obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories); public void RemapAssetLinks( @@ -1981,7 +1980,7 @@ public void RemapAssetLinks( AssetLinkQuery queryCategories) { base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); - RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + RemapInferredAssetLinks(obj, mapping, queryCategories); obj.VirtualMachineAdapter?.RemapAssetLinks(mapping, queryCategories, linkCache); } diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs index ab5583069..7ab566284 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs @@ -28,7 +28,6 @@ partial class SkyrimModSetterCommon private static partial IEnumerable RemapInferredAssetLinks( ISkyrimMod obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { throw new NotImplementedException(); diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs index 2626c02d4..589c25402 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs @@ -9413,7 +9413,6 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimMod obj) private static partial IEnumerable RemapInferredAssetLinks( ISkyrimMod obj, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache, AssetLinkQuery queryCategories); public void RemapAssetLinks( @@ -9422,7 +9421,7 @@ public void RemapAssetLinks( IAssetLinkCache? linkCache, AssetLinkQuery queryCategories) { - RemapInferredAssetLinks(obj, mapping, linkCache, queryCategories); + RemapInferredAssetLinks(obj, mapping, queryCategories); obj.TextureSets.RemapAssetLinks(mapping, queryCategories, linkCache); obj.HeadParts.RemapAssetLinks(mapping, queryCategories, linkCache); obj.Eyes.RemapAssetLinks(mapping, queryCategories, linkCache); From 821628118fc9b4a7649fd667f3b2fb295716acb4 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Jul 2023 14:07:58 -0500 Subject: [PATCH 096/135] Remap asset link partial functions return void --- .../Modules/Plugin/ContainedAssetLinksModule.cs | 4 ++-- .../Records/Common Subrecords/ScriptEntry.cs | 2 +- .../Records/Common Subrecords/ScriptEntry_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs | 2 +- .../Records/Major Records/ArmorAddon_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs | 2 +- .../Records/Major Records/Book_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic.cs | 2 +- .../Records/Major Records/DialogTopic_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/Npc.cs | 2 +- .../Records/Major Records/Npc_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs | 2 +- .../Records/Major Records/Quest_Generated.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs index 6314cd8b0..8a27a324f 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/ContainedAssetLinksModule.cs @@ -365,7 +365,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin if (obj.GetObjectData().HasInferredAssets) { using (var f = fg.Function( - $"private static partial IEnumerable<{nameof(IAssetLinkGetter)}> RemapInferredAssetLinks", + $"private static partial void RemapInferredAssetLinks", semiColon: true)) { f.Add($"{obj.Interface(getter: false)} obj"); @@ -378,7 +378,7 @@ private async Task GenerateRemapAssetLinks(ObjectGeneration obj, StructuredStrin if (obj.GetObjectData().HasResolvedAssets) { using (var f = fg.Function( - $"private static partial IEnumerable<{nameof(IAssetLinkGetter)}> RemapResolvedAssetLinks", + $"private static partial void RemapResolvedAssetLinks", semiColon: true)) { f.Add($"{obj.Interface(getter: false)} obj"); diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs index da8f1dada..3f4165bd8 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs @@ -18,7 +18,7 @@ public enum Flag : byte partial class ScriptEntrySetterCommon { - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( IScriptEntry obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs index e5ed3c216..c987f95f5 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry_Generated.cs @@ -880,7 +880,7 @@ public IEnumerable EnumerateListedAssetLinks(IScriptEntry obj) yield break; } - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( IScriptEntry obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs index 2ecbff6c7..5df546372 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs @@ -123,7 +123,7 @@ IAssetLink ReplaceWeightSuffix(string newFileSuffix) partial class ArmorAddonSetterCommon { - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( IArmorAddon obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs index 67f12e784..18f1907f4 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon_Generated.cs @@ -1567,7 +1567,7 @@ public IEnumerable EnumerateListedAssetLinks(IArmorAddon obj) yield break; } - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( IArmorAddon obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs index 7d80d250c..587a253c6 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs @@ -149,7 +149,7 @@ public static partial void WriteBinaryTeachesCustom(MutagenWriter writer, IBookG partial class BookSetterCommon { - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( IBook obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs index cf88f4488..f7c3ddbe7 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book_Generated.cs @@ -1826,7 +1826,7 @@ public IEnumerable EnumerateListedAssetLinks(IBook obj) yield break; } - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( IBook obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories); diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic.cs index 99aebf839..fdf8f61ea 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic.cs @@ -146,7 +146,7 @@ public enum SubtypeEnum partial class DialogTopicSetterCommon { - private static partial IEnumerable RemapResolvedAssetLinks( + private static partial void RemapResolvedAssetLinks( IDialogTopic obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs index e246a86ca..7cc3432d8 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/DialogTopic_Generated.cs @@ -1675,7 +1675,7 @@ public IEnumerable EnumerateListedAssetLinks(IDialogTopic obj) yield break; } - private static partial IEnumerable RemapResolvedAssetLinks( + private static partial void RemapResolvedAssetLinks( IDialogTopic obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc.cs index 36da53145..d50106d75 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc.cs @@ -20,7 +20,7 @@ public enum MajorFlag partial class NpcSetterCommon { - private static partial IEnumerable RemapResolvedAssetLinks( + private static partial void RemapResolvedAssetLinks( INpc obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs index fa1b81ee4..89f44d88e 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Npc_Generated.cs @@ -3620,7 +3620,7 @@ public IEnumerable EnumerateListedAssetLinks(INpc obj) yield break; } - private static partial IEnumerable RemapResolvedAssetLinks( + private static partial void RemapResolvedAssetLinks( INpc obj, IReadOnlyDictionary mapping, IAssetLinkCache? linkCache, diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs index 2ca3dcda3..7ce82fedb 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs @@ -47,7 +47,7 @@ public enum TargetFlag partial class QuestSetterCommon { - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( IQuest obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs index 8345fc2af..689a60b93 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest_Generated.cs @@ -1968,7 +1968,7 @@ public IEnumerable EnumerateListedAssetLinks(IQuest obj) yield break; } - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( IQuest obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories); diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs index 7ab566284..529a32aea 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs @@ -25,7 +25,7 @@ partial void CustomCtor() partial class SkyrimModSetterCommon { - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( ISkyrimMod obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs index 589c25402..b4c15dce4 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod_Generated.cs @@ -9410,7 +9410,7 @@ public IEnumerable EnumerateListedAssetLinks(ISkyrimMod obj) yield break; } - private static partial IEnumerable RemapInferredAssetLinks( + private static partial void RemapInferredAssetLinks( ISkyrimMod obj, IReadOnlyDictionary mapping, AssetLinkQuery queryCategories); From 35fdc2567008c21178f3ae6e2653c3dc05d89305 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 22 Jul 2023 00:31:34 +0200 Subject: [PATCH 097/135] Implement custom remap asset link methods --- .../Records/Common Subrecords/ScriptEntry.cs | 27 +++++++++- .../Records/Major Records/ArmorAddon.cs | 53 +++++++++++-------- .../Records/Major Records/Book.cs | 30 +++++++++-- .../Records/Major Records/DialogTopic.cs | 2 +- .../Records/Major Records/Npc.cs | 4 +- .../Records/Major Records/Quest.cs | 2 +- Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs | 2 +- 7 files changed, 88 insertions(+), 32 deletions(-) diff --git a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs index 3f4165bd8..316eb8a0d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Common Subrecords/ScriptEntry.cs @@ -2,6 +2,7 @@ using Mutagen.Bethesda.Plugins.Aspects; using Mutagen.Bethesda.Plugins.Assets; using Mutagen.Bethesda.Skyrim.Assets; +using Noggog; namespace Mutagen.Bethesda.Skyrim; @@ -23,7 +24,31 @@ private static partial void RemapInferredAssetLinks( IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) { - throw new NotImplementedException(); + if (!queryCategories.HasFlag(AssetLinkQuery.Inferred)) return; + + if (string.IsNullOrWhiteSpace(obj.Name)) return; + + var compiledAsset = new AssetLink(obj.Name + SkyrimScriptCompiledAssetType.PexExtension); + var sourceAsset = new AssetLink(obj.Name + SkyrimScriptSourceAssetType.PscExtension); + + if (mapping.TryGetValue(compiledAsset, out var newCompiledAsset)) + { + var directoryParts = newCompiledAsset.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); + if (directoryParts.Length > 1) + { + var newName = directoryParts[^1].TrimEnd(SkyrimScriptCompiledAssetType.PexExtension); + obj.Name = newName; + } + } + else if (mapping.TryGetValue(sourceAsset, out var newSourceAsset)) + { + var directoryParts = newSourceAsset.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); + if (directoryParts.Length > 1) + { + var newName = directoryParts[^1].TrimEnd(SkyrimScriptSourceAssetType.PscExtension); + obj.Name = newName; + } + } } } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs index 5df546372..61914593f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/ArmorAddon.cs @@ -73,27 +73,11 @@ public static partial IEnumerable GetInferredAssetLinks(IArmor { if (assetType != null && assetType != typeof(SkyrimModelAssetType)) yield break; - IEnumerable TryToAddWeightModel(string path) - { - var name = Path.GetFileNameWithoutExtension(path); - if (name.Length < 3) yield break; - - IAssetLink ReplaceWeightSuffix(string newFileSuffix) - { - var dir = Path.GetDirectoryName(path); - var newFile = $"{name[..^2]}{newFileSuffix}.{SkyrimModelAssetType.Instance.FileExtensions.First()}"; - return dir == null ? new AssetLink(newFile) : new AssetLink(Path.Combine(dir, newFile)); - } - - const string zeroSuffix = "_0"; - const string oneSuffix = "_1"; - if (name.EndsWith(oneSuffix)) + IEnumerable TryToAddWeightModel(string path) { + var otherWeight = GetOtherWeight(path); + if (otherWeight != null) { - yield return ReplaceWeightSuffix(zeroSuffix); - } - else if (name.EndsWith(zeroSuffix)) - { - yield return ReplaceWeightSuffix(oneSuffix); + yield return otherWeight; } } @@ -119,6 +103,33 @@ IAssetLink ReplaceWeightSuffix(string newFileSuffix) yield return assetLink; } } + + internal static IAssetLink? GetOtherWeight(string path) { + const string zeroSuffix = "_0"; + const string oneSuffix = "_1"; + + var name = Path.GetFileNameWithoutExtension(path); + if (name.Length < 3) return null; + + if (name.EndsWith(oneSuffix)) + { + return ReplaceWeightSuffix(zeroSuffix, path, name); + } + + if (name.EndsWith(zeroSuffix)) + { + return ReplaceWeightSuffix(oneSuffix, path, name); + } + + return null; + } + + internal static IAssetLink ReplaceWeightSuffix(string newFileSuffix, string path, string name) + { + var dir = Path.GetDirectoryName(path); + var newFile = name[..^2] + newFileSuffix + Path.GetExtension(path); + return dir == null ? new AssetLink(newFile) : new AssetLink(Path.Combine(dir, newFile)); + } } partial class ArmorAddonSetterCommon @@ -128,7 +139,7 @@ private static partial void RemapInferredAssetLinks( IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) { - throw new NotImplementedException(); + // Let the linked asset remap function handle this } } diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs index 587a253c6..7f779b767 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Book.cs @@ -154,14 +154,31 @@ private static partial void RemapInferredAssetLinks( IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) { - throw new NotImplementedException(); + if (!queryCategories.HasFlag(AssetLinkQuery.Inferred)) return; + + var text = obj.BookText.String; + if (string.IsNullOrWhiteSpace(text)) return; + + string MatchEvaluator(Match match) + { + if (!match.Success) return match.Value; + + var asset = new AssetLink(match.Groups[1].Value); + if (!mapping.TryGetValue(asset, out var assetPath)) return match.Value; + + return match.Value.Replace(match.Groups[1].Value, assetPath); + } + + var resultText = BookCommon.Regex.Replace(text, MatchEvaluator); + + obj.BookText.String = resultText; } } partial class BookCommon { private const string Pattern = @" GetResolvedAssetLinks(INpcGetter obj, IAssetLinkCache linkCache, Type? assetType) diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs index 7ce82fedb..507a8148f 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Quest.cs @@ -52,7 +52,7 @@ private static partial void RemapInferredAssetLinks( IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) { - throw new NotImplementedException(); + // Nothing to do here, we can't change the name of the mod } } diff --git a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs index 529a32aea..1e97bb3bd 100644 --- a/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs +++ b/Mutagen.Bethesda.Skyrim/Records/SkyrimMod.cs @@ -30,7 +30,7 @@ private static partial void RemapInferredAssetLinks( IReadOnlyDictionary mapping, AssetLinkQuery queryCategories) { - throw new NotImplementedException(); + // Nothing to do here, we can't change the name of the mod } } From 753c371a1b6a4429c6e434b4266db76d9a096e58 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 22 Jul 2023 00:32:02 +0200 Subject: [PATCH 098/135] Make IAssetLinkCache non-optional for resolved enumeration --- .../Plugins/Assets/IAssetLinkContainer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs index 253ef5c97..c6c0949a6 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs @@ -81,7 +81,7 @@ public static IEnumerable> EnumerateInferredAssetLinks< public static IEnumerable EnumerateResolvedAssetLinks( this IAssetLinkContainerGetter assetLinkContainerGetter, - IAssetLinkCache? linkCache, + IAssetLinkCache linkCache, Type? assetType = null) { return assetLinkContainerGetter.EnumerateAssetLinks(AssetLinkQuery.Resolved, linkCache: linkCache, assetType); @@ -89,7 +89,7 @@ public static IEnumerable EnumerateResolvedAssetLinks( public static IEnumerable> EnumerateResolvedAssetLinks( this IAssetLinkContainerGetter assetLinkContainerGetter, - IAssetLinkCache? linkCache) + IAssetLinkCache linkCache) where TAsset : IAssetType { return assetLinkContainerGetter.EnumerateAssetLinks(AssetLinkQuery.Resolved, linkCache: linkCache, typeof(TAsset)) @@ -98,7 +98,7 @@ public static IEnumerable> EnumerateResolvedAssetLinks< public static IEnumerable EnumerateAllAssetLinks( this IAssetLinkContainerGetter assetLinkContainerGetter, - IAssetLinkCache? linkCache, + IAssetLinkCache linkCache, Type? assetType = null) { return assetLinkContainerGetter.EnumerateAssetLinks( @@ -109,7 +109,7 @@ public static IEnumerable EnumerateAllAssetLinks( public static IEnumerable> EnumerateAllAssetLinks( this IAssetLinkContainerGetter assetLinkContainerGetter, - IAssetLinkCache? linkCache) + IAssetLinkCache linkCache) where TAsset : IAssetType { return assetLinkContainerGetter.EnumerateAssetLinks( From 463c8c66eb0b398b692f7ac62edd950804d10536 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 22 Jul 2023 00:32:26 +0200 Subject: [PATCH 099/135] Add extension methods for asset link remapping --- .../Plugins/Assets/IAssetLinkContainer.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs index c6c0949a6..84975a08b 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs @@ -28,6 +28,32 @@ public interface IAssetLinkContainer : IAssetLinkContainerGetter new IEnumerable EnumerateListedAssetLinks(); } +public static class AssetLinkContainerExt +{ + public static void RemapInferredAssetLinks( + this IAssetLinkContainer assetLinkContainerGetter, + IReadOnlyDictionary mapping) + { + assetLinkContainerGetter.RemapAssetLinks(mapping, AssetLinkQuery.Inferred, null); + } + + public static void RemapResolvedAssetLinks( + this IAssetLinkContainer assetLinkContainerGetter, + IReadOnlyDictionary mapping, + IAssetLinkCache linkCache) + { + assetLinkContainerGetter.RemapAssetLinks(mapping, AssetLinkQuery.Resolved, linkCache); + } + + public static void RemapAllAssetLinks( + this IAssetLinkContainer assetLinkContainerGetter, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache = null) + { + assetLinkContainerGetter.RemapAssetLinks(mapping, AssetLinkQuery.Listed | AssetLinkQuery.Inferred | AssetLinkQuery.Resolved, linkCache); + } +} + /// /// An interface for classes that contain AssetLinks and can enumerate them. /// From df4c318f7cb690131ccdca172ea1043c69c9fc89 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 22 Jul 2023 00:32:44 +0200 Subject: [PATCH 100/135] Add equality comparers to AssetLink --- Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index 2321a9049..8c0954935 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -251,6 +251,20 @@ public override string ToString() return DataRelativePath; } + public override int GetHashCode() + { + return AssetLink.PathComparer.GetHashCode(RawPath); + } + + public override bool Equals(object? other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + if (other is not AssetLink rhs) return false; + + return AssetLink.PathComparer.Equals(RawPath, rhs.RawPath); + } + public virtual bool Equals(AssetLink? other) { if (ReferenceEquals(null, other)) return false; From ec3342199fe88d9fda005ee36d72bd4e12695d07 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 22 Jul 2023 00:34:53 +0200 Subject: [PATCH 101/135] Add test for remapping --- .../Mutagen.Bethesda.UnitTests.csproj | 8 ++++ .../Skyrim/Assets/AssetTestsSkyrim.cs | 46 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTestsSkyrim.cs diff --git a/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj b/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj index 317e72636..9c681f169 100644 --- a/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj +++ b/Mutagen.Bethesda.UnitTests/Mutagen.Bethesda.UnitTests.csproj @@ -40,5 +40,13 @@ + + + + cs + content + Compile + + diff --git a/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTestsSkyrim.cs b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTestsSkyrim.cs new file mode 100644 index 000000000..1434ba53f --- /dev/null +++ b/Mutagen.Bethesda.UnitTests/Skyrim/Assets/AssetTestsSkyrim.cs @@ -0,0 +1,46 @@ +using FluentAssertions; +using Mutagen.Bethesda.Plugins; +using Mutagen.Bethesda.Plugins.Assets; +using Mutagen.Bethesda.Skyrim; +using Mutagen.Bethesda.Skyrim.Assets; +using Xunit; + +namespace Mutagen.Bethesda.UnitTests.Skyrim.Assets; + +public class AssetTestsSkyrim +{ + [Fact] + public void TestRemapBook() { + var book = new Book(FormKey.Null, SkyrimRelease.SkyrimSE); + + book.BookText.String = """ + Some test text + abc def + Textures/11.png + + + More random text + + XXX + """; + + book.RemapInferredAssetLinks(new Dictionary + { + { new AssetLink("Textures/11.png"), "Textures/aa.png" }, + { new AssetLink("Textures/22.png"), "Textures/bb.png" }, + { new AssetLink("Textures/33.png"), "Textures/cc.png" }, + { new AssetLink("Textures/44.png"), "Textures/dd.png" }, + }); + + book.BookText.String.Should().Be(""" + Some test text + abc def + Textures/11.png + + + More random text + + XXX + """); + } +} From 0e8807b053d5754a5c62922a2d4128c94b89e5a5 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 21 Jul 2023 17:57:38 -0500 Subject: [PATCH 102/135] Block just docs from rebuilding in CI --- .github/workflows/ci-build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index ec4421eeb..4de3fa00d 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -6,11 +6,17 @@ on: - dev - release - prerelease + paths-ignore: + - 'docs/**' + - 'mkdocs.yml' pull_request: branches: - dev - release - prerelease + paths-ignore: + - 'docs/**' + - 'mkdocs.yml' jobs: build-test: From 1beafca4f9da9f730f506f92897b6d4a11c79349 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 22 Jul 2023 01:02:56 +0200 Subject: [PATCH 103/135] Make parameter non-optional --- Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs index 84975a08b..1b41d1c69 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/IAssetLinkContainer.cs @@ -48,7 +48,7 @@ public static void RemapResolvedAssetLinks( public static void RemapAllAssetLinks( this IAssetLinkContainer assetLinkContainerGetter, IReadOnlyDictionary mapping, - IAssetLinkCache? linkCache = null) + IAssetLinkCache linkCache) { assetLinkContainerGetter.RemapAssetLinks(mapping, AssetLinkQuery.Listed | AssetLinkQuery.Inferred | AssetLinkQuery.Resolved, linkCache); } From fccb003a0255a0d65e7384edc1ff91f7e9913d66 Mon Sep 17 00:00:00 2001 From: nickp Date: Sat, 22 Jul 2023 01:04:29 +0200 Subject: [PATCH 104/135] Add asset type to hash code --- Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs index 8c0954935..1d474d87a 100644 --- a/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/Assets/AssetLink.cs @@ -253,7 +253,9 @@ public override string ToString() public override int GetHashCode() { - return AssetLink.PathComparer.GetHashCode(RawPath); + return HashCode.Combine( + typeof(TAssetType).GetHashCode(), + AssetLink.PathComparer.GetHashCode(RawPath)); } public override bool Equals(object? other) From 08af6b94e3b2061d7fe419605afcc99fd142ede8 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 00:36:35 -0500 Subject: [PATCH 105/135] docs --- mkdocs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index c8056eb75..c8d950944 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -80,21 +80,21 @@ nav: - Has Mod Assertions - Live File Monitoring - Archives (BSAs): Archives.md - - Strings + - Strings: - Translated Strings: Translated-Strings.md - Strings Overlays - - Examples + - Examples: - Print Some Content: Print-Some-Content.md - Accessing Known Records - Record Overrides and Duplication - Low Level Examples: Low-Level-Examples.md - - Getting Familiar with C# + - Getting Familiar with C#: - Namespaces: Namespaces.md - Intellisense - Nullability to Indicate Record Presence: Nullability-to-Indicate-Record-Presence.md - Inspect Class Definitions - Debugging - - Best Practices and Optimizations + - Best Practices and Optimizations: - Getters Everywhere - FormLinks Always Target Getter Interfaces: FormLinks-Always-Target-Getter-Interfaces.md - FormLinks vs EditorID as Identifiers: FormLinks-vs-EditorID-as-Identifiers.md From 039a08aba168ecb4e9b07ebe6b4462ee6d48d399 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 00:46:14 -0500 Subject: [PATCH 106/135] docs --- mkdocs.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index c8d950944..55dd57f17 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -42,7 +42,6 @@ theme: features: - navigation.instant - navigation.tracking - - navigation.sections - navigation.indexes nav: @@ -95,16 +94,16 @@ nav: - Inspect Class Definitions - Debugging - Best Practices and Optimizations: - - Getters Everywhere + - Getters Everywhere: - FormLinks Always Target Getter Interfaces: FormLinks-Always-Target-Getter-Interfaces.md - FormLinks vs EditorID as Identifiers: FormLinks-vs-EditorID-as-Identifiers.md - - FormLinks vs FormID/FormKey as Identifiers - - Reference FormLinks By EditorID - - LinkCache Resolution Type Choice - - Lists vs HashSet + - FormLinks vs FormID/FormKey as Identifiers: + - Reference FormLinks By EditorID: + - LinkCache Resolution Type Choice: + - Lists vs HashSet: - Enumerable Laziness: Enumerable-Laziness.md - TryGet Concepts: TryGet-Concepts.md - - Access Overlays Once + - Access Overlays Once: - ITPO Avoidance: ITPO-Avoidance.md - Reuse Translation Masks: Reuse-Translation-Masks.md - Modifying Groups Being Iterated: Modifying-Groups-Being-Iterated.md From 8aebbee14a76d0d2d7ac8f15849099dab9de63b4 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 01:07:51 -0500 Subject: [PATCH 107/135] docs --- docs/Adding-Required-Resources.md | 7 +-- docs/Binary-Streams.md | 5 +- docs/Binary-Utility.md | 9 ++-- docs/Correctness.md | 23 ++++----- docs/FormKey-Allocation-and-Persistence.md | 19 ++++---- docs/FormKey-Picker.md | 13 ++--- docs/Game-Constants.md | 8 +--- docs/Header-Structs.md | 29 +++++------ docs/Json.md | 3 +- docs/Low-Level-Tools.md | 5 +- docs/ModKey-Picker.md | 13 ++--- docs/Oblivion-Aspect-Interfaces.md | 3 +- docs/Oblivion-Link-Interfaces.md | 3 +- docs/Reflection-Powered-Settings.md | 19 ++++---- docs/Skyrim-Aspect-Interfaces.md | 3 +- docs/Skyrim-Link-Interfaces.md | 3 +- docs/Skyrim-Perks.md | 1 + docs/WPF-Library.md | 7 +-- mkdocs.yml | 56 ++++++++++++++++------ 19 files changed, 133 insertions(+), 96 deletions(-) diff --git a/docs/Adding-Required-Resources.md b/docs/Adding-Required-Resources.md index d724c2671..e62d3e032 100644 --- a/docs/Adding-Required-Resources.md +++ b/docs/Adding-Required-Resources.md @@ -1,8 +1,9 @@ +# Adding Required Resources `Mutagen.WPF` is built with style-less controls. This means the controls are just logic, and you can add your own look exactly how you want it. Typically though a default look is provided, and `Mutagen.WPF` does this as well. It is built on top of [MahApps](https://mahapps.com/), and other reusable libraries. -# Global Import +## Global Import To import these resources/looks, the easiest way is to modify the `App.xaml` file that comes with every WPF project: ```cs @@ -29,8 +30,8 @@ To import these resources/looks, the easiest way is to modify the `App.xaml` fil ``` -# Non-Global Import +## Non-Global Import You can also add the above ResourceDictionary to specific controls in your WPF app, if you don't want to import/apply them globally to everything. -# Work In Progress +## Work In Progress These patterns may be adjusted over time, as they don't allow for the easiest customization of color theming and such. As better patterns for exposing more control are discovered, these suggestions might change. diff --git a/docs/Binary-Streams.md b/docs/Binary-Streams.md index f9e285247..178ef8594 100644 --- a/docs/Binary-Streams.md +++ b/docs/Binary-Streams.md @@ -1,7 +1,8 @@ -# BinaryReadStream +# Binary Streams +## BinaryReadStream `IBinaryReadStream` is an interface that exposes binary extraction from a stream, with `BinaryReadStream` being a basic implementation. The interface offers calls to read `int`, `short`, `uint`, `double`, `byte[]`, and even newer concepts such as `ReadOnlySpan` and `ReadOnlyMemorySlice`. -# MutagenBinaryReadStream +## MutagenBinaryReadStream This is just a further extension on BinaryReadStream, offering additionally: - A [[HeaderConstants]] object for reference when alignment is important - An offset member, to help calculate position relative to a source file, if the MutagenBinaryReadStream happens to be a substream on only a slice of data. diff --git a/docs/Binary-Utility.md b/docs/Binary-Utility.md index 5a7ced91a..b657bed4e 100644 --- a/docs/Binary-Utility.md +++ b/docs/Binary-Utility.md @@ -1,4 +1,5 @@ -# BinaryStringUtility +# Binary Utility +## BinaryStringUtility Bethesda games store their strings on disk in a single byte format, with a null terminator. There are some convenience parsing functions inside `BinaryStringUtility` to convert these to C# strings. ### ToZString @@ -21,7 +22,7 @@ var amountParsed = str.Length + 1; // +1 for the null termination that was trimm ``` -# SubRecord Iteration and Location +## SubRecord Iteration and Location There are some convenience methods for iterating and locating Subrecords in a set of raw bytes in `UtilityTranslation`. These are extension methods onto `HeaderConstants` and `MajorRecordFrame`, so they can be used directly from those objects. ### EnumerateSubrecords @@ -104,7 +105,7 @@ if (finds.TryGetValue(full, out loc)) } ``` -# RecordLocator +## RecordLocator `RecordLocator` is a convenience class that processes a mod stream and returns all the locations of Groups and MajorRecords. @@ -164,5 +165,5 @@ This class just provides a common use case of locating records. If more fine tu Note that this class uses FormID, and does not make use of the abstraction concepts found in [[ModKey, FormKey, FormLink]] -# Decompression +## Decompression MajorRecords with their compression flag enabled come in a compressed format. The byte content needs to be unzipped before it can be read. diff --git a/docs/Correctness.md b/docs/Correctness.md index 4b9d928b7..397344cfa 100644 --- a/docs/Correctness.md +++ b/docs/Correctness.md @@ -1,30 +1,31 @@ -# Passthrough Testing +# Correctness +## Passthrough Testing Besides general unit tests for edge-case prone code section, Mutagen has a passthrough test suite that it uses to help confirm correctness. -## Definition +### Definition A passthrough means that Mutagen will read in a source file into the classes it provides, and then immediately re-export. If the two files match, then it was able to "pass through" Mutagen's systems without being changed unexpectedly. -## Pre-Processing +### Pre-Processing There is a bit more that goes into a passthrough than just importing, re-exporting, and comparing, though. For one, it is much easier to compare files match byte to byte if you're comparing the uncompressed data. As such, there are a few pre-processing steps that happen before a passthrough test is actually executed. -### Decompression +#### Decompression The source file is lightly processed so that all the records are in their decompressed format. -### Float Standardization +#### Float Standardization Some float values can be stored in multiple ways. A common one is zero, which is stored as zero by Bethesda in two different formats. This stage standardizes floats to be the format Mutagen will export as, while leaving their actual represented values intact. -### Subrecord Order Standardization +#### Subrecord Order Standardization Subrecords usually come in a predictable order, but they are not required to. Bethesda in some circumstances will deviate and shuffle the subrecords to where the content overall stays the same, but the order they show up on disk is different. This phase moves the subrecords to be in the order Mutagen would export them in. This helps the byte to byte comparison line up better without being distracted by subrecords of differing order. -### Strings File Key Reindexing +#### Strings File Key Reindexing Mutagen does not retain strings file key indexes compared to the original. This is not important information to store and persist so that it matches the input. As such, the source file needs to be reindexed so that it matches what Mutagen will output. This just means making the key index start at 1 and increment for every string that was exported. -### Other Minor Inconsistencies +#### Other Minor Inconsistencies There are a few other cases of inconsistencies that need to be aligned, similar to the ones above. -## Running +### Running Once a preprocessed file that has been trimmed, aligned, and decompressed is ready, then the actual passthrough will be done. Mutagen will import the original (unprocessed) file, and re-export it. The result will be compared to the pre-processed file which then should match byte to byte. If there is even one byte differing, the passthrough fails, and either Mutagen's code must be fixed, or if it was just a non-important inconsistency as described above, the passthrough systems will be adjusted to compensate. -# Helper UI +## Helper UI There is an internal helper UI to to facilitate selecting which tests to run, as well as digesting the parallel output that results. ![](https://i.imgur.com/YqFdom4.gif) ![](https://i.imgur.com/clKzSP0.gif) -# More References +## More References More documentation to come, but in the meantime, there is some testing information in this video about [Record Generation](https://youtu.be/j8r4p67eKLA). diff --git a/docs/FormKey-Allocation-and-Persistence.md b/docs/FormKey-Allocation-and-Persistence.md index 302e91efa..f98ed10f2 100644 --- a/docs/FormKey-Allocation-and-Persistence.md +++ b/docs/FormKey-Allocation-and-Persistence.md @@ -1,10 +1,11 @@ +# FormKey Allocation and Persistence It is common that tooling that is generating new records when creating plugins wants to keep their FormKeys consistent across several runs. The same records should get the same FormKeys. There are some challenges with fulfilling this: - How is a record detected to be the "same" as one from a previous run? - Where/How do you persist the mapping information between runs? -# Mapping Records Via EditorID +## Mapping Records Via EditorID One of the challenges is finding a way to map records from a previous run with records from the current run, so that their FormKeys can be synced. Mutagen does this by requiring the developer provide a unique EditorID when they want syncing to occur. Mutagen offers a few ways to hook into its allocation API. @@ -22,7 +23,7 @@ var syncedNpc3 = new Npc(mod.GetNextFormKey("SomeOtherEdid")); For the records where the EditorID was provided at the time of creation, syncing functionality will be applied if enabled (more on this later). -# Keep EditorIDs Unique +## Keep EditorIDs Unique With this pattern, the burden is on the developer to ensure that all records created in this fashion are supplied unique EditorIDs. If new record is made with an EditorID that has already been used in the current "run", then an exception will be thrown. It is recommended to name the EditorIDs off the aspects that drove the record to be made in the first place: @@ -33,10 +34,10 @@ It is recommended to name the EditorIDs off the aspects that drove the record to Since each is named with a specific "goal" in mind, it will be less likely to collide. -# Persistence and Allocation +## Persistence and Allocation The other half that needs to be considered is where the mapping information is stored, and how that data gets imported/used to fulfill the allocation requests described above. -## Setting a Mod's Allocator +### Setting a Mod's Allocator Every mod can have its FormKey allocator set, which is the logic that hands out new FormKeys to records. This where a FormKey syncing allocator can be injected with whatever behavior we wish. ```cs @@ -46,7 +47,7 @@ mod.SetAllocator(allocator); ``` This would set the mod to sync its FormKeys to a text file at the given path. -## Text File Allocators +### Text File Allocators These alloctors save their data into a text file with the following format: ``` TheEditorIdToSyncAgainst @@ -56,7 +57,7 @@ TheEditorIdToSyncAgainst One thing of note is that it saves just the FormID, without the mod indices. The ModKey to be associated with is not persisted in the file itself. -### TextFileFormKeyAllocator +#### TextFileFormKeyAllocator This a simplistic 1:1 allocator from a single mod to a single file. As such, the ModKey of the mod is combined with the FormID retrieved from the file to get the actual FormKey for use. ```cs @@ -65,7 +66,7 @@ var allocator = new TextFileFormKeyAllocator(mod, pathToFile); mod.SetAllocator(allocator); ``` -### TextFileSharedFormKeyAllocator +#### TextFileSharedFormKeyAllocator This is a more advanced allocator for when several separate sources need to coordinate together to avoid FormKey collisions. A prime example is a Synthesis patcher run, where several separate programs will run, and all need to avoid allocating FormKeys that another has used. ```cs @@ -76,10 +77,10 @@ mod.SetAllocator(allocator); This will save to a folder, instead, with a file within under "MyProgramName" that has this specific programs sync information. However, the system will examine other files within that folder so that those FormKeys can be avoided when allocating fresh new FormKeys. -### Sqlite +#### Sqlite There is also the beginnings of a Sqlite backed persistence system within `Mutagen.Bethesda.Sqlite`. It needs to be optimized before it will be a viable choice. -## Saving Allocation State +### Saving Allocation State Allocators are created separately from a mod, even if they are assigned to a mod and tightly associated with it. As such, allocators are themselves in charge of persisting their state once allocations have been made. Typically this is done via disposal mechanics: ```cs diff --git a/docs/FormKey-Picker.md b/docs/FormKey-Picker.md index 24a83b272..53d1d3208 100644 --- a/docs/FormKey-Picker.md +++ b/docs/FormKey-Picker.md @@ -1,3 +1,4 @@ +# FormKey Picker The FormKey Picker helps users select record(s) by typing in: - EditorIDs - FormKeys @@ -11,12 +12,12 @@ Make sure you've added the [Required Resources](Adding-Required-Resources), or t The Mutagen [Test Display](https://github.com/Mutagen-Modding/Mutagen/tree/release/Mutagen.Bethesda.WPF.TestDisplay) app utilizes the FormKey pickers, and provides a good example of how to use them from within a WPF app. -# FormKey Picker +## FormKey Picker This is a picker to select a single FormKey. ![FormKey Picker](https://i.imgur.com/gtlg5Md.gif) -## View Side +### View Side ```cs ``` -## ViewModel Side +### ViewModel Side ```cs // Some mechanics shown here are from `ReactiveUI`, or `Noggog.WPF` public class MyViewModel : ViewModel @@ -62,12 +63,12 @@ public class MyViewModel : ViewModel } ``` -# FormKey Multipicker +## FormKey Multipicker This is a picker to select any number of FormKeys. ![FormKey Multipicker](https://i.imgur.com/PlVXxu5.gif) -## View Side +### View Side ```cs ``` -## ViewModel Side +### ViewModel Side ```cs // Some mechanics shown here are from `ReactiveUI`, or `Noggog.WPF` public class MyViewModel : ViewModel diff --git a/docs/Game-Constants.md b/docs/Game-Constants.md index 3980207ad..6a2f0b4ea 100644 --- a/docs/Game-Constants.md +++ b/docs/Game-Constants.md @@ -1,10 +1,4 @@ - - - - - - - +# Game Constants As Bethesda games are released, headers are modified slightly. They still have a lot in common, but certain things move or the total length changes, or something else that will misalign any common parsing code. `GameConstants` is a class containing all the various alignment information specific to a game. Things like: diff --git a/docs/Header-Structs.md b/docs/Header-Structs.md index 23549bc06..780b6352b 100644 --- a/docs/Header-Structs.md +++ b/docs/Header-Structs.md @@ -1,4 +1,5 @@ -# General Concept +# Header Structs +## General Concept Header Structs are lightweight overlays that "lay" on top of some bytes and offers API to retrieve the various header fields or content bytes they contain. They are extremely cheap to create, as they do no parsing unless asked. They are aware of any differences in data alignments from game to game, so the same systems can be applied even if alignments change slightly. Using Header Structs, very performant and low level parsing is possible while retaining a large degree of safety and usability. @@ -11,7 +12,7 @@ Some notable features: They still require a lot of knowledge of the underlying binary structures of a mod, but the system goes a long way to empower the user to do it quickly, and with minimal potential for typo or misalignment errors. -# Example Usage +## Example Usage The following code will print all EditorIDs of all npcs from any game type. ```csharp var modPath = ModPath.FromPath("SomeFolder/Skyrim.esm"); @@ -47,9 +48,9 @@ while (stream.TryReadGroupFrame(out var groupFrame)) This code will only do the minimal parsing necessary to locate/print the EditorIDs. Most data will be skipped over and left unparsed. -# Headers, Frames and Pins +## Headers, Frames and Pins Header Structs come in a few combinations and flavors. The above code makes use of several of them. -## Categories +### Categories There are Header Structs for: - Groups - MajorRecords @@ -58,10 +59,10 @@ There are Header Structs for: These are the few different types of records we can expect to encounter in a mod file, and there is a separate struct for each, offering the specific API for its type. -## Flavors +### Flavors Each category also comes in a few flavors. -### Header +#### Header This is the most basic version that has been discussed in the descriptions above. It overlays on top of bytes and offers API to access the various aspects of the header. Typical accessors include: @@ -73,13 +74,13 @@ Typical accessors include: All of these fields align themselves properly by bouncing off a [[GameConstants|Game Constants]] object which has all the appropriate alignment information. -### Frame +#### Frame Frames add a single additional member `ReadOnlyMemorySlice Content { get; }`, and thus overlay on top of a whole record in its entirety, both the header and its content. This struct offers a nice easy package to access anything about an entire record in one location. -### Pin +#### Pin Pins add yet another single additional member `int Location { get; }`. This represents the location a frame exists relative to its parent. This facilitates parsing and operations where knowing a record's location is important. -# Additional Functionality +## Additional Functionality ## Iteration Both Group and MajorRecord Frames offer iteration functionality. ``` @@ -90,7 +91,7 @@ foreach (var subrecordPin in majorRecordFrame) ``` This allows the user to easily iterate and process contained records without needing to manually construct and align the headers themselves. -## Subrecord Location +### Subrecord Location MajorRecord Frames also have API for searching for a specific subrecord type. ``` @@ -105,8 +106,8 @@ This allows users to easily locate a specific record they are looking for, witho Note that it does iterate each Subrecord internally, so it is not a good solution if you are trying to process/find a large portion of Subrecords within a single Major Record. It is more appropriate for finding one or two specific ones. If you want to process all subrecords by type, it is recommended you iterate and switch on the type directly, or store the resulting SubrecordPins in a dictionary for later use. -## Subrecord Frame Data Interpretation -### Primitives +### Subrecord Frame Data Interpretation +#### Primitives Once a Subrecord Frame is located that you wish to retrieve data from, the content is still only offered as raw bytes (or rather, `ReadOnlyMemorySlice`). There are a lot of functions to help interpret that data to the appropriate type, while confirming correctness. ``` var subrecordFrame = ...; @@ -120,14 +121,14 @@ var subrecordFrame = ...; int contentAsInt = subrecordFrame.Content.Int32(); ``` This route will not do the check to enforce that the content length is exactly 4. It would only throw if the content wasn't long enough to be an int at all (less than 4). -### Strings +#### Strings Strings, unlike primitives, do not have a set length. So the call to interpret a Subrecord Frame's content as a string is just for convenience, and does not add any safety mechanisms. ``` var subrecordFrame = ...; string contentAsString = subrecordFrame.AsString(); ``` -# Writable Structs +## Writable Structs All the above concepts mentioned have been read-only. Header Structs can be overlaid on top of spans, and read data from them. There are writable structs as well, which have both getter and setter API. You can then read a section of data, and then make modifications which will affect the source `byte[]` at the correct indices. diff --git a/docs/Json.md b/docs/Json.md index 2dda1ed9e..002c7631b 100644 --- a/docs/Json.md +++ b/docs/Json.md @@ -1,6 +1,7 @@ +# Json Currently, the libraries that Mutagen offers related to Json targets `Newtonsoft.Json`. Alternatives can be added for `System.Text.Json` if there's demand. -# Json Converters +## Json Converters There are some built in converters to allow for FormKeys/FormLinks/ModKeys to be included in a Json DTO. ```cs diff --git a/docs/Low-Level-Tools.md b/docs/Low-Level-Tools.md index 318d946df..88a0f47cb 100644 --- a/docs/Low-Level-Tools.md +++ b/docs/Low-Level-Tools.md @@ -1,8 +1,9 @@ +# Low Level Tools The API and tools listed in the [[Plugin Record Suite]] are intended to expose Bethesda records in an organized, strongly typed, and (hopefully) less error prone fashion. However, some tasks and some users require a less safe and more direct approach to get the job done. This section is about some of the mechanics and tools under the hood, and are recommended for more advanced users. -# Reasoning and Typical Applications of Low Level Tooling +## Reasoning and Typical Applications of Low Level Tooling ## Cross-game Processing The [[Plugin Record Suite]] objects fall short when the task you are trying to accomplish is to be applied to multiple Bethesda games. There are no halfway hybrid generated classes that can parse and contain both Skyrim and Oblivion NPCs, for example. @@ -10,5 +11,5 @@ Interfaces can provide a small bit of relief, allowing some fields that are comm Low Level Tooling can be used instead of the generated records to write logic that can apply to multiple games where interfaces aren't good enough. It comes at the cost of being a lot more error prone to use, losing a lot of the common functionality (Equals/ToString/etc), and requiring a lot more knowledge of binary details. -## Testing the Record Suite Itself +### Testing the Record Suite Itself The generated records do the bulk of the parsing and data handling, but they cannot test themselves for correctness. The manual granularity of the Low Level Tools allow for code and logic to be written for testing projects to do the work needed to confirm correctness of the generated records. diff --git a/docs/ModKey-Picker.md b/docs/ModKey-Picker.md index 68cbea93c..ff2ea06b6 100644 --- a/docs/ModKey-Picker.md +++ b/docs/ModKey-Picker.md @@ -1,3 +1,4 @@ +# ModKey Picker The ModKey Picker helps users select mod(s) by typing in their names. The picker can reference certain objects to know what mods actually exist on a user's active load order: @@ -9,12 +10,12 @@ Make sure you've added the [Required Resources](Adding-Required-Resources), or t The Mutagen [Test Display](https://github.com/Mutagen-Modding/Mutagen/tree/release/Mutagen.Bethesda.WPF.TestDisplay) app utilizes the ModKey pickers, and provides a good example of how to use them from within a WPF app. -# ModKey Picker +## Single Picker This is a picker to select a single ModKey. ![ModKey Picker](https://i.imgur.com/FYT1EDq.gif) -## View Side +### View Side ```cs ``` -## ViewModel Side +### ViewModel Side ```cs // Some mechanics shown here are from `ReactiveUI`, or `Noggog.WPF` public class MyViewModel : ViewModel @@ -54,12 +55,12 @@ public class MyViewModel : ViewModel } ``` -# ModKey Multipicker +## ModKey Multipicker This is a picker to select any number of ModKeys. ![ModKey Multipicker](https://i.imgur.com/TNnR53A.gif) -## View Side +### View Side ```cs ``` -## ViewModel Side +### ViewModel Side ```cs // Some mechanics shown here are from `ReactiveUI`, or `Noggog.WPF` public class MyViewModel : ViewModel diff --git a/docs/Oblivion-Aspect-Interfaces.md b/docs/Oblivion-Aspect-Interfaces.md index 0e2804c4a..3bea4efb5 100644 --- a/docs/Oblivion-Aspect-Interfaces.md +++ b/docs/Oblivion-Aspect-Interfaces.md @@ -1,4 +1,5 @@ -# Aspect Interfaces +# Oblivion Aspect Interfaces +## Aspect Interfaces Aspect Interfaces expose common aspects of records. For example, `INamed` are implemented by all records that have a `Name`. Functions can then be written that take in `INamed`, allowing any record that has a name to be passed in. diff --git a/docs/Oblivion-Link-Interfaces.md b/docs/Oblivion-Link-Interfaces.md index 390e0c9fa..6020a3ede 100644 --- a/docs/Oblivion-Link-Interfaces.md +++ b/docs/Oblivion-Link-Interfaces.md @@ -1,4 +1,5 @@ -# Link Interfaces +# Oblivion Link Interfaces +## Link Interfaces Link Interfaces are used by FormLinks to point to several record types at once. For example, a Container record might be able to contain Armors, Weapons, Ingredients, etc. An interface would be defined such as 'IItem', which all Armor, Weapon, Ingredients would all implement. diff --git a/docs/Reflection-Powered-Settings.md b/docs/Reflection-Powered-Settings.md index 36c6537da..e6a7869df 100644 --- a/docs/Reflection-Powered-Settings.md +++ b/docs/Reflection-Powered-Settings.md @@ -1,8 +1,9 @@ +# Reflection Powered Settings This is a control that is able to attach to any DTO (Data Transfer Object) style class and generate a UI for each of the fields. This is very good for getting a basic settings editor up and running with minimal WPF experience. Originally it was part of Synthesis to provide UI controls for patcher settings, but has been moved up to Mutagen's libraries for more general use. -# Overview +## Overview Let's take an example DTO class ```cs public class TestSettings @@ -22,7 +23,7 @@ As such, it is an easy way to get a decent UI for any class, and is very helpful - You aren't used to WPF and just want to get something up and running - If you don't know ahead of time what fields will exist (Synthesis patchers being a prime example) -# Nesting +## Nesting The reflection systems allow nested classes, and utilize them to create "sections". Take this modified setup for example: @@ -52,14 +53,14 @@ This would yield the following display: ![](https://i.imgur.com/EFHZxEE.gif) -# Attributes +## Attributes Since the internal systems are constructing a view for you based on the contents of your class, you have reduced control over what is displayed, where, and how. The system provides some Attributes to help give back some of this control. They all live within the namespace `Mutagen.Bethesda.WPF.Reflection.Attributes` NOTE: The naming of these attributes differs slightly from the names Synthesis uses for its autogenerated setting systems -## Ignore +### Ignore A marker attribute that will make a specific field not display ``` @@ -67,7 +68,7 @@ A marker attribute that will make a specific field not display public bool MyIgnoredBool { get; set; } ``` -## Tooltip +### Tooltip Sets the tooltip to display ``` @@ -75,7 +76,7 @@ Sets the tooltip to display public bool SomeComplexSetting { get; set; } ``` -## SettingName +### SettingName Will set explicitly what text to display as the name for the field ``` @@ -83,7 +84,7 @@ Will set explicitly what text to display as the name for the field public bool SomeDerpyName { get; set; } ``` -## JsonDiskName +### JsonDiskName An attribute to change what text key is used when persisting/loading from json ``` @@ -91,7 +92,7 @@ An attribute to change what text key is used when persisting/loading from json public bool SomeSetting { get; set; } ``` -## MaintainOrder +### MaintainOrder Unfortunately, C# cannot properly guarantee order of fields when utilizing reflection. This attribute is a marker that helps maintain desired ordering. ``` @@ -102,7 +103,7 @@ public bool FirstSetting { get; set; } public bool SecondSetting { get; set; } ``` -## ObjectNameMember +### ObjectNameMember This attribute applies to the settings class itself, and defines the object type naming to show when [nested classes](Nesting) are involved. ```cs diff --git a/docs/Skyrim-Aspect-Interfaces.md b/docs/Skyrim-Aspect-Interfaces.md index 9f80082f5..44a72f4ce 100644 --- a/docs/Skyrim-Aspect-Interfaces.md +++ b/docs/Skyrim-Aspect-Interfaces.md @@ -1,4 +1,5 @@ -# Aspect Interfaces +# Skyrim Aspect Interfaces +## Aspect Interfaces Aspect Interfaces expose common aspects of records. For example, `INamed` are implemented by all records that have a `Name`. Functions can then be written that take in `INamed`, allowing any record that has a name to be passed in. diff --git a/docs/Skyrim-Link-Interfaces.md b/docs/Skyrim-Link-Interfaces.md index 9167f9458..adab926e6 100644 --- a/docs/Skyrim-Link-Interfaces.md +++ b/docs/Skyrim-Link-Interfaces.md @@ -1,4 +1,5 @@ -# Link Interfaces +# Skyrim Link Interfaces +## Link Interfaces Link Interfaces are used by FormLinks to point to several record types at once. For example, a Container record might be able to contain Armors, Weapons, Ingredients, etc. An interface would be defined such as 'IItem', which all Armor, Weapon, Ingredients would all implement. diff --git a/docs/Skyrim-Perks.md b/docs/Skyrim-Perks.md index 0147672f2..4741b7814 100644 --- a/docs/Skyrim-Perks.md +++ b/docs/Skyrim-Perks.md @@ -1,3 +1,4 @@ +# Skyrim Perks ## Perk Effect Types The abstract base class is `APerkEffect` which is inherited by: - `PerkQuestEffect` diff --git a/docs/WPF-Library.md b/docs/WPF-Library.md index 366b8fca7..f353b2e40 100644 --- a/docs/WPF-Library.md +++ b/docs/WPF-Library.md @@ -1,3 +1,4 @@ +# WPF Library If you are making a C# WPF UI application with Mutagen, you can import `Mutagen.Bethesda.WPF` to get some tooling related to Bethesda specific content. - Controls for Bethesda specific concepts, such as FormKeyPickers, LoadOrder displays, etc - Reflection powered settings editor @@ -7,13 +8,13 @@ The Mutagen repository has a [Test Display](https://github.com/Mutagen-Modding/M Explore the right hand side bar for more specifics on the features provided by Mutagen's WPF library -# FormKey Pickers +## FormKey Pickers ![FormKey Picker](https://i.imgur.com/gtlg5Md.gif) ![FormKey Multipicker](https://i.imgur.com/PlVXxu5.gif) -# ModKey Pickers +## ModKey Pickers ![ModKey Picker](https://i.imgur.com/FYT1EDq.gif) ![ModKey Multipicker](https://i.imgur.com/TNnR53A.gif) -# Reflection Powered Settings +## Reflection Powered Settings ![Reflection Settings](https://i.imgur.com/PdXSnk5.gif) diff --git a/mkdocs.yml b/mkdocs.yml index 55dd57f17..71935642f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -74,38 +74,64 @@ nav: - Mod Contexts: ModContexts.md - Previous Override Iteration: Previous-Override-Iteration.md - Load Order: - - Load-Order.md + # - Load-Order.md - Winning Override Iteration: Winning-Overrides.md - - Has Mod Assertions - - Live File Monitoring + # - Has Mod Assertions + # - Live File Monitoring - Archives (BSAs): Archives.md - Strings: - Translated Strings: Translated-Strings.md - - Strings Overlays + # - Strings Overlays - Examples: - Print Some Content: Print-Some-Content.md - - Accessing Known Records - - Record Overrides and Duplication + # - Accessing Known Records + # - Record Overrides and Duplication - Low Level Examples: Low-Level-Examples.md - Getting Familiar with C#: - Namespaces: Namespaces.md - - Intellisense + # - Intellisense - Nullability to Indicate Record Presence: Nullability-to-Indicate-Record-Presence.md - - Inspect Class Definitions - - Debugging + # - Inspect Class Definitions + # - Debugging - Best Practices and Optimizations: - - Getters Everywhere: + # - Getters Everywhere: - FormLinks Always Target Getter Interfaces: FormLinks-Always-Target-Getter-Interfaces.md - FormLinks vs EditorID as Identifiers: FormLinks-vs-EditorID-as-Identifiers.md - - FormLinks vs FormID/FormKey as Identifiers: - - Reference FormLinks By EditorID: - - LinkCache Resolution Type Choice: - - Lists vs HashSet: + # - FormLinks vs FormID/FormKey as Identifiers: + # - Reference FormLinks By EditorID: + # - LinkCache Resolution Type Choice: + # - Lists vs HashSet: - Enumerable Laziness: Enumerable-Laziness.md - TryGet Concepts: TryGet-Concepts.md - - Access Overlays Once: + # - Access Overlays Once: - ITPO Avoidance: ITPO-Avoidance.md - Reuse Translation Masks: Reuse-Translation-Masks.md - Modifying Groups Being Iterated: Modifying-Groups-Being-Iterated.md + # - Testing: + # - Auto Fixture: + # - Major Record Test Building: + - WPF Library: WPF-Library.md + - FormKey Picker: FormKey-Picker.md + - ModKey Picker: ModKey-Picker.md + # - Load Order Display + - Reflection Powered Settings: Reflection-Powered-Settings.md + - Adding Required Resources: Adding-Required-Resources.md + # - Dependency Injection: Dependency Injection + - FormKey Allocation/Persistence: FormKey-Allocation-and-Persistence.md + - Json: Json.md + - Low Level Tools: Low-Level-Tools.md + - Header Structs: Header-Structs.md + - Game Constants: Game-Constants.md + - Binary Streams: Binary-Streams.md + - Binary Utility: Binary-Utility.md + - Game Specific Documentation + - Oblivion + - Oblivion Aspect Interfaces: Oblivion-Aspect-Interfaces.md + - Oblivion Link Interfaces: Oblivion-Link-Interfaces.md + - Skyrim + - Skyrim Perks: Skyrim-Perks.md + - Skyrim Aspect Interfaces: Skyrim-Aspect-Interfaces.md + - Skyrim Link Interfaces: + - Correctness: Correctness.md index: Pages/index.md \ No newline at end of file From 77e66f2d7f3d2122f261e4a9c422b677ce862d64 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 01:11:04 -0500 Subject: [PATCH 108/135] docs --- mkdocs.yml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index 71935642f..6aff0ab7b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -107,31 +107,5 @@ nav: - ITPO Avoidance: ITPO-Avoidance.md - Reuse Translation Masks: Reuse-Translation-Masks.md - Modifying Groups Being Iterated: Modifying-Groups-Being-Iterated.md - # - Testing: - # - Auto Fixture: - # - Major Record Test Building: - - WPF Library: WPF-Library.md - - FormKey Picker: FormKey-Picker.md - - ModKey Picker: ModKey-Picker.md - # - Load Order Display - - Reflection Powered Settings: Reflection-Powered-Settings.md - - Adding Required Resources: Adding-Required-Resources.md - # - Dependency Injection: Dependency Injection - - FormKey Allocation/Persistence: FormKey-Allocation-and-Persistence.md - - Json: Json.md - - Low Level Tools: Low-Level-Tools.md - - Header Structs: Header-Structs.md - - Game Constants: Game-Constants.md - - Binary Streams: Binary-Streams.md - - Binary Utility: Binary-Utility.md - - Game Specific Documentation - - Oblivion - - Oblivion Aspect Interfaces: Oblivion-Aspect-Interfaces.md - - Oblivion Link Interfaces: Oblivion-Link-Interfaces.md - - Skyrim - - Skyrim Perks: Skyrim-Perks.md - - Skyrim Aspect Interfaces: Skyrim-Aspect-Interfaces.md - - Skyrim Link Interfaces: - - Correctness: Correctness.md index: Pages/index.md \ No newline at end of file From 5744adc979ed7ab0b0dac927fd7fbb40780adfcc Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 01:19:02 -0500 Subject: [PATCH 109/135] docs --- docs/{ => plugins}/Abstract-Subclassing.md | 0 docs/{ => plugins}/AssetLink.md | 0 docs/{ => plugins}/Binary-Exporting.md | 0 .../Binary-Format-Complexity-Abstraction.md | 0 docs/{ => plugins}/Binary-Importing.md | 0 docs/{ => plugins}/Binary-Overlay.md | 0 docs/{ => plugins}/Copy-Functionality.md | 0 .../Create,-Duplicate,-and-Override.md | 0 docs/{ => plugins}/Equality-Checks.md | 0 docs/{ => plugins}/Flags-and-Enums.md | 0 docs/{ => plugins}/Generated-Classes.md | 0 .../Interfaces-(Aspect-Link-Getters).md | 0 docs/{ => plugins}/Printing.md | 0 docs/{ => plugins}/Translation-Masks.md | 0 .../Typical-Mod-Construction-and-Importing.md | 0 .../index.md} | 0 mkdocs.yml | 58 ++++++++++++++----- 17 files changed, 42 insertions(+), 16 deletions(-) rename docs/{ => plugins}/Abstract-Subclassing.md (100%) rename docs/{ => plugins}/AssetLink.md (100%) rename docs/{ => plugins}/Binary-Exporting.md (100%) rename docs/{ => plugins}/Binary-Format-Complexity-Abstraction.md (100%) rename docs/{ => plugins}/Binary-Importing.md (100%) rename docs/{ => plugins}/Binary-Overlay.md (100%) rename docs/{ => plugins}/Copy-Functionality.md (100%) rename docs/{ => plugins}/Create,-Duplicate,-and-Override.md (100%) rename docs/{ => plugins}/Equality-Checks.md (100%) rename docs/{ => plugins}/Flags-and-Enums.md (100%) rename docs/{ => plugins}/Generated-Classes.md (100%) rename docs/{ => plugins}/Interfaces-(Aspect-Link-Getters).md (100%) rename docs/{ => plugins}/Printing.md (100%) rename docs/{ => plugins}/Translation-Masks.md (100%) rename docs/{ => plugins}/Typical-Mod-Construction-and-Importing.md (100%) rename docs/{Plugin-Record-Suite.md => plugins/index.md} (100%) diff --git a/docs/Abstract-Subclassing.md b/docs/plugins/Abstract-Subclassing.md similarity index 100% rename from docs/Abstract-Subclassing.md rename to docs/plugins/Abstract-Subclassing.md diff --git a/docs/AssetLink.md b/docs/plugins/AssetLink.md similarity index 100% rename from docs/AssetLink.md rename to docs/plugins/AssetLink.md diff --git a/docs/Binary-Exporting.md b/docs/plugins/Binary-Exporting.md similarity index 100% rename from docs/Binary-Exporting.md rename to docs/plugins/Binary-Exporting.md diff --git a/docs/Binary-Format-Complexity-Abstraction.md b/docs/plugins/Binary-Format-Complexity-Abstraction.md similarity index 100% rename from docs/Binary-Format-Complexity-Abstraction.md rename to docs/plugins/Binary-Format-Complexity-Abstraction.md diff --git a/docs/Binary-Importing.md b/docs/plugins/Binary-Importing.md similarity index 100% rename from docs/Binary-Importing.md rename to docs/plugins/Binary-Importing.md diff --git a/docs/Binary-Overlay.md b/docs/plugins/Binary-Overlay.md similarity index 100% rename from docs/Binary-Overlay.md rename to docs/plugins/Binary-Overlay.md diff --git a/docs/Copy-Functionality.md b/docs/plugins/Copy-Functionality.md similarity index 100% rename from docs/Copy-Functionality.md rename to docs/plugins/Copy-Functionality.md diff --git a/docs/Create,-Duplicate,-and-Override.md b/docs/plugins/Create,-Duplicate,-and-Override.md similarity index 100% rename from docs/Create,-Duplicate,-and-Override.md rename to docs/plugins/Create,-Duplicate,-and-Override.md diff --git a/docs/Equality-Checks.md b/docs/plugins/Equality-Checks.md similarity index 100% rename from docs/Equality-Checks.md rename to docs/plugins/Equality-Checks.md diff --git a/docs/Flags-and-Enums.md b/docs/plugins/Flags-and-Enums.md similarity index 100% rename from docs/Flags-and-Enums.md rename to docs/plugins/Flags-and-Enums.md diff --git a/docs/Generated-Classes.md b/docs/plugins/Generated-Classes.md similarity index 100% rename from docs/Generated-Classes.md rename to docs/plugins/Generated-Classes.md diff --git a/docs/Interfaces-(Aspect-Link-Getters).md b/docs/plugins/Interfaces-(Aspect-Link-Getters).md similarity index 100% rename from docs/Interfaces-(Aspect-Link-Getters).md rename to docs/plugins/Interfaces-(Aspect-Link-Getters).md diff --git a/docs/Printing.md b/docs/plugins/Printing.md similarity index 100% rename from docs/Printing.md rename to docs/plugins/Printing.md diff --git a/docs/Translation-Masks.md b/docs/plugins/Translation-Masks.md similarity index 100% rename from docs/Translation-Masks.md rename to docs/plugins/Translation-Masks.md diff --git a/docs/Typical-Mod-Construction-and-Importing.md b/docs/plugins/Typical-Mod-Construction-and-Importing.md similarity index 100% rename from docs/Typical-Mod-Construction-and-Importing.md rename to docs/plugins/Typical-Mod-Construction-and-Importing.md diff --git a/docs/Plugin-Record-Suite.md b/docs/plugins/index.md similarity index 100% rename from docs/Plugin-Record-Suite.md rename to docs/plugins/index.md diff --git a/mkdocs.yml b/mkdocs.yml index 6aff0ab7b..c2a10064e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -48,22 +48,22 @@ nav: - Home: index.md - Big Cheat Sheet: Big-Cheat-Sheet.md - Plugin Record Suite: - - Plugin-Record-Suite.md - - Generated Classes: Generated-Classes.md - - Binary Importing: Binary-Importing.md - - Binary Overlay: Binary-Overlay.md - - Interfaces (Aspect/Link/Getters): Interfaces-(Aspect-Link-Getters).md - - Copy Functionality: Copy-Functionality.md - - Binary Exporting: Binary-Exporting.md - - Equality Checks: Equality-Checks.md - - Translation Masks: Translation-Masks.md - - Flags and Enums: Flags-and-Enums.md - - Asset Links: AssetLink.md - - Binary Format Complexity Abstraction: Binary-Format-Complexity-Abstraction.md - - Create, Duplicate, and Override: Create,-Duplicate,-and-Override.md - - Abstract Subclassing: Abstract-Subclassing.md - - Printing: Printing.md - - Typical Mod Construction and Importing: Typical-Mod-Construction-and-Importing.md + - plugins/index.md + - Generated Classes: plugins/Generated-Classes.md + - Binary Importing: plugins/Binary-Importing.md + - Binary Overlay: plugins/Binary-Overlay.md + - Interfaces (Aspect/Link/Getters): plugins/Interfaces-(Aspect-Link-Getters).md + - Copy Functionality: plugins/Copy-Functionality.md + - Binary Exporting: plugins/Binary-Exporting.md + - Equality Checks: plugins/Equality-Checks.md + - Translation Masks: plugins/Translation-Masks.md + - Flags and Enums: plugins/Flags-and-Enums.md + - Asset Links: plugins/AssetLink.md + - Binary Format Complexity Abstraction: plugins/Binary-Format-Complexity-Abstraction.md + - Create, Duplicate, and Override: plugins/Create,-Duplicate,-and-Override.md + - Abstract Subclassing: plugins/Abstract-Subclassing.md + - Printing: plugins/Printing.md + - Typical Mod Construction and Importing: plugins/Typical-Mod-Construction-and-Importing.md - Environment: - Environment.md - Environment Construction: Environment-Construction.md @@ -107,5 +107,31 @@ nav: - ITPO Avoidance: ITPO-Avoidance.md - Reuse Translation Masks: Reuse-Translation-Masks.md - Modifying Groups Being Iterated: Modifying-Groups-Being-Iterated.md + # - Testing: + # - Auto Fixture: + # - Major Record Test Building: + - WPF Library: WPF-Library.md + - FormKey Picker: FormKey-Picker.md + - ModKey Picker: ModKey-Picker.md + # - Load Order Display + - Reflection Powered Settings: Reflection-Powered-Settings.md + - Adding Required Resources: Adding-Required-Resources.md + # - Dependency Injection: Dependency Injection + - FormKey Allocation/Persistence: FormKey-Allocation-and-Persistence.md + - Json: Json.md + - Low Level Tools: Low-Level-Tools.md + - Header Structs: Header-Structs.md + - Game Constants: Game-Constants.md + - Binary Streams: Binary-Streams.md + - Binary Utility: Binary-Utility.md + - Game Specific Documentation: + - Oblivion: + - Oblivion Aspect Interfaces: Oblivion-Aspect-Interfaces.md + - Oblivion Link Interfaces: Oblivion-Link-Interfaces.md + - Skyrim: + - Skyrim Perks: Skyrim-Perks.md + - Skyrim Aspect Interfaces: Skyrim-Aspect-Interfaces.md + - Skyrim Link Interfaces: Skyrim-Link-Interfaces.md + - Correctness: Correctness.md index: Pages/index.md \ No newline at end of file From 56b53c5491c33e928692b30b1455170d6705f0d7 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 01:21:26 -0500 Subject: [PATCH 110/135] docs --- .../{ => environment}/Environment-Construction.md | 0 docs/{ => environment}/Game-Locations.md | 0 docs/{Environment.md => environment/index.md} | 0 mkdocs.yml | 15 +++------------ 4 files changed, 3 insertions(+), 12 deletions(-) rename docs/{ => environment}/Environment-Construction.md (100%) rename docs/{ => environment}/Game-Locations.md (100%) rename docs/{Environment.md => environment/index.md} (100%) diff --git a/docs/Environment-Construction.md b/docs/environment/Environment-Construction.md similarity index 100% rename from docs/Environment-Construction.md rename to docs/environment/Environment-Construction.md diff --git a/docs/Game-Locations.md b/docs/environment/Game-Locations.md similarity index 100% rename from docs/Game-Locations.md rename to docs/environment/Game-Locations.md diff --git a/docs/Environment.md b/docs/environment/index.md similarity index 100% rename from docs/Environment.md rename to docs/environment/index.md diff --git a/mkdocs.yml b/mkdocs.yml index c2a10064e..adb94c539 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -65,9 +65,9 @@ nav: - Printing: plugins/Printing.md - Typical Mod Construction and Importing: plugins/Typical-Mod-Construction-and-Importing.md - Environment: - - Environment.md - - Environment Construction: Environment-Construction.md - - Game Locations: Game-Locations.md + - environment/index.md + - Environment Construction: environment/Environment-Construction.md + - Game Locations: environment/Game-Locations.md - Link Cache: - LinkCache.md - Record Lookup: Record-Lookup.md @@ -110,15 +110,6 @@ nav: # - Testing: # - Auto Fixture: # - Major Record Test Building: - - WPF Library: WPF-Library.md - - FormKey Picker: FormKey-Picker.md - - ModKey Picker: ModKey-Picker.md - # - Load Order Display - - Reflection Powered Settings: Reflection-Powered-Settings.md - - Adding Required Resources: Adding-Required-Resources.md - # - Dependency Injection: Dependency Injection - - FormKey Allocation/Persistence: FormKey-Allocation-and-Persistence.md - - Json: Json.md - Low Level Tools: Low-Level-Tools.md - Header Structs: Header-Structs.md - Game Constants: Game-Constants.md From 3fffeed9890bab7a38656219c563641c78e420eb Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 01:24:04 -0500 Subject: [PATCH 111/135] docs --- mkdocs.yml | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index adb94c539..0ddb1ecaf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -74,42 +74,31 @@ nav: - Mod Contexts: ModContexts.md - Previous Override Iteration: Previous-Override-Iteration.md - Load Order: - # - Load-Order.md - Winning Override Iteration: Winning-Overrides.md - # - Has Mod Assertions - # - Live File Monitoring - Archives (BSAs): Archives.md - Strings: - Translated Strings: Translated-Strings.md - # - Strings Overlays - Examples: - Print Some Content: Print-Some-Content.md - # - Accessing Known Records - # - Record Overrides and Duplication - Low Level Examples: Low-Level-Examples.md - Getting Familiar with C#: - Namespaces: Namespaces.md - # - Intellisense - Nullability to Indicate Record Presence: Nullability-to-Indicate-Record-Presence.md - # - Inspect Class Definitions - # - Debugging - Best Practices and Optimizations: - # - Getters Everywhere: - FormLinks Always Target Getter Interfaces: FormLinks-Always-Target-Getter-Interfaces.md - FormLinks vs EditorID as Identifiers: FormLinks-vs-EditorID-as-Identifiers.md - # - FormLinks vs FormID/FormKey as Identifiers: - # - Reference FormLinks By EditorID: - # - LinkCache Resolution Type Choice: - # - Lists vs HashSet: - Enumerable Laziness: Enumerable-Laziness.md - TryGet Concepts: TryGet-Concepts.md - # - Access Overlays Once: - ITPO Avoidance: ITPO-Avoidance.md - Reuse Translation Masks: Reuse-Translation-Masks.md - Modifying Groups Being Iterated: Modifying-Groups-Being-Iterated.md - # - Testing: - # - Auto Fixture: - # - Major Record Test Building: + - WPF Library: WPF-Library.md + - FormKey Picker: FormKey-Picker.md + - ModKey Picker: ModKey-Picker.md + - Reflection Powered Settings: Reflection-Powered-Settings.md + - Adding Required Resources: Adding-Required-Resources.md + - FormKey Allocation/Persistence: FormKey-Allocation-and-Persistence.md + - Json: Json.md - Low Level Tools: Low-Level-Tools.md - Header Structs: Header-Structs.md - Game Constants: Game-Constants.md From 253205f13c0f3cc603bb458a204114fdf0ae5b08 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 01:26:40 -0500 Subject: [PATCH 112/135] docs --- mkdocs.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index 0ddb1ecaf..e77db24fe 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -74,32 +74,54 @@ nav: - Mod Contexts: ModContexts.md - Previous Override Iteration: Previous-Override-Iteration.md - Load Order: + # - Load-Order.md - Winning Override Iteration: Winning-Overrides.md + # - Has Mod Assertions + # - Live File Monitoring - Archives (BSAs): Archives.md - Strings: - Translated Strings: Translated-Strings.md + # - Strings Overlays - Examples: - Print Some Content: Print-Some-Content.md + # - Accessing Known Records + # - Record Overrides and Duplication - Low Level Examples: Low-Level-Examples.md - Getting Familiar with C#: - Namespaces: Namespaces.md + # - Intellisense - Nullability to Indicate Record Presence: Nullability-to-Indicate-Record-Presence.md + # - Inspect Class Definitions + # - Debugging - Best Practices and Optimizations: + # - Getters Everywhere: - FormLinks Always Target Getter Interfaces: FormLinks-Always-Target-Getter-Interfaces.md - FormLinks vs EditorID as Identifiers: FormLinks-vs-EditorID-as-Identifiers.md + # - FormLinks vs FormID/FormKey as Identifiers: + # - Reference FormLinks By EditorID: + # - LinkCache Resolution Type Choice: + # - Lists vs HashSet: - Enumerable Laziness: Enumerable-Laziness.md - TryGet Concepts: TryGet-Concepts.md + # - Access Overlays Once: - ITPO Avoidance: ITPO-Avoidance.md - Reuse Translation Masks: Reuse-Translation-Masks.md - Modifying Groups Being Iterated: Modifying-Groups-Being-Iterated.md - - WPF Library: WPF-Library.md + # - Testing: + # - Auto Fixture: + # - Major Record Test Building: + - WPF Library: + - WPF-Library.md - FormKey Picker: FormKey-Picker.md - ModKey Picker: ModKey-Picker.md + # - Load Order Display - Reflection Powered Settings: Reflection-Powered-Settings.md - Adding Required Resources: Adding-Required-Resources.md + # - Dependency Injection: Dependency Injection - FormKey Allocation/Persistence: FormKey-Allocation-and-Persistence.md - Json: Json.md - - Low Level Tools: Low-Level-Tools.md + - Low Level Tools: + - Low-Level-Tools.md - Header Structs: Header-Structs.md - Game Constants: Game-Constants.md - Binary Streams: Binary-Streams.md From 6a58a4adcbee3c82c9c2d137bba8996280a7e046 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 01:49:12 -0500 Subject: [PATCH 113/135] Docs --- docs/Generic-Newing-or-Importing-Mods.md | 28 ------- docs/Testing-and-Correctness.md | 1 - .../Accessing-Known-Records.md} | 11 +-- .../Enumerable-Laziness.md | 0 .../FormLink-vs-FormLinkNullable.md | 5 +- ...rmLinks-Always-Target-Getter-Interfaces.md | 0 .../FormLinks-vs-EditorID-as-Identifiers.md | 0 .../Getters-Everywhere.md | 15 ++-- docs/{ => best-practices}/ITPO-Avoidance.md | 0 .../Modifying-Groups-Being-Iterated.md | 0 .../Reuse-Translation-Masks.md | 0 docs/{ => best-practices}/TryGet-Concepts.md | 0 docs/{ => examples}/Low-Level-Examples.md | 0 docs/{ => examples}/Print-Some-Content.md | 0 docs/{ => familiar}/Namespaces.md | 0 ...Nullability-to-Indicate-Record-Presence.md | 0 .../Oblivion-Aspect-Interfaces.md | 0 .../Oblivion-Link-Interfaces.md | 0 .../Skyrim-Aspect-Interfaces.md | 0 .../Skyrim-Link-Interfaces.md | 0 docs/{ => game-specific}/Skyrim-Perks.md | 0 docs/{ => linkcache}/ModContexts.md | 0 .../Previous-Override-Iteration.md | 0 docs/{ => linkcache}/Record-Lookup.md | 0 docs/{LinkCache.md => linkcache/index.md} | 0 docs/{ => loadorder}/Winning-Overrides.md | 0 docs/{Load-Order.md => loadorder/index.md} | 0 docs/{ => lowlevel}/Binary-Streams.md | 0 docs/{ => lowlevel}/Binary-Utility.md | 0 docs/{ => lowlevel}/C#-Span.md | 11 +-- docs/{ => lowlevel}/Game-Constants.md | 0 docs/{ => lowlevel}/Header-Structs.md | 0 .../{Low-Level-Tools.md => lowlevel/index.md} | 0 .../ModKey,-FormKey,-FormLink.md | 0 docs/{ => strings}/Translated-Strings.md | 0 docs/{ => top}/Archives.md | 0 docs/{ => top}/Big-Cheat-Sheet.md | 0 docs/{ => top}/Correctness.md | 0 docs/{ => top}/Json.md | 0 docs/{ => wpf}/Adding-Required-Resources.md | 0 docs/{ => wpf}/FormKey-Picker.md | 0 docs/{ => wpf}/ModKey-Picker.md | 0 docs/{ => wpf}/Reflection-Powered-Settings.md | 0 docs/{WPF-Library.md => wpf/index.md} | 0 mkdocs.yml | 81 ++++++++++--------- 45 files changed, 65 insertions(+), 87 deletions(-) delete mode 100644 docs/Generic-Newing-or-Importing-Mods.md delete mode 100644 docs/Testing-and-Correctness.md rename docs/{Accessing-Known-Records => best-practices/Accessing-Known-Records.md} (94%) rename docs/{ => best-practices}/Enumerable-Laziness.md (100%) rename docs/{ => best-practices}/FormLink-vs-FormLinkNullable.md (95%) rename docs/{ => best-practices}/FormLinks-Always-Target-Getter-Interfaces.md (100%) rename docs/{ => best-practices}/FormLinks-vs-EditorID-as-Identifiers.md (100%) rename docs/{ => best-practices}/Getters-Everywhere.md (94%) rename docs/{ => best-practices}/ITPO-Avoidance.md (100%) rename docs/{ => best-practices}/Modifying-Groups-Being-Iterated.md (100%) rename docs/{ => best-practices}/Reuse-Translation-Masks.md (100%) rename docs/{ => best-practices}/TryGet-Concepts.md (100%) rename docs/{ => examples}/Low-Level-Examples.md (100%) rename docs/{ => examples}/Print-Some-Content.md (100%) rename docs/{ => familiar}/Namespaces.md (100%) rename docs/{ => familiar}/Nullability-to-Indicate-Record-Presence.md (100%) rename docs/{ => game-specific}/Oblivion-Aspect-Interfaces.md (100%) rename docs/{ => game-specific}/Oblivion-Link-Interfaces.md (100%) rename docs/{ => game-specific}/Skyrim-Aspect-Interfaces.md (100%) rename docs/{ => game-specific}/Skyrim-Link-Interfaces.md (100%) rename docs/{ => game-specific}/Skyrim-Perks.md (100%) rename docs/{ => linkcache}/ModContexts.md (100%) rename docs/{ => linkcache}/Previous-Override-Iteration.md (100%) rename docs/{ => linkcache}/Record-Lookup.md (100%) rename docs/{LinkCache.md => linkcache/index.md} (100%) rename docs/{ => loadorder}/Winning-Overrides.md (100%) rename docs/{Load-Order.md => loadorder/index.md} (100%) rename docs/{ => lowlevel}/Binary-Streams.md (100%) rename docs/{ => lowlevel}/Binary-Utility.md (100%) rename docs/{ => lowlevel}/C#-Span.md (96%) rename docs/{ => lowlevel}/Game-Constants.md (100%) rename docs/{ => lowlevel}/Header-Structs.md (100%) rename docs/{Low-Level-Tools.md => lowlevel/index.md} (100%) rename docs/{ => plugins}/ModKey,-FormKey,-FormLink.md (100%) rename docs/{ => strings}/Translated-Strings.md (100%) rename docs/{ => top}/Archives.md (100%) rename docs/{ => top}/Big-Cheat-Sheet.md (100%) rename docs/{ => top}/Correctness.md (100%) rename docs/{ => top}/Json.md (100%) rename docs/{ => wpf}/Adding-Required-Resources.md (100%) rename docs/{ => wpf}/FormKey-Picker.md (100%) rename docs/{ => wpf}/ModKey-Picker.md (100%) rename docs/{ => wpf}/Reflection-Powered-Settings.md (100%) rename docs/{WPF-Library.md => wpf/index.md} (100%) diff --git a/docs/Generic-Newing-or-Importing-Mods.md b/docs/Generic-Newing-or-Importing-Mods.md deleted file mode 100644 index 45efd0894..000000000 --- a/docs/Generic-Newing-or-Importing-Mods.md +++ /dev/null @@ -1,28 +0,0 @@ -# Typical Mod Construction and Importing -If you're only dealing with one game, then code like this is typical: -```cs -public void SomeFunction() -{ - var newMod = new SkyrimMod(ModKey.FromFileName("MyMod.esp"), SkyrimRelease.SkyrimSE); - - var mutableInputMod = SkyrimMod.CreateFromBinary(inputPath, SkyrimRelease.SkyrimSE); - - using var readOnlyInputMod = SkyrimMod.CreateFromBinaryOverlay(inputPath, SkyrimRelease.SkyrimSE); -} -``` - -# Generic Variants -If you're intending to work on many game types in generic code, then the above code won't work well. Instead, it looks like: -```cs -public void SomeFunction(GameRelease release, ModPath inputPath) - where TMod : IModGetter -{ - var newMod = ModInstantiator.Activator(ModKey.FromFileName("MyMod.esp"), release); - - var importedMod = ModInstantiator.Importer(inputPath, release); -} -``` -In this way, this function does not need to know whether it's a SkyrimMod, or a Fallout4Mod. This of course, comes with the downside of only being able to interact with the object as much as the TMod constraint allows. You would not be able to access the Water group, for example, as it's uncertain if the mod in question has those. - -## Getter vs Setter -If the constraint `TMod` is only a Getter interface, then `ModInstantiator.Importer` will return a binary overlay underlying object. If it's a setter constraint, then it must be backed by a fully imported mutable object. diff --git a/docs/Testing-and-Correctness.md b/docs/Testing-and-Correctness.md deleted file mode 100644 index b1a085455..000000000 --- a/docs/Testing-and-Correctness.md +++ /dev/null @@ -1 +0,0 @@ -# Pre-Processors diff --git a/docs/Accessing-Known-Records b/docs/best-practices/Accessing-Known-Records.md similarity index 94% rename from docs/Accessing-Known-Records rename to docs/best-practices/Accessing-Known-Records.md index 23cc72e5b..33939dc21 100644 --- a/docs/Accessing-Known-Records +++ b/docs/best-practices/Accessing-Known-Records.md @@ -1,4 +1,5 @@ -# Recommended Patterns +# Accessing Known Records +## Recommended Patterns Often, especially for base master files like `Skyrim.esm`, there are specific records that you want to look up. The recommended strategy is to use the [FormKeys library](https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys), which lets you refer to records by EditorID, while still using FormKeys under the hood: @@ -13,9 +14,9 @@ if (Skyrim.Race.ArgonianRace.TryResolve(env.LinkCache, out var race)) The following sections will outline the alternatives and reasoning for the recommended best practices. -# Desire To Access Known Records +## Desire To Access Known Records -## By FormKey +### By FormKey For example, if you wanted to look up the Argonian Race record, you might do the following: ```cs var env = ...; // Some environment, like Synthesis, or Mutagen's GameEnvironment @@ -36,7 +37,7 @@ However, there's a few annoyances: - The only indication that `123456` points to the argonian race is to look it up and check, or hope the variable is named something intelligent (like `argonianRaceFormKey`) - Potential for typos. What if it was actually `123457` and got mis-copied? -## EditorID +### EditorID EditorIDs are a common alternative for looking up records, as they are human readable. ```cs @@ -50,5 +51,5 @@ if (env.LinkCache.TryResolve("ArgonianRace", out var race)) However, they are not recommended for general use, for the reasons [outlined here](https://github.com/Mutagen-Modding/Mutagen/wiki/FormLinks-vs-EditorID-as-Identifiers). -# Neither is Ideal +## Neither is Ideal Neither direct FormKeys or EditorIDs are ideal for looking up known records. This is why the recommended pattern is to use the [FormLinks library](https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys) to bridge the gap and get the best of both worlds diff --git a/docs/Enumerable-Laziness.md b/docs/best-practices/Enumerable-Laziness.md similarity index 100% rename from docs/Enumerable-Laziness.md rename to docs/best-practices/Enumerable-Laziness.md diff --git a/docs/FormLink-vs-FormLinkNullable.md b/docs/best-practices/FormLink-vs-FormLinkNullable.md similarity index 95% rename from docs/FormLink-vs-FormLinkNullable.md rename to docs/best-practices/FormLink-vs-FormLinkNullable.md index d526977ca..3791eb0ed 100644 --- a/docs/FormLink-vs-FormLinkNullable.md +++ b/docs/best-practices/FormLink-vs-FormLinkNullable.md @@ -1,15 +1,16 @@ +# FormLink vs FormLinkNullable FormLinks are used widely as a strongly typed identifier of a record, as an alternative to FormID, EditorID, or even FormKey. When using them, though, there are two variants: - `FormLink` - `FormLinkNullable` -# Which You Should Use +## Which You Should Use Generally, the answer is you should always use `FormLink`, rather than `FormLinkNullable`. Mutagen exposes `FormLinkNullable` in certain areas, but you yourself should rarely if ever decide to create a `FormLinkNullable` when writing your own code. -# What is FormLinkNullable +## What is FormLinkNullable If you shouldn't use it, what is `FormLinkNullable` for? It is used by Mutagen itself to expose a very specific difference in how FormIDs can be null within a binary file on the disk. diff --git a/docs/FormLinks-Always-Target-Getter-Interfaces.md b/docs/best-practices/FormLinks-Always-Target-Getter-Interfaces.md similarity index 100% rename from docs/FormLinks-Always-Target-Getter-Interfaces.md rename to docs/best-practices/FormLinks-Always-Target-Getter-Interfaces.md diff --git a/docs/FormLinks-vs-EditorID-as-Identifiers.md b/docs/best-practices/FormLinks-vs-EditorID-as-Identifiers.md similarity index 100% rename from docs/FormLinks-vs-EditorID-as-Identifiers.md rename to docs/best-practices/FormLinks-vs-EditorID-as-Identifiers.md diff --git a/docs/Getters-Everywhere.md b/docs/best-practices/Getters-Everywhere.md similarity index 94% rename from docs/Getters-Everywhere.md rename to docs/best-practices/Getters-Everywhere.md index 1b9fc8dcf..62074534d 100644 --- a/docs/Getters-Everywhere.md +++ b/docs/best-practices/Getters-Everywhere.md @@ -1,4 +1,5 @@ -# Overview +# Getters Everywhere +## Overview Mutagen offers up records in several ways. Consider dealing with an Npc, it would offer: - `Npc` class. A class with all the fields an Npc has - `INpc` interface. An interface with all the fields an Npc has. The class implements this. @@ -6,7 +7,7 @@ Mutagen offers up records in several ways. Consider dealing with an Npc, it wou In most example code and projects you look at, most of the code will be dealing with `INpcGetter`, and you should too. -# Best Practices +## Best Practices The best practice is to have your code interact with Getter interfaces as much as possible. Only at the last moment when you're sure you want to override a record and export it would you convert it to a settable version. A typical example: @@ -24,16 +25,16 @@ foreach (INpcGetter npcGetter in env.LoadOrder.PriorityOrder.Npc().WinningOverri } ``` -# Reasoning -## Readonly Increases Speed +## Reasoning +### Readonly Increases Speed A lot of Mutagen's speed comes from short circuiting unnecessary work. A big way it does this is by exposing records via [Binary Overlays](https://github.com/Mutagen-Modding/Mutagen/wiki/Binary-Overlay). These are record objects that are very lightweight and fast. But one of their downsides is they are read only. As soon as you want to modify something, you have to first convert it to a settable version of the record. This means creating a more "normal" settable `Npc` class, and reading ALL the data within that record to fill out each field one by one. This is often a waste of time. Take a look at our original example, if the Npc in question has a Level higher than 5, then all that work and time of reading the other fields is wasted. Once we find out the level is higher than 5, we no longer care about it anymore, and would prefer to have not parsed any of the other data. This is just one small example where it is preferable to remain in the parse-on-demand readonly mode as long as possible. -## Adds Clearer Intention to Modifications -### A Fully Mutable Ecosystem Has Easy Pitfalls +### Adds Clearer Intention to Modifications +#### A Fully Mutable Ecosystem Has Easy Pitfalls Let's pretend for a moment that all records were mutable within the entire ecosystem. This can easily lead to some very subtle bug prone situations. ```cs @@ -53,7 +54,7 @@ The above logic has some unexpected and probably undesirable side effects. We n Skyrim.esm should not be so easily modified. We wanted to modify Orthorn as it was defined in our outgoing patch. Skyrim.esm should be more or less immutable unless we take explicit intentional steps to do so. -### Initially Immutable Environment Encourages Clearer Intentions +#### Initially Immutable Environment Encourages Clearer Intentions Take the same situation, but in the actual ecosystem that provides getter interfaces by default: ```cs // Retrieve an Npc from Skyrim.esm diff --git a/docs/ITPO-Avoidance.md b/docs/best-practices/ITPO-Avoidance.md similarity index 100% rename from docs/ITPO-Avoidance.md rename to docs/best-practices/ITPO-Avoidance.md diff --git a/docs/Modifying-Groups-Being-Iterated.md b/docs/best-practices/Modifying-Groups-Being-Iterated.md similarity index 100% rename from docs/Modifying-Groups-Being-Iterated.md rename to docs/best-practices/Modifying-Groups-Being-Iterated.md diff --git a/docs/Reuse-Translation-Masks.md b/docs/best-practices/Reuse-Translation-Masks.md similarity index 100% rename from docs/Reuse-Translation-Masks.md rename to docs/best-practices/Reuse-Translation-Masks.md diff --git a/docs/TryGet-Concepts.md b/docs/best-practices/TryGet-Concepts.md similarity index 100% rename from docs/TryGet-Concepts.md rename to docs/best-practices/TryGet-Concepts.md diff --git a/docs/Low-Level-Examples.md b/docs/examples/Low-Level-Examples.md similarity index 100% rename from docs/Low-Level-Examples.md rename to docs/examples/Low-Level-Examples.md diff --git a/docs/Print-Some-Content.md b/docs/examples/Print-Some-Content.md similarity index 100% rename from docs/Print-Some-Content.md rename to docs/examples/Print-Some-Content.md diff --git a/docs/Namespaces.md b/docs/familiar/Namespaces.md similarity index 100% rename from docs/Namespaces.md rename to docs/familiar/Namespaces.md diff --git a/docs/Nullability-to-Indicate-Record-Presence.md b/docs/familiar/Nullability-to-Indicate-Record-Presence.md similarity index 100% rename from docs/Nullability-to-Indicate-Record-Presence.md rename to docs/familiar/Nullability-to-Indicate-Record-Presence.md diff --git a/docs/Oblivion-Aspect-Interfaces.md b/docs/game-specific/Oblivion-Aspect-Interfaces.md similarity index 100% rename from docs/Oblivion-Aspect-Interfaces.md rename to docs/game-specific/Oblivion-Aspect-Interfaces.md diff --git a/docs/Oblivion-Link-Interfaces.md b/docs/game-specific/Oblivion-Link-Interfaces.md similarity index 100% rename from docs/Oblivion-Link-Interfaces.md rename to docs/game-specific/Oblivion-Link-Interfaces.md diff --git a/docs/Skyrim-Aspect-Interfaces.md b/docs/game-specific/Skyrim-Aspect-Interfaces.md similarity index 100% rename from docs/Skyrim-Aspect-Interfaces.md rename to docs/game-specific/Skyrim-Aspect-Interfaces.md diff --git a/docs/Skyrim-Link-Interfaces.md b/docs/game-specific/Skyrim-Link-Interfaces.md similarity index 100% rename from docs/Skyrim-Link-Interfaces.md rename to docs/game-specific/Skyrim-Link-Interfaces.md diff --git a/docs/Skyrim-Perks.md b/docs/game-specific/Skyrim-Perks.md similarity index 100% rename from docs/Skyrim-Perks.md rename to docs/game-specific/Skyrim-Perks.md diff --git a/docs/ModContexts.md b/docs/linkcache/ModContexts.md similarity index 100% rename from docs/ModContexts.md rename to docs/linkcache/ModContexts.md diff --git a/docs/Previous-Override-Iteration.md b/docs/linkcache/Previous-Override-Iteration.md similarity index 100% rename from docs/Previous-Override-Iteration.md rename to docs/linkcache/Previous-Override-Iteration.md diff --git a/docs/Record-Lookup.md b/docs/linkcache/Record-Lookup.md similarity index 100% rename from docs/Record-Lookup.md rename to docs/linkcache/Record-Lookup.md diff --git a/docs/LinkCache.md b/docs/linkcache/index.md similarity index 100% rename from docs/LinkCache.md rename to docs/linkcache/index.md diff --git a/docs/Winning-Overrides.md b/docs/loadorder/Winning-Overrides.md similarity index 100% rename from docs/Winning-Overrides.md rename to docs/loadorder/Winning-Overrides.md diff --git a/docs/Load-Order.md b/docs/loadorder/index.md similarity index 100% rename from docs/Load-Order.md rename to docs/loadorder/index.md diff --git a/docs/Binary-Streams.md b/docs/lowlevel/Binary-Streams.md similarity index 100% rename from docs/Binary-Streams.md rename to docs/lowlevel/Binary-Streams.md diff --git a/docs/Binary-Utility.md b/docs/lowlevel/Binary-Utility.md similarity index 100% rename from docs/Binary-Utility.md rename to docs/lowlevel/Binary-Utility.md diff --git a/docs/C#-Span.md b/docs/lowlevel/C#-Span.md similarity index 96% rename from docs/C#-Span.md rename to docs/lowlevel/C#-Span.md index 37b0b447b..211644c2b 100644 --- a/docs/C#-Span.md +++ b/docs/lowlevel/C#-Span.md @@ -1,8 +1,9 @@ +# C# Span `Span`s are not a Mutagen concept, but rather a general C# concept. However, since they are used extensively by Mutagen's parsing systems and they are a newer concept just recently added to C#, it will be covered to some extent here. If you are more interested in Mutagen-specific concepts, you can skip this section. -# Spans are Sub-Sections of Arrays +## Spans are Sub-Sections of Arrays A `Span` is very similar to a `T[]`. It points to a spot in memory where T objects reside, like an array. Consider using a typical array, however, where you wanted some logic to process just a subsection of it. You would either have to: 1) Pass the array to a function, with `start` and `end` indices of where you wanted to process. 2) Make a new smaller array, and copy the data over, using that array with just the interesting data to represent a "subsection" of the original array. @@ -24,7 +25,7 @@ evenSmallerSection[1] = 123; Changing the value in `evenSmallerSection` will affect all others; They point to the same underlying array and space in memory. -# Faster Substring Alternative +## Faster Substring Alternative Trimming off or grabbing a few characters on a `string` using Substring() means allocating a whole 2nd string with mostly the same data, just some characters trimmed off. This is a fairly wasteful operation. `Span` concepts are great for Substring logic, as the original `string` memory can be reused while Span just points to small substrings of the original string without copies or new allocations. @@ -51,7 +52,7 @@ System.Console.WriteLine(result.ToString()); // Additionally, the WriteLine() API might be upgraded in C# to eventually take ReadOnlySpan as input, too ``` -# Interpreting Data as Another Type +## Interpreting Data as Another Type Another cool trick `Span`s can do is overlay on top of a `byte[]` a `Span` of a different type: ```cs byte[] someBytes = new byte[16]; @@ -76,7 +77,7 @@ for (int i = 0 ; i < uintSpan.Length ; i++) // All bytes in someBytes now contain 255 / 0xFF ``` -# Parsing Data from Span +## Parsing Data from Span Numeric primitives can be extracted from a `Span` fairly easily: ```cs Span span = ...; @@ -100,7 +101,7 @@ string str = BinaryStringUtility.ProcessWholeToZString(span); str = BinaryStringUtility.ToZString(span.Slice(11, 23)); ``` -# MemorySlice Alternative for Non-Stack Usage +## MemorySlice Alternative for Non-Stack Usage One of the major downsides of `Span` is that it is a `ref struct` which can only "live" on the stack. This means it cannot be a member of a class, or even be associated with async/await concepts, among other things. In this case, `MemorySlice` is an alternative concept (subsection of an array) that can live outside of the stack. diff --git a/docs/Game-Constants.md b/docs/lowlevel/Game-Constants.md similarity index 100% rename from docs/Game-Constants.md rename to docs/lowlevel/Game-Constants.md diff --git a/docs/Header-Structs.md b/docs/lowlevel/Header-Structs.md similarity index 100% rename from docs/Header-Structs.md rename to docs/lowlevel/Header-Structs.md diff --git a/docs/Low-Level-Tools.md b/docs/lowlevel/index.md similarity index 100% rename from docs/Low-Level-Tools.md rename to docs/lowlevel/index.md diff --git a/docs/ModKey,-FormKey,-FormLink.md b/docs/plugins/ModKey,-FormKey,-FormLink.md similarity index 100% rename from docs/ModKey,-FormKey,-FormLink.md rename to docs/plugins/ModKey,-FormKey,-FormLink.md diff --git a/docs/Translated-Strings.md b/docs/strings/Translated-Strings.md similarity index 100% rename from docs/Translated-Strings.md rename to docs/strings/Translated-Strings.md diff --git a/docs/Archives.md b/docs/top/Archives.md similarity index 100% rename from docs/Archives.md rename to docs/top/Archives.md diff --git a/docs/Big-Cheat-Sheet.md b/docs/top/Big-Cheat-Sheet.md similarity index 100% rename from docs/Big-Cheat-Sheet.md rename to docs/top/Big-Cheat-Sheet.md diff --git a/docs/Correctness.md b/docs/top/Correctness.md similarity index 100% rename from docs/Correctness.md rename to docs/top/Correctness.md diff --git a/docs/Json.md b/docs/top/Json.md similarity index 100% rename from docs/Json.md rename to docs/top/Json.md diff --git a/docs/Adding-Required-Resources.md b/docs/wpf/Adding-Required-Resources.md similarity index 100% rename from docs/Adding-Required-Resources.md rename to docs/wpf/Adding-Required-Resources.md diff --git a/docs/FormKey-Picker.md b/docs/wpf/FormKey-Picker.md similarity index 100% rename from docs/FormKey-Picker.md rename to docs/wpf/FormKey-Picker.md diff --git a/docs/ModKey-Picker.md b/docs/wpf/ModKey-Picker.md similarity index 100% rename from docs/ModKey-Picker.md rename to docs/wpf/ModKey-Picker.md diff --git a/docs/Reflection-Powered-Settings.md b/docs/wpf/Reflection-Powered-Settings.md similarity index 100% rename from docs/Reflection-Powered-Settings.md rename to docs/wpf/Reflection-Powered-Settings.md diff --git a/docs/WPF-Library.md b/docs/wpf/index.md similarity index 100% rename from docs/WPF-Library.md rename to docs/wpf/index.md diff --git a/mkdocs.yml b/mkdocs.yml index e77db24fe..f4edc5023 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -46,9 +46,10 @@ theme: nav: - Home: index.md - - Big Cheat Sheet: Big-Cheat-Sheet.md + - Big Cheat Sheet: top/Big-Cheat-Sheet.md - Plugin Record Suite: - plugins/index.md + - ModKey, FormKey, FormLink: plugins/ModKey,-FormKey,-FormLink.md - Generated Classes: plugins/Generated-Classes.md - Binary Importing: plugins/Binary-Importing.md - Binary Overlay: plugins/Binary-Overlay.md @@ -69,71 +70,73 @@ nav: - Environment Construction: environment/Environment-Construction.md - Game Locations: environment/Game-Locations.md - Link Cache: - - LinkCache.md - - Record Lookup: Record-Lookup.md - - Mod Contexts: ModContexts.md - - Previous Override Iteration: Previous-Override-Iteration.md + - linkcache/index.md + - Record Lookup: linkcache/Record-Lookup.md + - Mod Contexts: linkcache/ModContexts.md + - Previous Override Iteration: linkcache/Previous-Override-Iteration.md - Load Order: - # - Load-Order.md - - Winning Override Iteration: Winning-Overrides.md + - loadorder/index.md + - Winning Override Iteration: loadorder/Winning-Overrides.md # - Has Mod Assertions # - Live File Monitoring - - Archives (BSAs): Archives.md + - Archives (BSAs): top/Archives.md - Strings: - - Translated Strings: Translated-Strings.md + - Translated Strings: strings/Translated-Strings.md # - Strings Overlays - Examples: - - Print Some Content: Print-Some-Content.md - # - Accessing Known Records + - Print Some Content: examples/Print-Some-Content.md # - Record Overrides and Duplication - - Low Level Examples: Low-Level-Examples.md + - Low Level Examples: examples/Low-Level-Examples.md - Getting Familiar with C#: - - Namespaces: Namespaces.md + - Namespaces: familiar/Namespaces.md # - Intellisense - - Nullability to Indicate Record Presence: Nullability-to-Indicate-Record-Presence.md + - Nullability to Indicate Record Presence: familiar/Nullability-to-Indicate-Record-Presence.md # - Inspect Class Definitions # - Debugging - Best Practices and Optimizations: - # - Getters Everywhere: - - FormLinks Always Target Getter Interfaces: FormLinks-Always-Target-Getter-Interfaces.md - - FormLinks vs EditorID as Identifiers: FormLinks-vs-EditorID-as-Identifiers.md + - Getters Everywhere: best-practices/Getters-Everywhere.md + - Accessing Known Records: best-practices/Accessing-Known-Records.md + - FormLinks Always Target Getter Interfaces: best-practices/FormLinks-Always-Target-Getter-Interfaces.md + - FormLinks vs EditorID as Identifiers: best-practices/FormLinks-vs-EditorID-as-Identifiers.md + - FormLink vs FormLinkNullable: best-practices/FormLink-vs-FormLinkNullable.md # - FormLinks vs FormID/FormKey as Identifiers: # - Reference FormLinks By EditorID: # - LinkCache Resolution Type Choice: # - Lists vs HashSet: - - Enumerable Laziness: Enumerable-Laziness.md - - TryGet Concepts: TryGet-Concepts.md + - Enumerable Laziness: best-practices/Enumerable-Laziness.md + - TryGet Concepts: best-practices/TryGet-Concepts.md # - Access Overlays Once: - - ITPO Avoidance: ITPO-Avoidance.md - - Reuse Translation Masks: Reuse-Translation-Masks.md - - Modifying Groups Being Iterated: Modifying-Groups-Being-Iterated.md + - ITPO Avoidance: best-practices/ITPO-Avoidance.md + - Reuse Translation Masks: best-practices/Reuse-Translation-Masks.md + - Modifying Groups Being Iterated: best-practices/Modifying-Groups-Being-Iterated.md # - Testing: # - Auto Fixture: # - Major Record Test Building: - WPF Library: - - WPF-Library.md - - FormKey Picker: FormKey-Picker.md - - ModKey Picker: ModKey-Picker.md + - wpf/index.md + - FormKey Picker: wpf/FormKey-Picker.md + - ModKey Picker: wpf/ModKey-Picker.md # - Load Order Display - - Reflection Powered Settings: Reflection-Powered-Settings.md - - Adding Required Resources: Adding-Required-Resources.md + - Reflection Powered Settings: wpf/Reflection-Powered-Settings.md + - Adding Required Resources: wpf/Adding-Required-Resources.md # - Dependency Injection: Dependency Injection - FormKey Allocation/Persistence: FormKey-Allocation-and-Persistence.md - - Json: Json.md + - Json: top/Json.md - Low Level Tools: - - Low-Level-Tools.md - - Header Structs: Header-Structs.md - - Game Constants: Game-Constants.md - - Binary Streams: Binary-Streams.md - - Binary Utility: Binary-Utility.md + - index.md + - C# Span: lowlevel/C#-Span.md + - Header Structs: lowlevel/Header-Structs.md + - Game Constants: lowlevel/Game-Constants.md + - Binary Streams: lowlevel/Binary-Streams.md + - Binary Utility: lowlevel/Binary-Utility.md - Game Specific Documentation: - Oblivion: - - Oblivion Aspect Interfaces: Oblivion-Aspect-Interfaces.md - - Oblivion Link Interfaces: Oblivion-Link-Interfaces.md + - Oblivion Aspect Interfaces: game-specific/Oblivion-Aspect-Interfaces.md + - Oblivion Link Interfaces: game-specific/Oblivion-Link-Interfaces.md - Skyrim: - - Skyrim Perks: Skyrim-Perks.md - - Skyrim Aspect Interfaces: Skyrim-Aspect-Interfaces.md - - Skyrim Link Interfaces: Skyrim-Link-Interfaces.md - - Correctness: Correctness.md + - Skyrim Perks: game-specific/Skyrim-Perks.md + - Skyrim Aspect Interfaces: game-specific/Skyrim-Aspect-Interfaces.md + - Skyrim Link Interfaces: game-specific/Skyrim-Link-Interfaces.md + - Correctness: top/Correctness.md index: Pages/index.md \ No newline at end of file From e7051dbefedc13ffd22424b91d5b4d96c85325f8 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 01:53:51 -0500 Subject: [PATCH 114/135] docs --- docs/best-practices/Accessing-Known-Records.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/best-practices/Accessing-Known-Records.md b/docs/best-practices/Accessing-Known-Records.md index 33939dc21..89bed8f3d 100644 --- a/docs/best-practices/Accessing-Known-Records.md +++ b/docs/best-practices/Accessing-Known-Records.md @@ -49,7 +49,7 @@ if (env.LinkCache.TryResolve("ArgonianRace", out var race)) } ``` -However, they are not recommended for general use, for the reasons [outlined here](https://github.com/Mutagen-Modding/Mutagen/wiki/FormLinks-vs-EditorID-as-Identifiers). +However, they are not recommended for general use, for the reasons [outlined here](FormLinks-vs-EditorID-as-Identifiers.md). ## Neither is Ideal Neither direct FormKeys or EditorIDs are ideal for looking up known records. This is why the recommended pattern is to use the [FormLinks library](https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys) to bridge the gap and get the best of both worlds From e455b731215a30c44d79f7e2dfefcd94bbab2066 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 02:34:57 -0500 Subject: [PATCH 115/135] docs --- ...rmLinks-Always-Target-Getter-Interfaces.md | 4 ++-- .../FormLinks-vs-EditorID-as-Identifiers.md | 2 +- docs/best-practices/Getters-Everywhere.md | 2 +- docs/environment/Environment-Construction.md | 2 +- docs/environment/index.md | 4 ++-- docs/examples/Print-Some-Content.md | 4 +--- .../Oblivion-Aspect-Interfaces.md | 0 .../Oblivion-Link-Interfaces.md | 0 .../{ => skyrim}/Skyrim-Aspect-Interfaces.md | 0 .../{ => skyrim}/Skyrim-Link-Interfaces.md | 0 .../{ => skyrim}/Skyrim-Perks.md | 0 docs/linkcache/ModContexts.md | 2 +- docs/linkcache/Previous-Override-Iteration.md | 8 ++++---- docs/linkcache/Record-Lookup.md | 4 ++-- docs/linkcache/index.md | 10 +++++----- docs/loadorder/Winning-Overrides.md | 6 +++--- docs/loadorder/index.md | 6 +++--- docs/lowlevel/Binary-Streams.md | 2 +- docs/lowlevel/Binary-Utility.md | 4 ++-- docs/lowlevel/Header-Structs.md | 4 ++-- docs/lowlevel/index.md | 4 ++-- .../Binary-Format-Complexity-Abstraction.md | 2 +- docs/plugins/Binary-Importing.md | 2 +- docs/plugins/Binary-Overlay.md | 2 +- .../Create,-Duplicate,-and-Override.md | 6 +++--- docs/plugins/Flags-and-Enums.md | 2 +- .../FormKey-Allocation-and-Persistence.md | 0 .../Interfaces-(Aspect-Link-Getters).md | 5 ++--- docs/plugins/ModKey,-FormKey,-FormLink.md | 2 +- docs/top/Big-Cheat-Sheet.md | 20 +++++++++---------- docs/wpf/FormKey-Picker.md | 4 ++-- docs/wpf/ModKey-Picker.md | 4 ++-- docs/wpf/Reflection-Powered-Settings.md | 2 +- mkdocs.yml | 11 +++++----- 34 files changed, 64 insertions(+), 66 deletions(-) rename docs/game-specific/{ => oblivion}/Oblivion-Aspect-Interfaces.md (100%) rename docs/game-specific/{ => oblivion}/Oblivion-Link-Interfaces.md (100%) rename docs/game-specific/{ => skyrim}/Skyrim-Aspect-Interfaces.md (100%) rename docs/game-specific/{ => skyrim}/Skyrim-Link-Interfaces.md (100%) rename docs/game-specific/{ => skyrim}/Skyrim-Perks.md (100%) rename docs/{ => plugins}/FormKey-Allocation-and-Persistence.md (100%) diff --git a/docs/best-practices/FormLinks-Always-Target-Getter-Interfaces.md b/docs/best-practices/FormLinks-Always-Target-Getter-Interfaces.md index 9342c035d..8b31825a2 100644 --- a/docs/best-practices/FormLinks-Always-Target-Getter-Interfaces.md +++ b/docs/best-practices/FormLinks-Always-Target-Getter-Interfaces.md @@ -18,7 +18,7 @@ The above still has the generic targeting the getter interface `INpcGetter`, whi ## Why -Consider a [LinkCache resolve](https://github.com/Mutagen-Modding/Mutagen/wiki/Record-Lookup). A FormLink and a LinkCache are combined to look up a record with a specific FormKey and Type. +Consider a [LinkCache resolve](../linkcache/Record-Lookup.md). A FormLink and a LinkCache are combined to look up a record with a specific FormKey and Type. Using a non-getter interface is less ideal, because it limits the scope that the LinkCache can match against. This might result in a failure to match where it might find the Npc with the target FormKey, but not be able to satisfy the more restrictive type. ```cs @@ -28,7 +28,7 @@ if (myTargetNpc.TryResolve(myLinkCache, out var npc)) // Found a INpc! } ``` -The `TryResolve` call wants to return an `INpc` type to you. But if all it can find is a [readonly `INpcGetter`](https://github.com/Mutagen-Modding/Mutagen/wiki/Getters-Everywhere%3F), it cannot pretend that it's settable, and so fails to match. This is the result of you asking the system to find an Npc that is settable, when the ones that exist are only getters. +The `TryResolve` call wants to return an `INpc` type to you. But if all it can find is a [readonly `INpcGetter`](Getters-Everywhere.md), it cannot pretend that it's settable, and so fails to match. This is the result of you asking the system to find an Npc that is settable, when the ones that exist are only getters. You can solve this issue by modifying the TryResolve scope: ```cs diff --git a/docs/best-practices/FormLinks-vs-EditorID-as-Identifiers.md b/docs/best-practices/FormLinks-vs-EditorID-as-Identifiers.md index 42b022899..3ee12f44d 100644 --- a/docs/best-practices/FormLinks-vs-EditorID-as-Identifiers.md +++ b/docs/best-practices/FormLinks-vs-EditorID-as-Identifiers.md @@ -44,7 +44,7 @@ We're going to start out with the one upside that EditorIDs have: readability. Generally, this is the reason people initially gravitate towards EditorIDs, as lots of other tooling uses EditorIDs as they are more human friendly. #### FormLink Mapping Brings Readability to FormLink-Based Systems -Work has been done to mitigate this readability downside of FormLinks. [FormLink Mapping](https://github.com/Mutagen-Modding/Mutagen/wiki/Reference-FormLinks-By-EditorID) is a system where you can point to a mod and generate mappings so that you can reference and use FormLinks by their EditorID name. +Work has been done to mitigate this readability downside of FormLinks. [FormLink Mapping](https://github.com/Mutagen-Modding/Mutagen.Bethesda.FormKeys) is a system where you can point to a mod and generate mappings so that you can reference and use FormLinks by their EditorID name. This allows for the best of both worlds, where the code is human readable by writing EditorIDs, while still using FormLinks under the hood for the code to use. These systems mostly nullify the readability problem that FormKeys have. diff --git a/docs/best-practices/Getters-Everywhere.md b/docs/best-practices/Getters-Everywhere.md index 62074534d..621769bce 100644 --- a/docs/best-practices/Getters-Everywhere.md +++ b/docs/best-practices/Getters-Everywhere.md @@ -27,7 +27,7 @@ foreach (INpcGetter npcGetter in env.LoadOrder.PriorityOrder.Npc().WinningOverri ## Reasoning ### Readonly Increases Speed -A lot of Mutagen's speed comes from short circuiting unnecessary work. A big way it does this is by exposing records via [Binary Overlays](https://github.com/Mutagen-Modding/Mutagen/wiki/Binary-Overlay). These are record objects that are very lightweight and fast. But one of their downsides is they are read only. +A lot of Mutagen's speed comes from short circuiting unnecessary work. A big way it does this is by exposing records via [Binary Overlays](../plugins/Binary-Overlay.md). These are record objects that are very lightweight and fast. But one of their downsides is they are read only. As soon as you want to modify something, you have to first convert it to a settable version of the record. This means creating a more "normal" settable `Npc` class, and reading ALL the data within that record to fill out each field one by one. This is often a waste of time. diff --git a/docs/environment/Environment-Construction.md b/docs/environment/Environment-Construction.md index 9c3204cd3..cba38eb46 100644 --- a/docs/environment/Environment-Construction.md +++ b/docs/environment/Environment-Construction.md @@ -60,7 +60,7 @@ Order between multiple `TransformModListings` is respected, but will always come This lets you mix in a mod that you plan on exporting content with. It will be added to the end of the LinkCache as a mutable mod that is safe to change. You can put multiple `WithOutputMod` calls in your builder chain, and the order they appear will determine how they're placed on the Load Order and which ends up being the winning override. #### WithTargetDataFolder -Allows you to customize what game folder the environment will be constructed against. Useful when dealing with [ad-hoc installations](https://github.com/Mutagen-Modding/Mutagen/wiki/Game-Locations#adhoc-installations). +Allows you to customize what game folder the environment will be constructed against. Useful when dealing with [ad-hoc installations](Game-Locations.md#adhoc-installations). #### WithLoadOrder This is a `TransformLoadOrderListings` style call that simply discards any existing load order and injects an explicitly provided one. Will respect the ordering alongside other `TransformLoadOrderListings` phase calls. diff --git a/docs/environment/index.md b/docs/environment/index.md index 5d202cdec..cb524c288 100644 --- a/docs/environment/index.md +++ b/docs/environment/index.md @@ -29,9 +29,9 @@ The environment object that is given to you has lots of useful contextual items: - Creation Club load order file path (Skyrim.ccc) ## Advanced Usage -The above example just shows the basic one line environment definition to get the typical environment. Mutagen by default will construct Game Environments relative the game installation registered by Steam, as [described here](https://github.com/Mutagen-Modding/Mutagen/wiki/Game-Locations#sources). +The above example just shows the basic one line environment definition to get the typical environment. Mutagen by default will construct Game Environments relative the game installation registered by Steam, as [described here](Game-Locations.md#sources). -If you have custom requirements or want to mix in output mods, etc, be sure to check out the [Environment Construction](https://github.com/Mutagen-Modding/Mutagen/wiki/Environment-Construction) documentation. +If you have custom requirements or want to mix in output mods, etc, be sure to check out the [Environment Construction](Environment-Construction.md) documentation. ## Synthesis Usage If you're coding within a [Synthesis Patcher](https://github.com/Mutagen-Modding/Synthesis), you should not make your own environment as described here. Synthesis provides its own environment-like `IPatcherState` object in its Run function. [Read More](https://github.com/Mutagen-Modding/Synthesis/wiki/Coding-a-Patcher#synthesis-state-object) diff --git a/docs/examples/Print-Some-Content.md b/docs/examples/Print-Some-Content.md index 04ad9f201..c3501363d 100644 --- a/docs/examples/Print-Some-Content.md +++ b/docs/examples/Print-Some-Content.md @@ -20,6 +20,4 @@ An outline of what is going on in the code above: - Each name is printed out to the console - The mod object is disposed as we exit the `using` statement, which closes out any open file streams -This code is self-sufficient, aside from needing to supply the desired `pathToMod` to open. No other bootstrap code or other frameworking is required. - -This example can be found in the Example Project, under the [PrintContent](https://github.com/Mutagen-Modding/Mutagen/blob/master/Mutagen.Bethesda.Examples/Code/PrintContentCode.cs) section. \ No newline at end of file +This code is self-sufficient, aside from needing to supply the desired `pathToMod` to open. No other bootstrap code or other frameworking is required. \ No newline at end of file diff --git a/docs/game-specific/Oblivion-Aspect-Interfaces.md b/docs/game-specific/oblivion/Oblivion-Aspect-Interfaces.md similarity index 100% rename from docs/game-specific/Oblivion-Aspect-Interfaces.md rename to docs/game-specific/oblivion/Oblivion-Aspect-Interfaces.md diff --git a/docs/game-specific/Oblivion-Link-Interfaces.md b/docs/game-specific/oblivion/Oblivion-Link-Interfaces.md similarity index 100% rename from docs/game-specific/Oblivion-Link-Interfaces.md rename to docs/game-specific/oblivion/Oblivion-Link-Interfaces.md diff --git a/docs/game-specific/Skyrim-Aspect-Interfaces.md b/docs/game-specific/skyrim/Skyrim-Aspect-Interfaces.md similarity index 100% rename from docs/game-specific/Skyrim-Aspect-Interfaces.md rename to docs/game-specific/skyrim/Skyrim-Aspect-Interfaces.md diff --git a/docs/game-specific/Skyrim-Link-Interfaces.md b/docs/game-specific/skyrim/Skyrim-Link-Interfaces.md similarity index 100% rename from docs/game-specific/Skyrim-Link-Interfaces.md rename to docs/game-specific/skyrim/Skyrim-Link-Interfaces.md diff --git a/docs/game-specific/Skyrim-Perks.md b/docs/game-specific/skyrim/Skyrim-Perks.md similarity index 100% rename from docs/game-specific/Skyrim-Perks.md rename to docs/game-specific/skyrim/Skyrim-Perks.md diff --git a/docs/linkcache/ModContexts.md b/docs/linkcache/ModContexts.md index 9e6fdfaae..cadd5c56c 100644 --- a/docs/linkcache/ModContexts.md +++ b/docs/linkcache/ModContexts.md @@ -12,7 +12,7 @@ ModContexts offer additional information as described above, but they also come ## By Looping WinningOverrides ### By LinkCache Lookups -A more typical [Record Lookup](Record-Lookup) call returns the record object directly: +A more typical [Record Lookup](Record-Lookup.md) call returns the record object directly: ```cs IFormLinkGetter myFormLink = ...; diff --git a/docs/linkcache/Previous-Override-Iteration.md b/docs/linkcache/Previous-Override-Iteration.md index 8e6d78a42..70f7e9a72 100644 --- a/docs/linkcache/Previous-Override-Iteration.md +++ b/docs/linkcache/Previous-Override-Iteration.md @@ -4,7 +4,7 @@ A lot of functionality like [Record Lookup](Record-Lookup) or [Winning Overrides LinkCache offers an easy way to dig deeper into the load order and access the non-winning versions of records from previous mods. ## ResolveAll -While you can call it on a LinkCache directly, typically the preferred way to tap into this functionality is off a [FormLink](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formlink): +While you can call it on a LinkCache directly, typically the preferred way to tap into this functionality is off a [FormLink](../plugins/ModKey,-FormKey,-FormLink.md): ```cs IFormLinkGetter npcLink = ...; @@ -23,7 +23,7 @@ If you look at the above code snippet, it's not as useful as it could be. It wi This is because `ResolveAll` enumerates over records directly, and records do not have knowledge of what mod contained them. They know what mod defined the record in the first place (as that's part of its FormKey), but that might not be the mod that originated the record's state being interacted with. -`ResolveAllContexts` is an alternative that returns [ModContext](ModContexts) objects instead, which have a lot more information/tooling about where a record came from. +`ResolveAllContexts` is an alternative that returns [ModContext](ModContexts.md) objects instead, which have a lot more information/tooling about where a record came from. ```cs IFormLinkGetter npcLink = ...; @@ -36,10 +36,10 @@ foreach (var npcRecordContext in npcLink.ResolveAllContexts(myFormKey, out var npc)) } ``` -Now that the type is specified, it will run faster and be able to return a more appropriate type (INpcGetter) for you to use. As mentioned earlier, though, it is preferable to just [use FormLinks everywhere](https://github.com/Mutagen-Modding/Mutagen/wiki/FormLinks-Instead-of-FormID-FormKey) and initiate off of those. +Now that the type is specified, it will run faster and be able to return a more appropriate type (INpcGetter) for you to use. \ No newline at end of file diff --git a/docs/linkcache/index.md b/docs/linkcache/index.md index 176f2f8d8..94202ede9 100644 --- a/docs/linkcache/index.md +++ b/docs/linkcache/index.md @@ -1,13 +1,13 @@ # Link Cache The LinkCache is the record lookup engine. It powers a lot of functionality, such as: -- Looking up records by [FormKey/FormLink](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#resolves) -- Finding the [Winning Override](Winning-Overrides) in a [Load Order](Load-Order) -- [Iterating over all versions of a record](Previous-Override-Iteration) within a [Load Order](Load-Order) +- Looking up records by [FormKey/FormLink](../plugins/ModKey,-FormKey,-FormLink.md#resolves) +- Finding the [Winning Override](Winning-Overrides) in a [Load Order](../loadorder/index.md) +- [Iterating over all versions of a record](Previous-Override-Iteration) within a [Load Order](../loadorder/index.md) ## Context Every LinkCache is created from a context: - A single mod -- A [Load Order](Load-Order) +- A [Load Order](../loadorder/index.md) - Any arbitrary enumeration of mods ```cs @@ -65,7 +65,7 @@ Mutable components of Link Caches do not cache records, and so will not use memo Since the LinkCache is just an object caching records relative to a context, you can easily release this memory by tossing your LinkCache away for the Garbage Collector to pick up once you're done with it, or want to make a new fresh cache. (Perhaps a Clear() call will be added in the future, too) ### Identifier Only Caches -In some situations like the [FormKey Picker](FormKey-Picker), we only care about the FormKey and EditorID of records. Caching the entire record is a waste of memory. +In some situations like the [FormKey Picker](../wpf/FormKey-Picker.md), we only care about the FormKey and EditorID of records. Caching the entire record is a waste of memory. ```cs var linkCache = myLoadOrder.ToImmutableLinkCache(LinkCachePreferences.OnlyIdentifiers()); diff --git a/docs/loadorder/Winning-Overrides.md b/docs/loadorder/Winning-Overrides.md index c22231973..df0b1613b 100644 --- a/docs/loadorder/Winning-Overrides.md +++ b/docs/loadorder/Winning-Overrides.md @@ -12,12 +12,12 @@ foreach (var npc in loadOrder.PriorityOrder.Npc().WinningOverrides()) } ``` -If you then want to take winning overrides and add them to your mod with some modifications, this topic is covered more in depth [here](https://github.com/Mutagen-Modding/Mutagen/wiki/Create,-Duplicate,-and-Override#getoraddasoverride). +If you then want to take winning overrides and add them to your mod with some modifications, this topic is covered more in depth [here](../plugins/Create,-Duplicate,-and-Override.md#getoraddasoverride). ## Winning Context Overrides The above loop will just give you each record in the game with it's "winning" content. Sometimes more information is needed, though. -You can instead opt to iterate over [ModContexts](https://github.com/Mutagen-Modding/Mutagen/wiki/ModContexts) which is a wrapper object containing the record of interest PLUS other useful information and features. +You can instead opt to iterate over [ModContexts](../linkcache/ModContexts.md) which is a wrapper object containing the record of interest PLUS other useful information and features. ```csharp LoadOrder> loadOrder = ...; @@ -28,4 +28,4 @@ foreach (var npcContext in loadOrder.PriorityOrder.Npc().WinningContextOverrides } ``` -You can read more about [ModContexts](https://github.com/Mutagen-Modding/Mutagen/wiki/ModContexts) to see all the features they offer. +You can read more about [ModContexts](../linkcache/ModContexts.md) to see all the features they offer. diff --git a/docs/loadorder/index.md b/docs/loadorder/index.md index de14c58e9..62bd06efc 100644 --- a/docs/loadorder/index.md +++ b/docs/loadorder/index.md @@ -2,9 +2,9 @@ A Load Order represents a set of mods in a given order, where the mods loaded later "win" and override the records from previous mods. ## Getting a Load Order -Typically you will not construct a Load Order object yourself. Most times, using a [Game Environment](Game-Environment-Bootstrapper) is more desirable, and will have a Load Order for you to use. +Typically you will not construct a Load Order object yourself. Most times, using a [Game Environment](../environment/index.md) is more desirable, and will have a Load Order for you to use. -If you want to construct a Load Order object more manually, this will be discussed [later](#retrieving-a-load-order) in the article. +If you want to construct a Load Order object more manually, this will be discussed later in the article. ## ModListings A `ModListing` consists of: @@ -86,7 +86,7 @@ LoadOrder> loadOrder = LoadOrder.Import Content { get; }`, and thus overlay on top of a whole record in its entirety, both the header and its content. This struct offers a nice easy package to access anything about an entire record in one location. diff --git a/docs/lowlevel/index.md b/docs/lowlevel/index.md index 88a0f47cb..3a6c2ddb7 100644 --- a/docs/lowlevel/index.md +++ b/docs/lowlevel/index.md @@ -1,11 +1,11 @@ # Low Level Tools -The API and tools listed in the [[Plugin Record Suite]] are intended to expose Bethesda records in an organized, strongly typed, and (hopefully) less error prone fashion. However, some tasks and some users require a less safe and more direct approach to get the job done. +The API and tools listed in the [Plugin Record Suite](../plugins/index.md) are intended to expose Bethesda records in an organized, strongly typed, and (hopefully) less error prone fashion. However, some tasks and some users require a less safe and more direct approach to get the job done. This section is about some of the mechanics and tools under the hood, and are recommended for more advanced users. ## Reasoning and Typical Applications of Low Level Tooling ## Cross-game Processing -The [[Plugin Record Suite]] objects fall short when the task you are trying to accomplish is to be applied to multiple Bethesda games. There are no halfway hybrid generated classes that can parse and contain both Skyrim and Oblivion NPCs, for example. +The [Plugin Record Suite](../plugins/index.md) objects fall short when the task you are trying to accomplish is to be applied to multiple Bethesda games. There are no halfway hybrid generated classes that can parse and contain both Skyrim and Oblivion NPCs, for example. Interfaces can provide a small bit of relief, allowing some fields that are common to many records to be exposed. `INamed` is an example of this. Both Skyrim and Oblivion NPCs implement it, and so code that processed an `IEnumerable` could handle both. diff --git a/docs/plugins/Binary-Format-Complexity-Abstraction.md b/docs/plugins/Binary-Format-Complexity-Abstraction.md index 0b2cdb06e..0ebdbf2c6 100644 --- a/docs/plugins/Binary-Format-Complexity-Abstraction.md +++ b/docs/plugins/Binary-Format-Complexity-Abstraction.md @@ -2,7 +2,7 @@ Bethesda's binary format contains a lot implementation complexities that are unrelated to the actual content of the records. A lot of times the exposure of these details are a source of confusion, and don't add much upside in the way of flexibility or power into the hands of the user. Mutagen attempts to abstract these complexities away so that the end user is dealing with the distilled record content more directly, rather than wading through the gritty specifics that only matter in the context of their binary format on disk. ## FormKeys and FormLinks -This topic was covered in detail in the [ModKey, FormKey, FormLink](ModKey%2C-FormKey%2C-FormLink#formkeys) section, and so will not be covered here. +This topic was covered in detail in the [ModKey, FormKey, FormLink](ModKey,-FormKey,-FormLink.md#formkeys) section, and so will not be covered here. ## Record Types ### Four Character Headers diff --git a/docs/plugins/Binary-Importing.md b/docs/plugins/Binary-Importing.md index 26701a65f..1969ef41a 100644 --- a/docs/plugins/Binary-Importing.md +++ b/docs/plugins/Binary-Importing.md @@ -21,4 +21,4 @@ var mod = OblivionMod.CreateFromBinary( This import call will only process and import Potions and NPCs. ## Notes -While these basic import features sounds fundamental, they are overshadowed and depreciated somewhat by the [[Binary Overlay]] concepts. +While these basic import features sounds fundamental, they are overshadowed and depreciated somewhat by the [Binary Overlay](Binary-Overlay.md) concepts. diff --git a/docs/plugins/Binary-Overlay.md b/docs/plugins/Binary-Overlay.md index 5c62bc2d1..fbfda89b3 100644 --- a/docs/plugins/Binary-Overlay.md +++ b/docs/plugins/Binary-Overlay.md @@ -1,5 +1,5 @@ # Binary Overlay -Binary Overlays are an alternative to the more simplistic [[Binary Importing]] concepts. +Binary Overlays are an alternative to the more simplistic [Binary Importing](Binary-Importing.md) concepts. ## Reasoning for an Alternate Pattern ### Memory Usage is Frontloaded diff --git a/docs/plugins/Create,-Duplicate,-and-Override.md b/docs/plugins/Create,-Duplicate,-and-Override.md index 1d3480516..9463fe411 100644 --- a/docs/plugins/Create,-Duplicate,-and-Override.md +++ b/docs/plugins/Create,-Duplicate,-and-Override.md @@ -1,6 +1,6 @@ # Create, Duplicate, and Override ## Create New Records -New records can be constructed in a few ways. Note that a record's FormKey is required during construction, and immutable. If you want to change the FormKey of a record, a new one should be made. Any desired fields can be brought over via [CopyIn](Copy-Functionality#deepcopyin) mechanics. +New records can be constructed in a few ways. Note that a record's FormKey is required during construction, and immutable. If you want to change the FormKey of a record, a new one should be made. Any desired fields can be brought over via [CopyIn](Copy-Functionality.md#deepcopyin) mechanics. ### By Constructor Any standalone record can be made by using its constructor. ```cs @@ -17,7 +17,7 @@ var potion = mod.Potions.AddNew(); The new record will have the next available `FormKey` from that mod based on the metadata in its header, and automatically be added to the Group it originated from. Note this is not applicable to Binary Overlays, as they are getter only interfaces, so this concept is not applicable. This is instead meant for new Mod objects that have been created for the purpose of modification and eventual export. ### By Duplication -Duplicating a record is the equivalent of creating a fresh record, and then copying in data to match a different record. This can be done via [CopyIn](Copy-Functionality#deepcopyin) API, but there are some convenience methods for this as well +Duplicating a record is the equivalent of creating a fresh record, and then copying in data to match a different record. This can be done via [CopyIn](Copy-Functionality.md#deepcopyin) API, but there are some convenience methods for this as well ```csharp INpcGetter sourceNpc = ...; @@ -60,4 +60,4 @@ outputMod.Npcs.Add(npcCopy); This strategy works well if you might change your mind and not add the copied record to the outgoing mod. It lets you get a mutable version of the record without adding it to your outgoing mod until you are certain you want to include it. ### Nested Records -Some records like Placed Objects and Cells are often nested underneath other records. This makes it harder to follow the above patterns. For these you will want to make use of the [[ModContexts]] concepts. +Some records like Placed Objects and Cells are often nested underneath other records. This makes it harder to follow the above patterns. For these you will want to make use of the [../linkcache/ModContexts.md] concepts. diff --git a/docs/plugins/Flags-and-Enums.md b/docs/plugins/Flags-and-Enums.md index 30ba93394..485611c9a 100644 --- a/docs/plugins/Flags-and-Enums.md +++ b/docs/plugins/Flags-and-Enums.md @@ -55,7 +55,7 @@ if (e == (CreatureType)13) With this style API, you can still access all unknown values as needed. ## Flags Enum -Certain fields are allowed to have several values, and so make use of C#'s [Flags] enum systems. +Certain fields are allowed to have several values, and so make use of C#'s flags enum systems. For example, Oblivion `NPC`'s flags look like this: ```cs diff --git a/docs/FormKey-Allocation-and-Persistence.md b/docs/plugins/FormKey-Allocation-and-Persistence.md similarity index 100% rename from docs/FormKey-Allocation-and-Persistence.md rename to docs/plugins/FormKey-Allocation-and-Persistence.md diff --git a/docs/plugins/Interfaces-(Aspect-Link-Getters).md b/docs/plugins/Interfaces-(Aspect-Link-Getters).md index e15a7fd70..220bb342f 100644 --- a/docs/plugins/Interfaces-(Aspect-Link-Getters).md +++ b/docs/plugins/Interfaces-(Aspect-Link-Getters).md @@ -96,7 +96,7 @@ Additionally, Aspect Interfaces can be made to apply to cross-game records. The Link Interfaces have a different goal. They act more as markers, rather than a vehicle to expose common fields. ### Problem to Solve -Mutagen's [FormLinks](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formlinks) can specify a record type that the FormKey they represent is allowed to match against. It provides type safety to FormID/FormKey concepts. +Mutagen's [FormLinks](ModKey,-FormKey,-FormLink.md#formlinks) can specify a record type that the FormKey they represent is allowed to match against. It provides type safety to FormID/FormKey concepts. What happens when a FormLink should be able to point to multiple record types? A container object can contain many different record types: Armor, Weapons, etc. @@ -121,8 +121,7 @@ Here is an example of `F12` being used to investigate `IConstructibleGetter` and ![](https://i.imgur.com/0U8sUFm.gif) #### Autogenerated Documentation -A list of mappings also exists here on the wiki -https://github.com/Mutagen-Modding/Mutagen/wiki/Skyrim-Link-Interfaces#iconstructible +[A list of mappings also exists here on the wiki](../game-specific/skyrim/Skyrim-Link-Interfaces.md#iconstructible) ### Evolution New Link Interfaces are rarely defined. These are usually known ahead of time and new ones aren't added. diff --git a/docs/plugins/ModKey,-FormKey,-FormLink.md b/docs/plugins/ModKey,-FormKey,-FormLink.md index d49528307..cb35c365b 100644 --- a/docs/plugins/ModKey,-FormKey,-FormLink.md +++ b/docs/plugins/ModKey,-FormKey,-FormLink.md @@ -79,7 +79,7 @@ They contain: As an example of the type safety they provide, consider an NPC's `Race` member, which is of type: `FormLink`. This link is not allowed to point to or link against any record that is not a `Race`. It is hard to accidentally set a `FormLink` link to point to an `IPotion` record, as attempting to do so would typically result in a compiler error. ## Resolves -Combine a FormLink and a [[LinkCache]] to look up a record. (The LinkCache is associated with a specific context like a load order or a single mod) +Combine a FormLink and a [LinkCache](../linkcache/index.md) to look up a record. (The LinkCache is associated with a specific context like a load order or a single mod) ```cs var someItemLink = new FormLink(FormKey.Factory("123456:Skyrim.esm")); diff --git a/docs/top/Big-Cheat-Sheet.md b/docs/top/Big-Cheat-Sheet.md index 45e67f1fe..f69754662 100644 --- a/docs/top/Big-Cheat-Sheet.md +++ b/docs/top/Big-Cheat-Sheet.md @@ -14,7 +14,7 @@ When `...` is seen, that generally means the example will not cover how that obj ### Missing Namespaces If you're just copy pasting code, often it will not compile because some required namespaces are missing. You can have the IDE import them by clicking on the red object in question and activating quick fixes (`Ctrl - .` in Visual Studio). -[More Reading](https://github.com/Mutagen-Modding/Mutagen/wiki/Namespaces) +[More Reading](../familiar/Namespaces.md) ## Construct an Environment ```cs @@ -28,7 +28,7 @@ foreach (var listing in state.LoadOrder.ListedOrder) } ``` -[Read About Environments](https://github.com/Mutagen-Modding/Mutagen/wiki/Environment) +[Read About Environments](../Environment/index.md) ## Retrieve a Mod From a Load Order ```cs @@ -42,14 +42,14 @@ if (myLoadOrder.TryGetValue("MyMod.esp", out var mod)) } ``` -[Read About Mod Retrieval](https://github.com/Mutagen-Modding/Mutagen/wiki/Load-Order#accessing-specific-listings) +[Read About Mod Retrieval](../loadorder/index.md#accessing-specific-listings) ## Construct a ModKey ```cs var modKey = ModKey.FromFileName("Skyrim.esm"); modKey = new ModKey("Skyrim", ModType.Plugin); ``` -[Read About ModKeys](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#modkey) +[Read About ModKeys](../plugin/ModKey,-FormKey,-FormLink.md#modkey) ## Get List of Masters From A Mod ### Via MasterReferenceCollection @@ -100,7 +100,7 @@ IMasterReferenceCollection masterCollection = ...; FormID formID = masterCollection.GetFormID(formKey); ``` -[Read About FormKeys](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formkey) +[Read About FormKeys](../plugin/ModKey,-FormKey,-FormLink.md#formkey) ## Convert FormKey to FormLink ```cs @@ -109,7 +109,7 @@ FormKey formKey = ...; var npcLink = formKey.ToLink(); ``` -[Read About FormKeys](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formkey) +[Read About FormKeys](../plugin/ModKey,-FormKey,-FormLink.md#formkey) ## Convert MajorRecord to FormLink ```cs @@ -153,7 +153,7 @@ if (target.FormKey.Equals(npc.Race)) } ``` -[Read About FormKeys](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formkey) +[Read About FormKeys](../plugin/ModKey,-FormKey,-FormLink.md#formkey) ### By FormLink ```cs @@ -166,7 +166,7 @@ if (target.Equals(npc.Race)) } ``` -[Read About FormLinks](https://github.com/Mutagen-Modding/Mutagen/wiki/ModKey%2C-FormKey%2C-FormLink#formlink) +[Read About FormLinks](../plugin/ModKey,-FormKey,-FormLink.md#formlink) ### Using FormKey Mapping Library ```cs @@ -192,5 +192,5 @@ var dup2 = someMod.Npcs.DuplicateInAsNewRecord(newFormKey); var dup3 = someMod.Npcs.DuplicateInAsNewRecord(someEditorId); ``` -[Read more about duplication](https://github.com/Mutagen-Modding/Mutagen/wiki/Create%2C-Duplicate%2C-and-Override#by-duplication) -[Read more about FormKey Persistence](https://github.com/Mutagen-Modding/Mutagen/wiki/FormKey-Allocation-and-Persistence) +[Read more about duplication](../plugin/Create,-Duplicate,-and-Override.md#by-duplication) +[Read more about FormKey Persistence](../plugin/FormKey-Allocation-and-Persistence.md) diff --git a/docs/wpf/FormKey-Picker.md b/docs/wpf/FormKey-Picker.md index 53d1d3208..234b66e22 100644 --- a/docs/wpf/FormKey-Picker.md +++ b/docs/wpf/FormKey-Picker.md @@ -4,11 +4,11 @@ The FormKey Picker helps users select record(s) by typing in: - FormKeys - FormIDs (Mod indices relative to current load order) -The picker can reference a [[LinkCache]] to do lookups to help display and locate records that actually exist in the user's active load order. +The picker can reference a [LinkCache](../linkcache/index.md) to do lookups to help display and locate records that actually exist in the user's active load order. They can also be scoped to only allow or search for specific record types, if desired. -Make sure you've added the [Required Resources](Adding-Required-Resources), or the controls will not have any display. +Make sure you've added the [Required Resources](Adding-Required-Resources.md), or the controls will not have any display. The Mutagen [Test Display](https://github.com/Mutagen-Modding/Mutagen/tree/release/Mutagen.Bethesda.WPF.TestDisplay) app utilizes the FormKey pickers, and provides a good example of how to use them from within a WPF app. diff --git a/docs/wpf/ModKey-Picker.md b/docs/wpf/ModKey-Picker.md index ff2ea06b6..ff18968f8 100644 --- a/docs/wpf/ModKey-Picker.md +++ b/docs/wpf/ModKey-Picker.md @@ -2,11 +2,11 @@ The ModKey Picker helps users select mod(s) by typing in their names. The picker can reference certain objects to know what mods actually exist on a user's active load order: -- A [[Load Order]] object +- A [Load Order](../loadorder/index.md) object - Any enumerable of type `ModKey` or `IModListingGetter` - An `IObservable>` of type `ModKey` or `IModListingGetter`. (Reactive Extension concepts) -Make sure you've added the [Required Resources](Adding-Required-Resources), or the controls will not have any display. +Make sure you've added the [Required Resources](Adding-Required-Resources.md), or the controls will not have any display. The Mutagen [Test Display](https://github.com/Mutagen-Modding/Mutagen/tree/release/Mutagen.Bethesda.WPF.TestDisplay) app utilizes the ModKey pickers, and provides a good example of how to use them from within a WPF app. diff --git a/docs/wpf/Reflection-Powered-Settings.md b/docs/wpf/Reflection-Powered-Settings.md index e6a7869df..078e684f2 100644 --- a/docs/wpf/Reflection-Powered-Settings.md +++ b/docs/wpf/Reflection-Powered-Settings.md @@ -104,7 +104,7 @@ public bool SecondSetting { get; set; } ``` ### ObjectNameMember -This attribute applies to the settings class itself, and defines the object type naming to show when [nested classes](Nesting) are involved. +This attribute applies to the settings class itself, and defines the object type naming to show when [nested classes](#Nesting) are involved. ```cs [ObjectNameMember(nameof(TestSettings.MyString))] diff --git a/mkdocs.yml b/mkdocs.yml index f4edc5023..eb94cbcd5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -65,6 +65,7 @@ nav: - Abstract Subclassing: plugins/Abstract-Subclassing.md - Printing: plugins/Printing.md - Typical Mod Construction and Importing: plugins/Typical-Mod-Construction-and-Importing.md + - FormKey Allocation and Persistence: FormKey-Allocation-and-Persistence.md - Environment: - environment/index.md - Environment Construction: environment/Environment-Construction.md @@ -131,12 +132,12 @@ nav: - Binary Utility: lowlevel/Binary-Utility.md - Game Specific Documentation: - Oblivion: - - Oblivion Aspect Interfaces: game-specific/Oblivion-Aspect-Interfaces.md - - Oblivion Link Interfaces: game-specific/Oblivion-Link-Interfaces.md + - Oblivion Aspect Interfaces: game-specific/oblivion/Oblivion-Aspect-Interfaces.md + - Oblivion Link Interfaces: game-specific/oblivion/Oblivion-Link-Interfaces.md - Skyrim: - - Skyrim Perks: game-specific/Skyrim-Perks.md - - Skyrim Aspect Interfaces: game-specific/Skyrim-Aspect-Interfaces.md - - Skyrim Link Interfaces: game-specific/Skyrim-Link-Interfaces.md + - Skyrim Perks: game-specific/skyrim/Skyrim-Perks.md + - Skyrim Aspect Interfaces: game-specific/skyrim/Skyrim-Aspect-Interfaces.md + - Skyrim Link Interfaces: game-specific/skyrim/Skyrim-Link-Interfaces.md - Correctness: top/Correctness.md index: Pages/index.md \ No newline at end of file From 57707902fb11147e6c2b215907164472bd0d7d53 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 02:39:09 -0500 Subject: [PATCH 116/135] Update README.md --- README.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7766b3bcc..45c6ac3d3 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,3 @@ - - -## Table Of Contents - -- [Mutagen](#mutagen) - - [Goals](#goals) - - [Sample API](#sample-api) - - [Seeing Mutagen in Action](#seeing-mutagen-in-action) - - [Synthesis](#synthesis) - - [Installing Mutagen](#installing-mutagen) - - - ![Release](https://github.com/Mutagen-Modding/Mutagen/workflows/Release/badge.svg) ![Dev](https://github.com/Mutagen-Modding/Mutagen/workflows/Dev/badge.svg) [![NuGet Stats](https://img.shields.io/nuget/v/Mutagen.Bethesda.svg)](https://www.nuget.org/packages/Mutagen.Bethesda) [![Discord](https://discordapp.com/api/guilds/759302581448474626/widget.png)](https://discord.gg/53KMEsW) @@ -42,9 +29,9 @@ foreach (var weaponEditorId in env.LoadOrder.PriorityOrder.Weapon().WinningOverr ``` This example snippet would print all the unique Weapon EditorIDs from the load order to the console. -Check out the [Wiki](https://github.com/Mutagen-Modding/Mutagen/wiki) for more detailed explainations of Mutagen's API, and more typical use cases and examples. +Check out the [Wiki]([https://github.com/Mutagen-Modding/Mutagen/wiki](https://mutagen-modding.github.io/Mutagen/)) for more detailed explainations of Mutagen's API, and more typical use cases and examples. -Also be sure to check out the [Big Cheat Sheet](https://github.com/Mutagen-Modding/Mutagen/wiki/Big-Cheat-Sheet) +Also be sure to check out the [Big Cheat Sheet]([https://github.com/Mutagen-Modding/Mutagen/wiki/Big-Cheat-Sheet](https://mutagen-modding.github.io/Mutagen/top/Big-Cheat-Sheet/)) ## Seeing Mutagen in Action ### Synthesis From 7c425bfbdd9dfce96c89b668a91bbd415b95605b Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 02:39:57 -0500 Subject: [PATCH 117/135] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 45c6ac3d3..8cd35f49d 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ foreach (var weaponEditorId in env.LoadOrder.PriorityOrder.Weapon().WinningOverr ``` This example snippet would print all the unique Weapon EditorIDs from the load order to the console. -Check out the [Wiki]([https://github.com/Mutagen-Modding/Mutagen/wiki](https://mutagen-modding.github.io/Mutagen/)) for more detailed explainations of Mutagen's API, and more typical use cases and examples. +Check out the [Wiki](https://mutagen-modding.github.io/Mutagen/) for more detailed explainations of Mutagen's API, and more typical use cases and examples. -Also be sure to check out the [Big Cheat Sheet]([https://github.com/Mutagen-Modding/Mutagen/wiki/Big-Cheat-Sheet](https://mutagen-modding.github.io/Mutagen/top/Big-Cheat-Sheet/)) +Also be sure to check out the [Big Cheat Sheet](https://mutagen-modding.github.io/Mutagen/top/Big-Cheat-Sheet/) ## Seeing Mutagen in Action ### Synthesis From c2ab1e1589417d95d5bc3fb79d7b1be16ba8e0cf Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 02:40:47 -0500 Subject: [PATCH 118/135] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8cd35f49d..0e56b099d 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ foreach (var weaponEditorId in env.LoadOrder.PriorityOrder.Weapon().WinningOverr ``` This example snippet would print all the unique Weapon EditorIDs from the load order to the console. +## Wiki Check out the [Wiki](https://mutagen-modding.github.io/Mutagen/) for more detailed explainations of Mutagen's API, and more typical use cases and examples. Also be sure to check out the [Big Cheat Sheet](https://mutagen-modding.github.io/Mutagen/top/Big-Cheat-Sheet/) From a163bb1f913b9c6171fc3b46a1e169cf11b0e14f Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 02:44:23 -0500 Subject: [PATCH 119/135] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0e56b099d..14cc90693 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,11 @@ # Mutagen Mutagen is a C# library for analyzing, modifying, and creating Bethesda mods. One of its main features is offering interfaces and classes for the records that exist at compile time and are first class citizens in C#. With actual members for each field they get the benefits of type safety, simple live debugging, Intellisense features such as autocomplete. The interfaces offer clean API to the user and abstract away much of the binary record specifics and oddities of how they are stored on disk, while the actual implementation remains very closely tied to the data offering as much speed as it can by leveraging some of the latest C# features. Most of the public facing API is created by code generation, with small manual snippets of code for the one-off special cases. This means the library is able to provide consistent API with very little manual work when adding new record definitions or features. +## Wiki +Check out the [Wiki](https://mutagen-modding.github.io/Mutagen/) for more detailed explainations of Mutagen's API, and more typical use cases and examples. + +Also be sure to check out the [Big Cheat Sheet](https://mutagen-modding.github.io/Mutagen/top/Big-Cheat-Sheet/) + ## Goals What is Mutagen trying to provide? - Ability to analyze, create, or manipulate esp/esm mod files for Bethesda games in C#. @@ -29,11 +34,6 @@ foreach (var weaponEditorId in env.LoadOrder.PriorityOrder.Weapon().WinningOverr ``` This example snippet would print all the unique Weapon EditorIDs from the load order to the console. -## Wiki -Check out the [Wiki](https://mutagen-modding.github.io/Mutagen/) for more detailed explainations of Mutagen's API, and more typical use cases and examples. - -Also be sure to check out the [Big Cheat Sheet](https://mutagen-modding.github.io/Mutagen/top/Big-Cheat-Sheet/) - ## Seeing Mutagen in Action ### Synthesis [Synthesis](https://github.com/Mutagen-Modding/Synthesis) is a patcher pipeline built on top of Mutagen, and it already has a [large library](https://github.com/Mutagen-Modding/Synthesis/network/dependents?package_id=UGFja2FnZS0xMzg1MjY1MjYz) of example patchers to study and get inspiration from. From 73afd28f9e3c72e7192df0c6f2ead953c0e2fbd9 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 22 Jul 2023 02:44:41 -0500 Subject: [PATCH 120/135] docs --- docs/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.md b/docs/index.md index 22eb3f87b..12f26cb09 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,3 +1,4 @@ +# Home [![Discord](https://discordapp.com/api/guilds/759302581448474626/widget.png)](https://discord.gg/53KMEsW) Mutagen is a C# library for analyzing, modifying, and creating Bethesda mods. One of its main features is offering interfaces and classes for the records that exist at compile time and are first class citizens in C#. With actual members for each field they get the benefits of type safety, simple live debugging, Intellisense features such as autocomplete. The interfaces offer clean API to the user and abstract away much of the binary record specifics and oddities of how they are stored on disk, while the actual implementation remains very closely tied to the data offering as much speed as it can by leveraging some of the latest C# features. Most of the public facing API is created by code generation, with small manual snippets of code for the one-off special cases. This means the library is able to provide consistent API with very little manual work when adding new record definitions or features. From 30496d41d9315b8d072a3a2b97654d034351d8f5 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Jul 2023 02:11:01 -0500 Subject: [PATCH 121/135] CI updates --- .github/workflows/ci-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-publish.yml b/.github/workflows/ci-publish.yml index ad2496775..2c2e739be 100644 --- a/.github/workflows/ci-publish.yml +++ b/.github/workflows/ci-publish.yml @@ -90,16 +90,16 @@ jobs: - name: Build run: dotnet build Mutagen.Records.sln -c Release --no-restore /p:GeneratePackageOnBuild=false - name: Pack Preview - if: ${{ success() && (github.event.inputs.is_release_event != 'true' || github.ref != 'refs/heads/master') }} + if: ${{ success() && (github.event.inputs.is_release_event != 'true' || github.ref != 'refs/heads/release') }} run: | dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out --version-suffix "nightly-${{ steps.current-time.outputs.formattedTime }}" - name: Pack Release - if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/master' }} + if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/release' }} run: | dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out - name: Publish to Github uses: svenstaro/upload-release-action@v2 - if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/master' }} + if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/release' }} with: file: "**/*.nupkg" repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -116,7 +116,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Reset nightly to master + - name: Reset nightly to release run: | head_sha=$(git rev-parse --verify HEAD) echo "head_sha=$head_sha" From 6dd4502ef1a64bad207b8fd321d3b21d636fdf53 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Jul 2023 02:13:51 -0500 Subject: [PATCH 122/135] Fix oblivions default header version to 0.8 --- Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs | 5 +++-- Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs index 8fcd0e08f..8ed2e8199 100644 --- a/Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs @@ -50,7 +50,8 @@ public ModStats() #endregion #region Version - public Single Version { get; set; } = default; + public static readonly Single VersionDefault = 0.8f; + public Single Version { get; set; } = VersionDefault; #endregion #region NumRecords public UInt32 NumRecords { get; set; } = default; @@ -765,7 +766,7 @@ internal partial class ModStatsSetterCommon public void Clear(IModStats item) { ClearPartial(); - item.Version = default; + item.Version = ModStats.VersionDefault; item.NumRecords = default; item.NextFormID = ModStats.NextFormIDDefault; } diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml b/Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml index 538f4c8db..cd72d2587 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml @@ -15,7 +15,7 @@
- + From 8b18117cf2463bcb613d8870ed05b3ace87c5f19 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Jul 2023 02:22:26 -0500 Subject: [PATCH 123/135] Upgrade oblivion header version to 1.0 CK makes 1.0 --- Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs | 2 +- Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs index 8ed2e8199..b850a7dc6 100644 --- a/Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/ModStats_Generated.cs @@ -50,7 +50,7 @@ public ModStats() #endregion #region Version - public static readonly Single VersionDefault = 0.8f; + public static readonly Single VersionDefault = 1.0f; public Single Version { get; set; } = VersionDefault; #endregion #region NumRecords diff --git a/Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml b/Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml index cd72d2587..3c89f8888 100644 --- a/Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml +++ b/Mutagen.Bethesda.Oblivion/Records/OblivionModHeader.xml @@ -15,7 +15,7 @@ - + From ab74005b1825c8f5bc0a4615b827d767b7a16b3e Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Jul 2023 04:49:21 -0500 Subject: [PATCH 124/135] Oblivion WeaponType Bow/Staff swapped --- Mutagen.Bethesda.Oblivion/Records/Major Records/Weapon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Weapon.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Weapon.cs index 7acec832b..05fee9b1e 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Weapon.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Weapon.cs @@ -8,8 +8,8 @@ public enum WeaponType BladeTwoHand, BluntOneHand, BluntTwoHand, - Bow, Staff, + Bow, } [Flags] From b5fdb70b0e672e20038304fd6d6f1c18a57c8066 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Jul 2023 22:52:02 -0500 Subject: [PATCH 125/135] EDIDLink's RecordType.Null removed --- Mutagen.Bethesda.Core/Plugins/EDIDLink.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Mutagen.Bethesda.Core/Plugins/EDIDLink.cs b/Mutagen.Bethesda.Core/Plugins/EDIDLink.cs index 2c176d658..2375ea995 100644 --- a/Mutagen.Bethesda.Core/Plugins/EDIDLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/EDIDLink.cs @@ -17,11 +17,6 @@ public sealed class EDIDLink : IEDIDLink, IEquatable public static readonly IEDIDLinkGetter Empty = new EDIDLink(); - /// - /// A readonly singleton representing a "null" record type - /// - public static readonly RecordType Null = new RecordType("\0\0\0\0"); - /// /// Record type representing the target EditorID to link against /// @@ -31,7 +26,7 @@ public sealed class EDIDLink : IEDIDLink, IEquatable @@ -72,7 +67,7 @@ private bool TryLinkToMod( IModGetter mod, [MaybeNullWhen(false)]out TMajor item) { - if (EDID == Null) + if (EDID == RecordType.Null) { item = default; return false; @@ -105,7 +100,7 @@ private bool TryLinkToMod( /// True if link was resolved and a record was retrieved public bool TryResolve(ILinkCache cache, out TMajor major) { - if (EDID == Null) + if (EDID == RecordType.Null) { major = default!; return false; @@ -182,7 +177,7 @@ public void SetTo(IEDIDLinkGetter link) public void Clear() { - EDID = Null; + EDID = RecordType.Null; } public static implicit operator EDIDLink(RecordType recordType) @@ -194,7 +189,7 @@ public static implicit operator EDIDLink(TMajor major) { if (major.EditorID == null) { - return Null; + return RecordType.Null; } else { From 414c61f17c19c2447e390e7a36acb0e55f7a11cc Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Jul 2023 22:54:59 -0500 Subject: [PATCH 126/135] EDIDLink.Empty -> Null --- Mutagen.Bethesda.Core/Plugins/EDIDLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mutagen.Bethesda.Core/Plugins/EDIDLink.cs b/Mutagen.Bethesda.Core/Plugins/EDIDLink.cs index 2375ea995..f9dde7779 100644 --- a/Mutagen.Bethesda.Core/Plugins/EDIDLink.cs +++ b/Mutagen.Bethesda.Core/Plugins/EDIDLink.cs @@ -15,7 +15,7 @@ public sealed class EDIDLink : IEDIDLink, IEquatable /// A readonly singleton representing an unlinked EDIDLink /// - public static readonly IEDIDLinkGetter Empty = new EDIDLink(); + public static readonly IEDIDLinkGetter Null = new EDIDLink(); /// /// Record type representing the target EditorID to link against From 951e922430b9abe4cbacb263022b6f87a7fe3abb Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Jul 2023 23:59:10 -0500 Subject: [PATCH 127/135] Remove loqui generation from sourcegen project Might break things? Need to research --- .../Mutagen.Bethesda.SourceGenerators.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/Mutagen.Bethesda.SourceGenerators/Mutagen.Bethesda.SourceGenerators.csproj b/Mutagen.Bethesda.SourceGenerators/Mutagen.Bethesda.SourceGenerators.csproj index 475845a4a..32eb57887 100644 --- a/Mutagen.Bethesda.SourceGenerators/Mutagen.Bethesda.SourceGenerators.csproj +++ b/Mutagen.Bethesda.SourceGenerators/Mutagen.Bethesda.SourceGenerators.csproj @@ -24,7 +24,6 @@ - @@ -37,7 +36,6 @@ - From a7fe3fa09556db21a95cc3f9b0194078f3b43d4d Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 29 Jul 2023 23:59:21 -0500 Subject: [PATCH 128/135] Remove Loqui Xml serialization bits --- .../XML/DataTypeXmlTranslationGeneration.cs | 125 ------ .../Modules/XML/FolderExportModule.cs | 254 ----------- .../XML/FormLinkXmlTranslationGeneration.cs | 82 ---- .../GenderedTypeXmlTranslationGeneration.cs | 64 --- .../Modules/XML/MutagenXmlModule.cs | 410 ------------------ .../XML/StringXmlTranslationGeneration.cs | 57 --- 6 files changed, 992 deletions(-) delete mode 100644 Mutagen.Bethesda.Generation/Modules/XML/DataTypeXmlTranslationGeneration.cs delete mode 100644 Mutagen.Bethesda.Generation/Modules/XML/FolderExportModule.cs delete mode 100644 Mutagen.Bethesda.Generation/Modules/XML/FormLinkXmlTranslationGeneration.cs delete mode 100644 Mutagen.Bethesda.Generation/Modules/XML/GenderedTypeXmlTranslationGeneration.cs delete mode 100644 Mutagen.Bethesda.Generation/Modules/XML/MutagenXmlModule.cs delete mode 100644 Mutagen.Bethesda.Generation/Modules/XML/StringXmlTranslationGeneration.cs diff --git a/Mutagen.Bethesda.Generation/Modules/XML/DataTypeXmlTranslationGeneration.cs b/Mutagen.Bethesda.Generation/Modules/XML/DataTypeXmlTranslationGeneration.cs deleted file mode 100644 index 0acd330b2..000000000 --- a/Mutagen.Bethesda.Generation/Modules/XML/DataTypeXmlTranslationGeneration.cs +++ /dev/null @@ -1,125 +0,0 @@ -using Loqui.Generation; -using System.Xml.Linq; -using Mutagen.Bethesda.Generation.Fields; -using Noggog.StructuredStrings; -using Noggog.StructuredStrings.CSharp; - -namespace Mutagen.Bethesda.Generation; - -public class DataTypeXmlTranslationGeneration : XmlTranslationGeneration -{ - public override bool ShouldGenerateWrite(TypeGeneration typeGen) - { - return true; - } - - public override void GenerateCopyIn( - StructuredStringBuilder sb, - ObjectGeneration objGen, - TypeGeneration typeGen, - Accessor nodeAccessor, - Accessor itemAccessor, - Accessor errorMaskAccessor, - Accessor translationMaskAccessor) - { - throw new NotImplementedException(); - } - - public override void GenerateForCommonXSD(XElement rootElement, TypeGeneration typeGen) - { - throw new NotImplementedException(); - } - - public override XElement GenerateForXSD( - ObjectGeneration objGen, - XElement rootElement, - XElement choiceElement, - TypeGeneration typeGen, - string nameOverride) - { - throw new NotImplementedException(); - } - - public override void GenerateWrite( - StructuredStringBuilder sb, - ObjectGeneration obj, - TypeGeneration typeGen, - Accessor writerAccessor, - Accessor itemAccessor, - Accessor errorMaskAccessor, - Accessor nameAccessor, - Accessor translationMaskAccessor) - { - var dataType = typeGen as DataType; - bool isInRange = false; - var origDepth = sb.Depth; - foreach (var subField in dataType.IterateFieldsWithMeta()) - { - if (!this.XmlMod.TryGetTypeGeneration(subField.Field.GetType(), out var subGenerator)) - { - throw new ArgumentException("Unsupported type generator: " + subField.Field); - } - - var subData = subField.Field.GetFieldData(); - if (!subGenerator.ShouldGenerateWrite(subField.Field)) continue; - if (subField.BreakIndex != -1) - { - sb.AppendLine($"if (!item.{dataType.StateName}.HasFlag({obj.Name}.{dataType.EnumName}.Break{subField.BreakIndex}))"); - sb.AppendLine("{"); - sb.Depth++; - } - if (subField.Range != null && !isInRange) - { - isInRange = true; - sb.AppendLine($"if (item.{dataType.StateName}.HasFlag({obj.Name}.{dataType.EnumName}.Range{subField.RangeIndex}))"); - sb.AppendLine("{"); - sb.Depth++; - } - if (subField.Range == null && isInRange) - { - isInRange = false; - sb.Depth--; - sb.AppendLine("}"); - } - - List conditions = new List(); - if (this.XmlMod.TranslationMaskParameter - && subField.Field.IntegrateField) - { - conditions.Add(subField.Field.GetTranslationIfAccessor("translationMask")); - } - if (conditions.Count > 0) - { - using (var args = sb.If(ands: true)) - { - foreach (var item in conditions) - { - args.Add(item); - } - } - } - using (sb.CurlyBrace(doIt: conditions.Count > 0)) - { - subGenerator.GenerateWrite( - sb: sb, - objGen: obj, - nameAccessor: $"nameof(item.{subField.Field.Name})", - typeGen: subField.Field, - writerAccessor: writerAccessor, - translationMaskAccessor: "translationMask", - itemAccessor: Accessor.FromType(subField.Field, "item"), - errorMaskAccessor: $"errorMask"); - } - } - for (int i = sb.Depth - origDepth; i > 0; i--) - { - sb.Depth--; - sb.AppendLine("}"); - } - } - - public override string GetTranslatorInstance(TypeGeneration typeGen, bool getter) - { - throw new NotImplementedException(); - } -} \ No newline at end of file diff --git a/Mutagen.Bethesda.Generation/Modules/XML/FolderExportModule.cs b/Mutagen.Bethesda.Generation/Modules/XML/FolderExportModule.cs deleted file mode 100644 index 5ec9995e5..000000000 --- a/Mutagen.Bethesda.Generation/Modules/XML/FolderExportModule.cs +++ /dev/null @@ -1,254 +0,0 @@ -using Loqui.Generation; -using System.Xml.Linq; -using Mutagen.Bethesda.Generation.Fields; -using Noggog; -using Noggog.StructuredStrings; -using Noggog.StructuredStrings.CSharp; -using ObjectType = Mutagen.Bethesda.Plugins.Meta.ObjectType; - -namespace Mutagen.Bethesda.Generation.Modules; - -public class FolderExportModule : GenerationModule -{ - public override async IAsyncEnumerable RequiredUsingStatements(ObjectGeneration obj) - { - yield return "System.Threading.Tasks"; - yield return "Noggog.Utility"; - } - - public override async Task PostFieldLoad(ObjectGeneration obj, TypeGeneration field, XElement node) - { - await base.PostFieldLoad(obj, field, node); - field.GetFieldData().CustomFolder = node.TryGetAttribute("customFolder", out var customFolder) && customFolder; - } - - public override async Task GenerateInClass(ObjectGeneration obj, StructuredStringBuilder sb) - { - await base.GenerateInClass(obj, sb); - - switch (obj.GetObjectType()) - { - case ObjectType.Record: - await GenerateForRecord(obj, sb); - break; - case ObjectType.Mod: - await GenerateForMod(obj, sb); - break; - case ObjectType.Subrecord: - case ObjectType.Group: - default: - break; - } - } - - private async Task GenerateForMod(ObjectGeneration obj, StructuredStringBuilder sb) - { - using (var args = sb.Function( - $"public static Task<{obj.Name}> CreateFromXmlFolder")) - { - args.Add("DirectoryPath dir"); - args.Add("ModKey modKey"); - } - using (sb.CurlyBrace()) - { - using (var args = sb.Call( - "return CreateFromXmlFolder")) - { - args.Add("dir: dir"); - args.Add("modKey: modKey"); - args.Add("errorMask: null"); - } - } - sb.AppendLine(); - - using (var args = sb.Function( - $"public static async Task<({obj.Name} Mod, {obj.Mask(MaskType.Error)} ErrorMask)> CreateFromXmlFolderWithErrorMask")) - { - args.Add("DirectoryPath dir"); - args.Add("ModKey modKey"); - } - using (sb.CurlyBrace()) - { - sb.AppendLine("ErrorMaskBuilder? errorMaskBuilder = new ErrorMaskBuilder();"); - using (var args = sb.Call( - "var ret = await CreateFromXmlFolder")) - { - args.Add("dir: dir"); - args.Add("modKey: modKey"); - args.Add("errorMask: errorMaskBuilder"); - } - sb.AppendLine($"var errorMask = {obj.Mask(MaskType.Error)}.Factory(errorMaskBuilder);"); - sb.AppendLine("return (ret, errorMask);"); - } - sb.AppendLine(); - - using (var args = sb.Function( - $"public static async Task<{obj.Name}> CreateFromXmlFolder")) - { - args.Add("DirectoryPath dir"); - args.Add("ModKey modKey"); - args.Add("ErrorMaskBuilder? errorMask"); - } - using (sb.CurlyBrace()) - { - sb.AppendLine($"var item = new {obj.Name}(modKey);"); - sb.AppendLine($"var tasks = new List();"); - foreach (var field in obj.IterateFields()) - { - if (field.GetFieldData().CustomFolder) - { - using (var args = sb.Call( - $"tasks.Add(Task.Run(() => item.CreateFromXmlFolder{field.Name}", - suffixLine: "))")) - { - args.Add("dir: dir"); - args.Add($"name: nameof({field.Name})"); - args.Add($"index: (int){field.IndexEnumName}"); - args.Add($"errorMask: errorMask"); - } - continue; - } - if (!(field is LoquiType loqui)) - { - throw new ArgumentException(); - } - switch (loqui.TargetObjectGeneration.GetObjectType()) - { - case ObjectType.Record: - using (var args = sb.Call( - $"item.{field.Name}.CopyInFromXml")) - { - args.Add($"path: Path.Combine(dir.Path, \"{field.Name}.xml\")"); - args.Add($"errorMask: errorMask"); - args.Add($"translationMask: null"); - } - break; - case ObjectType.Group: - if (!loqui.TryGetSpecificationAsObject("T", out var subObj)) continue; - using (var args = sb.Call( - $"tasks.Add(Task.Run(() => item.{field.Name}.CreateFromXmlFolder<{subObj.Name}>", - suffixLine: "))")) - { - args.Add($"dir: dir"); - args.Add($"name: nameof({field.Name})"); - args.Add($"errorMask: errorMask"); - args.Add($"index: (int){field.IndexEnumName}"); - } - break; - default: - break; - } - } - sb.AppendLine("await Task.WhenAll(tasks);"); - sb.AppendLine("return item;"); - } - sb.AppendLine(); - - using (var args = sb.Function( - $"public async Task<{obj.Mask(MaskType.Error)}?> WriteToXmlFolder")) - { - args.Add("DirectoryPath dir"); - args.Add("bool doMasks = true"); - } - using (sb.CurlyBrace()) - { - sb.AppendLine($"ErrorMaskBuilder? errorMaskBuilder = null;"); - sb.AppendLine("dir.Create();"); - sb.AppendLine("using (new FolderCleaner(dir, FolderCleaner.CleanType.AccessTime))"); - using (sb.CurlyBrace()) - { - sb.AppendLine($"var tasks = new List();"); - foreach (var field in obj.IterateFields()) - { - if (!(field is LoquiType loqui)) - { - throw new ArgumentException(); - } - if (field.GetFieldData().CustomFolder) - { - using (var args = sb.Call( - $"tasks.Add(Task.Run(() => WriteToXmlFolder{field.Name}", - suffixLine: "))")) - { - args.Add("dir: dir"); - args.Add($"name: nameof({field.Name})"); ; - args.Add($"index: (int){field.IndexEnumName}"); - args.Add($"errorMask: errorMaskBuilder"); - } - continue; - } - switch (loqui.TargetObjectGeneration.GetObjectType()) - { - case ObjectType.Record: - using (var args = sb.Call( - $"tasks.Add(Task.Run(() => this.{field.Name}.WriteToXml", - suffixLine: "))")) - { - args.Add($"path: Path.Combine(dir.Path, \"{field.Name}.xml\")"); - args.Add($"errorMask: errorMaskBuilder"); - args.Add($"translationMask: null"); - } - break; - case ObjectType.Group: - ObjectGeneration subObj; - if (field is GroupType group) - { - if (!group.TryGetSpecificationAsObject("T", out subObj)) continue; - using (var args = sb.Call( - $"tasks.Add(Task.Run(() => {field.Name}.WriteToXmlFolder<{subObj.Name}, {subObj.Mask(MaskType.Error)}>", - suffixLine: "))")) - { - args.Add($"dir: dir.Path"); - args.Add($"name: nameof({field.Name})"); - args.Add($"errorMask: errorMaskBuilder"); - args.Add($"index: (int){field.IndexEnumName}"); - } - } - else - { - using (var args = sb.Call( - $"tasks.Add(Task.Run(() => {field.Name}.WriteToXmlFolder", - suffixLine: "))")) - { - args.Add($"dir: dir.Path"); - args.Add($"name: nameof({field.Name})"); - args.Add($"errorMask: errorMaskBuilder"); - args.Add($"index: (int){field.IndexEnumName}"); - } - } - break; - default: - break; - } - } - sb.AppendLine("await Task.WhenAll(tasks);"); - } - sb.AppendLine("return null;"); - } - } - - private async Task GenerateForRecord(ObjectGeneration obj, StructuredStringBuilder sb) - { - if (!obj.IsTopClass) return; - - using (var args = sb.Function( - $"public{obj.FunctionOverride()}async Task WriteToXmlFolder")) - { - args.Add("DirectoryPath dir"); - args.Add("string name"); - args.Add("XElement node"); - args.Add("int counter"); - args.Add($"ErrorMaskBuilder? errorMask"); - } - using (sb.CurlyBrace()) - { - using (var args = sb.Call( - "this.WriteToXml")) - { - args.Add("node: node"); - args.Add("errorMask: errorMask"); - args.Add("translationMask: null"); - } - } - } -} \ No newline at end of file diff --git a/Mutagen.Bethesda.Generation/Modules/XML/FormLinkXmlTranslationGeneration.cs b/Mutagen.Bethesda.Generation/Modules/XML/FormLinkXmlTranslationGeneration.cs deleted file mode 100644 index 9fbd90f2b..000000000 --- a/Mutagen.Bethesda.Generation/Modules/XML/FormLinkXmlTranslationGeneration.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Loqui.Generation; -using Mutagen.Bethesda.Generation.Fields; -using Mutagen.Bethesda.Plugins; -using Noggog.StructuredStrings; -using Noggog.StructuredStrings.CSharp; - -namespace Mutagen.Bethesda.Generation; - -public class FormLinkXmlTranslationGeneration : PrimitiveXmlTranslationGeneration -{ - public override string TypeName(TypeGeneration typeGen) - { - FormLinkType type = typeGen as FormLinkType; - switch (type.FormIDType) - { - case FormLinkType.FormIDTypeEnum.Normal: - return base.TypeName(typeGen); - case FormLinkType.FormIDTypeEnum.EDIDChars: - return "RecordType"; - default: - throw new NotImplementedException(); - } - } - - protected override string ItemWriteAccess(TypeGeneration typeGen, Accessor itemAccessor) - { - FormLinkType type = typeGen as FormLinkType; - switch (type.FormIDType) - { - case FormLinkType.FormIDTypeEnum.Normal: - return $"{itemAccessor}.FormKey"; - case FormLinkType.FormIDTypeEnum.EDIDChars: - return $"{itemAccessor}.EDID"; - default: - throw new NotImplementedException(); - } - } - - public override void GenerateCopyIn( - StructuredStringBuilder sb, - ObjectGeneration objGen, - TypeGeneration typeGen, - Accessor frameAccessor, - Accessor itemAccessor, - Accessor errorMaskAccessor, - Accessor translationMaskAccessor) - { - FormLinkType linkType = typeGen as FormLinkType; - MaskGenerationUtility.WrapErrorFieldIndexPush(sb, - () => - { - if (itemAccessor.IsAssignment) - { - using (var args = sb.Call( - $"{itemAccessor} = {(linkType.FormIDType == FormLinkType.FormIDTypeEnum.Normal ? "FormKey" : "RecordType")}XmlTranslation.Instance.Parse")) - { - args.AddPassArg("node"); - args.AddPassArg("errorMask"); - } - } - else - { - using (var args = sb.Function( - itemAccessor.Assign($"new {linkType.DirectTypeName(getter: false)}"))) - { - args.Add(subFg => - { - using (var subArgs = subFg.Function( - $"FormKeyXmlTranslation.Instance.Parse")) - { - subArgs.AddPassArg("node"); - subArgs.AddPassArg("errorMask"); - } - }); - } - } - }, - indexAccessor: typeGen.HasIndex ? typeGen.IndexEnumInt : null, - errorMaskAccessor: errorMaskAccessor, - doIt: typeGen.HasIndex); - } -} \ No newline at end of file diff --git a/Mutagen.Bethesda.Generation/Modules/XML/GenderedTypeXmlTranslationGeneration.cs b/Mutagen.Bethesda.Generation/Modules/XML/GenderedTypeXmlTranslationGeneration.cs deleted file mode 100644 index 12b83e401..000000000 --- a/Mutagen.Bethesda.Generation/Modules/XML/GenderedTypeXmlTranslationGeneration.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Loqui.Generation; -using System.Xml.Linq; -using Mutagen.Bethesda.Generation.Fields; -using Noggog.StructuredStrings; -using Noggog.StructuredStrings.CSharp; - -namespace Mutagen.Bethesda.Generation; - -public class GenderedTypeXmlTranslationGeneration : XmlTranslationGeneration -{ - public override void GenerateCopyIn(StructuredStringBuilder sb, ObjectGeneration objGen, TypeGeneration typeGen, Accessor nodeAccessor, Accessor itemAccessor, Accessor errorMaskAccessor, Accessor translationMaskAccessor) - { - GenderedType gendered = typeGen as GenderedType; - var gen = this.XmlMod.GetTypeGeneration(gendered.SubTypeGeneration.GetType()); - MaskGenerationUtility.WrapErrorFieldIndexPush( - sb, - () => - { - using (var args = sb.Call( - $"{itemAccessor} = new {typeGen.TypeName(getter: false)}")) - { - args.Add(subFg => - { - gen.GenerateCopyIn(subFg, objGen, gendered.SubTypeGeneration, nodeAccessor, Accessor.ConstructorParam($"male"), errorMaskAccessor, translationMaskAccessor: null); - }); - args.Add(subFg => - { - gen.GenerateCopyIn(subFg, objGen, gendered.SubTypeGeneration, nodeAccessor, Accessor.ConstructorParam($"female"), errorMaskAccessor, translationMaskAccessor: null); - }); - } - }, - errorMaskAccessor, - typeGen.HasIndex ? typeGen.IndexEnumInt : default(Accessor)); - } - - public override void GenerateForCommonXSD(XElement rootElement, TypeGeneration typeGen) - { - throw new NotImplementedException(); - } - - public override XElement GenerateForXSD(ObjectGeneration objGen, XElement rootElement, XElement choiceElement, TypeGeneration typeGen, string nameOverride) - { - throw new NotImplementedException(); - } - - public override void GenerateWrite(StructuredStringBuilder sb, ObjectGeneration objGen, TypeGeneration typeGen, Accessor writerAccessor, Accessor itemAccessor, Accessor errorMaskAccessor, Accessor nameAccessor, Accessor translationMaskAccessor) - { - GenderedType gendered = typeGen as GenderedType; - var gen = this.XmlMod.GetTypeGeneration(gendered.SubTypeGeneration.GetType()); - using (sb.CurlyBrace()) - { - gen.GenerateWrite(sb, objGen, gendered.SubTypeGeneration, writerAccessor, $"{itemAccessor}.Male", errorMaskAccessor, nameAccessor, translationMaskAccessor); - } - using (sb.CurlyBrace()) - { - gen.GenerateWrite(sb, objGen, gendered.SubTypeGeneration, writerAccessor, $"{itemAccessor}.Female", errorMaskAccessor, nameAccessor, translationMaskAccessor); - } - } - - public override string GetTranslatorInstance(TypeGeneration typeGen, bool getter) - { - throw new NotImplementedException(); - } -} \ No newline at end of file diff --git a/Mutagen.Bethesda.Generation/Modules/XML/MutagenXmlModule.cs b/Mutagen.Bethesda.Generation/Modules/XML/MutagenXmlModule.cs deleted file mode 100644 index 6cf96a002..000000000 --- a/Mutagen.Bethesda.Generation/Modules/XML/MutagenXmlModule.cs +++ /dev/null @@ -1,410 +0,0 @@ -using Loqui.Generation; -using Loqui.Internal; -using Mutagen.Bethesda.Generation.Fields; -using Noggog.StructuredStrings; -using Noggog.StructuredStrings.CSharp; - -namespace Mutagen.Bethesda.Generation; - -public class MutagenXmlModule : XmlTranslationModule -{ - public MutagenXmlModule(LoquiGenerator gen) - : base(gen) - { - } - - public override void GenerateWriteToNode(ObjectGeneration obj, StructuredStringBuilder sb) - { - using (var args = sb.Function( - $"public static void WriteToNode{ModuleNickname}{obj.GetGenericTypes(MaskType.Normal)}")) - { - args.Wheres.AddRange(obj.GenerateWhereClauses(LoquiInterfaceType.IGetter, defs: obj.Generics)); - args.Add($"{obj.Interface(internalInterface: true, getter: true)} item"); - args.Add($"XElement {XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend)}"); - args.Add($"ErrorMaskBuilder? errorMask"); - args.Add($"{nameof(TranslationCrystal)}? translationMask"); - } - using (sb.CurlyBrace()) - { - if (obj.HasLoquiBaseObject) - { - using (var args = sb.Call( - $"{this.TranslationWriteClass(obj.BaseClass)}.WriteToNode{ModuleNickname}")) - { - args.Add($"item: item"); - args.AddPassArg($"{XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend)}"); - args.Add($"errorMask: errorMask"); - args.Add($"translationMask: translationMask"); - } - } - - void generateNormal(XmlTranslationGeneration generator, TypeGeneration field) - { - if (!generator.ShouldGenerateWrite(field)) return; - - List conditions = new List(); - if (field.Nullable) - { - conditions.Add($"{field.NullableAccessor(getter: true, accessor: Accessor.FromType(field, "item"))}"); - } - if (this.TranslationMaskParameter) - { - conditions.Add(field.GetTranslationIfAccessor("translationMask")); - } - if (conditions.Count > 0) - { - using (var args = sb.If(ands: true)) - { - foreach (var item in conditions) - { - args.Add(item); - } - } - } - using (sb.CurlyBrace(doIt: conditions.Count > 0)) - { - var maskType = this.Gen.MaskModule.GetMaskModule(field.GetType()).GetErrorMaskTypeStr(field); - generator.GenerateWrite( - sb: sb, - objGen: obj, - typeGen: field, - writerAccessor: $"{XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend)}", - itemAccessor: Accessor.FromType(field, "item"), - errorMaskAccessor: $"errorMask", - translationMaskAccessor: "translationMask", - nameAccessor: $"nameof(item.{field.Name})"); - } - } - - foreach (var field in obj.IterateFields(expandSets: SetMarkerType.ExpandSets.FalseAndInclude, nonIntegrated: true)) - { - if (!this.TryGetTypeGeneration(field.GetType(), out var generator)) - { - if (!field.IntegrateField) continue; - throw new ArgumentException("Unsupported type generator: " + field); - } - - if (field is DataType dataType) - { - if (dataType.Nullable) - { - sb.AppendLine($"if (item.{dataType.StateName}.HasFlag({obj.Name}.{dataType.EnumName}.Has))"); - } - using (sb.CurlyBrace(doIt: dataType.Nullable)) - { - bool isInRange = false; - int encounteredBreakIndex = 0; - foreach (var subField in dataType.IterateFieldsWithMeta()) - { - if (!this.TryGetTypeGeneration(subField.Field.GetType(), out var subGenerator)) - { - throw new ArgumentException("Unsupported type generator: " + subField.Field); - } - - var subData = subField.Field.GetFieldData(); - if (!subGenerator.ShouldGenerateCopyIn(subField.Field)) continue; - if (subField.BreakIndex != -1) - { - sb.AppendLine($"if (!item.{dataType.StateName}.HasFlag({obj.Name}.{dataType.EnumName}.Break{subField.BreakIndex}))"); - sb.AppendLine("{"); - sb.Depth++; - encounteredBreakIndex++; - } - if (subField.Range != null && !isInRange) - { - isInRange = true; - sb.AppendLine($"if (item.{dataType.StateName}.HasFlag({obj.Name}.{dataType.EnumName}.Range{subField.RangeIndex}))"); - sb.AppendLine("{"); - sb.Depth++; - } - if (subField.Range == null && isInRange) - { - isInRange = false; - sb.Depth--; - sb.AppendLine("}"); - } - generateNormal(subGenerator, subField.Field); - } - for (int i = 0; i < encounteredBreakIndex; i++) - { - sb.Depth--; - sb.AppendLine("}"); - if (i == encounteredBreakIndex - 1) - { - sb.AppendLine("else"); - using (sb.CurlyBrace()) - { - sb.AppendLine($"node.Add(new XElement(\"Has{dataType.EnumName}\"));"); - } - } - } - } - } - else - { - generateNormal(generator, field); - } - } - } - sb.AppendLine(); - } - - private void HandleDataTypeParsing(ObjectGeneration obj, StructuredStringBuilder sb, DataType set, DataType.DataTypeIteration subField, ref bool isInRange) - { - if (subField.FieldIndex == 0 && set.Nullable) - { - sb.AppendLine($"item.{set.StateName} |= {obj.Name}.{set.EnumName}.Has;"); - } - if (subField.BreakIndex != -1) - { - sb.AppendLine($"item.{set.StateName} &= ~{obj.Name}.{set.EnumName}.Break{subField.BreakIndex};"); - } - if (subField.Range != null && !isInRange) - { - isInRange = true; - sb.AppendLine($"item.{set.StateName} |= {obj.Name}.{set.EnumName}.Range{subField.RangeIndex};"); - } - if (subField.Range == null && isInRange) - { - isInRange = false; - } - } - - protected override async Task PreCreateLoop(ObjectGeneration obj, StructuredStringBuilder sb) - { - foreach (var field in obj.IterateFields(nonIntegrated: true, expandSets: SetMarkerType.ExpandSets.FalseAndInclude)) - { - if (!(field is DataType set)) continue; - for (int i = 0; i < set.BreakIndices.Count; i++) - { - sb.AppendLine($"item.{set.StateName} |= {obj.Name}.{set.EnumName}.Break{i};"); - } - } - } - - protected override void FillPrivateElement(ObjectGeneration obj, StructuredStringBuilder sb) - { - if (obj.IterateFields(includeBaseClass: true).Any(f => f.ReadOnly)) - { - using (var args = sb.Function( - $"protected static void FillPrivateElement{ModuleNickname}")) - { - args.Add($"{obj.Interface(getter: false, internalInterface: true)} item"); - args.Add($"XElement {XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend)}"); - args.Add("string name"); - args.Add($"ErrorMaskBuilder? errorMask"); - args.Add($"{nameof(TranslationCrystal)}? translationMask"); - } - using (sb.CurlyBrace()) - { - sb.AppendLine("switch (name)"); - using (sb.CurlyBrace()) - { - bool isInRange = false; - foreach (var field in obj.IterateFields(expandSets: SetMarkerType.ExpandSets.FalseAndInclude, nonIntegrated: true)) - { - if (field is DataType set) - { - if (set.Nullable) - { - sb.AppendLine($"case \"Has{set.EnumName}\":"); - using (sb.IncreaseDepth()) - { - sb.AppendLine($"item.{set.StateName} |= {obj.Name}.{set.EnumName}.Has;"); - sb.AppendLine("break;"); - } - } - foreach (var subField in set.IterateFieldsWithMeta()) - { - if (subField.Field.Derivative) continue; - if (!subField.Field.ReadOnly) continue; - if (!subField.Field.IntegrateField) continue; - if (!this.TryGetTypeGeneration(subField.Field.GetType(), out var generator)) - { - throw new ArgumentException("Unsupported type generator: " + subField.Field); - } - sb.AppendLine($"case \"{subField.Field.Name}\":"); - using (sb.IncreaseDepth()) - { - if (generator.ShouldGenerateCopyIn(subField.Field)) - { - generator.GenerateCopyIn( - sb: sb, - objGen: obj, - typeGen: subField.Field, - nodeAccessor: XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend).Result, - itemAccessor: Accessor.FromType(subField.Field, "item"), - translationMaskAccessor: "translationMask", - errorMaskAccessor: $"errorMask"); - } - HandleDataTypeParsing(obj, sb, set, subField, ref isInRange); - sb.AppendLine("break;"); - } - } - } - else if (field.IntegrateField) - { - if (field.Derivative) continue; - if (!field.ReadOnly) continue; - if (!this.TryGetTypeGeneration(field.GetType(), out var generator)) - { - throw new ArgumentException("Unsupported type generator: " + field); - } - - sb.AppendLine($"case \"{field.Name}\":"); - using (sb.IncreaseDepth()) - { - if (generator.ShouldGenerateCopyIn(field)) - { - generator.GenerateCopyIn( - sb: sb, - objGen: obj, - typeGen: field, - nodeAccessor: XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend).Result, - itemAccessor: Accessor.FromType(field, "item"), - translationMaskAccessor: "translationMask", - errorMaskAccessor: $"errorMask"); - } - sb.AppendLine("break;"); - } - } - } - - sb.AppendLine("default:"); - using (sb.IncreaseDepth()) - { - if (obj.HasLoquiBaseObject) - { - using (var args = sb.Call( - $"{obj.BaseClass.CommonClass(LoquiInterfaceType.ISetter, CommonGenerics.Class, MaskType.Normal)}.FillPrivateElement{ModuleNickname}{obj.GetBaseMask_GenericTypes(MaskType.Error)}")) - { - args.Add("item: item"); - args.AddPassArg($"{XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend)}"); - args.Add("name: name"); - args.Add("errorMask: errorMask"); - if (this.TranslationMaskParameter) - { - args.Add($"translationMask: translationMask"); - } - } - } - sb.AppendLine("break;"); - } - } - } - sb.AppendLine(); - } - } - - protected override void FillPublicElement(ObjectGeneration obj, StructuredStringBuilder sb) - { - using (var args = sb.Function( - $"public static void FillPublicElement{ModuleNickname}")) - { - args.Add($"{obj.Interface(getter: false, internalInterface: true)} item"); - args.Add($"XElement {XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend)}"); - args.Add("string name"); - args.Add($"ErrorMaskBuilder? errorMask"); - args.Add($"{nameof(TranslationCrystal)}? translationMask"); - } - using (sb.CurlyBrace()) - { - sb.AppendLine("switch (name)"); - using (sb.CurlyBrace()) - { - bool isInRange = false; - foreach (var field in obj.IterateFields(expandSets: SetMarkerType.ExpandSets.FalseAndInclude, nonIntegrated: true)) - { - if (field is DataType set) - { - foreach (var subField in set.IterateFieldsWithMeta()) - { - if (subField.Field.Derivative) continue; - if (subField.Field.ReadOnly) continue; - if (!subField.Field.IntegrateField) continue; - if (!this.TryGetTypeGeneration(subField.Field.GetType(), out var generator)) - { - throw new ArgumentException("Unsupported type generator: " + subField.Field); - } - - sb.AppendLine($"case \"{subField.Field.Name}\":"); - using (sb.IncreaseDepth()) - { - if (generator.ShouldGenerateCopyIn(subField.Field)) - { - generator.GenerateCopyIn( - sb: sb, - objGen: obj, - typeGen: subField.Field, - nodeAccessor: XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend).Result, - itemAccessor: Accessor.FromType(subField.Field, "item"), - translationMaskAccessor: "translationMask", - errorMaskAccessor: $"errorMask"); - } - HandleDataTypeParsing(obj, sb, set, subField, ref isInRange); - sb.AppendLine("break;"); - } - } - } - else if (field.IntegrateField) - { - if (field.Derivative) continue; - if (field.ReadOnly) continue; - if (!this.TryGetTypeGeneration(field.GetType(), out var generator)) - { - throw new ArgumentException("Unsupported type generator: " + field); - } - - sb.AppendLine($"case \"{field.Name}\":"); - using (sb.IncreaseDepth()) - { - if (generator.ShouldGenerateCopyIn(field)) - { - generator.GenerateCopyIn( - sb: sb, - objGen: obj, - typeGen: field, - nodeAccessor: XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend).Result, - itemAccessor: Accessor.FromType(field, "item"), - translationMaskAccessor: "translationMask", - errorMaskAccessor: $"errorMask"); - } - sb.AppendLine("break;"); - } - } - } - - sb.AppendLine("default:"); - using (sb.IncreaseDepth()) - { - if (obj.HasLoquiBaseObject) - { - using (var args = sb.Call( - $"{this.TranslationCreateClass(obj.BaseClass)}.FillPublicElement{ModuleNickname}")) - { - args.Add("item: item"); - args.AddPassArg($"{XmlTranslationModule.XElementLine.GetParameterName(obj, Context.Backend)}"); - args.Add("name: name"); - args.Add("errorMask: errorMask"); - if (this.TranslationMaskParameter) - { - args.Add($"translationMask: translationMask"); - } - } - } - sb.AppendLine("break;"); - } - } - } - sb.AppendLine(); - } - - public override async IAsyncEnumerable RequiredUsingStatements(ObjectGeneration obj) - { - await foreach (var item in base.RequiredUsingStatements(obj)) - { - yield return item; - } - yield return "Mutagen.Bethesda.Xml"; - } -} \ No newline at end of file diff --git a/Mutagen.Bethesda.Generation/Modules/XML/StringXmlTranslationGeneration.cs b/Mutagen.Bethesda.Generation/Modules/XML/StringXmlTranslationGeneration.cs deleted file mode 100644 index 311cc51a3..000000000 --- a/Mutagen.Bethesda.Generation/Modules/XML/StringXmlTranslationGeneration.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Loqui.Generation; -using Noggog.StructuredStrings; -using Noggog.StructuredStrings.CSharp; -using StringType = Mutagen.Bethesda.Generation.Fields.StringType; - -namespace Mutagen.Bethesda.Generation; - -public class StringXmlTranslationGeneration : Loqui.Generation.PrimitiveXmlTranslationGeneration -{ - public override void GenerateWrite( - StructuredStringBuilder sb, - ObjectGeneration objGen, - TypeGeneration typeGen, - Accessor writerAccessor, - Accessor itemAccessor, - Accessor errorMaskAccessor, - Accessor nameAccessor, - Accessor translationMaskAccessor) - { - StringType str = typeGen as StringType; - if (str.Translated.HasValue) - { - using (var args = sb.Call( - $"Mutagen.Bethesda.Xml.TranslatedStringXmlTranslation.Instance.Write")) - { - args.Add($"{XmlTranslationModule.XElementLine.GetParameterName(objGen, Context.Backend)}: {writerAccessor}"); - args.Add($"name: {nameAccessor}"); - args.Add($"item: {ItemWriteAccess(typeGen, itemAccessor)}"); - if (typeGen.HasIndex) - { - args.Add($"fieldIndex: (int){typeGen.IndexEnumName}"); - } - args.Add($"errorMask: {errorMaskAccessor}"); - } - } - else - { - using (var args = sb.Call( - $"{this.TypeName(typeGen)}XmlTranslation.Instance.Write")) - { - args.Add($"{XmlTranslationModule.XElementLine.GetParameterName(objGen, Context.Backend)}: {writerAccessor}"); - args.Add($"name: {nameAccessor}"); - args.Add($"item: {ItemWriteAccess(typeGen, itemAccessor)}"); - if (typeGen.HasIndex) - { - args.Add($"fieldIndex: (int){typeGen.IndexEnumName}"); - } - args.Add($"errorMask: {errorMaskAccessor}"); - } - } - } - - protected override string ItemWriteAccess(TypeGeneration typeGen, Accessor itemAccessor) - { - return itemAccessor.Access; - } -} \ No newline at end of file From daeedb5152b12e6fed23b894e0211120245a9143 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 30 Jul 2023 00:37:24 -0500 Subject: [PATCH 129/135] Oblivion.ClimateData swapped to TimeOnly --- Directory.Packages.props | 4 +- .../Modules/Plugin/PluginTranslationModule.cs | 224 +++++++++--------- .../Records/Major Records/Climate.cs | 20 +- .../Records/Major Records/Climate.xml | 8 +- .../Major Records/ClimateData_Generated.cs | 40 ++-- 5 files changed, 149 insertions(+), 147 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f54ec6453..4c86e30bf 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,10 +24,10 @@ - [2.59.0.1-nightly-20230704-193765] + [2.59.0.1-dev] - [2.59.0.1-nightly-20230704-193765] + [2.59.0.1-dev] diff --git a/Mutagen.Bethesda.Generation/Modules/Plugin/PluginTranslationModule.cs b/Mutagen.Bethesda.Generation/Modules/Plugin/PluginTranslationModule.cs index 36139799f..429ca4893 100644 --- a/Mutagen.Bethesda.Generation/Modules/Plugin/PluginTranslationModule.cs +++ b/Mutagen.Bethesda.Generation/Modules/Plugin/PluginTranslationModule.cs @@ -44,75 +44,77 @@ public override string TranslatorReference(ObjectGeneration obj, Accessor item) { return base.TranslatorReference(obj, item); } - return $"{this.TranslationWriteClass(obj)}.Instance"; + return $"{TranslationWriteClass(obj)}.Instance"; } public PluginTranslationModule(LoquiGenerator gen) : base(gen) { - this.DoErrorMasks = false; - this.TranslationMaskParameter = false; - this._typeGenerations[typeof(LoquiType)] = new LoquiBinaryTranslationGeneration(TranslationTerm); - this._typeGenerations[typeof(BoolType)] = new BooleanBinaryTranslationGeneration(); - this._typeGenerations[typeof(CharType)] = new CharBinaryTranslationGeneration(); - this._typeGenerations[typeof(DateTimeType)] = new PrimitiveBinaryTranslationGeneration(expectedLen: null); - this._typeGenerations[typeof(DoubleType)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 8); - this._typeGenerations[typeof(EnumType)] = new EnumBinaryTranslationGeneration(); - this._typeGenerations[typeof(FloatType)] = new FloatBinaryTranslationGeneration(); - this._typeGenerations[typeof(PercentType)] = new PercentBinaryTranslationGeneration(); - this._typeGenerations[typeof(Int8Type)] = new SByteBinaryTranslationGeneration(); - this._typeGenerations[typeof(Int16Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 2); - this._typeGenerations[typeof(Int32Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 4); - this._typeGenerations[typeof(Int64Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 8); - this._typeGenerations[typeof(P2UInt8Type)] = new PointBinaryTranslationGeneration(expectedLen: 2); - this._typeGenerations[typeof(P3UInt8Type)] = new PointBinaryTranslationGeneration(expectedLen: 3); - this._typeGenerations[typeof(P3UInt16Type)] = new PointBinaryTranslationGeneration(expectedLen: 6); - this._typeGenerations[typeof(P2FloatType)] = new PointBinaryTranslationGeneration(expectedLen: 8); - this._typeGenerations[typeof(P3FloatType)] = new PointBinaryTranslationGeneration(expectedLen: 12); - this._typeGenerations[typeof(P2Int32Type)] = new PointBinaryTranslationGeneration(expectedLen: 8); - this._typeGenerations[typeof(P3IntType)] = new PointBinaryTranslationGeneration(expectedLen: 12); - this._typeGenerations[typeof(P2Int16Type)] = new PointBinaryTranslationGeneration(expectedLen: 4); - this._typeGenerations[typeof(P3Int16Type)] = new PointBinaryTranslationGeneration(expectedLen: 6); - this._typeGenerations[typeof(P2FloatType)] = new PointBinaryTranslationGeneration(expectedLen: 8); - this._typeGenerations[typeof(StringType)] = new StringBinaryTranslationGeneration() + DoErrorMasks = false; + TranslationMaskParameter = false; + _typeGenerations[typeof(LoquiType)] = new LoquiBinaryTranslationGeneration(TranslationTerm); + _typeGenerations[typeof(BoolType)] = new BooleanBinaryTranslationGeneration(); + _typeGenerations[typeof(CharType)] = new CharBinaryTranslationGeneration(); + _typeGenerations[typeof(DateTimeType)] = new PrimitiveBinaryTranslationGeneration(expectedLen: null); + _typeGenerations[typeof(TimeOnlyType)] = new PrimitiveBinaryTranslationGeneration(expectedLen: null); + _typeGenerations[typeof(DateOnlyType)] = new PrimitiveBinaryTranslationGeneration(expectedLen: null); + _typeGenerations[typeof(DoubleType)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 8); + _typeGenerations[typeof(EnumType)] = new EnumBinaryTranslationGeneration(); + _typeGenerations[typeof(FloatType)] = new FloatBinaryTranslationGeneration(); + _typeGenerations[typeof(PercentType)] = new PercentBinaryTranslationGeneration(); + _typeGenerations[typeof(Int8Type)] = new SByteBinaryTranslationGeneration(); + _typeGenerations[typeof(Int16Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 2); + _typeGenerations[typeof(Int32Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 4); + _typeGenerations[typeof(Int64Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 8); + _typeGenerations[typeof(P2UInt8Type)] = new PointBinaryTranslationGeneration(expectedLen: 2); + _typeGenerations[typeof(P3UInt8Type)] = new PointBinaryTranslationGeneration(expectedLen: 3); + _typeGenerations[typeof(P3UInt16Type)] = new PointBinaryTranslationGeneration(expectedLen: 6); + _typeGenerations[typeof(P2FloatType)] = new PointBinaryTranslationGeneration(expectedLen: 8); + _typeGenerations[typeof(P3FloatType)] = new PointBinaryTranslationGeneration(expectedLen: 12); + _typeGenerations[typeof(P2Int32Type)] = new PointBinaryTranslationGeneration(expectedLen: 8); + _typeGenerations[typeof(P3IntType)] = new PointBinaryTranslationGeneration(expectedLen: 12); + _typeGenerations[typeof(P2Int16Type)] = new PointBinaryTranslationGeneration(expectedLen: 4); + _typeGenerations[typeof(P3Int16Type)] = new PointBinaryTranslationGeneration(expectedLen: 6); + _typeGenerations[typeof(P2FloatType)] = new PointBinaryTranslationGeneration(expectedLen: 8); + _typeGenerations[typeof(StringType)] = new StringBinaryTranslationGeneration() { PreferDirectTranslation = false }; - this._typeGenerations[typeof(AssetLinkType)] = new AssetLinkBinaryTranslationGeneration() + _typeGenerations[typeof(AssetLinkType)] = new AssetLinkBinaryTranslationGeneration() { PreferDirectTranslation = false }; - this._typeGenerations[typeof(FilePathType)] = new FilePathBinaryTranslationGeneration(); - this._typeGenerations[typeof(UInt8Type)] = new ByteBinaryTranslationGeneration(); - this._typeGenerations[typeof(UInt16Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 2); - this._typeGenerations[typeof(UInt32Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 4); - this._typeGenerations[typeof(UInt64Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 8); - this._typeGenerations[typeof(FormIDType)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 4) + _typeGenerations[typeof(FilePathType)] = new FilePathBinaryTranslationGeneration(); + _typeGenerations[typeof(UInt8Type)] = new ByteBinaryTranslationGeneration(); + _typeGenerations[typeof(UInt16Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 2); + _typeGenerations[typeof(UInt32Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 4); + _typeGenerations[typeof(UInt64Type)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 8); + _typeGenerations[typeof(FormIDType)] = new PrimitiveBinaryTranslationGeneration(expectedLen: 4) { PreferDirectTranslation = false }; - this._typeGenerations[typeof(FormKeyType)] = new FormKeyBinaryTranslationGeneration(); - this._typeGenerations[typeof(ModKeyType)] = new ModKeyBinaryTranslationGeneration(); - this._typeGenerations[typeof(RecordTypeType)] = new RecordTypeBinaryTranslationGeneration(); - this._typeGenerations[typeof(FormLinkType)] = new FormLinkBinaryTranslationGeneration(); - this._typeGenerations[typeof(FormLinkOrIndexType)] = new FormLinkOrIndexTranslationGeneration(); - this._typeGenerations[typeof(ListType)] = new PluginListBinaryTranslationGeneration(); - this._typeGenerations[typeof(Array2dType)] = new Array2dBinaryTranslationGeneration(); - this._typeGenerations[typeof(ArrayType)] = new PluginArrayBinaryTranslationGeneration(); - this._typeGenerations[typeof(DictType)] = new DictBinaryTranslationGeneration(); - this._typeGenerations[typeof(ByteArrayType)] = new ByteArrayBinaryTranslationGeneration(); - this._typeGenerations[typeof(BufferType)] = new BufferBinaryTranslationGeneration(); - this._typeGenerations[typeof(DataType)] = new DataBinaryTranslationGeneration(); - this._typeGenerations[typeof(ColorType)] = new ColorBinaryTranslationGeneration() + _typeGenerations[typeof(FormKeyType)] = new FormKeyBinaryTranslationGeneration(); + _typeGenerations[typeof(ModKeyType)] = new ModKeyBinaryTranslationGeneration(); + _typeGenerations[typeof(RecordTypeType)] = new RecordTypeBinaryTranslationGeneration(); + _typeGenerations[typeof(FormLinkType)] = new FormLinkBinaryTranslationGeneration(); + _typeGenerations[typeof(FormLinkOrIndexType)] = new FormLinkOrIndexTranslationGeneration(); + _typeGenerations[typeof(ListType)] = new PluginListBinaryTranslationGeneration(); + _typeGenerations[typeof(Array2dType)] = new Array2dBinaryTranslationGeneration(); + _typeGenerations[typeof(ArrayType)] = new PluginArrayBinaryTranslationGeneration(); + _typeGenerations[typeof(DictType)] = new DictBinaryTranslationGeneration(); + _typeGenerations[typeof(ByteArrayType)] = new ByteArrayBinaryTranslationGeneration(); + _typeGenerations[typeof(BufferType)] = new BufferBinaryTranslationGeneration(); + _typeGenerations[typeof(DataType)] = new DataBinaryTranslationGeneration(); + _typeGenerations[typeof(ColorType)] = new ColorBinaryTranslationGeneration() { PreferDirectTranslation = false }; - this._typeGenerations[typeof(ZeroType)] = new ZeroBinaryTranslationGeneration(); - this._typeGenerations[typeof(NothingType)] = new NothingBinaryTranslationGeneration(); - this._typeGenerations[typeof(CustomLogic)] = new CustomLogicTranslationGeneration(); - this._typeGenerations[typeof(GenderedType)] = new GenderedTypeBinaryTranslationGeneration(); - this._typeGenerations[typeof(BreakType)] = new BreakBinaryTranslationGeneration(); - this._typeGenerations[typeof(MarkerType)] = new MarkerBinaryTranslationGeneration(); + _typeGenerations[typeof(ZeroType)] = new ZeroBinaryTranslationGeneration(); + _typeGenerations[typeof(NothingType)] = new NothingBinaryTranslationGeneration(); + _typeGenerations[typeof(CustomLogic)] = new CustomLogicTranslationGeneration(); + _typeGenerations[typeof(GenderedType)] = new GenderedTypeBinaryTranslationGeneration(); + _typeGenerations[typeof(BreakType)] = new BreakBinaryTranslationGeneration(); + _typeGenerations[typeof(MarkerType)] = new MarkerBinaryTranslationGeneration(); APILine[] modAPILines = new APILine[] { new APILine( @@ -225,7 +227,7 @@ public PluginTranslationModule(LoquiGenerator gen) return dir == TranslationDirection.Reader && obj.GetObjectType() != ObjectType.Mod; }); - this.MainAPI = new TranslationModuleAPI( + MainAPI = new TranslationModuleAPI( writerAPI: new MethodAPI( majorAPI: new APILine[] { new APILine(WriterClass, $"{WriterClass} {WriterMemberName}") }, optionalAPI: modAPILines @@ -249,7 +251,7 @@ public PluginTranslationModule(LoquiGenerator gen) { CustomMethodAPI.FactoryPublic(gameRelease), })); - this.MinorAPIs.Add( + MinorAPIs.Add( new TranslationModuleAPI( new MethodAPI( majorAPI: new APILine[] { new APILine("Path", $"{nameof(ModPath)} path") }, @@ -266,12 +268,12 @@ public PluginTranslationModule(LoquiGenerator gen) .ToArray())) { Funnel = new TranslationFunnel( - this.MainAPI, + MainAPI, ConvertFromPathOut, ConvertFromPathIn), When = (o, d) => d == TranslationDirection.Reader && o.GetObjectType() == ObjectType.Mod }); - this.MinorAPIs.Add( + MinorAPIs.Add( new TranslationModuleAPI( new MethodAPI( majorAPI: new APILine[] { new APILine("Path", $"{nameof(FilePath)} path") }, @@ -288,12 +290,12 @@ public PluginTranslationModule(LoquiGenerator gen) .ToArray())) { Funnel = new TranslationFunnel( - this.MainAPI, + MainAPI, ConvertFromPathOut, ConvertFromPathIn), When = (o, d) => d == TranslationDirection.Writer && o.GetObjectType() == ObjectType.Mod }); - this.MinorAPIs.Add( + MinorAPIs.Add( new TranslationModuleAPI( new MethodAPI( majorAPI: new APILine[] { new APILine("Stream", "Stream stream") }, @@ -309,12 +311,12 @@ public PluginTranslationModule(LoquiGenerator gen) .ToArray())) { Funnel = new TranslationFunnel( - this.MainAPI, + MainAPI, ConvertFromStreamOut, ConvertFromStreamIn), When = (o, _) => o.GetObjectType() == ObjectType.Mod }); - this.CustomLogic = new CustomLogicTranslationGeneration() { Module = this }; + CustomLogic = new CustomLogicTranslationGeneration() { Module = this }; } #region Minor API Translations @@ -342,7 +344,7 @@ private void ConvertFromStreamOut(ObjectGeneration obj, StructuredStringBuilder } using (sb.CurlyBrace()) { - internalToDo(this.MainAPI.PublicMembers(obj, TranslationDirection.Writer).ToArray()); + internalToDo(MainAPI.PublicMembers(obj, TranslationDirection.Writer).ToArray()); } } @@ -367,7 +369,7 @@ private void ConvertFromStreamIn(ObjectGeneration obj, StructuredStringBuilder s sb.AppendLine($"frame.{nameof(MutagenFrame.MetaData)}.{nameof(ParsingBundle.RecordInfoCache)} = infoCache;"); sb.AppendLine($"frame.{nameof(MutagenFrame.MetaData)}.{nameof(ParsingBundle.Parallel)} = parallel;"); sb.AppendLine($"frame.{nameof(MutagenFrame.MetaData)}.{nameof(ParsingBundle.ModKey)} = modKey;"); - internalToDo(this.MainAPI.PublicMembers(obj, TranslationDirection.Reader).ToArray()); + internalToDo(MainAPI.PublicMembers(obj, TranslationDirection.Reader).ToArray()); } } sb.AppendLine("catch (Exception ex)"); @@ -429,7 +431,7 @@ private void ConvertFromPathOut(ObjectGeneration obj, StructuredStringBuilder sb } using (sb.CurlyBrace()) { - internalToDo(this.MainAPI.PublicMembers(obj, TranslationDirection.Writer).ToArray()); + internalToDo(MainAPI.PublicMembers(obj, TranslationDirection.Writer).ToArray()); } sb.AppendLine($"using (var fs = fileSystem.GetOrDefault().FileStream.Create(path, FileMode.Create, FileAccess.Write))"); using (sb.CurlyBrace()) @@ -484,7 +486,7 @@ private void ConvertFromPathIn(ObjectGeneration obj, StructuredStringBuilder sb, sb.AppendLine($"frame.{nameof(BinaryOverlayFactoryPackage.MetaData)}.{nameof(ParsingBundle.StringsLookup)} = StringsFolderLookupOverlay.TypicalFactory({gameReleaseStr}, path.{nameof(ModPath.ModKey)}, Path.GetDirectoryName(path.{nameof(ModPath.Path)})!, stringsParam);"); } } - internalToDo(this.MainAPI.PublicMembers(obj, TranslationDirection.Reader).ToArray()); + internalToDo(MainAPI.PublicMembers(obj, TranslationDirection.Reader).ToArray()); } } sb.AppendLine("catch (Exception ex)"); @@ -582,13 +584,13 @@ public override async Task GenerateInClass(ObjectGeneration obj, StructuredStrin if (obj.GetObjectType() == ObjectType.Mod) { using (var args = sb.Function( - $"public{obj.NewOverride()}static {await this.ObjectReturn(obj, maskReturn: false)} {CreateFromPrefix}{TranslationTerm}")) + $"public{obj.NewOverride()}static {await ObjectReturn(obj, maskReturn: false)} {CreateFromPrefix}{TranslationTerm}")) { - foreach (var (API, Public) in this.MainAPI.ReaderAPI.IterateAPI(obj, + foreach (var (API, Public) in MainAPI.ReaderAPI.IterateAPI(obj, TranslationDirection.Reader, Context.Class, - this.DoErrorMasks ? new APILine(ErrorMaskKey, "ErrorMaskBuilder? errorMask") : null, - this.DoErrorMasks ? new APILine(TranslationMaskKey, $"{nameof(TranslationCrystal)}? translationMask", (o, i) => this.TranslationMaskParameter) : null)) + DoErrorMasks ? new APILine(ErrorMaskKey, "ErrorMaskBuilder? errorMask") : null, + DoErrorMasks ? new APILine(TranslationMaskKey, $"{nameof(TranslationCrystal)}? translationMask", (o, i) => TranslationMaskParameter) : null)) { args.Add(API.Result); } @@ -600,22 +602,22 @@ public override async Task GenerateInClass(ObjectGeneration obj, StructuredStrin { await GenerateNewSnippet(obj, sb); using (var args = sb.Call( - $"{Loqui.Generation.Utility.Await(await AsyncImport(obj))}{obj.CommonClassInstance("ret", LoquiInterfaceType.ISetter, CommonGenerics.Class)}.{CopyInFromPrefix}{TranslationTerm}")) + $"{Utility.Await(await AsyncImport(obj))}{obj.CommonClassInstance("ret", LoquiInterfaceType.ISetter, CommonGenerics.Class)}.{CopyInFromPrefix}{TranslationTerm}")) { args.Add("item: ret"); - foreach (var arg in this.MainAPI.PassArgs(obj, TranslationDirection.Reader, Context.Class, Context.Backend)) + foreach (var arg in MainAPI.PassArgs(obj, TranslationDirection.Reader, Context.Class, Context.Backend)) { args.Add(arg); } - foreach (var arg in this.MainAPI.InternalPassArgs(obj, TranslationDirection.Reader, Context.Class, Context.Backend)) + foreach (var arg in MainAPI.InternalPassArgs(obj, TranslationDirection.Reader, Context.Class, Context.Backend)) { args.Add(arg); } - if (this.DoErrorMasks) + if (DoErrorMasks) { args.AddPassArg("errorMask"); } - if (this.TranslationMaskParameter) + if (TranslationMaskParameter) { args.AddPassArg("translationMask"); } @@ -772,7 +774,7 @@ private async Task GenerateCreateExtras(ObjectGeneration obj, StructuredStringBu if (obj.HasEmbeddedFields()) { using (var args = sb.Function( - $"public static {Loqui.Generation.Utility.TaskReturn(async)} Fill{ModuleNickname}Structs")) + $"public static {Utility.TaskReturn(async)} Fill{ModuleNickname}Structs")) { args.Add($"{obj.Interface(getter: false, internalInterface: true)} item"); args.Add($"{ReaderClass} {ReaderMemberName}"); @@ -782,7 +784,7 @@ private async Task GenerateCreateExtras(ObjectGeneration obj, StructuredStringBu if (obj.HasLoquiBaseObject && obj.BaseClassTrail().Any((b) => b.HasEmbeddedFields())) { using (var args = sb.Call( - $"{Loqui.Generation.Utility.Await(async)}{TranslationCreateClass(obj.BaseClass)}.Fill{ModuleNickname}Structs")) + $"{Utility.Await(async)}{TranslationCreateClass(obj.BaseClass)}.Fill{ModuleNickname}Structs")) { args.AddPassArg("item"); args.AddPassArg(ReaderMemberName); @@ -800,7 +802,7 @@ private async Task GenerateCreateExtras(ObjectGeneration obj, StructuredStringBu if (fieldData.Binary == BinaryGenerationType.NoGeneration) continue; if (field.Derivative && fieldData.Binary != BinaryGenerationType.Custom) continue; if (!field.Enabled) continue; - if (!this.TryGetTypeGeneration(field.GetType(), out var generator)) + if (!TryGetTypeGeneration(field.GetType(), out var generator)) { if (!field.IntegrateField) continue; throw new ArgumentException("Unsupported type generator: " + field); @@ -830,7 +832,7 @@ private async Task GenerateCreateExtras(ObjectGeneration obj, StructuredStringBu if (obj.HasRecordTypeFields() && !obj.IsTopLevelGroup()) { using (var args = sb.Function( - $"public static {Loqui.Generation.Utility.TaskWrap(nameof(ParseResult), HasAsyncRecords(obj, self: true))} Fill{ModuleNickname}RecordTypes")) + $"public static {Utility.TaskWrap(nameof(ParseResult), HasAsyncRecords(obj, self: true))} Fill{ModuleNickname}RecordTypes")) { args.Add($"{obj.Interface(getter: false, internalInterface: true)} item"); args.Add($"{ReaderClass} {ReaderMemberName}"); @@ -867,7 +869,7 @@ private async Task GenerateCreateExtras(ObjectGeneration obj, StructuredStringBu if (!fieldData.GenerationTypes.Any()) continue; if (fieldData.Binary == BinaryGenerationType.NoGeneration) continue; if (field.Field.Derivative && fieldData.Binary != BinaryGenerationType.Custom) continue; - if (!this.TryGetTypeGeneration(field.Field.GetType(), out var generator)) + if (!TryGetTypeGeneration(field.Field.GetType(), out var generator)) { throw new ArgumentException("Unsupported type generator: " + field.Field); } @@ -882,7 +884,7 @@ private async Task GenerateCreateExtras(ObjectGeneration obj, StructuredStringBu foreach (var field in fields) { var fieldData = field.Field.GetFieldData(); - if (!this.TryGetTypeGeneration(field.Field.GetType(), out var generator)) + if (!TryGetTypeGeneration(field.Field.GetType(), out var generator)) { throw new ArgumentException("Unsupported type generator: " + field.Field); } @@ -959,7 +961,7 @@ await GenerateLastParsedShortCircuit( bool first = true; foreach (var doublesField in doubles) { - if (!this.TryGetTypeGeneration(doublesField.Field.GetType(), out var doubleGen)) + if (!TryGetTypeGeneration(doublesField.Field.GetType(), out var doubleGen)) { throw new ArgumentException("Unsupported type generator: " + doublesField.Field); } @@ -1015,7 +1017,7 @@ await GenerateLastParsedShortCircuit( int count = 0; foreach (var doublesField in doubles) { - if (!this.TryGetTypeGeneration(doublesField.Field.GetType(), out var doubleGen)) + if (!TryGetTypeGeneration(doublesField.Field.GetType(), out var doubleGen)) { throw new ArgumentException("Unsupported type generator: " + doublesField.Field); } @@ -1087,7 +1089,7 @@ await GenerateLastParsedShortCircuit( || fieldData.TriggeringRecordTypes.Count > 0 || fieldData.GenerationTypes.Count() > 0) continue; if (field.Field.Derivative && fieldData.Binary != BinaryGenerationType.Custom) continue; - if (!this.TryGetTypeGeneration(field.Field.GetType(), out var generator)) + if (!TryGetTypeGeneration(field.Field.GetType(), out var generator)) { throw new ArgumentException("Unsupported type generator: " + field.Field); } @@ -1132,7 +1134,7 @@ await GenerateLastParsedShortCircuit( else if (obj.HasLoquiBaseObject && obj.BaseClassTrail().Any((b) => b.HasRecordTypeFields())) { using (var args = sb.Call( - $"return {Loqui.Generation.Utility.Await(HasAsyncRecords(obj, self: false))}{TranslationCreateClass(obj.BaseClass)}.Fill{ModuleNickname}RecordTypes")) + $"return {Utility.Await(HasAsyncRecords(obj, self: false))}{TranslationCreateClass(obj.BaseClass)}.Fill{ModuleNickname}RecordTypes")) { args.AddPassArg("item"); args.AddPassArg(ReaderMemberName); @@ -1203,7 +1205,7 @@ await GenerateLastParsedShortCircuit( using (var args = sb.Call( $"static partial void {field.Name}CustomVersionParse")) { - foreach (var (API, Public) in this.MainAPI.ReaderAPI.IterateAPI( + foreach (var (API, Public) in MainAPI.ReaderAPI.IterateAPI( obj, TranslationDirection.Reader, Context.Backend, @@ -1264,7 +1266,7 @@ protected override async Task GenerateFillSnippet(ObjectGeneration obj, Structur bool isInRange = false; foreach (var subField in set.IterateFieldsWithMeta()) { - if (!this.TryGetTypeGeneration(subField.Field.GetType(), out var subGenerator)) + if (!TryGetTypeGeneration(subField.Field.GetType(), out var subGenerator)) { throw new ArgumentException("Unsupported type generator: " + subField.Field); } @@ -1543,7 +1545,7 @@ protected async Task GenerateOverlayExtras(ObjectGeneration obj, StructuredStrin || !fieldData.GenerationTypes.Any()) continue; if (fieldData.BinaryOverlayFallback == BinaryGenerationType.NoGeneration) continue; if (field.Field.Derivative && fieldData.BinaryOverlayFallback != BinaryGenerationType.Custom) continue; - if (!this.TryGetTypeGeneration(field.Field.GetType(), out var generator)) + if (!TryGetTypeGeneration(field.Field.GetType(), out var generator)) { throw new ArgumentException("Unsupported type generator: " + field.Field); } @@ -1558,7 +1560,7 @@ protected async Task GenerateOverlayExtras(ObjectGeneration obj, StructuredStrin foreach (var field in fields) { var fieldData = field.Field.GetFieldData(); - if (!this.TryGetTypeGeneration(field.Field.GetType(), out var generator)) + if (!TryGetTypeGeneration(field.Field.GetType(), out var generator)) { throw new ArgumentException("Unsupported type generator: " + field.Field); } @@ -1652,7 +1654,7 @@ await generator.GenerateWrapperRecordTypeParse( bool first = true; foreach (var doublesField in doubles) { - if (!this.TryGetTypeGeneration(doublesField.Field.GetType(), out var doubleGen)) + if (!TryGetTypeGeneration(doublesField.Field.GetType(), out var doubleGen)) { throw new ArgumentException("Unsupported type generator: " + doublesField.Field); @@ -1717,7 +1719,7 @@ await doubleGen.GenerateWrapperRecordTypeParse( int count = 0; foreach (var doublesField in doubles) { - if (!this.TryGetTypeGeneration(doublesField.Field.GetType(), + if (!TryGetTypeGeneration(doublesField.Field.GetType(), out var doubleGen)) { throw new ArgumentException("Unsupported type generator: " + @@ -1900,7 +1902,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct if (await obj.IsMajorRecord()) { - bool async = this.HasAsync(obj, self: true); + bool async = HasAsync(obj, self: true); using (var args = sb.Call( $"{nameof(PluginUtilityTranslation)}.MajorRecordParse<{obj.Interface(getter: false, internalInterface: true)}>")) { @@ -1913,7 +1915,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct if (data.CustomBinaryEnd != CustomEnd.Off) { using (var args = sb.Call( - $"{Loqui.Generation.Utility.Await(data.CustomBinaryEnd == CustomEnd.Async)}{this.TranslationCreateClass(obj)}.CustomBinaryEndImport{(await this.AsyncImport(obj) ? null : "Public")}")) + $"{Utility.Await(data.CustomBinaryEnd == CustomEnd.Async)}{TranslationCreateClass(obj)}.CustomBinaryEndImport{(await AsyncImport(obj) ? null : "Public")}")) { args.AddPassArg(ReaderMemberName); args.Add($"obj: {accessor}"); @@ -1973,7 +1975,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct throw new NotImplementedException(); } } - bool async = this.HasAsync(obj, self: true); + bool async = HasAsync(obj, self: true); var utilityTranslation = nameof(PluginUtilityTranslation); switch (objType) { @@ -1984,7 +1986,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct { using (var args = sb.Call( $"{utilityTranslation}.SubrecordParse", - suffixLine: Loqui.Generation.Utility.ConfigAwait(async))) + suffixLine: Utility.ConfigAwait(async))) { args.Add($"record: {accessor}"); args.AddPassArg("frame"); @@ -2003,7 +2005,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct case ObjectType.Record: using (var args = sb.Call( $"{utilityTranslation}.RecordParse", - suffixLine: Loqui.Generation.Utility.ConfigAwait(async))) + suffixLine: Utility.ConfigAwait(async))) { args.Add($"record: {accessor}"); args.AddPassArg(ReaderMemberName); @@ -2021,7 +2023,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct { using (var args = sb.Call( $"{utilityTranslation}.GroupParse<{obj.GetTypeName(LoquiInterfaceType.ISetter)}, T>", - suffixLine: Loqui.Generation.Utility.ConfigAwait(async))) + suffixLine: Utility.ConfigAwait(async))) { args.Add($"record: {accessor}"); args.AddPassArg(ReaderMemberName); @@ -2034,7 +2036,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct { using (var args = sb.Call( $"{utilityTranslation}.GroupParse", - suffixLine: Loqui.Generation.Utility.ConfigAwait(async))) + suffixLine: Utility.ConfigAwait(async))) { args.Add($"record: {accessor}"); args.AddPassArg(ReaderMemberName); @@ -2051,7 +2053,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct case ObjectType.Mod: using (var args = sb.Call( $"{utilityTranslation}.ModParse", - suffixLine: Loqui.Generation.Utility.ConfigAwait(async))) + suffixLine: Utility.ConfigAwait(async))) { args.Add($"record: {accessor}"); args.AddPassArg(ReaderMemberName); @@ -2066,7 +2068,7 @@ protected override async Task GenerateCopyInSnippet(ObjectGeneration obj, Struct if (data.CustomBinaryEnd != CustomEnd.Off) { using (var args = sb.Call( - $"{Loqui.Generation.Utility.Await(data.CustomBinaryEnd == CustomEnd.Async)}{this.TranslationCreateClass(obj)}.CustomBinaryEndImportPublic")) + $"{Utility.Await(data.CustomBinaryEnd == CustomEnd.Async)}{TranslationCreateClass(obj)}.CustomBinaryEndImportPublic")) { args.AddPassArg(ReaderMemberName); args.Add($"obj: {accessor}"); @@ -2268,7 +2270,7 @@ protected async Task GenerateImportWrapper(ObjectGeneration obj, StructuredStrin totalPassedLength = lengths.CurLength; } } - if (!this.TryGetTypeGeneration(lengths.Field.GetType(), out var typeGen)) + if (!TryGetTypeGeneration(lengths.Field.GetType(), out var typeGen)) { if (!lengths.Field.IntegrateField) continue; throw new NotImplementedException(); @@ -2394,7 +2396,7 @@ await typeGen.GenerateWrapperFields( expandSets: SetMarkerType.ExpandSets.FalseAndInclude, nonIntegrated: true)) { - if (!this.TryGetTypeGeneration(field.GetType(), out var typeGen)) continue; + if (!TryGetTypeGeneration(field.GetType(), out var typeGen)) continue; await typeGen.GenerateWrapperCtor( sb: sb, objGen: obj, @@ -2425,7 +2427,7 @@ await typeGen.GenerateWrapperCtor( } using (var args = sb.Function( - $"public static {this.BinaryOverlayClass(obj)} {obj.Name}Factory")) + $"public static {BinaryOverlayClass(obj)} {obj.Name}Factory")) { args.Add($"{nameof(ModPath)} path"); if (objData.GameReleaseOptions != null) @@ -2582,7 +2584,7 @@ private async Task GenerateFactoryMethod(ObjectGeneration obj, StructuredStringB var recordDataAccessor = new Accessor("_recordData"); var objData = obj.GetObjectData(); if (!objData.BinaryOverlayGenerateCtor) return; - var retValue = obj.GetObjectType() == ObjectType.Mod ? this.BinaryOverlayClass(obj) : obj.Interface(getter: true, internalInterface: true); + var retValue = obj.GetObjectType() == ObjectType.Mod ? BinaryOverlayClass(obj) : obj.Interface(getter: true, internalInterface: true); using (var args = sb.Function( $"public static {retValue} {obj.Name}Factory")) { @@ -2760,7 +2762,7 @@ private async Task GenerateFactoryMethod(ObjectGeneration obj, StructuredStringB includeBaseClass: true, passedLenPrefix: "ret.")) { - if (!this.TryGetTypeGeneration(lengths.Field.GetType(), out var typeGen)) continue; + if (!TryGetTypeGeneration(lengths.Field.GetType(), out var typeGen)) continue; var data = lengths.Field.GetFieldData(); if (lengths.Field is CustomLogic) continue; switch (data.BinaryOverlayFallback) @@ -2781,7 +2783,7 @@ private async Task GenerateFactoryMethod(ObjectGeneration obj, StructuredStringB // Parse ending positions await foreach (var lengths in IteratePassedLengths(obj, forOverlay: true, passedLenPrefix: "ret.")) { - if (!this.TryGetTypeGeneration(lengths.Field.GetType(), out var typeGen)) continue; + if (!TryGetTypeGeneration(lengths.Field.GetType(), out var typeGen)) continue; var data = lengths.Field.GetFieldData(); switch (data.BinaryOverlayFallback) { @@ -2974,7 +2976,7 @@ await typeGen.GenerateWrapperUnknownLengthParse( // Parse ending positions await foreach (var lengths in IteratePassedLengths(obj, forOverlay: true, passedLenPrefix: "ret.")) { - if (!this.TryGetTypeGeneration(lengths.Field.GetType(), out var typeGen)) continue; + if (!TryGetTypeGeneration(lengths.Field.GetType(), out var typeGen)) continue; var data = lengths.Field.GetFieldData(); switch (data.BinaryOverlayFallback) { @@ -3113,7 +3115,7 @@ protected override async Task GenerateWriteSnippet(ObjectGeneration obj, Structu if (firstBase != null) { using (var args = sb.Call( - $"{this.TranslationWriteClass(firstBase)}.WriteEmbedded")) + $"{TranslationWriteClass(firstBase)}.WriteEmbedded")) { args.AddPassArg($"item"); args.Add($"writer: {writerNameToUse}"); @@ -3162,7 +3164,7 @@ protected override async Task GenerateWriteSnippet(ObjectGeneration obj, Structu if (firstBase != null) { using (var args = sb.Call( - $"{this.TranslationWriteClass(firstBase)}.WriteRecordTypes")) + $"{TranslationWriteClass(firstBase)}.WriteRecordTypes")) { args.AddPassArg($"item"); args.Add($"writer: {writerNameToUse}"); @@ -3248,7 +3250,7 @@ private async Task GenerateWriteExtras(ObjectGeneration obj, StructuredStringBui } using (sb.CurlyBrace(doIt: conditions.Count > 0)) { - var maskType = this.Gen.MaskModule.GetMaskModule(field.GetType()).GetErrorMaskTypeStr(field); + var maskType = Gen.MaskModule.GetMaskModule(field.GetType()).GetErrorMaskTypeStr(field); if (fieldData.Binary == BinaryGenerationType.Custom) { CustomLogic.GenerateWrite( @@ -3258,7 +3260,7 @@ private async Task GenerateWriteExtras(ObjectGeneration obj, StructuredStringBui writerAccessor: WriterMemberName); continue; } - if (!this.TryGetTypeGeneration(field.GetType(), out var generator)) + if (!TryGetTypeGeneration(field.GetType(), out var generator)) { if (!field.IntegrateField) continue; throw new ArgumentException("Unsupported type generator: " + field); @@ -3358,7 +3360,7 @@ await generator.GenerateWrite( default: throw new NotImplementedException(); } - if (!this.TryGetTypeGeneration(field.GetType(), out var generator)) + if (!TryGetTypeGeneration(field.GetType(), out var generator)) { throw new ArgumentException("Unsupported type generator: " + field); } @@ -3380,7 +3382,7 @@ await generator.GenerateWrite( bool isInRange = false; foreach (var subField in dataType.IterateFieldsWithMeta()) { - if (!this.TryGetTypeGeneration(subField.Field.GetType(), out var subGenerator)) + if (!TryGetTypeGeneration(subField.Field.GetType(), out var subGenerator)) { throw new ArgumentException("Unsupported type generator: " + subField.Field); } diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.cs index cd7c50672..947aaf274 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.cs @@ -16,7 +16,7 @@ public enum MoonPhase partial class ClimateDataBinaryWriteTranslation { - private static byte GetByte(DateTime d) + private static byte GetByte(TimeOnly d) { var mins = d.Hour * 60 + d.Minute; return (byte)(mins / 10); @@ -63,25 +63,25 @@ private static DateTime DateConverter(DateTime d) .AddMinutes(d.Minute / 10 * 10); } - private static bool GetDate(byte b, out DateTime date) + private static bool GetDate(byte b, out TimeOnly date) { if (b > 144) { throw new ArgumentException("Cannot have a time value greater than 144"); - date = default(DateTime); + date = default(TimeOnly); return false; } - date = DateTime.MinValue.AddMinutes(b * 10); + date = new TimeOnly().AddMinutes(b * 10); return true; } - public static DateTime GetDate(byte b) + public static TimeOnly GetDate(byte b) { if (b > 144) { throw new ArgumentException("Cannot have a time value greater than 144"); } - return DateTime.MinValue.AddMinutes(b * 10); + return new TimeOnly().AddMinutes(b * 10); } public static partial void FillBinarySunriseBeginCustom(MutagenFrame frame, IClimateData item) @@ -140,10 +140,10 @@ public static partial void FillBinaryPhaseLengthCustom(MutagenFrame frame, IClim partial class ClimateDataBinaryOverlay { - public partial DateTime GetSunriseBeginCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[0]); - public partial DateTime GetSunriseEndCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[1]); - public partial DateTime GetSunsetBeginCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[2]); - public partial DateTime GetSunsetEndCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[3]); + public partial TimeOnly GetSunriseBeginCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[0]); + public partial TimeOnly GetSunriseEndCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[1]); + public partial TimeOnly GetSunsetBeginCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[2]); + public partial TimeOnly GetSunsetEndCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[3]); public partial Climate.MoonPhase GetPhaseCustom(int location) => (Climate.MoonPhase)ClimateDataBinaryCreateTranslation.GetPhaseInt(_structData.Span[5]); public partial byte GetPhaseLengthCustom(int location) => ClimateDataBinaryCreateTranslation.GetPhaseLen(_structData.Span[5]); } \ No newline at end of file diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.xml b/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.xml index 0e9b9b19e..e151b5559 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.xml +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.xml @@ -13,10 +13,10 @@ - - - - + + + + diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/ClimateData_Generated.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/ClimateData_Generated.cs index d140cd4f1..8b1f2853d 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/ClimateData_Generated.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/ClimateData_Generated.cs @@ -50,16 +50,16 @@ public ClimateData() #endregion #region SunriseBegin - public DateTime SunriseBegin { get; set; } = default; + public TimeOnly SunriseBegin { get; set; } = default; #endregion #region SunriseEnd - public DateTime SunriseEnd { get; set; } = default; + public TimeOnly SunriseEnd { get; set; } = default; #endregion #region SunsetBegin - public DateTime SunsetBegin { get; set; } = default; + public TimeOnly SunsetBegin { get; set; } = default; #endregion #region SunsetEnd - public DateTime SunsetEnd { get; set; } = default; + public TimeOnly SunsetEnd { get; set; } = default; #endregion #region Volatility public Byte Volatility { get; set; } = default; @@ -611,10 +611,10 @@ public partial interface IClimateData : IClimateDataGetter, ILoquiObjectSetter { - new DateTime SunriseBegin { get; set; } - new DateTime SunriseEnd { get; set; } - new DateTime SunsetBegin { get; set; } - new DateTime SunsetEnd { get; set; } + new TimeOnly SunriseBegin { get; set; } + new TimeOnly SunriseEnd { get; set; } + new TimeOnly SunsetBegin { get; set; } + new TimeOnly SunsetEnd { get; set; } new Byte Volatility { get; set; } new Climate.MoonPhase Phase { get; set; } new Byte PhaseLength { get; set; } @@ -632,10 +632,10 @@ public partial interface IClimateDataGetter : [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] object CommonSetterTranslationInstance(); static ILoquiRegistration StaticRegistration => ClimateData_Registration.Instance; - DateTime SunriseBegin { get; } - DateTime SunriseEnd { get; } - DateTime SunsetBegin { get; } - DateTime SunsetEnd { get; } + TimeOnly SunriseBegin { get; } + TimeOnly SunriseEnd { get; } + TimeOnly SunsetBegin { get; } + TimeOnly SunsetEnd { get; } Byte Volatility { get; } Climate.MoonPhase Phase { get; } Byte PhaseLength { get; } @@ -1500,20 +1500,20 @@ void IBinaryItem.WriteToBinary( } #region SunriseBegin - public partial DateTime GetSunriseBeginCustom(int location); - public DateTime SunriseBegin => GetSunriseBeginCustom(location: 0x0); + public partial TimeOnly GetSunriseBeginCustom(int location); + public TimeOnly SunriseBegin => GetSunriseBeginCustom(location: 0x0); #endregion #region SunriseEnd - public partial DateTime GetSunriseEndCustom(int location); - public DateTime SunriseEnd => GetSunriseEndCustom(location: 0x1); + public partial TimeOnly GetSunriseEndCustom(int location); + public TimeOnly SunriseEnd => GetSunriseEndCustom(location: 0x1); #endregion #region SunsetBegin - public partial DateTime GetSunsetBeginCustom(int location); - public DateTime SunsetBegin => GetSunsetBeginCustom(location: 0x2); + public partial TimeOnly GetSunsetBeginCustom(int location); + public TimeOnly SunsetBegin => GetSunsetBeginCustom(location: 0x2); #endregion #region SunsetEnd - public partial DateTime GetSunsetEndCustom(int location); - public DateTime SunsetEnd => GetSunsetEndCustom(location: 0x3); + public partial TimeOnly GetSunsetEndCustom(int location); + public TimeOnly SunsetEnd => GetSunsetEndCustom(location: 0x3); #endregion public Byte Volatility => _structData.Span[0x4]; #region Phase From 8df5084a97ceca21d4a6f1c69b18ad390ac8968d Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 30 Jul 2023 03:02:52 -0500 Subject: [PATCH 130/135] Skyrim/Fallout climate using TimeOnly --- .../Records/Major Records/Climate.cs | 84 ++++ .../Records/Major Records/Climate.xml | 8 +- .../Major Records/Climate_Generated.cs | 440 +++++++++++------- .../Records/Major Records/Climate.cs | 27 +- .../Records/Major Records/Climate.cs | 85 ++++ .../Records/Major Records/Climate.xml | 8 +- .../Major Records/Climate_Generated.cs | 440 +++++++++++------- 7 files changed, 707 insertions(+), 385 deletions(-) diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate.cs index 808be0bb0..b45a48623 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate.cs @@ -32,6 +32,59 @@ public static partial void FillBinaryMoonAndPhaseLengthCustom(MutagenFrame frame item.Moons |= Climate.Moon.Secunda; } } + + private static bool GetTime(byte b, out TimeOnly date) + { + if (b > 144) + { + throw new ArgumentException("Cannot have a time value greater than 144"); + date = default(TimeOnly); + return false; + } + date = new TimeOnly().AddMinutes(b * 10); + return true; + } + + public static TimeOnly GetTime(byte b) + { + if (b > 144) + { + throw new ArgumentException("Cannot have a time value greater than 144"); + } + return new TimeOnly().AddMinutes(b * 10); + } + + public static partial void FillBinarySunriseBeginCustom(MutagenFrame frame, IClimateInternal item) + { + if (GetTime(frame.Reader.ReadUInt8(), out var date)) + { + item.SunriseBegin = date; + } + } + + public static partial void FillBinarySunriseEndCustom(MutagenFrame frame, IClimateInternal item) + { + if (GetTime(frame.Reader.ReadUInt8(), out var date)) + { + item.SunriseEnd = date; + } + } + + public static partial void FillBinarySunsetBeginCustom(MutagenFrame frame, IClimateInternal item) + { + if (GetTime(frame.Reader.ReadUInt8(), out var date)) + { + item.SunsetBegin = date; + } + } + + public static partial void FillBinarySunsetEndCustom(MutagenFrame frame, IClimateInternal item) + { + if (GetTime(frame.Reader.ReadUInt8(), out var date)) + { + item.SunsetEnd = date; + } + } } partial class ClimateBinaryWriteTranslation @@ -49,10 +102,41 @@ public static partial void WriteBinaryMoonAndPhaseLengthCustom(MutagenWriter wri } writer.Write(raw); } + + private static byte GetByte(TimeOnly d) + { + var mins = d.Hour * 60 + d.Minute; + return (byte)(mins / 10); + } + + public static partial void WriteBinarySunriseBeginCustom(MutagenWriter writer, IClimateGetter item) + { + writer.Write(GetByte(item.SunriseBegin)); + } + + public static partial void WriteBinarySunriseEndCustom(MutagenWriter writer, IClimateGetter item) + { + writer.Write(GetByte(item.SunriseEnd)); + } + + public static partial void WriteBinarySunsetBeginCustom(MutagenWriter writer, IClimateGetter item) + { + writer.Write(GetByte(item.SunsetBegin)); + } + + public static partial void WriteBinarySunsetEndCustom(MutagenWriter writer, IClimateGetter item) + { + writer.Write(GetByte(item.SunsetEnd)); + } } partial class ClimateBinaryOverlay { + public partial TimeOnly GetSunriseBeginCustom() => ClimateBinaryCreateTranslation.GetTime(_structData.Span[0]); + public partial TimeOnly GetSunriseEndCustom() => ClimateBinaryCreateTranslation.GetTime(_structData.Span[1]); + public partial TimeOnly GetSunsetBeginCustom() => ClimateBinaryCreateTranslation.GetTime(_structData.Span[2]); + public partial TimeOnly GetSunsetEndCustom() => ClimateBinaryCreateTranslation.GetTime(_structData.Span[3]); + public Climate.Moon Moons { get diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate.xml b/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate.xml index 106517c5b..851e633e4 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate.xml +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate.xml @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate_Generated.cs b/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate_Generated.cs index 7229fc944..b6c8530c5 100644 --- a/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate_Generated.cs +++ b/Mutagen.Bethesda.Fallout4/Records/Major Records/Climate_Generated.cs @@ -97,17 +97,17 @@ public Model? Model IModelGetter? IModeledGetter.Model => this.Model; #endregion #endregion - #region SunriseBeginRaw - public Byte SunriseBeginRaw { get; set; } = default; + #region SunriseBegin + public TimeOnly SunriseBegin { get; set; } = default; #endregion - #region SunriseEndRaw - public Byte SunriseEndRaw { get; set; } = default; + #region SunriseEnd + public TimeOnly SunriseEnd { get; set; } = default; #endregion - #region SunsetBeginRaw - public Byte SunsetBeginRaw { get; set; } = default; + #region SunsetBegin + public TimeOnly SunsetBegin { get; set; } = default; #endregion - #region SunsetEndRaw - public Byte SunsetEndRaw { get; set; } = default; + #region SunsetEnd + public TimeOnly SunsetEnd { get; set; } = default; #endregion #region Volatility public Byte Volatility { get; set; } = default; @@ -148,10 +148,10 @@ public Mask(TItem initialValue) this.SunTexture = initialValue; this.SunGlareTexture = initialValue; this.Model = new MaskItem?>(initialValue, new Model.Mask(initialValue)); - this.SunriseBeginRaw = initialValue; - this.SunriseEndRaw = initialValue; - this.SunsetBeginRaw = initialValue; - this.SunsetEndRaw = initialValue; + this.SunriseBegin = initialValue; + this.SunriseEnd = initialValue; + this.SunsetBegin = initialValue; + this.SunsetEnd = initialValue; this.Volatility = initialValue; this.Moons = initialValue; this.PhaseLength = initialValue; @@ -169,10 +169,10 @@ public Mask( TItem SunTexture, TItem SunGlareTexture, TItem Model, - TItem SunriseBeginRaw, - TItem SunriseEndRaw, - TItem SunsetBeginRaw, - TItem SunsetEndRaw, + TItem SunriseBegin, + TItem SunriseEnd, + TItem SunsetBegin, + TItem SunsetEnd, TItem Volatility, TItem Moons, TItem PhaseLength) @@ -189,10 +189,10 @@ public Mask( this.SunTexture = SunTexture; this.SunGlareTexture = SunGlareTexture; this.Model = new MaskItem?>(Model, new Model.Mask(Model)); - this.SunriseBeginRaw = SunriseBeginRaw; - this.SunriseEndRaw = SunriseEndRaw; - this.SunsetBeginRaw = SunsetBeginRaw; - this.SunsetEndRaw = SunsetEndRaw; + this.SunriseBegin = SunriseBegin; + this.SunriseEnd = SunriseEnd; + this.SunsetBegin = SunsetBegin; + this.SunsetEnd = SunsetEnd; this.Volatility = Volatility; this.Moons = Moons; this.PhaseLength = PhaseLength; @@ -211,10 +211,10 @@ protected Mask() public TItem SunTexture; public TItem SunGlareTexture; public MaskItem?>? Model { get; set; } - public TItem SunriseBeginRaw; - public TItem SunriseEndRaw; - public TItem SunsetBeginRaw; - public TItem SunsetEndRaw; + public TItem SunriseBegin; + public TItem SunriseEnd; + public TItem SunsetBegin; + public TItem SunsetEnd; public TItem Volatility; public TItem Moons; public TItem PhaseLength; @@ -235,10 +235,10 @@ public bool Equals(Mask? rhs) if (!object.Equals(this.SunTexture, rhs.SunTexture)) return false; if (!object.Equals(this.SunGlareTexture, rhs.SunGlareTexture)) return false; if (!object.Equals(this.Model, rhs.Model)) return false; - if (!object.Equals(this.SunriseBeginRaw, rhs.SunriseBeginRaw)) return false; - if (!object.Equals(this.SunriseEndRaw, rhs.SunriseEndRaw)) return false; - if (!object.Equals(this.SunsetBeginRaw, rhs.SunsetBeginRaw)) return false; - if (!object.Equals(this.SunsetEndRaw, rhs.SunsetEndRaw)) return false; + if (!object.Equals(this.SunriseBegin, rhs.SunriseBegin)) return false; + if (!object.Equals(this.SunriseEnd, rhs.SunriseEnd)) return false; + if (!object.Equals(this.SunsetBegin, rhs.SunsetBegin)) return false; + if (!object.Equals(this.SunsetEnd, rhs.SunsetEnd)) return false; if (!object.Equals(this.Volatility, rhs.Volatility)) return false; if (!object.Equals(this.Moons, rhs.Moons)) return false; if (!object.Equals(this.PhaseLength, rhs.PhaseLength)) return false; @@ -251,10 +251,10 @@ public override int GetHashCode() hash.Add(this.SunTexture); hash.Add(this.SunGlareTexture); hash.Add(this.Model); - hash.Add(this.SunriseBeginRaw); - hash.Add(this.SunriseEndRaw); - hash.Add(this.SunsetBeginRaw); - hash.Add(this.SunsetEndRaw); + hash.Add(this.SunriseBegin); + hash.Add(this.SunriseEnd); + hash.Add(this.SunsetBegin); + hash.Add(this.SunsetEnd); hash.Add(this.Volatility); hash.Add(this.Moons); hash.Add(this.PhaseLength); @@ -287,10 +287,10 @@ public override bool All(Func eval) if (!eval(this.Model.Overall)) return false; if (this.Model.Specific != null && !this.Model.Specific.All(eval)) return false; } - if (!eval(this.SunriseBeginRaw)) return false; - if (!eval(this.SunriseEndRaw)) return false; - if (!eval(this.SunsetBeginRaw)) return false; - if (!eval(this.SunsetEndRaw)) return false; + if (!eval(this.SunriseBegin)) return false; + if (!eval(this.SunriseEnd)) return false; + if (!eval(this.SunsetBegin)) return false; + if (!eval(this.SunsetEnd)) return false; if (!eval(this.Volatility)) return false; if (!eval(this.Moons)) return false; if (!eval(this.PhaseLength)) return false; @@ -321,10 +321,10 @@ public override bool Any(Func eval) if (eval(this.Model.Overall)) return true; if (this.Model.Specific != null && this.Model.Specific.Any(eval)) return true; } - if (eval(this.SunriseBeginRaw)) return true; - if (eval(this.SunriseEndRaw)) return true; - if (eval(this.SunsetBeginRaw)) return true; - if (eval(this.SunsetEndRaw)) return true; + if (eval(this.SunriseBegin)) return true; + if (eval(this.SunriseEnd)) return true; + if (eval(this.SunsetBegin)) return true; + if (eval(this.SunsetEnd)) return true; if (eval(this.Volatility)) return true; if (eval(this.Moons)) return true; if (eval(this.PhaseLength)) return true; @@ -361,10 +361,10 @@ protected void Translate_InternalFill(Mask obj, Func eval) obj.SunTexture = eval(this.SunTexture); obj.SunGlareTexture = eval(this.SunGlareTexture); obj.Model = this.Model == null ? null : new MaskItem?>(eval(this.Model.Overall), this.Model.Specific?.Translate(eval)); - obj.SunriseBeginRaw = eval(this.SunriseBeginRaw); - obj.SunriseEndRaw = eval(this.SunriseEndRaw); - obj.SunsetBeginRaw = eval(this.SunsetBeginRaw); - obj.SunsetEndRaw = eval(this.SunsetEndRaw); + obj.SunriseBegin = eval(this.SunriseBegin); + obj.SunriseEnd = eval(this.SunriseEnd); + obj.SunsetBegin = eval(this.SunsetBegin); + obj.SunsetEnd = eval(this.SunsetEnd); obj.Volatility = eval(this.Volatility); obj.Moons = eval(this.Moons); obj.PhaseLength = eval(this.PhaseLength); @@ -417,21 +417,21 @@ public void Print(StructuredStringBuilder sb, Climate.Mask? printMask = nu { Model?.Print(sb); } - if (printMask?.SunriseBeginRaw ?? true) + if (printMask?.SunriseBegin ?? true) { - sb.AppendItem(SunriseBeginRaw, "SunriseBeginRaw"); + sb.AppendItem(SunriseBegin, "SunriseBegin"); } - if (printMask?.SunriseEndRaw ?? true) + if (printMask?.SunriseEnd ?? true) { - sb.AppendItem(SunriseEndRaw, "SunriseEndRaw"); + sb.AppendItem(SunriseEnd, "SunriseEnd"); } - if (printMask?.SunsetBeginRaw ?? true) + if (printMask?.SunsetBegin ?? true) { - sb.AppendItem(SunsetBeginRaw, "SunsetBeginRaw"); + sb.AppendItem(SunsetBegin, "SunsetBegin"); } - if (printMask?.SunsetEndRaw ?? true) + if (printMask?.SunsetEnd ?? true) { - sb.AppendItem(SunsetEndRaw, "SunsetEndRaw"); + sb.AppendItem(SunsetEnd, "SunsetEnd"); } if (printMask?.Volatility ?? true) { @@ -460,10 +460,10 @@ public void Print(StructuredStringBuilder sb, Climate.Mask? printMask = nu public Exception? SunTexture; public Exception? SunGlareTexture; public MaskItem? Model; - public Exception? SunriseBeginRaw; - public Exception? SunriseEndRaw; - public Exception? SunsetBeginRaw; - public Exception? SunsetEndRaw; + public Exception? SunriseBegin; + public Exception? SunriseEnd; + public Exception? SunsetBegin; + public Exception? SunsetEnd; public Exception? Volatility; public Exception? Moons; public Exception? PhaseLength; @@ -483,14 +483,14 @@ public void Print(StructuredStringBuilder sb, Climate.Mask? printMask = nu return SunGlareTexture; case Climate_FieldIndex.Model: return Model; - case Climate_FieldIndex.SunriseBeginRaw: - return SunriseBeginRaw; - case Climate_FieldIndex.SunriseEndRaw: - return SunriseEndRaw; - case Climate_FieldIndex.SunsetBeginRaw: - return SunsetBeginRaw; - case Climate_FieldIndex.SunsetEndRaw: - return SunsetEndRaw; + case Climate_FieldIndex.SunriseBegin: + return SunriseBegin; + case Climate_FieldIndex.SunriseEnd: + return SunriseEnd; + case Climate_FieldIndex.SunsetBegin: + return SunsetBegin; + case Climate_FieldIndex.SunsetEnd: + return SunsetEnd; case Climate_FieldIndex.Volatility: return Volatility; case Climate_FieldIndex.Moons: @@ -519,17 +519,17 @@ public override void SetNthException(int index, Exception ex) case Climate_FieldIndex.Model: this.Model = new MaskItem(ex, null); break; - case Climate_FieldIndex.SunriseBeginRaw: - this.SunriseBeginRaw = ex; + case Climate_FieldIndex.SunriseBegin: + this.SunriseBegin = ex; break; - case Climate_FieldIndex.SunriseEndRaw: - this.SunriseEndRaw = ex; + case Climate_FieldIndex.SunriseEnd: + this.SunriseEnd = ex; break; - case Climate_FieldIndex.SunsetBeginRaw: - this.SunsetBeginRaw = ex; + case Climate_FieldIndex.SunsetBegin: + this.SunsetBegin = ex; break; - case Climate_FieldIndex.SunsetEndRaw: - this.SunsetEndRaw = ex; + case Climate_FieldIndex.SunsetEnd: + this.SunsetEnd = ex; break; case Climate_FieldIndex.Volatility: this.Volatility = ex; @@ -563,17 +563,17 @@ public override void SetNthMask(int index, object obj) case Climate_FieldIndex.Model: this.Model = (MaskItem?)obj; break; - case Climate_FieldIndex.SunriseBeginRaw: - this.SunriseBeginRaw = (Exception?)obj; + case Climate_FieldIndex.SunriseBegin: + this.SunriseBegin = (Exception?)obj; break; - case Climate_FieldIndex.SunriseEndRaw: - this.SunriseEndRaw = (Exception?)obj; + case Climate_FieldIndex.SunriseEnd: + this.SunriseEnd = (Exception?)obj; break; - case Climate_FieldIndex.SunsetBeginRaw: - this.SunsetBeginRaw = (Exception?)obj; + case Climate_FieldIndex.SunsetBegin: + this.SunsetBegin = (Exception?)obj; break; - case Climate_FieldIndex.SunsetEndRaw: - this.SunsetEndRaw = (Exception?)obj; + case Climate_FieldIndex.SunsetEnd: + this.SunsetEnd = (Exception?)obj; break; case Climate_FieldIndex.Volatility: this.Volatility = (Exception?)obj; @@ -597,10 +597,10 @@ public override bool IsInError() if (SunTexture != null) return true; if (SunGlareTexture != null) return true; if (Model != null) return true; - if (SunriseBeginRaw != null) return true; - if (SunriseEndRaw != null) return true; - if (SunsetBeginRaw != null) return true; - if (SunsetEndRaw != null) return true; + if (SunriseBegin != null) return true; + if (SunriseEnd != null) return true; + if (SunsetBegin != null) return true; + if (SunsetEnd != null) return true; if (Volatility != null) return true; if (Moons != null) return true; if (PhaseLength != null) return true; @@ -656,16 +656,16 @@ protected override void PrintFillInternal(StructuredStringBuilder sb) } Model?.Print(sb); { - sb.AppendItem(SunriseBeginRaw, "SunriseBeginRaw"); + sb.AppendItem(SunriseBegin, "SunriseBegin"); } { - sb.AppendItem(SunriseEndRaw, "SunriseEndRaw"); + sb.AppendItem(SunriseEnd, "SunriseEnd"); } { - sb.AppendItem(SunsetBeginRaw, "SunsetBeginRaw"); + sb.AppendItem(SunsetBegin, "SunsetBegin"); } { - sb.AppendItem(SunsetEndRaw, "SunsetEndRaw"); + sb.AppendItem(SunsetEnd, "SunsetEnd"); } { sb.AppendItem(Volatility, "Volatility"); @@ -688,10 +688,10 @@ public ErrorMask Combine(ErrorMask? rhs) ret.SunTexture = this.SunTexture.Combine(rhs.SunTexture); ret.SunGlareTexture = this.SunGlareTexture.Combine(rhs.SunGlareTexture); ret.Model = this.Model.Combine(rhs.Model, (l, r) => l.Combine(r)); - ret.SunriseBeginRaw = this.SunriseBeginRaw.Combine(rhs.SunriseBeginRaw); - ret.SunriseEndRaw = this.SunriseEndRaw.Combine(rhs.SunriseEndRaw); - ret.SunsetBeginRaw = this.SunsetBeginRaw.Combine(rhs.SunsetBeginRaw); - ret.SunsetEndRaw = this.SunsetEndRaw.Combine(rhs.SunsetEndRaw); + ret.SunriseBegin = this.SunriseBegin.Combine(rhs.SunriseBegin); + ret.SunriseEnd = this.SunriseEnd.Combine(rhs.SunriseEnd); + ret.SunsetBegin = this.SunsetBegin.Combine(rhs.SunsetBegin); + ret.SunsetEnd = this.SunsetEnd.Combine(rhs.SunsetEnd); ret.Volatility = this.Volatility.Combine(rhs.Volatility); ret.Moons = this.Moons.Combine(rhs.Moons); ret.PhaseLength = this.PhaseLength.Combine(rhs.PhaseLength); @@ -721,10 +721,10 @@ public ErrorMask Combine(ErrorMask? rhs) public bool SunTexture; public bool SunGlareTexture; public Model.TranslationMask? Model; - public bool SunriseBeginRaw; - public bool SunriseEndRaw; - public bool SunsetBeginRaw; - public bool SunsetEndRaw; + public bool SunriseBegin; + public bool SunriseEnd; + public bool SunsetBegin; + public bool SunsetEnd; public bool Volatility; public bool Moons; public bool PhaseLength; @@ -738,10 +738,10 @@ public TranslationMask( { this.SunTexture = defaultOn; this.SunGlareTexture = defaultOn; - this.SunriseBeginRaw = defaultOn; - this.SunriseEndRaw = defaultOn; - this.SunsetBeginRaw = defaultOn; - this.SunsetEndRaw = defaultOn; + this.SunriseBegin = defaultOn; + this.SunriseEnd = defaultOn; + this.SunsetBegin = defaultOn; + this.SunsetEnd = defaultOn; this.Volatility = defaultOn; this.Moons = defaultOn; this.PhaseLength = defaultOn; @@ -756,10 +756,10 @@ protected override void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal ret.Add((SunTexture, null)); ret.Add((SunGlareTexture, null)); ret.Add((Model != null ? Model.OnOverall : DefaultOn, Model?.GetCrystal())); - ret.Add((SunriseBeginRaw, null)); - ret.Add((SunriseEndRaw, null)); - ret.Add((SunsetBeginRaw, null)); - ret.Add((SunsetEndRaw, null)); + ret.Add((SunriseBegin, null)); + ret.Add((SunriseEnd, null)); + ret.Add((SunsetBegin, null)); + ret.Add((SunsetEnd, null)); ret.Add((Volatility, null)); ret.Add((Moons, null)); ret.Add((PhaseLength, null)); @@ -911,10 +911,10 @@ public partial interface IClimate : /// Aspects: IModeled /// new Model? Model { get; set; } - new Byte SunriseBeginRaw { get; set; } - new Byte SunriseEndRaw { get; set; } - new Byte SunsetBeginRaw { get; set; } - new Byte SunsetEndRaw { get; set; } + new TimeOnly SunriseBegin { get; set; } + new TimeOnly SunriseEnd { get; set; } + new TimeOnly SunsetBegin { get; set; } + new TimeOnly SunsetEnd { get; set; } new Byte Volatility { get; set; } new Climate.Moon Moons { get; set; } new Byte PhaseLength { get; set; } @@ -946,10 +946,10 @@ public partial interface IClimateGetter : /// IModelGetter? Model { get; } #endregion - Byte SunriseBeginRaw { get; } - Byte SunriseEndRaw { get; } - Byte SunsetBeginRaw { get; } - Byte SunsetEndRaw { get; } + TimeOnly SunriseBegin { get; } + TimeOnly SunriseEnd { get; } + TimeOnly SunsetBegin { get; } + TimeOnly SunsetEnd { get; } Byte Volatility { get; } Climate.Moon Moons { get; } Byte PhaseLength { get; } @@ -1133,10 +1133,10 @@ internal enum Climate_FieldIndex SunTexture = 8, SunGlareTexture = 9, Model = 10, - SunriseBeginRaw = 11, - SunriseEndRaw = 12, - SunsetBeginRaw = 13, - SunsetEndRaw = 14, + SunriseBegin = 11, + SunriseEnd = 12, + SunsetBegin = 13, + SunsetEnd = 14, Volatility = 15, Moons = 16, PhaseLength = 17, @@ -1248,10 +1248,10 @@ public void Clear(IClimateInternal item) item.SunTexture = default; item.SunGlareTexture = default; item.Model = null; - item.SunriseBeginRaw = default; - item.SunriseEndRaw = default; - item.SunsetBeginRaw = default; - item.SunsetEndRaw = default; + item.SunriseBegin = default; + item.SunriseEnd = default; + item.SunsetBegin = default; + item.SunsetEnd = default; item.Volatility = default; item.Moons = default; item.PhaseLength = default; @@ -1352,10 +1352,10 @@ public void FillEqualsMask( rhs.Model, (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), include); - ret.SunriseBeginRaw = item.SunriseBeginRaw == rhs.SunriseBeginRaw; - ret.SunriseEndRaw = item.SunriseEndRaw == rhs.SunriseEndRaw; - ret.SunsetBeginRaw = item.SunsetBeginRaw == rhs.SunsetBeginRaw; - ret.SunsetEndRaw = item.SunsetEndRaw == rhs.SunsetEndRaw; + ret.SunriseBegin = item.SunriseBegin == rhs.SunriseBegin; + ret.SunriseEnd = item.SunriseEnd == rhs.SunriseEnd; + ret.SunsetBegin = item.SunsetBegin == rhs.SunsetBegin; + ret.SunsetEnd = item.SunsetEnd == rhs.SunsetEnd; ret.Volatility = item.Volatility == rhs.Volatility; ret.Moons = item.Moons == rhs.Moons; ret.PhaseLength = item.PhaseLength == rhs.PhaseLength; @@ -1438,21 +1438,21 @@ protected static void ToStringFields( { ModelItem?.Print(sb, "Model"); } - if (printMask?.SunriseBeginRaw ?? true) + if (printMask?.SunriseBegin ?? true) { - sb.AppendItem(item.SunriseBeginRaw, "SunriseBeginRaw"); + sb.AppendItem(item.SunriseBegin, "SunriseBegin"); } - if (printMask?.SunriseEndRaw ?? true) + if (printMask?.SunriseEnd ?? true) { - sb.AppendItem(item.SunriseEndRaw, "SunriseEndRaw"); + sb.AppendItem(item.SunriseEnd, "SunriseEnd"); } - if (printMask?.SunsetBeginRaw ?? true) + if (printMask?.SunsetBegin ?? true) { - sb.AppendItem(item.SunsetBeginRaw, "SunsetBeginRaw"); + sb.AppendItem(item.SunsetBegin, "SunsetBegin"); } - if (printMask?.SunsetEndRaw ?? true) + if (printMask?.SunsetEnd ?? true) { - sb.AppendItem(item.SunsetEndRaw, "SunsetEndRaw"); + sb.AppendItem(item.SunsetEnd, "SunsetEnd"); } if (printMask?.Volatility ?? true) { @@ -1536,21 +1536,21 @@ public virtual bool Equals( } else if (!isModelEqual) return false; } - if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseBeginRaw) ?? true)) + if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseBegin) ?? true)) { - if (lhs.SunriseBeginRaw != rhs.SunriseBeginRaw) return false; + if (lhs.SunriseBegin != rhs.SunriseBegin) return false; } - if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseEndRaw) ?? true)) + if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseEnd) ?? true)) { - if (lhs.SunriseEndRaw != rhs.SunriseEndRaw) return false; + if (lhs.SunriseEnd != rhs.SunriseEnd) return false; } - if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetBeginRaw) ?? true)) + if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetBegin) ?? true)) { - if (lhs.SunsetBeginRaw != rhs.SunsetBeginRaw) return false; + if (lhs.SunsetBegin != rhs.SunsetBegin) return false; } - if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetEndRaw) ?? true)) + if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetEnd) ?? true)) { - if (lhs.SunsetEndRaw != rhs.SunsetEndRaw) return false; + if (lhs.SunsetEnd != rhs.SunsetEnd) return false; } if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.Volatility) ?? true)) { @@ -1605,10 +1605,10 @@ public virtual int GetHashCode(IClimateGetter item) { hash.Add(Modelitem); } - hash.Add(item.SunriseBeginRaw); - hash.Add(item.SunriseEndRaw); - hash.Add(item.SunsetBeginRaw); - hash.Add(item.SunsetEndRaw); + hash.Add(item.SunriseBegin); + hash.Add(item.SunriseEnd); + hash.Add(item.SunsetBegin); + hash.Add(item.SunsetEnd); hash.Add(item.Volatility); hash.Add(item.Moons); hash.Add(item.PhaseLength); @@ -1795,21 +1795,21 @@ public void DeepCopyIn( errorMask?.PopIndex(); } } - if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseBeginRaw) ?? true)) + if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseBegin) ?? true)) { - item.SunriseBeginRaw = rhs.SunriseBeginRaw; + item.SunriseBegin = rhs.SunriseBegin; } - if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseEndRaw) ?? true)) + if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseEnd) ?? true)) { - item.SunriseEndRaw = rhs.SunriseEndRaw; + item.SunriseEnd = rhs.SunriseEnd; } - if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetBeginRaw) ?? true)) + if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetBegin) ?? true)) { - item.SunsetBeginRaw = rhs.SunsetBeginRaw; + item.SunsetBegin = rhs.SunsetBegin; } - if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetEndRaw) ?? true)) + if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetEnd) ?? true)) { - item.SunsetEndRaw = rhs.SunsetEndRaw; + item.SunsetEnd = rhs.SunsetEnd; } if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.Volatility) ?? true)) { @@ -2011,10 +2011,18 @@ public static void WriteRecordTypes( } using (HeaderExport.Subrecord(writer, translationParams.ConvertToCustom(RecordTypes.TNAM))) { - writer.Write(item.SunriseBeginRaw); - writer.Write(item.SunriseEndRaw); - writer.Write(item.SunsetBeginRaw); - writer.Write(item.SunsetEndRaw); + ClimateBinaryWriteTranslation.WriteBinarySunriseBegin( + writer: writer, + item: item); + ClimateBinaryWriteTranslation.WriteBinarySunriseEnd( + writer: writer, + item: item); + ClimateBinaryWriteTranslation.WriteBinarySunsetBegin( + writer: writer, + item: item); + ClimateBinaryWriteTranslation.WriteBinarySunsetEnd( + writer: writer, + item: item); writer.Write(item.Volatility); ClimateBinaryWriteTranslation.WriteBinaryMoonAndPhaseLength( writer: writer, @@ -2022,6 +2030,58 @@ public static void WriteRecordTypes( } } + public static partial void WriteBinarySunriseBeginCustom( + MutagenWriter writer, + IClimateGetter item); + + public static void WriteBinarySunriseBegin( + MutagenWriter writer, + IClimateGetter item) + { + WriteBinarySunriseBeginCustom( + writer: writer, + item: item); + } + + public static partial void WriteBinarySunriseEndCustom( + MutagenWriter writer, + IClimateGetter item); + + public static void WriteBinarySunriseEnd( + MutagenWriter writer, + IClimateGetter item) + { + WriteBinarySunriseEndCustom( + writer: writer, + item: item); + } + + public static partial void WriteBinarySunsetBeginCustom( + MutagenWriter writer, + IClimateGetter item); + + public static void WriteBinarySunsetBegin( + MutagenWriter writer, + IClimateGetter item) + { + WriteBinarySunsetBeginCustom( + writer: writer, + item: item); + } + + public static partial void WriteBinarySunsetEndCustom( + MutagenWriter writer, + IClimateGetter item); + + public static void WriteBinarySunsetEnd( + MutagenWriter writer, + IClimateGetter item) + { + WriteBinarySunsetEndCustom( + writer: writer, + item: item); + } + public static partial void WriteBinaryMoonAndPhaseLengthCustom( MutagenWriter writer, IClimateGetter item); @@ -2158,14 +2218,18 @@ public static ParseResult FillBinaryRecordTypes( { frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; var dataFrame = frame.SpawnWithLength(contentLength); - if (dataFrame.Remaining < 1) return null; - item.SunriseBeginRaw = dataFrame.ReadUInt8(); - if (dataFrame.Remaining < 1) return null; - item.SunriseEndRaw = dataFrame.ReadUInt8(); - if (dataFrame.Remaining < 1) return null; - item.SunsetBeginRaw = dataFrame.ReadUInt8(); - if (dataFrame.Remaining < 1) return null; - item.SunsetEndRaw = dataFrame.ReadUInt8(); + ClimateBinaryCreateTranslation.FillBinarySunriseBeginCustom( + frame: dataFrame, + item: item); + ClimateBinaryCreateTranslation.FillBinarySunriseEndCustom( + frame: dataFrame, + item: item); + ClimateBinaryCreateTranslation.FillBinarySunsetBeginCustom( + frame: dataFrame, + item: item); + ClimateBinaryCreateTranslation.FillBinarySunsetEndCustom( + frame: dataFrame, + item: item); if (dataFrame.Remaining < 1) return null; item.Volatility = dataFrame.ReadUInt8(); ClimateBinaryCreateTranslation.FillBinaryMoonAndPhaseLengthCustom( @@ -2185,6 +2249,22 @@ public static ParseResult FillBinaryRecordTypes( } } + public static partial void FillBinarySunriseBeginCustom( + MutagenFrame frame, + IClimateInternal item); + + public static partial void FillBinarySunriseEndCustom( + MutagenFrame frame, + IClimateInternal item); + + public static partial void FillBinarySunsetBeginCustom( + MutagenFrame frame, + IClimateInternal item); + + public static partial void FillBinarySunsetEndCustom( + MutagenFrame frame, + IClimateInternal item); + public static partial void FillBinaryMoonAndPhaseLengthCustom( MutagenFrame frame, IClimateInternal item); @@ -2247,25 +2327,25 @@ void IBinaryItem.WriteToBinary( #endregion public IModelGetter? Model { get; private set; } private RangeInt32? _TNAMLocation; - #region SunriseBeginRaw - private int _SunriseBeginRawLocation => _TNAMLocation!.Value.Min; - private bool _SunriseBeginRaw_IsSet => _TNAMLocation.HasValue; - public Byte SunriseBeginRaw => _SunriseBeginRaw_IsSet ? _recordData.Span[_SunriseBeginRawLocation] : default; + #region SunriseBegin + private int _SunriseBeginLocation => _TNAMLocation!.Value.Min; + public partial TimeOnly GetSunriseBeginCustom(); + public TimeOnly SunriseBegin => GetSunriseBeginCustom(); #endregion - #region SunriseEndRaw - private int _SunriseEndRawLocation => _TNAMLocation!.Value.Min + 0x1; - private bool _SunriseEndRaw_IsSet => _TNAMLocation.HasValue; - public Byte SunriseEndRaw => _SunriseEndRaw_IsSet ? _recordData.Span[_SunriseEndRawLocation] : default; + #region SunriseEnd + private int _SunriseEndLocation => _TNAMLocation!.Value.Min + 0x1; + public partial TimeOnly GetSunriseEndCustom(); + public TimeOnly SunriseEnd => GetSunriseEndCustom(); #endregion - #region SunsetBeginRaw - private int _SunsetBeginRawLocation => _TNAMLocation!.Value.Min + 0x2; - private bool _SunsetBeginRaw_IsSet => _TNAMLocation.HasValue; - public Byte SunsetBeginRaw => _SunsetBeginRaw_IsSet ? _recordData.Span[_SunsetBeginRawLocation] : default; + #region SunsetBegin + private int _SunsetBeginLocation => _TNAMLocation!.Value.Min + 0x2; + public partial TimeOnly GetSunsetBeginCustom(); + public TimeOnly SunsetBegin => GetSunsetBeginCustom(); #endregion - #region SunsetEndRaw - private int _SunsetEndRawLocation => _TNAMLocation!.Value.Min + 0x3; - private bool _SunsetEndRaw_IsSet => _TNAMLocation.HasValue; - public Byte SunsetEndRaw => _SunsetEndRaw_IsSet ? _recordData.Span[_SunsetEndRawLocation] : default; + #region SunsetEnd + private int _SunsetEndLocation => _TNAMLocation!.Value.Min + 0x3; + public partial TimeOnly GetSunsetEndCustom(); + public TimeOnly SunsetEnd => GetSunsetEndCustom(); #endregion #region Volatility private int _VolatilityLocation => _TNAMLocation!.Value.Min + 0x4; diff --git a/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.cs b/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.cs index 947aaf274..3fd6ddec6 100644 --- a/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.cs +++ b/Mutagen.Bethesda.Oblivion/Records/Major Records/Climate.cs @@ -56,14 +56,7 @@ public static partial void WriteBinaryPhaseLengthCustom(MutagenWriter writer, IC partial class ClimateDataBinaryCreateTranslation { - private static DateTime DateConverter(DateTime d) - { - return DateTime.MinValue - .AddHours(d.Hour) - .AddMinutes(d.Minute / 10 * 10); - } - - private static bool GetDate(byte b, out TimeOnly date) + private static bool GetTime(byte b, out TimeOnly date) { if (b > 144) { @@ -75,7 +68,7 @@ private static bool GetDate(byte b, out TimeOnly date) return true; } - public static TimeOnly GetDate(byte b) + public static TimeOnly GetTime(byte b) { if (b > 144) { @@ -86,7 +79,7 @@ public static TimeOnly GetDate(byte b) public static partial void FillBinarySunriseBeginCustom(MutagenFrame frame, IClimateData item) { - if (GetDate(frame.Reader.ReadUInt8(), out var date)) + if (GetTime(frame.Reader.ReadUInt8(), out var date)) { item.SunriseBegin = date; } @@ -94,7 +87,7 @@ public static partial void FillBinarySunriseBeginCustom(MutagenFrame frame, ICli public static partial void FillBinarySunriseEndCustom(MutagenFrame frame, IClimateData item) { - if (GetDate(frame.Reader.ReadUInt8(), out var date)) + if (GetTime(frame.Reader.ReadUInt8(), out var date)) { item.SunriseEnd = date; } @@ -102,7 +95,7 @@ public static partial void FillBinarySunriseEndCustom(MutagenFrame frame, IClima public static partial void FillBinarySunsetBeginCustom(MutagenFrame frame, IClimateData item) { - if (GetDate(frame.Reader.ReadUInt8(), out var date)) + if (GetTime(frame.Reader.ReadUInt8(), out var date)) { item.SunsetBegin = date; } @@ -110,7 +103,7 @@ public static partial void FillBinarySunsetBeginCustom(MutagenFrame frame, IClim public static partial void FillBinarySunsetEndCustom(MutagenFrame frame, IClimateData item) { - if (GetDate(frame.Reader.ReadUInt8(), out var date)) + if (GetTime(frame.Reader.ReadUInt8(), out var date)) { item.SunsetEnd = date; } @@ -140,10 +133,10 @@ public static partial void FillBinaryPhaseLengthCustom(MutagenFrame frame, IClim partial class ClimateDataBinaryOverlay { - public partial TimeOnly GetSunriseBeginCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[0]); - public partial TimeOnly GetSunriseEndCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[1]); - public partial TimeOnly GetSunsetBeginCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[2]); - public partial TimeOnly GetSunsetEndCustom(int location) => ClimateDataBinaryCreateTranslation.GetDate(_structData.Span[3]); + public partial TimeOnly GetSunriseBeginCustom(int location) => ClimateDataBinaryCreateTranslation.GetTime(_structData.Span[0]); + public partial TimeOnly GetSunriseEndCustom(int location) => ClimateDataBinaryCreateTranslation.GetTime(_structData.Span[1]); + public partial TimeOnly GetSunsetBeginCustom(int location) => ClimateDataBinaryCreateTranslation.GetTime(_structData.Span[2]); + public partial TimeOnly GetSunsetEndCustom(int location) => ClimateDataBinaryCreateTranslation.GetTime(_structData.Span[3]); public partial Climate.MoonPhase GetPhaseCustom(int location) => (Climate.MoonPhase)ClimateDataBinaryCreateTranslation.GetPhaseInt(_structData.Span[5]); public partial byte GetPhaseLengthCustom(int location) => ClimateDataBinaryCreateTranslation.GetPhaseLen(_structData.Span[5]); } \ No newline at end of file diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate.cs index 3fc49e8c1..4a88733f3 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate.cs @@ -1,4 +1,5 @@ using Mutagen.Bethesda.Plugins.Binary.Streams; +using Mutagen.Bethesda.Plugins.Binary.Translations; using Noggog; namespace Mutagen.Bethesda.Skyrim; @@ -32,6 +33,59 @@ public static partial void FillBinaryMoonAndPhaseLengthCustom(MutagenFrame frame item.Moons |= Climate.Moon.Secunda; } } + + private static bool GetTime(byte b, out TimeOnly date) + { + if (b > 144) + { + throw new ArgumentException("Cannot have a time value greater than 144"); + date = default(TimeOnly); + return false; + } + date = new TimeOnly().AddMinutes(b * 10); + return true; + } + + public static TimeOnly GetTime(byte b) + { + if (b > 144) + { + throw new ArgumentException("Cannot have a time value greater than 144"); + } + return new TimeOnly().AddMinutes(b * 10); + } + + public static partial void FillBinarySunriseBeginCustom(MutagenFrame frame, IClimateInternal item) + { + if (GetTime(frame.Reader.ReadUInt8(), out var date)) + { + item.SunriseBegin = date; + } + } + + public static partial void FillBinarySunriseEndCustom(MutagenFrame frame, IClimateInternal item) + { + if (GetTime(frame.Reader.ReadUInt8(), out var date)) + { + item.SunriseEnd = date; + } + } + + public static partial void FillBinarySunsetBeginCustom(MutagenFrame frame, IClimateInternal item) + { + if (GetTime(frame.Reader.ReadUInt8(), out var date)) + { + item.SunsetBegin = date; + } + } + + public static partial void FillBinarySunsetEndCustom(MutagenFrame frame, IClimateInternal item) + { + if (GetTime(frame.Reader.ReadUInt8(), out var date)) + { + item.SunsetEnd = date; + } + } } partial class ClimateBinaryWriteTranslation @@ -49,10 +103,41 @@ public static partial void WriteBinaryMoonAndPhaseLengthCustom(MutagenWriter wri } writer.Write(raw); } + + private static byte GetByte(TimeOnly d) + { + var mins = d.Hour * 60 + d.Minute; + return (byte)(mins / 10); + } + + public static partial void WriteBinarySunriseBeginCustom(MutagenWriter writer, IClimateGetter item) + { + writer.Write(GetByte(item.SunriseBegin)); + } + + public static partial void WriteBinarySunriseEndCustom(MutagenWriter writer, IClimateGetter item) + { + writer.Write(GetByte(item.SunriseEnd)); + } + + public static partial void WriteBinarySunsetBeginCustom(MutagenWriter writer, IClimateGetter item) + { + writer.Write(GetByte(item.SunsetBegin)); + } + + public static partial void WriteBinarySunsetEndCustom(MutagenWriter writer, IClimateGetter item) + { + writer.Write(GetByte(item.SunsetEnd)); + } } partial class ClimateBinaryOverlay { + public partial TimeOnly GetSunriseBeginCustom() => ClimateBinaryCreateTranslation.GetTime(_recordData.Span[_TNAMLocation!.Value.Min + 0]); + public partial TimeOnly GetSunriseEndCustom() => ClimateBinaryCreateTranslation.GetTime(_recordData.Span[_TNAMLocation!.Value.Min + 1]); + public partial TimeOnly GetSunsetBeginCustom() => ClimateBinaryCreateTranslation.GetTime(_recordData.Span[_TNAMLocation!.Value.Min + 2]); + public partial TimeOnly GetSunsetEndCustom() => ClimateBinaryCreateTranslation.GetTime(_recordData.Span[_TNAMLocation!.Value.Min + 3]); + public Climate.Moon Moons { get diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate.xml b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate.xml index 8e60db877..50f38f71d 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate.xml +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate.xml @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs index 8480799b3..a60ab8511 100644 --- a/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs +++ b/Mutagen.Bethesda.Skyrim/Records/Major Records/Climate_Generated.cs @@ -100,17 +100,17 @@ public Model? Model IModelGetter? IModeledGetter.Model => this.Model; #endregion #endregion - #region SunriseBeginRaw - public Byte SunriseBeginRaw { get; set; } = default; + #region SunriseBegin + public TimeOnly SunriseBegin { get; set; } = default; #endregion - #region SunriseEndRaw - public Byte SunriseEndRaw { get; set; } = default; + #region SunriseEnd + public TimeOnly SunriseEnd { get; set; } = default; #endregion - #region SunsetBeginRaw - public Byte SunsetBeginRaw { get; set; } = default; + #region SunsetBegin + public TimeOnly SunsetBegin { get; set; } = default; #endregion - #region SunsetEndRaw - public Byte SunsetEndRaw { get; set; } = default; + #region SunsetEnd + public TimeOnly SunsetEnd { get; set; } = default; #endregion #region Volatility public Byte Volatility { get; set; } = default; @@ -151,10 +151,10 @@ public Mask(TItem initialValue) this.SunTexture = initialValue; this.SunGlareTexture = initialValue; this.Model = new MaskItem?>(initialValue, new Model.Mask(initialValue)); - this.SunriseBeginRaw = initialValue; - this.SunriseEndRaw = initialValue; - this.SunsetBeginRaw = initialValue; - this.SunsetEndRaw = initialValue; + this.SunriseBegin = initialValue; + this.SunriseEnd = initialValue; + this.SunsetBegin = initialValue; + this.SunsetEnd = initialValue; this.Volatility = initialValue; this.Moons = initialValue; this.PhaseLength = initialValue; @@ -172,10 +172,10 @@ public Mask( TItem SunTexture, TItem SunGlareTexture, TItem Model, - TItem SunriseBeginRaw, - TItem SunriseEndRaw, - TItem SunsetBeginRaw, - TItem SunsetEndRaw, + TItem SunriseBegin, + TItem SunriseEnd, + TItem SunsetBegin, + TItem SunsetEnd, TItem Volatility, TItem Moons, TItem PhaseLength) @@ -192,10 +192,10 @@ public Mask( this.SunTexture = SunTexture; this.SunGlareTexture = SunGlareTexture; this.Model = new MaskItem?>(Model, new Model.Mask(Model)); - this.SunriseBeginRaw = SunriseBeginRaw; - this.SunriseEndRaw = SunriseEndRaw; - this.SunsetBeginRaw = SunsetBeginRaw; - this.SunsetEndRaw = SunsetEndRaw; + this.SunriseBegin = SunriseBegin; + this.SunriseEnd = SunriseEnd; + this.SunsetBegin = SunsetBegin; + this.SunsetEnd = SunsetEnd; this.Volatility = Volatility; this.Moons = Moons; this.PhaseLength = PhaseLength; @@ -214,10 +214,10 @@ protected Mask() public TItem SunTexture; public TItem SunGlareTexture; public MaskItem?>? Model { get; set; } - public TItem SunriseBeginRaw; - public TItem SunriseEndRaw; - public TItem SunsetBeginRaw; - public TItem SunsetEndRaw; + public TItem SunriseBegin; + public TItem SunriseEnd; + public TItem SunsetBegin; + public TItem SunsetEnd; public TItem Volatility; public TItem Moons; public TItem PhaseLength; @@ -238,10 +238,10 @@ public bool Equals(Mask? rhs) if (!object.Equals(this.SunTexture, rhs.SunTexture)) return false; if (!object.Equals(this.SunGlareTexture, rhs.SunGlareTexture)) return false; if (!object.Equals(this.Model, rhs.Model)) return false; - if (!object.Equals(this.SunriseBeginRaw, rhs.SunriseBeginRaw)) return false; - if (!object.Equals(this.SunriseEndRaw, rhs.SunriseEndRaw)) return false; - if (!object.Equals(this.SunsetBeginRaw, rhs.SunsetBeginRaw)) return false; - if (!object.Equals(this.SunsetEndRaw, rhs.SunsetEndRaw)) return false; + if (!object.Equals(this.SunriseBegin, rhs.SunriseBegin)) return false; + if (!object.Equals(this.SunriseEnd, rhs.SunriseEnd)) return false; + if (!object.Equals(this.SunsetBegin, rhs.SunsetBegin)) return false; + if (!object.Equals(this.SunsetEnd, rhs.SunsetEnd)) return false; if (!object.Equals(this.Volatility, rhs.Volatility)) return false; if (!object.Equals(this.Moons, rhs.Moons)) return false; if (!object.Equals(this.PhaseLength, rhs.PhaseLength)) return false; @@ -254,10 +254,10 @@ public override int GetHashCode() hash.Add(this.SunTexture); hash.Add(this.SunGlareTexture); hash.Add(this.Model); - hash.Add(this.SunriseBeginRaw); - hash.Add(this.SunriseEndRaw); - hash.Add(this.SunsetBeginRaw); - hash.Add(this.SunsetEndRaw); + hash.Add(this.SunriseBegin); + hash.Add(this.SunriseEnd); + hash.Add(this.SunsetBegin); + hash.Add(this.SunsetEnd); hash.Add(this.Volatility); hash.Add(this.Moons); hash.Add(this.PhaseLength); @@ -290,10 +290,10 @@ public override bool All(Func eval) if (!eval(this.Model.Overall)) return false; if (this.Model.Specific != null && !this.Model.Specific.All(eval)) return false; } - if (!eval(this.SunriseBeginRaw)) return false; - if (!eval(this.SunriseEndRaw)) return false; - if (!eval(this.SunsetBeginRaw)) return false; - if (!eval(this.SunsetEndRaw)) return false; + if (!eval(this.SunriseBegin)) return false; + if (!eval(this.SunriseEnd)) return false; + if (!eval(this.SunsetBegin)) return false; + if (!eval(this.SunsetEnd)) return false; if (!eval(this.Volatility)) return false; if (!eval(this.Moons)) return false; if (!eval(this.PhaseLength)) return false; @@ -324,10 +324,10 @@ public override bool Any(Func eval) if (eval(this.Model.Overall)) return true; if (this.Model.Specific != null && this.Model.Specific.Any(eval)) return true; } - if (eval(this.SunriseBeginRaw)) return true; - if (eval(this.SunriseEndRaw)) return true; - if (eval(this.SunsetBeginRaw)) return true; - if (eval(this.SunsetEndRaw)) return true; + if (eval(this.SunriseBegin)) return true; + if (eval(this.SunriseEnd)) return true; + if (eval(this.SunsetBegin)) return true; + if (eval(this.SunsetEnd)) return true; if (eval(this.Volatility)) return true; if (eval(this.Moons)) return true; if (eval(this.PhaseLength)) return true; @@ -364,10 +364,10 @@ protected void Translate_InternalFill(Mask obj, Func eval) obj.SunTexture = eval(this.SunTexture); obj.SunGlareTexture = eval(this.SunGlareTexture); obj.Model = this.Model == null ? null : new MaskItem?>(eval(this.Model.Overall), this.Model.Specific?.Translate(eval)); - obj.SunriseBeginRaw = eval(this.SunriseBeginRaw); - obj.SunriseEndRaw = eval(this.SunriseEndRaw); - obj.SunsetBeginRaw = eval(this.SunsetBeginRaw); - obj.SunsetEndRaw = eval(this.SunsetEndRaw); + obj.SunriseBegin = eval(this.SunriseBegin); + obj.SunriseEnd = eval(this.SunriseEnd); + obj.SunsetBegin = eval(this.SunsetBegin); + obj.SunsetEnd = eval(this.SunsetEnd); obj.Volatility = eval(this.Volatility); obj.Moons = eval(this.Moons); obj.PhaseLength = eval(this.PhaseLength); @@ -420,21 +420,21 @@ public void Print(StructuredStringBuilder sb, Climate.Mask? printMask = nu { Model?.Print(sb); } - if (printMask?.SunriseBeginRaw ?? true) + if (printMask?.SunriseBegin ?? true) { - sb.AppendItem(SunriseBeginRaw, "SunriseBeginRaw"); + sb.AppendItem(SunriseBegin, "SunriseBegin"); } - if (printMask?.SunriseEndRaw ?? true) + if (printMask?.SunriseEnd ?? true) { - sb.AppendItem(SunriseEndRaw, "SunriseEndRaw"); + sb.AppendItem(SunriseEnd, "SunriseEnd"); } - if (printMask?.SunsetBeginRaw ?? true) + if (printMask?.SunsetBegin ?? true) { - sb.AppendItem(SunsetBeginRaw, "SunsetBeginRaw"); + sb.AppendItem(SunsetBegin, "SunsetBegin"); } - if (printMask?.SunsetEndRaw ?? true) + if (printMask?.SunsetEnd ?? true) { - sb.AppendItem(SunsetEndRaw, "SunsetEndRaw"); + sb.AppendItem(SunsetEnd, "SunsetEnd"); } if (printMask?.Volatility ?? true) { @@ -463,10 +463,10 @@ public void Print(StructuredStringBuilder sb, Climate.Mask? printMask = nu public Exception? SunTexture; public Exception? SunGlareTexture; public MaskItem? Model; - public Exception? SunriseBeginRaw; - public Exception? SunriseEndRaw; - public Exception? SunsetBeginRaw; - public Exception? SunsetEndRaw; + public Exception? SunriseBegin; + public Exception? SunriseEnd; + public Exception? SunsetBegin; + public Exception? SunsetEnd; public Exception? Volatility; public Exception? Moons; public Exception? PhaseLength; @@ -486,14 +486,14 @@ public void Print(StructuredStringBuilder sb, Climate.Mask? printMask = nu return SunGlareTexture; case Climate_FieldIndex.Model: return Model; - case Climate_FieldIndex.SunriseBeginRaw: - return SunriseBeginRaw; - case Climate_FieldIndex.SunriseEndRaw: - return SunriseEndRaw; - case Climate_FieldIndex.SunsetBeginRaw: - return SunsetBeginRaw; - case Climate_FieldIndex.SunsetEndRaw: - return SunsetEndRaw; + case Climate_FieldIndex.SunriseBegin: + return SunriseBegin; + case Climate_FieldIndex.SunriseEnd: + return SunriseEnd; + case Climate_FieldIndex.SunsetBegin: + return SunsetBegin; + case Climate_FieldIndex.SunsetEnd: + return SunsetEnd; case Climate_FieldIndex.Volatility: return Volatility; case Climate_FieldIndex.Moons: @@ -522,17 +522,17 @@ public override void SetNthException(int index, Exception ex) case Climate_FieldIndex.Model: this.Model = new MaskItem(ex, null); break; - case Climate_FieldIndex.SunriseBeginRaw: - this.SunriseBeginRaw = ex; + case Climate_FieldIndex.SunriseBegin: + this.SunriseBegin = ex; break; - case Climate_FieldIndex.SunriseEndRaw: - this.SunriseEndRaw = ex; + case Climate_FieldIndex.SunriseEnd: + this.SunriseEnd = ex; break; - case Climate_FieldIndex.SunsetBeginRaw: - this.SunsetBeginRaw = ex; + case Climate_FieldIndex.SunsetBegin: + this.SunsetBegin = ex; break; - case Climate_FieldIndex.SunsetEndRaw: - this.SunsetEndRaw = ex; + case Climate_FieldIndex.SunsetEnd: + this.SunsetEnd = ex; break; case Climate_FieldIndex.Volatility: this.Volatility = ex; @@ -566,17 +566,17 @@ public override void SetNthMask(int index, object obj) case Climate_FieldIndex.Model: this.Model = (MaskItem?)obj; break; - case Climate_FieldIndex.SunriseBeginRaw: - this.SunriseBeginRaw = (Exception?)obj; + case Climate_FieldIndex.SunriseBegin: + this.SunriseBegin = (Exception?)obj; break; - case Climate_FieldIndex.SunriseEndRaw: - this.SunriseEndRaw = (Exception?)obj; + case Climate_FieldIndex.SunriseEnd: + this.SunriseEnd = (Exception?)obj; break; - case Climate_FieldIndex.SunsetBeginRaw: - this.SunsetBeginRaw = (Exception?)obj; + case Climate_FieldIndex.SunsetBegin: + this.SunsetBegin = (Exception?)obj; break; - case Climate_FieldIndex.SunsetEndRaw: - this.SunsetEndRaw = (Exception?)obj; + case Climate_FieldIndex.SunsetEnd: + this.SunsetEnd = (Exception?)obj; break; case Climate_FieldIndex.Volatility: this.Volatility = (Exception?)obj; @@ -600,10 +600,10 @@ public override bool IsInError() if (SunTexture != null) return true; if (SunGlareTexture != null) return true; if (Model != null) return true; - if (SunriseBeginRaw != null) return true; - if (SunriseEndRaw != null) return true; - if (SunsetBeginRaw != null) return true; - if (SunsetEndRaw != null) return true; + if (SunriseBegin != null) return true; + if (SunriseEnd != null) return true; + if (SunsetBegin != null) return true; + if (SunsetEnd != null) return true; if (Volatility != null) return true; if (Moons != null) return true; if (PhaseLength != null) return true; @@ -659,16 +659,16 @@ protected override void PrintFillInternal(StructuredStringBuilder sb) } Model?.Print(sb); { - sb.AppendItem(SunriseBeginRaw, "SunriseBeginRaw"); + sb.AppendItem(SunriseBegin, "SunriseBegin"); } { - sb.AppendItem(SunriseEndRaw, "SunriseEndRaw"); + sb.AppendItem(SunriseEnd, "SunriseEnd"); } { - sb.AppendItem(SunsetBeginRaw, "SunsetBeginRaw"); + sb.AppendItem(SunsetBegin, "SunsetBegin"); } { - sb.AppendItem(SunsetEndRaw, "SunsetEndRaw"); + sb.AppendItem(SunsetEnd, "SunsetEnd"); } { sb.AppendItem(Volatility, "Volatility"); @@ -691,10 +691,10 @@ public ErrorMask Combine(ErrorMask? rhs) ret.SunTexture = this.SunTexture.Combine(rhs.SunTexture); ret.SunGlareTexture = this.SunGlareTexture.Combine(rhs.SunGlareTexture); ret.Model = this.Model.Combine(rhs.Model, (l, r) => l.Combine(r)); - ret.SunriseBeginRaw = this.SunriseBeginRaw.Combine(rhs.SunriseBeginRaw); - ret.SunriseEndRaw = this.SunriseEndRaw.Combine(rhs.SunriseEndRaw); - ret.SunsetBeginRaw = this.SunsetBeginRaw.Combine(rhs.SunsetBeginRaw); - ret.SunsetEndRaw = this.SunsetEndRaw.Combine(rhs.SunsetEndRaw); + ret.SunriseBegin = this.SunriseBegin.Combine(rhs.SunriseBegin); + ret.SunriseEnd = this.SunriseEnd.Combine(rhs.SunriseEnd); + ret.SunsetBegin = this.SunsetBegin.Combine(rhs.SunsetBegin); + ret.SunsetEnd = this.SunsetEnd.Combine(rhs.SunsetEnd); ret.Volatility = this.Volatility.Combine(rhs.Volatility); ret.Moons = this.Moons.Combine(rhs.Moons); ret.PhaseLength = this.PhaseLength.Combine(rhs.PhaseLength); @@ -724,10 +724,10 @@ public ErrorMask Combine(ErrorMask? rhs) public bool SunTexture; public bool SunGlareTexture; public Model.TranslationMask? Model; - public bool SunriseBeginRaw; - public bool SunriseEndRaw; - public bool SunsetBeginRaw; - public bool SunsetEndRaw; + public bool SunriseBegin; + public bool SunriseEnd; + public bool SunsetBegin; + public bool SunsetEnd; public bool Volatility; public bool Moons; public bool PhaseLength; @@ -741,10 +741,10 @@ public TranslationMask( { this.SunTexture = defaultOn; this.SunGlareTexture = defaultOn; - this.SunriseBeginRaw = defaultOn; - this.SunriseEndRaw = defaultOn; - this.SunsetBeginRaw = defaultOn; - this.SunsetEndRaw = defaultOn; + this.SunriseBegin = defaultOn; + this.SunriseEnd = defaultOn; + this.SunsetBegin = defaultOn; + this.SunsetEnd = defaultOn; this.Volatility = defaultOn; this.Moons = defaultOn; this.PhaseLength = defaultOn; @@ -759,10 +759,10 @@ protected override void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal ret.Add((SunTexture, null)); ret.Add((SunGlareTexture, null)); ret.Add((Model != null ? Model.OnOverall : DefaultOn, Model?.GetCrystal())); - ret.Add((SunriseBeginRaw, null)); - ret.Add((SunriseEndRaw, null)); - ret.Add((SunsetBeginRaw, null)); - ret.Add((SunsetEndRaw, null)); + ret.Add((SunriseBegin, null)); + ret.Add((SunriseEnd, null)); + ret.Add((SunsetBegin, null)); + ret.Add((SunsetEnd, null)); ret.Add((Volatility, null)); ret.Add((Moons, null)); ret.Add((PhaseLength, null)); @@ -926,10 +926,10 @@ public partial interface IClimate : /// Aspects: IModeled /// new Model? Model { get; set; } - new Byte SunriseBeginRaw { get; set; } - new Byte SunriseEndRaw { get; set; } - new Byte SunsetBeginRaw { get; set; } - new Byte SunsetEndRaw { get; set; } + new TimeOnly SunriseBegin { get; set; } + new TimeOnly SunriseEnd { get; set; } + new TimeOnly SunsetBegin { get; set; } + new TimeOnly SunsetEnd { get; set; } new Byte Volatility { get; set; } new Climate.Moon Moons { get; set; } new Byte PhaseLength { get; set; } @@ -962,10 +962,10 @@ public partial interface IClimateGetter : /// IModelGetter? Model { get; } #endregion - Byte SunriseBeginRaw { get; } - Byte SunriseEndRaw { get; } - Byte SunsetBeginRaw { get; } - Byte SunsetEndRaw { get; } + TimeOnly SunriseBegin { get; } + TimeOnly SunriseEnd { get; } + TimeOnly SunsetBegin { get; } + TimeOnly SunsetEnd { get; } Byte Volatility { get; } Climate.Moon Moons { get; } Byte PhaseLength { get; } @@ -1149,10 +1149,10 @@ internal enum Climate_FieldIndex SunTexture = 8, SunGlareTexture = 9, Model = 10, - SunriseBeginRaw = 11, - SunriseEndRaw = 12, - SunsetBeginRaw = 13, - SunsetEndRaw = 14, + SunriseBegin = 11, + SunriseEnd = 12, + SunsetBegin = 13, + SunsetEnd = 14, Volatility = 15, Moons = 16, PhaseLength = 17, @@ -1261,10 +1261,10 @@ public void Clear(IClimateInternal item) item.SunTexture = default; item.SunGlareTexture = default; item.Model = null; - item.SunriseBeginRaw = default; - item.SunriseEndRaw = default; - item.SunsetBeginRaw = default; - item.SunsetEndRaw = default; + item.SunriseBegin = default; + item.SunriseEnd = default; + item.SunsetBegin = default; + item.SunsetEnd = default; item.Volatility = default; item.Moons = default; item.PhaseLength = default; @@ -1404,10 +1404,10 @@ public void FillEqualsMask( rhs.Model, (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), include); - ret.SunriseBeginRaw = item.SunriseBeginRaw == rhs.SunriseBeginRaw; - ret.SunriseEndRaw = item.SunriseEndRaw == rhs.SunriseEndRaw; - ret.SunsetBeginRaw = item.SunsetBeginRaw == rhs.SunsetBeginRaw; - ret.SunsetEndRaw = item.SunsetEndRaw == rhs.SunsetEndRaw; + ret.SunriseBegin = item.SunriseBegin == rhs.SunriseBegin; + ret.SunriseEnd = item.SunriseEnd == rhs.SunriseEnd; + ret.SunsetBegin = item.SunsetBegin == rhs.SunsetBegin; + ret.SunsetEnd = item.SunsetEnd == rhs.SunsetEnd; ret.Volatility = item.Volatility == rhs.Volatility; ret.Moons = item.Moons == rhs.Moons; ret.PhaseLength = item.PhaseLength == rhs.PhaseLength; @@ -1490,21 +1490,21 @@ protected static void ToStringFields( { ModelItem?.Print(sb, "Model"); } - if (printMask?.SunriseBeginRaw ?? true) + if (printMask?.SunriseBegin ?? true) { - sb.AppendItem(item.SunriseBeginRaw, "SunriseBeginRaw"); + sb.AppendItem(item.SunriseBegin, "SunriseBegin"); } - if (printMask?.SunriseEndRaw ?? true) + if (printMask?.SunriseEnd ?? true) { - sb.AppendItem(item.SunriseEndRaw, "SunriseEndRaw"); + sb.AppendItem(item.SunriseEnd, "SunriseEnd"); } - if (printMask?.SunsetBeginRaw ?? true) + if (printMask?.SunsetBegin ?? true) { - sb.AppendItem(item.SunsetBeginRaw, "SunsetBeginRaw"); + sb.AppendItem(item.SunsetBegin, "SunsetBegin"); } - if (printMask?.SunsetEndRaw ?? true) + if (printMask?.SunsetEnd ?? true) { - sb.AppendItem(item.SunsetEndRaw, "SunsetEndRaw"); + sb.AppendItem(item.SunsetEnd, "SunsetEnd"); } if (printMask?.Volatility ?? true) { @@ -1588,21 +1588,21 @@ public virtual bool Equals( } else if (!isModelEqual) return false; } - if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseBeginRaw) ?? true)) + if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseBegin) ?? true)) { - if (lhs.SunriseBeginRaw != rhs.SunriseBeginRaw) return false; + if (lhs.SunriseBegin != rhs.SunriseBegin) return false; } - if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseEndRaw) ?? true)) + if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseEnd) ?? true)) { - if (lhs.SunriseEndRaw != rhs.SunriseEndRaw) return false; + if (lhs.SunriseEnd != rhs.SunriseEnd) return false; } - if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetBeginRaw) ?? true)) + if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetBegin) ?? true)) { - if (lhs.SunsetBeginRaw != rhs.SunsetBeginRaw) return false; + if (lhs.SunsetBegin != rhs.SunsetBegin) return false; } - if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetEndRaw) ?? true)) + if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetEnd) ?? true)) { - if (lhs.SunsetEndRaw != rhs.SunsetEndRaw) return false; + if (lhs.SunsetEnd != rhs.SunsetEnd) return false; } if ((equalsMask?.GetShouldTranslate((int)Climate_FieldIndex.Volatility) ?? true)) { @@ -1657,10 +1657,10 @@ public virtual int GetHashCode(IClimateGetter item) { hash.Add(Modelitem); } - hash.Add(item.SunriseBeginRaw); - hash.Add(item.SunriseEndRaw); - hash.Add(item.SunsetBeginRaw); - hash.Add(item.SunsetEndRaw); + hash.Add(item.SunriseBegin); + hash.Add(item.SunriseEnd); + hash.Add(item.SunsetBegin); + hash.Add(item.SunsetEnd); hash.Add(item.Volatility); hash.Add(item.Moons); hash.Add(item.PhaseLength); @@ -1868,21 +1868,21 @@ public void DeepCopyIn( errorMask?.PopIndex(); } } - if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseBeginRaw) ?? true)) + if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseBegin) ?? true)) { - item.SunriseBeginRaw = rhs.SunriseBeginRaw; + item.SunriseBegin = rhs.SunriseBegin; } - if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseEndRaw) ?? true)) + if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunriseEnd) ?? true)) { - item.SunriseEndRaw = rhs.SunriseEndRaw; + item.SunriseEnd = rhs.SunriseEnd; } - if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetBeginRaw) ?? true)) + if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetBegin) ?? true)) { - item.SunsetBeginRaw = rhs.SunsetBeginRaw; + item.SunsetBegin = rhs.SunsetBegin; } - if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetEndRaw) ?? true)) + if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.SunsetEnd) ?? true)) { - item.SunsetEndRaw = rhs.SunsetEndRaw; + item.SunsetEnd = rhs.SunsetEnd; } if ((copyMask?.GetShouldTranslate((int)Climate_FieldIndex.Volatility) ?? true)) { @@ -2084,10 +2084,18 @@ public static void WriteRecordTypes( } using (HeaderExport.Subrecord(writer, translationParams.ConvertToCustom(RecordTypes.TNAM))) { - writer.Write(item.SunriseBeginRaw); - writer.Write(item.SunriseEndRaw); - writer.Write(item.SunsetBeginRaw); - writer.Write(item.SunsetEndRaw); + ClimateBinaryWriteTranslation.WriteBinarySunriseBegin( + writer: writer, + item: item); + ClimateBinaryWriteTranslation.WriteBinarySunriseEnd( + writer: writer, + item: item); + ClimateBinaryWriteTranslation.WriteBinarySunsetBegin( + writer: writer, + item: item); + ClimateBinaryWriteTranslation.WriteBinarySunsetEnd( + writer: writer, + item: item); writer.Write(item.Volatility); ClimateBinaryWriteTranslation.WriteBinaryMoonAndPhaseLength( writer: writer, @@ -2095,6 +2103,58 @@ public static void WriteRecordTypes( } } + public static partial void WriteBinarySunriseBeginCustom( + MutagenWriter writer, + IClimateGetter item); + + public static void WriteBinarySunriseBegin( + MutagenWriter writer, + IClimateGetter item) + { + WriteBinarySunriseBeginCustom( + writer: writer, + item: item); + } + + public static partial void WriteBinarySunriseEndCustom( + MutagenWriter writer, + IClimateGetter item); + + public static void WriteBinarySunriseEnd( + MutagenWriter writer, + IClimateGetter item) + { + WriteBinarySunriseEndCustom( + writer: writer, + item: item); + } + + public static partial void WriteBinarySunsetBeginCustom( + MutagenWriter writer, + IClimateGetter item); + + public static void WriteBinarySunsetBegin( + MutagenWriter writer, + IClimateGetter item) + { + WriteBinarySunsetBeginCustom( + writer: writer, + item: item); + } + + public static partial void WriteBinarySunsetEndCustom( + MutagenWriter writer, + IClimateGetter item); + + public static void WriteBinarySunsetEnd( + MutagenWriter writer, + IClimateGetter item) + { + WriteBinarySunsetEndCustom( + writer: writer, + item: item); + } + public static partial void WriteBinaryMoonAndPhaseLengthCustom( MutagenWriter writer, IClimateGetter item); @@ -2228,14 +2288,18 @@ public static ParseResult FillBinaryRecordTypes( { frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; var dataFrame = frame.SpawnWithLength(contentLength); - if (dataFrame.Remaining < 1) return null; - item.SunriseBeginRaw = dataFrame.ReadUInt8(); - if (dataFrame.Remaining < 1) return null; - item.SunriseEndRaw = dataFrame.ReadUInt8(); - if (dataFrame.Remaining < 1) return null; - item.SunsetBeginRaw = dataFrame.ReadUInt8(); - if (dataFrame.Remaining < 1) return null; - item.SunsetEndRaw = dataFrame.ReadUInt8(); + ClimateBinaryCreateTranslation.FillBinarySunriseBeginCustom( + frame: dataFrame, + item: item); + ClimateBinaryCreateTranslation.FillBinarySunriseEndCustom( + frame: dataFrame, + item: item); + ClimateBinaryCreateTranslation.FillBinarySunsetBeginCustom( + frame: dataFrame, + item: item); + ClimateBinaryCreateTranslation.FillBinarySunsetEndCustom( + frame: dataFrame, + item: item); if (dataFrame.Remaining < 1) return null; item.Volatility = dataFrame.ReadUInt8(); ClimateBinaryCreateTranslation.FillBinaryMoonAndPhaseLengthCustom( @@ -2255,6 +2319,22 @@ public static ParseResult FillBinaryRecordTypes( } } + public static partial void FillBinarySunriseBeginCustom( + MutagenFrame frame, + IClimateInternal item); + + public static partial void FillBinarySunriseEndCustom( + MutagenFrame frame, + IClimateInternal item); + + public static partial void FillBinarySunsetBeginCustom( + MutagenFrame frame, + IClimateInternal item); + + public static partial void FillBinarySunsetEndCustom( + MutagenFrame frame, + IClimateInternal item); + public static partial void FillBinaryMoonAndPhaseLengthCustom( MutagenFrame frame, IClimateInternal item); @@ -2318,25 +2398,25 @@ void IBinaryItem.WriteToBinary( #endregion public IModelGetter? Model { get; private set; } private RangeInt32? _TNAMLocation; - #region SunriseBeginRaw - private int _SunriseBeginRawLocation => _TNAMLocation!.Value.Min; - private bool _SunriseBeginRaw_IsSet => _TNAMLocation.HasValue; - public Byte SunriseBeginRaw => _SunriseBeginRaw_IsSet ? _recordData.Span[_SunriseBeginRawLocation] : default; + #region SunriseBegin + private int _SunriseBeginLocation => _TNAMLocation!.Value.Min; + public partial TimeOnly GetSunriseBeginCustom(); + public TimeOnly SunriseBegin => GetSunriseBeginCustom(); #endregion - #region SunriseEndRaw - private int _SunriseEndRawLocation => _TNAMLocation!.Value.Min + 0x1; - private bool _SunriseEndRaw_IsSet => _TNAMLocation.HasValue; - public Byte SunriseEndRaw => _SunriseEndRaw_IsSet ? _recordData.Span[_SunriseEndRawLocation] : default; + #region SunriseEnd + private int _SunriseEndLocation => _TNAMLocation!.Value.Min + 0x1; + public partial TimeOnly GetSunriseEndCustom(); + public TimeOnly SunriseEnd => GetSunriseEndCustom(); #endregion - #region SunsetBeginRaw - private int _SunsetBeginRawLocation => _TNAMLocation!.Value.Min + 0x2; - private bool _SunsetBeginRaw_IsSet => _TNAMLocation.HasValue; - public Byte SunsetBeginRaw => _SunsetBeginRaw_IsSet ? _recordData.Span[_SunsetBeginRawLocation] : default; + #region SunsetBegin + private int _SunsetBeginLocation => _TNAMLocation!.Value.Min + 0x2; + public partial TimeOnly GetSunsetBeginCustom(); + public TimeOnly SunsetBegin => GetSunsetBeginCustom(); #endregion - #region SunsetEndRaw - private int _SunsetEndRawLocation => _TNAMLocation!.Value.Min + 0x3; - private bool _SunsetEndRaw_IsSet => _TNAMLocation.HasValue; - public Byte SunsetEndRaw => _SunsetEndRaw_IsSet ? _recordData.Span[_SunsetEndRawLocation] : default; + #region SunsetEnd + private int _SunsetEndLocation => _TNAMLocation!.Value.Min + 0x3; + public partial TimeOnly GetSunsetEndCustom(); + public TimeOnly SunsetEnd => GetSunsetEndCustom(); #endregion #region Volatility private int _VolatilityLocation => _TNAMLocation!.Value.Min + 0x4; From 49a6dd1fbefdf7da3dadb992f81ff1af91e323e3 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 30 Jul 2023 13:40:52 -0500 Subject: [PATCH 131/135] nuget bump --- Directory.Packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 4c86e30bf..35e8573df 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,10 +24,10 @@ - [2.59.0.1-dev] + [2.59.0.1-nightly-20230730-092521] - [2.59.0.1-dev] + [2.59.0.1-nightly-20230730-092521] From 9af601ad20d0a4bffc77ce3f847c8526a5c28fc6 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Wed, 2 Aug 2023 14:40:33 -0500 Subject: [PATCH 132/135] Some functions made public on GameLocator --- Mutagen.Bethesda.Core/Installs/DI/GameLocator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mutagen.Bethesda.Core/Installs/DI/GameLocator.cs b/Mutagen.Bethesda.Core/Installs/DI/GameLocator.cs index b51d0efb3..f1fe4c347 100644 --- a/Mutagen.Bethesda.Core/Installs/DI/GameLocator.cs +++ b/Mutagen.Bethesda.Core/Installs/DI/GameLocator.cs @@ -29,7 +29,7 @@ private IEnumerable GetAllGameDirectories(GameRelease release) } } - private bool TryGetGameDirectory(GameRelease release, [MaybeNullWhen(false)] out DirectoryPath path) + public bool TryGetGameDirectory(GameRelease release, [MaybeNullWhen(false)] out DirectoryPath path) { foreach (var source in GetAllGameDirectories(release)) { @@ -56,7 +56,7 @@ private bool TryGetGameDirectory(IGameSource gameSource, [MaybeNullWhen(false)] } } - private DirectoryPath GetGameDirectory(GameRelease release) + public DirectoryPath GetGameDirectory(GameRelease release) { if (TryGetGameDirectory(release, out var path)) { @@ -65,7 +65,7 @@ private DirectoryPath GetGameDirectory(GameRelease release) throw new DirectoryNotFoundException($"Game folder for {release} cannot be found automatically"); } - private bool TryGetDataDirectory(GameRelease release, [MaybeNullWhen(false)] out DirectoryPath path) + public bool TryGetDataDirectory(GameRelease release, [MaybeNullWhen(false)] out DirectoryPath path) { if (TryGetGameDirectory(release, out path)) { @@ -76,7 +76,7 @@ private bool TryGetDataDirectory(GameRelease release, [MaybeNullWhen(false)] out return false; } - private DirectoryPath GetDataDirectory(GameRelease release) + public DirectoryPath GetDataDirectory(GameRelease release) { if (TryGetDataDirectory(release, out var path)) { From 0b332ef6938f01db84b3555e2f669dc203edd840 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Wed, 2 Aug 2023 14:40:55 -0500 Subject: [PATCH 133/135] Testing Suite exposing CLI --- Directory.Packages.props | 1 + .../ViewModels/MainVM.cs | 3 +- .../CLI/RunConfigCommand.cs | 10 ++ .../CLI/RunSinglePassthrough.cs | 22 +++++ .../Mutagen.Bethesda.Tests.csproj | 33 +------ .../Fallout4PassthroughTest.cs | 4 +- .../OblivionPassthroughTest.cs | 4 +- .../Passthrough Tests/PassthroughTest.cs | 12 +-- .../SkyrimPassthroughTest.cs | 4 +- Mutagen.Bethesda.Tests/Program.cs | 98 +++++++++++++++++-- Mutagen.Bethesda.Tests/TestingSettings.cs | 47 ++++++++- 11 files changed, 179 insertions(+), 59 deletions(-) create mode 100644 Mutagen.Bethesda.Tests/CLI/RunConfigCommand.cs create mode 100644 Mutagen.Bethesda.Tests/CLI/RunSinglePassthrough.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index 35e8573df..930b1fe5a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,6 +8,7 @@ 4.5.0 + 2.4.0 diff --git a/Mutagen.Bethesda.Tests.GUI/ViewModels/MainVM.cs b/Mutagen.Bethesda.Tests.GUI/ViewModels/MainVM.cs index 7d6ef042d..ccec4c89d 100644 --- a/Mutagen.Bethesda.Tests.GUI/ViewModels/MainVM.cs +++ b/Mutagen.Bethesda.Tests.GUI/ViewModels/MainVM.cs @@ -295,7 +295,7 @@ public PassthroughSettings GetPassthroughSettings() return new PassthroughSettings() { DeleteCachesAfter = false, - ParallelProccessingSteps = false, + ParallelProcessingSteps = false, CacheReuse = new CacheReuse() { ReuseAlignment = CacheAlignment, @@ -306,7 +306,6 @@ public PassthroughSettings GetPassthroughSettings() }, TestBinaryOverlay = TestOverlay, TestCopyIn = TestCopyIn, - TestFolder = false, TestImport = TestImport, TestNormal = TestNormal, ParallelWriting = TestParallel, diff --git a/Mutagen.Bethesda.Tests/CLI/RunConfigCommand.cs b/Mutagen.Bethesda.Tests/CLI/RunConfigCommand.cs new file mode 100644 index 000000000..0907a58b1 --- /dev/null +++ b/Mutagen.Bethesda.Tests/CLI/RunConfigCommand.cs @@ -0,0 +1,10 @@ +using CommandLine; + +namespace Mutagen.Bethesda.Tests.CLI; + +[Verb("run-config")] +public class RunConfigCommand +{ + [Option('p', "Path")] + public string PathToConfig { get; set; } +} \ No newline at end of file diff --git a/Mutagen.Bethesda.Tests/CLI/RunSinglePassthrough.cs b/Mutagen.Bethesda.Tests/CLI/RunSinglePassthrough.cs new file mode 100644 index 000000000..cf6336df5 --- /dev/null +++ b/Mutagen.Bethesda.Tests/CLI/RunSinglePassthrough.cs @@ -0,0 +1,22 @@ +using CommandLine; + +namespace Mutagen.Bethesda.Tests.CLI; + +[Verb("run-passthrough")] +public class RunSinglePassthrough +{ + [Option('m', "ModPath")] + public string PathToMod { get; set; } + + [Option('r', "Release")] + public GameRelease Release { get; set; } + + [Option('c', "CacheReuse")] + public bool ReuseCaches { get; set; } + + [Option('n', "NicknameSuffix")] + public string NicknameSuffix { get; set; } + + [Option('d', "DataFolder")] + public string? DataFolder { get; set; } +} \ No newline at end of file diff --git a/Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj b/Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj index 3cc7dfd70..c89e3d342 100644 --- a/Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj +++ b/Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj @@ -3,7 +3,6 @@ Exe net6.0;net7.0 - False false @@ -21,6 +20,7 @@ + @@ -30,35 +30,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Mutagen.Bethesda.Tests/Passthrough Tests/Fallout4PassthroughTest.cs b/Mutagen.Bethesda.Tests/Passthrough Tests/Fallout4PassthroughTest.cs index d0d50533e..d5349d43b 100644 --- a/Mutagen.Bethesda.Tests/Passthrough Tests/Fallout4PassthroughTest.cs +++ b/Mutagen.Bethesda.Tests/Passthrough Tests/Fallout4PassthroughTest.cs @@ -462,7 +462,7 @@ protected override async Task ImportBinary(FilePath path) { return Fallout4Mod.CreateFromBinary( new ModPath(ModKey, path.Path), - parallel: Settings.ParallelProccessingSteps); + parallel: Settings.ParallelProcessingSteps); } protected override async Task ImportCopyIn(FilePath file) @@ -473,5 +473,5 @@ protected override async Task ImportCopyIn(FilePath file) return ret; } - protected override Processor ProcessorFactory() => new Fallout4Processor(Settings.ParallelProccessingSteps); + protected override Processor ProcessorFactory() => new Fallout4Processor(Settings.ParallelProcessingSteps); } \ No newline at end of file diff --git a/Mutagen.Bethesda.Tests/Passthrough Tests/OblivionPassthroughTest.cs b/Mutagen.Bethesda.Tests/Passthrough Tests/OblivionPassthroughTest.cs index c2320ed97..113e88ebd 100644 --- a/Mutagen.Bethesda.Tests/Passthrough Tests/OblivionPassthroughTest.cs +++ b/Mutagen.Bethesda.Tests/Passthrough Tests/OblivionPassthroughTest.cs @@ -11,7 +11,7 @@ public class OblivionPassthroughTest : PassthroughTest { public override GameRelease GameRelease => GameRelease.Oblivion; - protected override Processor ProcessorFactory() => new OblivionProcessor(Settings.ParallelProccessingSteps); + protected override Processor ProcessorFactory() => new OblivionProcessor(Settings.ParallelProcessingSteps); public OblivionPassthroughTest(PassthroughTestParams param) : base(param) @@ -27,7 +27,7 @@ protected override async Task ImportBinary(FilePath path) { return OblivionMod.CreateFromBinary( new ModPath(ModKey, path.Path), - parallel: Settings.ParallelProccessingSteps); + parallel: Settings.ParallelProcessingSteps); } protected override async Task ImportCopyIn(FilePath file) diff --git a/Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs b/Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs index 6ef32b37e..8d66a8307 100644 --- a/Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs +++ b/Mutagen.Bethesda.Tests/Passthrough Tests/PassthroughTest.cs @@ -65,7 +65,7 @@ public PassthroughTest(PassthroughTestParams param) var test = new Test( $"Setup Processed Files", - parallel: Settings.ParallelProccessingSteps, + parallel: Settings.ParallelProcessingSteps, toDo: async (o) => { o.OnNext(Nickname); @@ -242,7 +242,7 @@ public Test BinaryPassthroughTest() "Binary Normal Passthrough", GameRelease, Target, - parallel: Settings.ParallelProccessingSteps, + parallel: Settings.ParallelProcessingSteps, toDo: async (o) => { o.OnNext(FilePath.ToString()); @@ -275,7 +275,7 @@ public Test BinaryPassthroughTest() "Binary Normal Passthrough Parallel", GameRelease, Target, - parallel: Settings.ParallelProccessingSteps, + parallel: Settings.ParallelProcessingSteps, toDo: async (o) => { o.OnNext(FilePath.ToString()); @@ -333,7 +333,7 @@ public Test BinaryPassthroughTest() "Binary Overlay Passthrough", GameRelease, Target, - parallel: Settings.ParallelProccessingSteps, + parallel: Settings.ParallelProcessingSteps, toDo: async (o) => { o.OnNext(FilePath.ToString()); @@ -373,7 +373,7 @@ public Test BinaryPassthroughTest() "Copy In Passthrough", GameRelease, Target, - parallel: Settings.ParallelProccessingSteps, + parallel: Settings.ParallelProcessingSteps, toDo: async (o) => { o.OnNext(FilePath.ToString()); @@ -562,7 +562,7 @@ public IEnumerable AssertStringsEqual( new FileStream(sourcePath, FileMode.Open), pathToTest); }, - parallel: Settings.ParallelProccessingSteps); + parallel: Settings.ParallelProcessingSteps); } } diff --git a/Mutagen.Bethesda.Tests/Passthrough Tests/SkyrimPassthroughTest.cs b/Mutagen.Bethesda.Tests/Passthrough Tests/SkyrimPassthroughTest.cs index d61344468..404ac188c 100644 --- a/Mutagen.Bethesda.Tests/Passthrough Tests/SkyrimPassthroughTest.cs +++ b/Mutagen.Bethesda.Tests/Passthrough Tests/SkyrimPassthroughTest.cs @@ -228,7 +228,7 @@ protected override async Task ImportBinary(FilePath path) return SkyrimMod.CreateFromBinary( new ModPath(ModKey, path.Path), GameRelease.ToSkyrimRelease(), - parallel: Settings.ParallelProccessingSteps); + parallel: Settings.ParallelProcessingSteps); } protected override async Task ImportCopyIn(FilePath file) @@ -239,5 +239,5 @@ protected override async Task ImportCopyIn(FilePath file) return ret; } - protected override Processor ProcessorFactory() => new SkyrimProcessor(GameRelease, Settings.ParallelProccessingSteps); + protected override Processor ProcessorFactory() => new SkyrimProcessor(GameRelease, Settings.ParallelProcessingSteps); } \ No newline at end of file diff --git a/Mutagen.Bethesda.Tests/Program.cs b/Mutagen.Bethesda.Tests/Program.cs index 16a9bbb2b..cc326c714 100644 --- a/Mutagen.Bethesda.Tests/Program.cs +++ b/Mutagen.Bethesda.Tests/Program.cs @@ -1,24 +1,28 @@ using Newtonsoft.Json; using Noggog; using System.Diagnostics; +using CommandLine; +using Mutagen.Bethesda.Installs.DI; +using Mutagen.Bethesda.Tests.CLI; namespace Mutagen.Bethesda.Tests; class Program { static async Task Main(string[] args) + { + await Parser.Default.ParseArguments(args, typeof(RunConfigCommand), typeof(RunSinglePassthrough)) + .MapResult( + (RunConfigCommand runConfig) => RunConfig(runConfig), + (RunSinglePassthrough singlePassthrough) => RunSingle(singlePassthrough), + async _ => -1); + } + + private static async Task RunConfig(RunConfigCommand cmd) { try { - FilePath settingsFile; - if (args.Length == 1) - { - settingsFile = new FilePath(args[0]); - } - else - { - settingsFile = new FilePath("../../../TestingSettings.json"); - } + FilePath settingsFile = cmd.PathToConfig; if (!settingsFile.Exists) { throw new ArgumentException($"Could not find settings file at: {settingsFile}"); @@ -27,6 +31,79 @@ static async Task Main(string[] args) Console.WriteLine($"Using settings: {settingsFile.Path}"); var settings = JsonConvert.DeserializeObject(File.ReadAllText(settingsFile.Path)); + return await RunTests(settings); + } + catch (Exception ex) + { + Console.WriteLine("Exception occurred:"); + Console.WriteLine(ex); + return -1; + } + } + + private static async Task RunSingle(RunSinglePassthrough cmd) + { + try + { + var locator = new GameLocator(); + var dataDir = locator.GetDataDirectory(cmd.Release); + var settings = new TestingSettings() + { + PassthroughSettings = new PassthroughSettings() + { + CacheReuse = new CacheReuse(cmd.ReuseCaches), + TestNormal = true, + TestBinaryOverlay = true, + DeleteCachesAfter = false, + TestImport = false, + ParallelWriting = false, + TestCopyIn = false, + ParallelProcessingSteps = false, + Trimming = new TrimmingSettings() + { + Enabled = false + } + }, + TargetGroups = new List() + { + new TargetGroup() + { + GameRelease = cmd.Release, + NicknameSuffix = cmd.NicknameSuffix, + Do = true, + Targets = new List() + { + new Target() + { + Do = true, + Path = cmd.PathToMod + } + } + } + }, + TestFlattenedMod = false, + TestBenchmarks = false, + TestEquality = false, + TestPex = false, + TestGroupMasks = false, + TestRecordEnumerables = false, + DataFolderLocations = new DataFolderLocations(cmd.Release, dataDir) + }; + + return await RunTests(settings); + } + catch (Exception ex) + { + Console.WriteLine("Exception occurred:"); + Console.WriteLine(ex); + return -1; + } + } + + private static async Task RunTests(TestingSettings settings) + { + try + { Stopwatch sw = new Stopwatch(); sw.Start(); await TestBattery.RunTests(settings); @@ -36,7 +113,8 @@ static async Task Main(string[] args) { Console.WriteLine("Exception occurred:"); Console.WriteLine(ex); + return -1; } - Console.ReadLine(); + return 0; } } \ No newline at end of file diff --git a/Mutagen.Bethesda.Tests/TestingSettings.cs b/Mutagen.Bethesda.Tests/TestingSettings.cs index 87678cf7a..e831310bd 100644 --- a/Mutagen.Bethesda.Tests/TestingSettings.cs +++ b/Mutagen.Bethesda.Tests/TestingSettings.cs @@ -23,6 +23,15 @@ public record DataFolderLocations public string SkyrimVR { get; set; } = string.Empty; public string Fallout4 { get; set; } = string.Empty; + public DataFolderLocations() + { + } + + public DataFolderLocations(GameRelease release, string path) + { + Set(release, path); + } + public string Get(GameRelease mode) { switch (mode) @@ -39,6 +48,27 @@ public string Get(GameRelease mode) throw new NotImplementedException(); } } + + public void Set(GameRelease mode, string path) + { + switch (mode) + { + case GameRelease.Oblivion: + Oblivion = path; + break; + case GameRelease.SkyrimLE: + Skyrim = path; + break; + case GameRelease.SkyrimSE: + SkyrimSpecialEdition = path; + break; + case GameRelease.Fallout4: + Fallout4 = path; + break; + default: + throw new NotImplementedException(); + } + } } public record PassthroughSettings @@ -49,14 +79,12 @@ public record PassthroughSettings public bool TestNormal { get; set; } public bool TestBinaryOverlay { get; set; } public bool TestImport { get; set; } - public bool TestFolder { get; set; } public bool TestCopyIn { get; set; } public bool ParallelWriting { get; set; } - public bool ParallelProccessingSteps { get; set; } + public bool ParallelProcessingSteps { get; set; } public bool HasAnyToRun => TestNormal || TestBinaryOverlay - || TestFolder || TestCopyIn; } @@ -67,6 +95,19 @@ public record CacheReuse public bool ReuseAlignment { get; set; } public bool ReuseProcessing { get; set; } public bool ReuseTrimming { get; set; } + + public CacheReuse() + { + } + + public CacheReuse(bool on) + { + ReuseDecompression = on; + ReuseMerge = on; + ReuseAlignment = on; + ReuseProcessing = on; + ReuseTrimming = on; + } } public record TrimmingSettings From c1416244757bf7aeb059e2ced1dc2c977936b06a Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 11 Aug 2023 20:36:09 -0500 Subject: [PATCH 134/135] Nuget bump --- Directory.Packages.props | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 930b1fe5a..3e899c7e2 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -25,10 +25,10 @@ - [2.59.0.1-nightly-20230730-092521] + [2.60] - [2.59.0.1-nightly-20230730-092521] + [2.60] @@ -40,16 +40,16 @@ - [2.59.0.1-nightly-20230715-044535] + [2.60] - [2.59.0.1-nightly-20230715-044535] + [2.60] - [2.59.0.1-nightly-20230715-044535] + [2.60] - [2.59.0.1-nightly-20230715-044535] + [2.60] 0.9.5 From 4592d33d94bd12f44923dae183d1549fc6bad503 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 11 Aug 2023 20:38:40 -0500 Subject: [PATCH 135/135] CI updates --- .github/workflows/ci-publish.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-publish.yml b/.github/workflows/ci-publish.yml index 2c2e739be..b3e47ef18 100644 --- a/.github/workflows/ci-publish.yml +++ b/.github/workflows/ci-publish.yml @@ -25,11 +25,12 @@ jobs: - name: Get Activity Short Circuit id: check run: | + echo "Event name: ${{ github.event_name }}" git branch -a git fetch origin nightly:nightly head_sha=$(git rev-parse --verify HEAD) nightly_sha=$(git rev-parse --verify nightly) - if [[ "$head_sha" == "$nightly_sha" ]]; then + if [[ "$head_sha" == "$nightly_sha" && ${{ github.event_name }} != "release" ]]; then same_sha=true; else same_sha=false; @@ -90,11 +91,11 @@ jobs: - name: Build run: dotnet build Mutagen.Records.sln -c Release --no-restore /p:GeneratePackageOnBuild=false - name: Pack Preview - if: ${{ success() && (github.event.inputs.is_release_event != 'true' || github.ref != 'refs/heads/release') }} + if: ${{ success() && github.event.release.prerelease }} run: | dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out --version-suffix "nightly-${{ steps.current-time.outputs.formattedTime }}" - name: Pack Release - if: ${{ success() && github.event.inputs.is_release_event == 'true' && github.ref == 'refs/heads/release' }} + if: ${{ success() && !github.event.release.prerelease }} run: | dotnet pack Mutagen.Records.sln -c Release --no-build --no-restore -o out - name: Publish to Github