/// <summary> /// 保存驱动数据 /// </summary> /// <param name="IDaHua">数据</param> /// <returns></returns> public bool Save_DaHua_ShuJu(IDaHua IDaHua) { bool ok = false; string filename = "Camer" + IDaHua.CamerIndx1.ToString(); IniLibrary.IniTool inifiles = new IniLibrary.IniTool(ref filename, "DaHua", null); inifiles.WriteString(IDaHua.ToString(), "CamerIndx1", IDaHua.CamerIndx1.ToString()); inifiles.WriteString(IDaHua.ToString(), "TriggerSourceenum", IDaHua.TriggerSourceenum); inifiles.WriteString(IDaHua.ToString(), "Exposuretime", IDaHua.Exposuretime.ToString()); inifiles.WriteString(IDaHua.ToString(), "Gainraw", IDaHua.Gainraw.ToString()); ok = true; return(ok); }
/// <summary> /// 加载相机配置 /// </summary> /// <param name="IDa">相机参数</param> /// <param name="camer_number">加载第几个相机配置</param> void load_DaHua_ShuJu(IDaHua IDa, int camer_number) { string filename = "Camer" + camer_number.ToString(); IniLibrary.IniTool inifiles = new IniLibrary.IniTool(ref filename, "DaHua", null); if (File.Exists(inifiles.FileName_Path1)) { IDa.CamerIndx1 = Convert.ToInt16(inifiles.ReadString(IDa.ToString(), "CamerIndx1", IDa.CamerIndx1.ToString())); IDa.TriggerSourceenum = inifiles.ReadString(IDa.ToString(), "TriggerSourceenum", IDa.TriggerSourceenum); IDa.Exposuretime = Convert.ToDouble(inifiles.ReadString(IDa.ToString(), "Exposuretime", IDa.Exposuretime.ToString())); IDa.Gainraw = Convert.ToDouble(inifiles.ReadString(IDa.ToString(), "Gainraw", IDa.Gainraw.ToString())); } else { inifiles.WriteString(IDa.ToString(), "CamerIndx1", camer_number.ToString()); inifiles.WriteString(IDa.ToString(), "TriggerSourceenum", IDa.TriggerSourceenum); inifiles.WriteString(IDa.ToString(), "Exposuretime", IDa.Exposuretime.ToString()); inifiles.WriteString(IDa.ToString(), "Gainraw", IDa.Gainraw.ToString()); } }