Skip to content

Commit

Permalink
IsLegacyLayout property cached
Browse files Browse the repository at this point in the history
  • Loading branch information
searica committed Nov 23, 2024
1 parent bd9a0d6 commit 23f96f7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion JotunnLib/Utils/ModCompatibility/ModuleVersionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,22 @@ internal class ModuleVersionData

public uint NetworkVersion { get; internal set; }

private bool? isLegacyDataLayout;

/// <summary>
/// Whether any of the ModModule instances in Modules use the legacy data layout.
/// </summary>
public bool IsLegacyDataLayout
{
get
{
isLegacyDataLayout ??= Modules.Where(x => x.IsLegacyDataLayout).Any();
return isLegacyDataLayout.Value;
}
}

/// <summary>
/// Flag indicating if the ModModule was in a layout that can be deserialized.
/// Whether all the ModModule instances were in a layout that can be deserialized.
/// </summary>
public bool IsSupportedDataLayout { get; private set; } = true;

Expand Down

0 comments on commit 23f96f7

Please sign in to comment.