| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 | using System;using System.Text.RegularExpressions;using System.Threading;using System.Threading.Tasks;using Aitex.Core.UI.Control;using MECF.Framework.Simulator.Core.Driver;using Aitex.Core.Util;using Venus_Core;namespace Venus_Simulator.Devices{    class TMSimulatorServer : SocketDeviceSimulator    {        private readonly Regex _check_load  = new Regex(@"CHECK LOAD\s+(\d+)\s+ARM\s+(A|B)\s*");        private readonly Regex _move_arm    = new Regex(@"(PLACE|PICK)\s+(\d+)\s+SLOT\s+(\d+)\s+ARM\s+(A|B)\s+(\w{4})\s*");        private readonly Regex _move_wafer = new Regex(@"(PLACE|PICK)\s+(\d+)\s+SLOT\s+(\d+)\s+ARM\s+(A|B)\s*");        private PeriodicJob _HwThread;        public TMSimulatorServer() : base(1102, -1, "\r\n", ' ')        {            _HwThread = new PeriodicJob(500, OnSendEvent, "EfemHardware", true);        }        private bool OnSendEvent()        {                return true;        }        protected override void ProcessUnsplitMessage(string str)        {            if(str.Contains("HOME") || str.Contains("GOTO") || str.Contains("XFER"))            {                Thread.Sleep(1500);                OnWriteMessage("_RDY");            }            if (str.Contains("RQ WAF_CEN DATA"))            {                string t = new Random().Next(0, 359).ToString().PadLeft(6, '0');                string r = new Random().Next(0, 50000).ToString().PadLeft(6, '0');                OnWriteMessage($"WAF_CEN RT 000000 000000 000000 000000 LFT 000000 000000 000000 000000 OFFSET {r} {t}");                OnWriteMessage("_RDY");            }            if (_check_load.IsMatch(str))            {                Match result = _check_load.Match(str);                string station = result.Groups[1].Value;                string arm = result.Groups[2].Value;                OnWriteMessage(string.Format($"LOAD {arm} OFF"));            }            else if(_move_arm.IsMatch(str))            {                // @"(PLACE|PICK)\s+(\d+)\s+SLOT\s+(\d+)\s+ARM\s+(A|B)\s+(\w{4})\s+"                Match result = _move_arm.Match(str);                string operation = result.Groups[1].Value;                string station = result.Groups[2].Value;                string slot = result.Groups[3].Value;                string arm = result.Groups[4].Value;                string dir = result.Groups[5].Value;                Thread.Sleep(5000);                OnWriteMessage("_RDY");            }            else if(_move_wafer.IsMatch(str))            {                // @"(PLACE|PICK)\s+(\d+)\s+SLOT\s+(\d+)\s+ARM\s+(A|B)\s+"                Match result = _move_wafer.Match(str);                string operation = result.Groups[1].Value;                string station = result.Groups[2].Value;                string slot = result.Groups[3].Value;                string arm = result.Groups[4].Value;                Thread.Sleep(5000);                OnWriteMessage("_RDY");            }        }    }}
 |