S7Explorer/Models/S7Function.cs

49 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using DotNetSiemensPLCToolBoxLibrary.DataTypes.Blocks.Step7V5;
namespace S7Explorer.Models
{
public class S7Function
{
public S7Block Block { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public List<S7FunctionParameter> Parameters { get; set; } = new List<S7FunctionParameter>();
public string Code { get; set; }
public S7Function()
{
}
public S7Function(S7Block block)
{
Block = block;
Name = block?.Name ?? string.Empty;
Description = block?.Title ?? string.Empty;
// Code would need to be extracted from the block
// This is just a placeholder
Code = "// Function code would be extracted here";
}
public override string ToString()
{
return Name;
}
}
public class S7FunctionParameter
{
public string Name { get; set; }
public string DataType { get; set; }
public string Comment { get; set; }
public string Direction { get; set; } // IN, OUT, IN_OUT
public override string ToString()
{
return $"{Direction} {Name} : {DataType}";
}
}
}