Upgrade Nuget
大石头 authored at 2024-09-27 23:48:45
477.00 B
SmartA4
namespace SmartA4;

/// <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");
}