42 lines
958 B
C#
42 lines
958 B
C#
using Hawkeye.VisionBuilder.Workflow.Operations.Attributes;
|
|
|
|
namespace Hawkeye.VisionBuilder.Workflow.Operations.Memory;
|
|
|
|
[Category("Memory")]
|
|
public class ImageFromMemoryOperation:BaseOperation
|
|
{
|
|
public ImageFromMemoryOperation()
|
|
{
|
|
CanHaveProcessingError = false;
|
|
}
|
|
|
|
public string SlotName { get; set; } = "Image";
|
|
|
|
|
|
protected override void InterpretInternal(Context context)
|
|
{
|
|
if (context.Memory.ContainsKey(SlotName))
|
|
{
|
|
context.ActiveImage = context.Memory[SlotName];
|
|
Status = "Image from slot "+SlotName;
|
|
Result = true;
|
|
}
|
|
else
|
|
{
|
|
Status = "Slot not found";
|
|
Result = false;
|
|
}
|
|
}
|
|
|
|
public override void Save(BinaryWriter bw)
|
|
{
|
|
base.Save(bw);
|
|
bw.Write(SlotName);
|
|
}
|
|
|
|
public override void Load(BinaryReader br)
|
|
{
|
|
base.Load(br);
|
|
SlotName = br.ReadString();
|
|
}
|
|
} |