/// <summary> /// NOTE: overlapping definitions are not supported! /// If canvas and mergee have the same property set, the canvas property will be kept and the other ignored. /// Add support for resources with overlapping definitions if needed. /// </summary> /// <param name="otherDefinition"></param> public void Merge(ResourceDefinition otherDefinition) { // This is by convention - use meta from the layer, not from the canvas Meta = otherDefinition.Meta; foreach (var propInfo in DefinitionPropInfo) { var otherValue = propInfo.GetValue(otherDefinition, null); if (propInfo.Name == nameof(ObjectType)) { if (LayersType == null) { LayersType = new List <ObjectType>(); } LayersType.Add((ObjectType)otherValue); } if ((int)otherValue > 0 && (int)propInfo.GetValue(this, null) == 0) { propInfo.SetValue(this, otherValue, null); } } }
public AssemblerResource(ResourceDefinition definition, IImage <T> image, InstructionLayer instruction) { Definition = definition; Data = image; Instruction = instruction; }