using Aitex.Core.RT.Device; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace athosRT.Devices.EFEM { public class EntityFactory { private SystemServerModule _system = (SystemServerModule)null; private AlignerServerModule _aligner = (AlignerServerModule)null; private RobotServerModule _robot = (RobotServerModule)null; private LoadPortServerModule _loadportA = (LoadPortServerModule)null; private LoadPortServerModule _loadportB = (LoadPortServerModule)null; private LoadPortServerModule _loadportC = (LoadPortServerModule)null; private LoadPortServerModule _loadportD = (LoadPortServerModule)null; private LoadPortServerModule _loadportE = (LoadPortServerModule)null; private LoadPortServerModule _loadportF = (LoadPortServerModule)null; private LoadPortServerModule _loadportG = (LoadPortServerModule)null; private LoadPortServerModule _loadportH = (LoadPortServerModule)null; private LoadPortServerModule _loadportI = (LoadPortServerModule)null; private LoadPortServerModule _loadportJ = (LoadPortServerModule)null; private BufferServerModule _buffer1 = (BufferServerModule)null; private BufferServerModule _buffer2 = (BufferServerModule)null; private BufferServerModule _aligner1 = (BufferServerModule)null; private BufferServerModule _aligner2 = (BufferServerModule)null; public EntityFactory() { this._system = new SystemServerModule("System"); this._aligner = new AlignerServerModule("Aligner"); this._robot = new RobotServerModule("Robot"); this._loadportA = new LoadPortServerModule("LP1"); this._loadportB = new LoadPortServerModule("LP2"); this._loadportC = new LoadPortServerModule("LP3"); this._loadportD = new LoadPortServerModule("LP4"); this._loadportE = new LoadPortServerModule("LP5"); this._loadportF = new LoadPortServerModule("LP6"); this._loadportG = new LoadPortServerModule("LP7"); this._loadportH = new LoadPortServerModule("LP8"); this._loadportI = new LoadPortServerModule("LP9"); this._loadportJ = new LoadPortServerModule("LP10"); this._aligner1 = new BufferServerModule("Aligner1"); this._aligner2 = new BufferServerModule("Aligner2"); this._buffer1 = new BufferServerModule("CoolingBuffer1"); this._buffer2 = new BufferServerModule("CoolingBuffer2"); } public IServerModule GetEntity(string name) { if (string.IsNullOrEmpty(name)) return (IServerModule)null; if (ModuleHelper.IsLoadPort((ModuleName)Enum.Parse(typeof(ModuleName), name))) { int num = int.Parse(new Regex("[1-9]\\d*").Match(name).ToString()); int? nullable = Singleton.Instance.GetValue("LoadPortQuantity"); int valueOrDefault = nullable.GetValueOrDefault(); if (num > valueOrDefault & nullable.HasValue) return (IServerModule)null; } switch (name) { case "Aligner": return _aligner; case "Aligner1": return _aligner1; case "Aligner2": return _aligner2; case "Aligner3": return _aligner1; case "Aligner4": return _aligner2; case "CoolingBuffer1": return _buffer1; case "CoolingBuffer2": return _buffer2; case "LP1": return _loadportA; case "LP10": return _loadportJ; case "LP2": return _loadportB; case "LP3": return _loadportC; case "LP4": return _loadportD; case "LP5": return _loadportE; case "LP6": return _loadportF; case "LP7": return _loadportG; case "LP8": return _loadportH; case "LP9": return _loadportI; case "Robot": return _robot; case "System": return _system; default: return (IServerModule)null; } } } }