/// <summary> /// 保存产品参数到Ini /// </summary> /// <returns></returns> public bool WriteIniParProduct() { try { Stopwatch sw = new Stopwatch(); sw.Start(); //配置文件名称 I_I.WriteIni("Model", "Name", ComConfigPar.C_I.NameModel, ComConfigPar.C_I.PathConfigIni); //配置文件序号 I_I.WriteIni("Model", "No", this.No.ToString(), ComConfigPar.C_I.PathConfigIni); //配置参数 for (int i = 0; i < c_NumParProduct; i++) { I_I.WriteIni("ParProduct" + i.ToString(), "Value", this.ParProduct_L[i].DblValue.ToString(), ComConfigPar.C_I.PathConfigIni); //写入值 I_I.WriteIni("ParProduct" + i.ToString(), "Min", this.ParProduct_L[i].DblMin.ToString(), ComConfigPar.C_I.PathConfigIni); //写入最小值 I_I.WriteIni("ParProduct" + i.ToString(), "Max", this.ParProduct_L[i].DblMax.ToString(), ComConfigPar.C_I.PathConfigIni); //写入最大值 I_I.WriteIni("ParProduct" + i.ToString(), "Co", this.ParProduct_L[i].Co.ToString(), ComConfigPar.C_I.PathConfigIni); //写入系数 I_I.WriteIni("ParProduct" + i.ToString(), "Annotation", this.ParProduct_L[i].Annotation.ToString(), ComConfigPar.C_I.PathConfigIni); //写入注释 } sw.Stop(); return(true); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); return(false); } }
/// <summary> /// 保存拍照位置参数到ini /// </summary> /// <returns></returns> public bool WriteIniPosPhoto() { try { Stopwatch sw = new Stopwatch(); sw.Start(); int num = 0; for (int i = 0; i < ParCameraWork.NumCamera; i++) { for (int j = 0; j < ParCameraWork.P_I[i + 1]; j++) { string section = "Camera" + (i + 1).ToString() + "Pos" + (j + 1).ToString(); I_I.WriteIni(section, "X", PosPhoto_L[num].X.ToString(), ComConfigPar.C_I.PathConfigIni); I_I.WriteIni(section, "Y", PosPhoto_L[num].Y.ToString(), ComConfigPar.C_I.PathConfigIni); num++; } } sw.Stop(); return(true); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); return(false); } }
/// <summary> /// 写入参数 /// </summary> /// <returns></returns> public bool WrtiteIniTypePLC() { try { I_I.WriteIni("PLCModel", "Model", TypePLC_e.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "BlReadCycReg", BlReadCycReg.ToString(), ParSetPLC.c_PathPLC); //是否循环读取PLC I_I.WriteIni("PLCModel", "Protocol", TypePLCProtocol_e.ToString(), ParSetPLC.c_PathPLC); //协议版本 I_I.WriteIni("PLCModel", "BlRSingleTaskCamera", BlRSingleTaskCamera.ToString(), ParSetPLC.c_PathPLC); //单线程触发 I_I.WriteIni("PLCModel", "Delay", Delay.ToString(), ParSetPLC.c_PathPLC); //循环读取延迟 I_I.WriteIni("PLCModel", "BlAnnotherPLC", BlAnnotherPLC.ToString(), ParSetPLC.c_PathPLC); //PLC独立通信 I_I.WriteIni("PLCModel", "BlAnnotherPLCLog", BlAnnotherPLCLog.ToString(), ParSetPLC.c_PathPLC); //PLC独立通信 I_I.WriteIni("PLCModel", "BlClearAllTrigger", BlClearAllTrigger.ToString(), ParSetPLC.c_PathPLC); //清空触发信号 //通用端口 I_I.WriteIni("PLCModel", "IP", IP.ToString(), ParSetPLC.c_PathPLC); //IP I_I.WriteIni("PLCModel", "Port", Port.ToString(), ParSetPLC.c_PathPLC); //PLC独立通信 //写入端口 I_I.WriteIni("PLCModel", "BlWritePort1", BlWritePort1.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "BlWritePort2", BlWritePort2.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "BlWritePort3", BlWritePort3.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "BlWritePort4", BlWritePort4.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "BlWritePort5", BlWritePort5.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "BlWritePort6", BlWritePort6.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "PortWrite1", PortWrite1.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "PortWrite2", PortWrite2.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "PortWrite3", PortWrite3.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "PortWrite4", PortWrite4.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "PortWrite5", PortWrite5.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "PortWrite6", PortWrite6.ToString(), ParSetPLC.c_PathPLC); return(true); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); return(false); } }
public bool WrtiteIniTypePLC() { try { I_I.WriteIni("PLCModel", "Model", TypePLC_e.ToString(), ParSetPLC.c_PathPLC); I_I.WriteIni("PLCModel", "BlReadCycReg", BlReadCycReg.ToString(), ParSetPLC.c_PathPLC); //是否循环读取PLC I_I.WriteIni("PLCModel", "Protocol", TypePLCProtocol_e.ToString(), ParSetPLC.c_PathPLC); //协议版本 I_I.WriteIni("PLCModel", "BlRSingleTaskCamera", BlRSingleTaskCamera.ToString(), ParSetPLC.c_PathPLC); //单线程触发 I_I.WriteIni("PLCModel", "Delay", Delay.ToString(), ParSetPLC.c_PathPLC); //循环读取延迟 I_I.WriteIni("PLCModel", "BlAnnotherPLC", BlAnnotherPLC.ToString(), ParSetPLC.c_PathPLC); //PLC独立通信 I_I.WriteIni("PLCModel", "BlAnnotherPLCLog", BlAnnotherPLCLog.ToString(), ParSetPLC.c_PathPLC); //PLC独立通信 I_I.WriteIni("PLCModel", "IP", IP.ToString(), ParSetPLC.c_PathPLC); //IP I_I.WriteIni("PLCModel", "Port", Port.ToString(), ParSetPLC.c_PathPLC); //PLC独立通信 return(true); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); return(false); } }
//写入Ini public void WriteIniRegCycle() { //循环读取寄存器 I_I.WriteIni("CycReg", "CycReg", RegCyc, ParSetPLC.c_PathCyc); }