Upgrade Nuget
大石头 authored at 2024-11-20 14:35:47
477.00 B
SmartA2
namespace SmartA2;

/// <summary>输出口</summary>
public class OutputPort
{
    /// <summary>文件路径</summary>
    public String FileName { get; set; }

    /// <summary>读取开关值</summary>
    /// <returns></returns>
    public Boolean Read() => File.ReadAllText(FileName)?.Trim() == "1";

    /// <summary>写入开关值</summary>
    /// <param name="value"></param>
    public void Write(Boolean value) => File.WriteAllText(FileName, value ? "1" : "0");
}