示例#1
0
        public static string ToSml(this SecsMessage msg)
        {
            if (msg is null)
            {
                return(null);
            }

            using (var sw = new StringWriter())
            {
                msg.WriteTo(sw);
                return(sw.ToString());
            }
        }
示例#2
0
        public static void WriteTo(this SecsMessage msg, TextWriter writer, int indent = 4)
        {
            if (msg is null)
            {
                return;
            }

            writer.WriteLine(msg.ToString());
            if (msg.SecsItem != null)
            {
                msg.SecsItem.Write(writer, indent);
            }
            writer.Write('.');
        }
示例#3
0
        public static async Task WriteToAsync(this SecsMessage msg, TextWriter writer, int indent = 4)
        {
            if (msg is null)
            {
                return;
            }

            await writer.WriteLineAsync(msg.ToString());

            if (msg.SecsItem != null)
            {
                await WriteAsync(writer, msg.SecsItem, indent);
            }
            await writer.WriteAsync('.');
        }
示例#4
0
 public SecsException(SecsMessage msg, string description)
     : base(description)
 {
     SecsMsg = msg;
 }
示例#5
0
 public void MessageOut(SecsMessage msg, int systembyte) => WriteLine($"--> [0x{systembyte:X8}] {msg}");
示例#6
0
 public void MessageIn(SecsMessage msg, int systembyte) => WriteLine($"<-- [0x{systembyte:X8}] {msg}");
示例#7
0
 public static bool IsMatch(this SecsMessage src, in SecsMessage target)