/// <summary> /// 从配置文件读取保存在本地的CIM连接配置 /// </summary> public void InitParams() { try { #region params ETypeMode = (TypeMode)Enum.Parse(typeof(TypeMode), GetCimConfig(CIM_PARAMS.ModeType.ToString())); StrSendQueue = GetCimConfig(CIM_PARAMS.SendQueue.ToString(), ETypeMode.ToString()); StrReadQueue = GetCimConfig(CIM_PARAMS.ReadQueue.ToString(), ETypeMode.ToString()); StrIP = GetCimConfig(CIM_PARAMS.IP.ToString(), ETypeMode.ToString()); StrPort = GetCimConfig(CIM_PARAMS.Port.ToString(), ETypeMode.ToString()); iCycTimes = short.Parse(GetCimConfig(CIM_PARAMS.CycTimes.ToString())); StrUserID = GetCimConfig(CIM_PARAMS.UserID.ToString()); StrFab = GetCimConfig(CIM_PARAMS.Fab.ToString()); StrArea = GetCimConfig(CIM_PARAMS.Area.ToString()); StrLine = GetCimConfig(CIM_PARAMS.Line.ToString()); StrOperation = GetCimConfig(CIM_PARAMS.Operation.ToString()); EqpId = GetCimConfig(CIM_PARAMS.EqpId.ToString()); Wo_id = GetCimConfig(CIM_PARAMS.Wo_id.ToString()); StrLot = GetCimConfig(CIM_PARAMS.RunCard.ToString()); StrModelNo = GetCimConfig(CIM_PARAMS.ModelNo.ToString()); StrCom = GetCimConfig(CIM_PARAMS.COM.ToString()); iBaudrate = short.Parse(GetCimConfig(CIM_PARAMS.Baudrate.ToString())); iCodeDelay = short.Parse(GetCimConfig(CIM_PARAMS.CodeDelay.ToString())); ETypeCode = (TypeCode_enum)Enum.Parse(typeof(TypeCode_enum), GetCimConfig(CIM_PARAMS.CodeType.ToString())); BlLog = bool.Parse(GetCimConfig(CIM_PARAMS.BlLog.ToString())); #endregion } catch (Exception ex) { Log.L_I.WriteError(ClassName, ex); } InitCimMode(); }
/// <summary> /// 将所有CIM参数写入到ini,部分以mode为section保存,其余是公共参数 /// </summary> public void WriteCimConfig() { #region params WriteCimConfig(CIM_PARAMS.SendQueue.ToString(), StrSendQueue, ETypeMode.ToString()); WriteCimConfig(CIM_PARAMS.ReadQueue.ToString(), StrReadQueue, ETypeMode.ToString()); WriteCimConfig(CIM_PARAMS.IP.ToString(), StrIP, ETypeMode.ToString()); WriteCimConfig(CIM_PARAMS.Port.ToString(), StrPort, ETypeMode.ToString()); WriteCimConfig(CIM_PARAMS.CycTimes.ToString(), iCycTimes.ToString()); WriteCimConfig(CIM_PARAMS.UserID.ToString(), StrUserID); WriteCimConfig(CIM_PARAMS.Fab.ToString(), StrFab); WriteCimConfig(CIM_PARAMS.Area.ToString(), StrArea); WriteCimConfig(CIM_PARAMS.Line.ToString(), StrLine); WriteCimConfig(CIM_PARAMS.EqpId.ToString(), EqpId); WriteCimConfig(CIM_PARAMS.Operation.ToString(), StrOperation); WriteCimConfig(CIM_PARAMS.Wo_id.ToString(), Wo_id); WriteCimConfig(CIM_PARAMS.ModelNo.ToString(), StrModelNo); WriteCimConfig(CIM_PARAMS.RunCard.ToString(), StrLot); WriteCimConfig(CIM_PARAMS.COM.ToString(), StrCom); WriteCimConfig(CIM_PARAMS.CodeDelay.ToString(), iCodeDelay.ToString()); WriteCimConfig(CIM_PARAMS.Baudrate.ToString(), iBaudrate.ToString()); WriteCimConfig(CIM_PARAMS.CodeType.ToString(), ETypeCode.ToString()); WriteCimConfig(CIM_PARAMS.ModeType.ToString(), ETypeMode.ToString()); WriteCimConfig(CIM_PARAMS.BlLog.ToString(), BlLog.ToString()); #endregion }