Files
2025-07-14 12:03:59 +02:00

58 lines
1.9 KiB
C#

using System.Reflection.Metadata.Ecma335;
using System.Security.AccessControl;
using Hawkeye.VisionBuilder.Workflow.Operations;
namespace Hawkeye.VisionBuilder.Workflow.Configuration;
public class WorkflowConfiguration
{
public WorkflowConfiguration()
{
var userFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
PythonPath = Path.Combine(userFolder, @"miniconda3\envs\ai3_cpu\python.exe");
}
public ECameraType RuntimeCameraType { get; set; } = ECameraType.Emulation;
public ECameraType DevelopmentCameraType { get; set; } = ECameraType.Emulation;
public string EmulationPath { get; set; } = "..\\Data\\Emulation";
public string PythonPath { get; set; }
public EOutputs Outputs { get; set; }
public int ResultPin { get; set; }
public string SerialPort { get; set; } = "";
public int Delay { get; set; } = 0;
public BadTweakLearning BadTweakLearning { get; set; } = new BadTweakLearning();
public RecipeSelectionConfig RecipeSelectionConfig { get; set; }=new RecipeSelectionConfig();
public void Save(BinaryWriter bw)
{
bw.Write((int)RuntimeCameraType);
bw.Write((int)DevelopmentCameraType);
bw.Write((int)Outputs);
bw.Write(EmulationPath);
bw.Write(PythonPath);
bw.Write(ResultPin);
bw.Write(SerialPort);
bw.Write(Delay);
BadTweakLearning.Save(bw);
RecipeSelectionConfig.Save(bw);
}
public void Load(BinaryReader br)
{
RuntimeCameraType = (ECameraType) br.ReadInt32();
DevelopmentCameraType = (ECameraType) br.ReadInt32();
Outputs = (EOutputs) br.ReadInt32();
EmulationPath = br.ReadString();
PythonPath = br.ReadString();
ResultPin = br.ReadInt32();
SerialPort = br.ReadString();
Delay = br.ReadInt32();
BadTweakLearning.Load(br);
RecipeSelectionConfig.Load(br);
}
}