diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenu.xml b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenu.xml index 8d8c4e14ae..473c34a715 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenu.xml +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenu.xml @@ -45,17 +45,17 @@ - + - + - + diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItem.cs b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItem.cs index c79b73ea68..1912ff9aad 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItem.cs +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItem.cs @@ -130,12 +130,13 @@ public partial ParseResult TargetParseCustomParse( private IATerminalMenuItemTargetGetter GetTarget() { + var data = _targetLocation.HasValue ? _recordData.Slice(_targetLocation.Value) : Array.Empty(); switch (Type) { case TerminalMenuItemBinaryCreateTranslation.TypeOption.DisplayText: - return TerminalMenuItemDisplayTextBinaryOverlay.TerminalMenuItemDisplayTextFactory(_recordData.Slice(_targetLocation!.Value), _package); + return TerminalMenuItemDisplayTextBinaryOverlay.TerminalMenuItemDisplayTextFactory(data, _package); case TerminalMenuItemBinaryCreateTranslation.TypeOption.SubmenuTerminalMenu: - return TerminalMenuItemSubmenuBinaryOverlay.TerminalMenuItemSubmenuFactory(_recordData.Slice(_targetLocation!.Value), _package); + return TerminalMenuItemSubmenuBinaryOverlay.TerminalMenuItemSubmenuFactory(data, _package); case TerminalMenuItemBinaryCreateTranslation.TypeOption.ActionReturnToDesktop: return new TerminalMenuItemReturnToDesktop(); case TerminalMenuItemBinaryCreateTranslation.TypeOption.ActionReturnToPrevious: @@ -143,7 +144,7 @@ private IATerminalMenuItemTargetGetter GetTarget() case TerminalMenuItemBinaryCreateTranslation.TypeOption.ActionForceRedraw: return new TerminalMenuItemForceRedraw(); case TerminalMenuItemBinaryCreateTranslation.TypeOption.DataSlateBOOK: - return TerminalMenuItemDataslateBinaryOverlay.TerminalMenuItemDataslateFactory(_recordData.Slice(_targetLocation!.Value), _package); + return TerminalMenuItemDataslateBinaryOverlay.TerminalMenuItemDataslateFactory(data, _package); default: throw new ArgumentOutOfRangeException(); } diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemDataslate_Generated.cs b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemDataslate_Generated.cs index 4d25a7227e..1777aa0816 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemDataslate_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemDataslate_Generated.cs @@ -54,14 +54,14 @@ public TerminalMenuItemDataslate() #endregion #region Dataslate - private readonly IFormLink _Dataslate = new FormLink(); - public IFormLink Dataslate + private readonly IFormLinkNullable _Dataslate = new FormLinkNullable(); + public IFormLinkNullable Dataslate { get => _Dataslate; set => _Dataslate.SetTo(value); } [DebuggerBrowsable(DebuggerBrowsableState.Never)] - IFormLinkGetter ITerminalMenuItemDataslateGetter.Dataslate => this.Dataslate; + IFormLinkNullableGetter ITerminalMenuItemDataslateGetter.Dataslate => this.Dataslate; #endregion #region To String @@ -409,7 +409,7 @@ public partial interface ITerminalMenuItemDataslate : ILoquiObjectSetter, ITerminalMenuItemDataslateGetter { - new IFormLink Dataslate { get; set; } + new IFormLinkNullable Dataslate { get; set; } } public partial interface ITerminalMenuItemDataslateGetter : @@ -419,7 +419,7 @@ public partial interface ITerminalMenuItemDataslateGetter : ILoquiObject { static new ILoquiRegistration StaticRegistration => TerminalMenuItemDataslate_Registration.Instance; - IFormLinkGetter Dataslate { get; } + IFormLinkNullableGetter Dataslate { get; } } @@ -771,7 +771,7 @@ protected static void ToStringFields( printMask: printMask); if (printMask?.Dataslate ?? true) { - sb.AppendItem(item.Dataslate.FormKey, "Dataslate"); + sb.AppendItem(item.Dataslate.FormKeyNullable, "Dataslate"); } } @@ -838,7 +838,10 @@ public IEnumerable EnumerateFormLinks(ITerminalMenuItemDataslat { yield return item; } - yield return FormLinkInformation.Factory(obj.Dataslate); + if (FormLinkInformation.TryFactory(obj.Dataslate, out var DataslateInfo)) + { + yield return DataslateInfo; + } yield break; } @@ -865,7 +868,7 @@ public void DeepCopyIn( deepCopy: deepCopy); if ((copyMask?.GetShouldTranslate((int)TerminalMenuItemDataslate_FieldIndex.Dataslate) ?? true)) { - item.Dataslate.SetTo(rhs.Dataslate.FormKey); + item.Dataslate.SetTo(rhs.Dataslate.FormKeyNullable); } } @@ -976,7 +979,7 @@ public static void WriteRecordTypes( MutagenWriter writer, TypedWriteParams translationParams) { - FormLinkBinaryTranslation.Instance.Write( + FormLinkBinaryTranslation.Instance.WriteNullable( writer: writer, item: item.Dataslate, header: translationParams.ConvertToCustom(RecordTypes.BNAM)); @@ -1092,7 +1095,7 @@ void IBinaryItem.WriteToBinary( #region Dataslate private int? _DataslateLocation; - public IFormLinkGetter Dataslate => FormLinkBinaryTranslation.Instance.NullableRecordOverlayFactory(_package, _recordData, _DataslateLocation); + public IFormLinkNullableGetter Dataslate => FormLinkBinaryTranslation.Instance.NullableRecordOverlayFactory(_package, _recordData, _DataslateLocation); #endregion partial void CustomFactoryEnd( OverlayStream stream, diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemDisplayText_Generated.cs b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemDisplayText_Generated.cs index 9f767a1959..89b79785e6 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemDisplayText_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemDisplayText_Generated.cs @@ -54,8 +54,9 @@ public TerminalMenuItemDisplayText() #endregion #region DisplayText - public TranslatedString DisplayText { get; set; } = string.Empty; - ITranslatedStringGetter ITerminalMenuItemDisplayTextGetter.DisplayText => this.DisplayText; + public TranslatedString? DisplayText { get; set; } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ITranslatedStringGetter? ITerminalMenuItemDisplayTextGetter.DisplayText => this.DisplayText; #endregion #region To String @@ -397,7 +398,7 @@ public partial interface ITerminalMenuItemDisplayText : ILoquiObjectSetter, ITerminalMenuItemDisplayTextGetter { - new TranslatedString DisplayText { get; set; } + new TranslatedString? DisplayText { get; set; } } public partial interface ITerminalMenuItemDisplayTextGetter : @@ -406,7 +407,7 @@ public partial interface ITerminalMenuItemDisplayTextGetter : ILoquiObject { static new ILoquiRegistration StaticRegistration => TerminalMenuItemDisplayText_Registration.Instance; - ITranslatedStringGetter DisplayText { get; } + ITranslatedStringGetter? DisplayText { get; } } @@ -637,7 +638,7 @@ internal partial class TerminalMenuItemDisplayTextSetterCommon : ATerminalMenuIt public void Clear(ITerminalMenuItemDisplayText item) { ClearPartial(); - item.DisplayText.Clear(); + item.DisplayText = default; base.Clear(item); } @@ -755,9 +756,10 @@ protected static void ToStringFields( item: item, sb: sb, printMask: printMask); - if (printMask?.DisplayText ?? true) + if ((printMask?.DisplayText ?? true) + && item.DisplayText is {} DisplayTextItem) { - sb.AppendItem(item.DisplayText, "DisplayText"); + sb.AppendItem(DisplayTextItem, "DisplayText"); } } @@ -799,7 +801,10 @@ public override bool Equals( public virtual int GetHashCode(ITerminalMenuItemDisplayTextGetter item) { var hash = new HashCode(); - hash.Add(item.DisplayText); + if (item.DisplayText is {} DisplayTextitem) + { + hash.Add(DisplayTextitem); + } hash.Add(base.GetHashCode()); return hash.ToHashCode(); } @@ -850,7 +855,7 @@ public void DeepCopyIn( deepCopy: deepCopy); if ((copyMask?.GetShouldTranslate((int)TerminalMenuItemDisplayText_FieldIndex.DisplayText) ?? true)) { - item.DisplayText = rhs.DisplayText.DeepCopy(); + item.DisplayText = rhs.DisplayText?.DeepCopy(); } } @@ -961,7 +966,7 @@ public static void WriteRecordTypes( MutagenWriter writer, TypedWriteParams translationParams) { - StringBinaryTranslation.Instance.Write( + StringBinaryTranslation.Instance.WriteNullable( writer: writer, item: item.DisplayText, header: translationParams.ConvertToCustom(RecordTypes.UNAM), @@ -1081,7 +1086,7 @@ void IBinaryItem.WriteToBinary( #region DisplayText private int? _DisplayTextLocation; - public ITranslatedStringGetter DisplayText => _DisplayTextLocation.HasValue ? StringBinaryTranslation.Instance.Parse(HeaderTranslation.ExtractSubrecordMemory(_recordData, _DisplayTextLocation.Value, _package.MetaData.Constants), StringsSource.Normal, parsingBundle: _package.MetaData) : TranslatedString.Empty; + public ITranslatedStringGetter? DisplayText => _DisplayTextLocation.HasValue ? StringBinaryTranslation.Instance.Parse(HeaderTranslation.ExtractSubrecordMemory(_recordData, _DisplayTextLocation.Value, _package.MetaData.Constants), StringsSource.Normal, parsingBundle: _package.MetaData) : default(TranslatedString?); #endregion partial void CustomFactoryEnd( OverlayStream stream, diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemSubmenu_Generated.cs b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemSubmenu_Generated.cs index d7d71e9f56..a97f1896f0 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemSubmenu_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/TerminalMenuItemSubmenu_Generated.cs @@ -54,14 +54,14 @@ public TerminalMenuItemSubmenu() #endregion #region Submenu - private readonly IFormLink _Submenu = new FormLink(); - public IFormLink Submenu + private readonly IFormLinkNullable _Submenu = new FormLinkNullable(); + public IFormLinkNullable Submenu { get => _Submenu; set => _Submenu.SetTo(value); } [DebuggerBrowsable(DebuggerBrowsableState.Never)] - IFormLinkGetter ITerminalMenuItemSubmenuGetter.Submenu => this.Submenu; + IFormLinkNullableGetter ITerminalMenuItemSubmenuGetter.Submenu => this.Submenu; #endregion #region To String @@ -409,7 +409,7 @@ public partial interface ITerminalMenuItemSubmenu : ILoquiObjectSetter, ITerminalMenuItemSubmenuGetter { - new IFormLink Submenu { get; set; } + new IFormLinkNullable Submenu { get; set; } } public partial interface ITerminalMenuItemSubmenuGetter : @@ -419,7 +419,7 @@ public partial interface ITerminalMenuItemSubmenuGetter : ILoquiObject { static new ILoquiRegistration StaticRegistration => TerminalMenuItemSubmenu_Registration.Instance; - IFormLinkGetter Submenu { get; } + IFormLinkNullableGetter Submenu { get; } } @@ -771,7 +771,7 @@ protected static void ToStringFields( printMask: printMask); if (printMask?.Submenu ?? true) { - sb.AppendItem(item.Submenu.FormKey, "Submenu"); + sb.AppendItem(item.Submenu.FormKeyNullable, "Submenu"); } } @@ -838,7 +838,10 @@ public IEnumerable EnumerateFormLinks(ITerminalMenuItemSubmenuG { yield return item; } - yield return FormLinkInformation.Factory(obj.Submenu); + if (FormLinkInformation.TryFactory(obj.Submenu, out var SubmenuInfo)) + { + yield return SubmenuInfo; + } yield break; } @@ -865,7 +868,7 @@ public void DeepCopyIn( deepCopy: deepCopy); if ((copyMask?.GetShouldTranslate((int)TerminalMenuItemSubmenu_FieldIndex.Submenu) ?? true)) { - item.Submenu.SetTo(rhs.Submenu.FormKey); + item.Submenu.SetTo(rhs.Submenu.FormKeyNullable); } } @@ -976,7 +979,7 @@ public static void WriteRecordTypes( MutagenWriter writer, TypedWriteParams translationParams) { - FormLinkBinaryTranslation.Instance.Write( + FormLinkBinaryTranslation.Instance.WriteNullable( writer: writer, item: item.Submenu, header: translationParams.ConvertToCustom(RecordTypes.TNAM)); @@ -1092,7 +1095,7 @@ void IBinaryItem.WriteToBinary( #region Submenu private int? _SubmenuLocation; - public IFormLinkGetter Submenu => FormLinkBinaryTranslation.Instance.NullableRecordOverlayFactory(_package, _recordData, _SubmenuLocation); + public IFormLinkNullableGetter Submenu => FormLinkBinaryTranslation.Instance.NullableRecordOverlayFactory(_package, _recordData, _SubmenuLocation); #endregion partial void CustomFactoryEnd( OverlayStream stream,