| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 | using System;using System.Collections.Generic;using System.Linq;using System.Reflection;using System.Xml.Serialization;namespace Aitex.Core.RT.SCCore{    public class SCValue    {        public SystemConfigValue System { get; set; }         private Dictionary<string, Tuple<object, PropertyInfo>> _fieldMap =            new Dictionary<string, Tuple<object, PropertyInfo>>();        public SCValue()        {             System = new SystemConfigValue();        }        public List<string> GetKeys()        {            return _fieldMap.Keys.ToList();        }        public void SetKeys(List<string> keys)        {            _fieldMap.Clear();            Dictionary<string, object> items = new Dictionary<string, object>();            PropertyInfo[] property = typeof(SCValue).GetProperties();            foreach (PropertyInfo fiGroup in property)            {                object objGroup = fiGroup.GetValue(this, null);                foreach (PropertyInfo fiItem in objGroup.GetType().GetProperties())                {                    string name = String.Format("{0}_{1}", fiGroup.Name, fiItem.Name);                    if (keys.Contains(name))                    {                        _fieldMap[name] = Tuple.Create(objGroup, fiItem);                    }                }            }        }        public void Update(Dictionary<string, object> result)        {            if (result == null)                return;            foreach (KeyValuePair<string, object> item in result)            {                if (_fieldMap.ContainsKey(item.Key))                {                    _fieldMap[item.Key].Item2.SetValue(_fieldMap[item.Key].Item1, item.Value, null);                }            }        }        public void Update(string key, string value)        {            if (!_fieldMap.ContainsKey(key))                return;            if (_fieldMap[key].Item2.PropertyType == typeof(double))            {                _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToDouble(value), null);            }else if (_fieldMap[key].Item2.PropertyType == typeof(int))            {                _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToInt32(value), null);            }else if (_fieldMap[key].Item2.PropertyType == typeof(string))            {                _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, value, null);                        }else if (_fieldMap[key].Item2.PropertyType == typeof(bool))            {                _fieldMap[key].Item2.SetValue(_fieldMap[key].Item1, Convert.ToBoolean(value), null);            }          }        public Dictionary<string, object> GetValue()        {            Dictionary<string, object> result = new Dictionary<string, object>();            foreach (var item in _fieldMap)            {                result[item.Key] = item.Value.Item2.GetValue(item.Value.Item1, null);             }            return result;        }        public class SystemConfigValue        {            public int  Language { get; set; }            public bool IsSimulatorMode { get; set; }            public int TotalWaferCount { get; set; }            public bool Blade1Enable { get; set; }            public bool Blade2Enable { get; set; }            public int  RobotSpeed { get; set; }            public int  TimeLimitRobotCommand { get; set; }            public int  TimeLimitForPickWafer { get; set; }            public int  TimeLimitForPlaceWafer { get; set; }            public int  TimeLimitForExchangeWafer { get; set; }            public int  TimeLimitForAlignWafer { get; set; }              public int  TimeLimitForWID { get; set; }            public int TimeLimitRobotHome { get; set; }            public int TimeLimitAlignerHome { get; set; }            public int TimeLimitLoadportHome { get; set; }             public int  TimeLimitLoadportLoad { get; set; }            public int  TimeLimitLoadportUnload { get; set; }            public int  TimeLimitLoadportClamp { get; set; }            public int TimeLimitReadRFID { get; set; }            public int TimeLimitWriteRFID { get; set; }            public int RobotCommunicationToken { get; set; }            public bool DualBlade1TransferEnable { get; set; }            public int AlignerCommunicationToken { get; set; }            public bool EnableReadLaserMarker1 { get; set; }            public bool EnableReadLaserMarker2 { get; set; }            public double AlignerReadAngle { get; set; }            public double AlignerDefaultAngle { get; set; }             public string ReaderJob1Main { get; set; }            public string ReaderJob1Slave { get; set; }            public string ReaderJob2Main { get; set; }            public string ReaderJob2Slave { get; set; }            public bool EnableAutoLockWhenCassetteArrived { get; set; }            public bool EnableAutoCarrierIdReadAfterLatch { get; set; }            public bool EnableAutoDockAfterIdRead { get; set; }            public bool EnableAutoMappingAfterDock { get; set; }            public bool EnableAutoUndockAfterProcessComplete { get; set; }            public bool EnableAutoUndockAfterUndocking { get; set; }            public bool EnablePauseWhenVerifyIDFailed { get; set; }                       public bool ConfigDO32AsBuzzer { get; set; }			public bool ShowWaferID { get; set; }            public bool CycleEnable { get; set; }            public int CycleCount { get; set; }            public bool CycleEnableAutoUnload { get; set; }            public bool CycleEnableAlign { get; set; }            public bool CycleEnableLaserMarker1 { get; set; }            public bool CycleEnableLaserMarker2 { get; set; }            public bool TransferStopImmediately { get; set; }            public bool OptionLoadportMonitor { get; set; }            public bool OptionMainternaceMonitor { get; set; }            public bool OptionSignalTowerMonitor { get; set; }            public bool FaEnableSpooling { get; set; }            public string FaConnectionMode { get; set; }            public string FaLocalIpAddress { get; set; }            public int FaLocalPortNumber { get; set; }            public string FaRemoteIpAddress { get; set; }            public int FaRemotePortNumber { get; set; }            public double FaT3Timeout { get; set; }            public double FaT5Timeout { get; set; }            public double FaT6Timeout { get; set; }            public double FaT7Timeout { get; set; }            public double FaT8Timeout { get; set; }            public double FaLinkTestInterval { get; set; }            public string FaDefaultCommunicationState { get; set; }            public string FaDefaultControlState { get; set; }            public string FaDefaultControlSubState { get; set; }            public int FaDeviceId { get; set; }            public string WaferDisplayMode { get; set; }            public bool EnableAligner { get; set; }            public bool EnableOcrReader { get; set; }        }    }}
 |