void Init() { config = new ConfigFileManager(Constant.ConfigParamFilePath); IPAddress[] ips = Dns.GetHostAddresses(""); //当参数为""时返回本机所有IP bool IsExist = false; foreach (IPAddress ip in ips) { if (Regex.IsMatch(ip.ToString(), "(192.168.0.)+")) { IsExist = true; } } if (!IsExist) { MessageBox.Show("网络地址错误,请检查网络连接!"); ConstantMethod.AppExit(); } InitHKCamera(); InitZd(); //InitXMCam(); InitPrjInfo(); InitSysInfo(); InitJxp(); }
private void button1_Click(object sender, EventArgs e) { userInput = pwdTxt.Text; if (!IsStart) { this.Hide(); return; } ConfigFileManager passWdFile = new ConfigFileManager(); if (File.Exists(Constant.ConfigPassWdFilePath)) { passWdFile.LoadFile(Constant.ConfigPassWdFilePath); } else { return; } string pwdTime = "0"; pwdTime = DateTime.Now.ToString("yyyyMMdd"); if (userInput.Equals(Pwd)) { //修改下次时间 DateTime nowAdd = DateTime.Now; nowAdd = nowAdd.AddMonths(PwdCount); pwdTime = nowAdd.ToString("yyyyMMdd"); passWdFile.WriteConfig(Constant.passwdTime, pwdTime); //修改密码输入的次数 int pwdInt = 0; if (int.TryParse(pwdTime, out pwdInt)) { PwdCount++; passWdFile.WriteConfig(Constant.passwdCount, PwdCount.ToString()); } this.Close(); } else { MessageBox.Show(Constant.pwdWrong); passWdFile.WriteConfig(Constant.passwdTime, pwdTime); Environment.Exit(0); this.Close(); } passWdFile.Dispose(); pwdTxt.Text = ""; }
public static int getLangId() { int id = 0; ConfigFileManager langXml = new ConfigFileManager(Constant.ConfigParamFilePath); string idsstr = langXml.ReadConfig(langStr); if (!int.TryParse(idsstr, out id)) { id = 0; } return(id); }
public static bool setLangId(int id, ConfigFileManager p) { ConfigFileManager langXml = p;// ConfigFileManager(Constant.ConfigParamFilePath); try { langXml.WriteConfig(langStr, id.ToString()); } catch (Exception ex) { return(false); } return(true); }
public projInfo() { strLst = new List <string>(); cfg = new ConfigFileManager(Constant.cfgPrjFile); }
public EvokDTWork() { PsLstAuto = new List <DTPlcInfoSimple>(); PsLstAuto.Add(autoMesOutInPs); PsLstAuto.Add(dbcOutInPs); PsLstAuto.Add(ltbcOutInPs); PsLstAuto.Add(safeOutInPs); PsLstAuto.Add(prodOutInPs); prodOutInPs.IsParam = false; PsLstAuto.Add(lcOutInPs); PsLstAuto.Add(stopOutInPs); PsLstAuto.Add(cutDoneOutInPs); PsLstAuto.Add(plcHandlebarCodeOutInPs); PsLstAuto.Add(ldsCountInOutPs); PsLstAuto.Add(pauseOutPs); PsLstAuto.Add(startOutPs); PsLstAuto.Add(resetOutPs); PsLstAuto.Add(autoSLOutPs); PsLstAuto.Add(pageShiftOutPs); PsLstAuto.Add(emgStopInPs); PsLstAuto.Add(startInPs); PsLstAuto.Add(resetInPs); PsLstAuto.Add(pauseInPs); PsLstAuto.Add(autoSLInPs); PsLstAuto.Add(autoCCInPs); PsLstAuto.Add(clInPs); PsLstAuto.Add(slInPs); PsLstAuto.Add(alarm1InPs); PsLstAuto.Add(alarm2InPs); PsLstAuto.Add(alarm3InPs); PsLstAuto.Add(alarm4InPs); PsLstAuto.Add(alarm5InPs); PsLstAuto.Add(alarm6InPs); PsLstAuto.Add(alarm7InPs); PsLstAuto.Add(alarm8InPs); PsLstAuto.Add(alarm9InPs); PsLstAuto.Add(alarm10InPs); PsLstAuto.Add(alarm11InPs); PsLstAuto.Add(alarm12InPs); PsLstAuto.Add(alarm13InPs); PsLstAuto.Add(alarm14InPs); PsLstAuto.Add(alarm15InPs); PsLstAuto.Add(alarm16InPs); PsLstAuto.Add(startCountInOutPs); PsLstHand = new List <DTPlcInfoSimple>(); PsLstParam = new List <DTPlcInfoSimple>(); PsLstIO = new List <DTPlcInfoSimple>(); UserDataTable = new DataTable(); AllPlcSimpleLst = new List <List <DTPlcInfoSimple> >(); AllPlcSimpleLst.Add(psLstAuto); AllPlcSimpleLst.Add(psLstHand); AllPlcSimpleLst.Add(psLstParam); AllPlcSimpleLst.Add(PsLstIO); paramFile = new ConfigFileManager(); if (File.Exists(Constant.ConfigParamFilePath)) { paramFile.LoadFile(Constant.ConfigParamFilePath); if (!int.TryParse(paramFile.ReadConfig(Constant.printBarcodeMode), out printBarCodeMode)) { MessageBox.Show(Constant.ErrorParamConfigFile); ConstantMethod.AppExit(); } } else { MessageBox.Show(Constant.ConfigParamFilePath + Constant.ErrorParamConfigFile); ConstantMethod.AppExit(); } LogManager.WriteProgramLog(Constant.Start); }