mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
ZoneCodeGenerator: Add Computations class for StructureInformation including IsUsed to check whether a structure has at least 1 usage
This commit is contained in:
parent
b79f237014
commit
27f92e6c33
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ZoneCodeGenerator.Domain.FastFileStructure;
|
using ZoneCodeGenerator.Domain.FastFileStructure;
|
||||||
|
using ZoneCodeGenerator.Generating.Computations;
|
||||||
using ZoneCodeGenerator.Persistence;
|
using ZoneCodeGenerator.Persistence;
|
||||||
|
|
||||||
namespace ZoneCodeGenerator.Domain.Information
|
namespace ZoneCodeGenerator.Domain.Information
|
||||||
@ -33,6 +34,7 @@ namespace ZoneCodeGenerator.Domain.Information
|
|||||||
public bool IsLeaf { get; set; }
|
public bool IsLeaf { get; set; }
|
||||||
|
|
||||||
public List<MemberInformation> NameChain { get; set; }
|
public List<MemberInformation> NameChain { get; set; }
|
||||||
|
public StructureComputations Computations => new StructureComputations(this);
|
||||||
|
|
||||||
public StructureInformation(DataTypeWithMembers type)
|
public StructureInformation(DataTypeWithMembers type)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using ZoneCodeGenerator.Domain;
|
||||||
|
using ZoneCodeGenerator.Domain.Evaluation;
|
||||||
|
using ZoneCodeGenerator.Domain.Information;
|
||||||
|
|
||||||
|
namespace ZoneCodeGenerator.Generating.Computations
|
||||||
|
{
|
||||||
|
class StructureComputations
|
||||||
|
{
|
||||||
|
private readonly StructureInformation information;
|
||||||
|
|
||||||
|
public bool IsUsed => information.Usages.Any();
|
||||||
|
|
||||||
|
public StructureComputations(StructureInformation information)
|
||||||
|
{
|
||||||
|
this.information = information;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user