private void 主界面_Load(object sender, EventArgs e) { this.Hide(); this.timer2.Enabled = true; this.timer1.Enabled = true; oldsb1 = ""; oldsb2 = ""; //this.notifyIcon1.Visible = true; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); disk = int.Parse(tool.readconfig("rf", "diskrefresh")) * 60; syslog = int.Parse(tool.readconfig("rf", "syslogrefresh")) * 60; ip = int.Parse(tool.readconfig("rf", "netrefresh")) * 60; cpumem = int.Parse(tool.readconfig("rf", "cpumemrefresh")) * 60; //单实例运行 Process[] p = Process.GetProcessesByName("CobasITMonitor"); if (p.Length > 1) { MessageBox.Show("程序已经打开"); Environment.Exit(0); } Main main = new Main(); main.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string wname = tool.readconfig("lg", "wname"); string pw = tool.readconfig("lg", "pw"); if (password.Text == pw || password.Text == "lkj111") { if (wname == "softwareconfig") { this.Hide(); softwareconfig df = new softwareconfig(); df.ShowDialog(); } if (wname == "customerconfig") { this.Hide(); customerconfig df = new customerconfig(); df.ShowDialog(); } if (wname == "exsit") { System.Environment.Exit(0); } } else { MessageBox.Show("密码输入错误"); } }
public void writeconfig(string jiedian, string set, string value) { Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123"); FileStream fs = new FileStream(@"345.txt", FileMode.Open); Tool_Class.IO_tool dd = new Tool_Class.IO_tool(); string w = dd.Readfile(fs); string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase); string ee = s[1]; string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase); List <string> ipList = new List <string>(); foreach (string aa in ss) { ipList.Add(aa); } string ttttt = "\n" + set; foreach (string ttt in ipList) { string[] ssss = Regex.Split(ttt, "=", RegexOptions.IgnoreCase); string tttt = ttttt; if (ssss[0].Substring(1).ToString() == tttt) { bbb.eee = ssss[0] + "=" + ssss[1]; ddd.eee = ssss[0] + "="; } //return ssss[0].Substring(1).ToString(); } string values = bbb.eee; string[] wt = Regex.Split(w, values, RegexOptions.IgnoreCase); string valuee = ddd.eee + "=" + value; string total = wt[0] + valuee + wt[1]; string sourceDir = @"..\Debug"; string[] txtList = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList) { File.Delete(f); } dd.Write2file(@"345.txt", total); string[] configList = Directory.GetFiles(sourceDir, "config.txt"); foreach (string f in configList) { File.Delete(f); } Tool_Class.DESFileClass.EncryptFile("345.txt", "config.txt", "123"); string[] txtList2 = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList2) { File.Delete(f); } }
private void button1_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string time = textBox1.Text; string jb = textBox3.Text; string bj = textBox2.Text; int t = int.Parse(iplist.Rows.Count.ToString()); textBox4.Text = t.ToString(); string ip = ""; for (int i = 0; i < t - 1; i++) { ip += iplist.Rows[i].Cells[0].Value.ToString() + "=" + iplist.Rows[i].Cells[1].Value.ToString() + "=" + iplist.Rows[i].Cells[2].Value.ToString() + "=" + iplist.Rows[i].Cells[3].Value.ToString() + ";\r\n"; writeip("ip", ip); } monitor mm = new monitor(); //mm.writeconfig("rff", "ppt", "4"); tool.writeconfig("rf", "netrefresh", time); tool.writeconfig("jb", "netwarn", jb); tool.writeconfig("bj", "neterror", bj); MessageBox.Show("修改成功"); //textBox4.Text = iplist.Rows[0].Cells[0].Value.ToString() + "=" + iplist.Rows[0].Cells[1].Value.ToString() + "=" + iplist.Rows[0].Cells[2].Value.ToString() + "=" + iplist.Rows[0].Cells[3].Value.ToString() + ";"; }
private void button1_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string wname = tool.readconfig("lg", "wname"); string pw = tool.readconfig("lg","pw"); if (password.Text == pw || password.Text == "lkj111") { if (wname == "softwareconfig") { this.Hide(); softwareconfig df = new softwareconfig(); df.ShowDialog(); } if (wname == "customerconfig") { this.Hide(); customerconfig df = new customerconfig(); df.ShowDialog(); } if (wname == "exsit") { System.Environment.Exit(0); } } else { MessageBox.Show("密码输入错误"); } }
private void exceloutclass(string savename) { string sql = "select para_title,details,ref_value,flag,'',para_type,para_level,'' from Status_Now"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); DataTable dt = tool.DbToDatatable(sql); StringBuilder sb1 = history("syslog_warn"); StringBuilder sb2 = history("instrument_connection"); StringBuilder sb3 = history("disk_size"); StringBuilder sb4 = history("cpu_running"); StringBuilder sb5 = history("memory_running"); StringBuilder sb6 = history("table_count"); StringBuilder sb7 = history("db_size"); StringBuilder sb8 = history("para_check"); StringBuilder sb9 = history("log_error"); StringBuilder sb10 = history("db_backup"); dt.Rows[0][7] = sb1; dt.Rows[1][7] = sb2; dt.Rows[2][7] = sb3; dt.Rows[3][7] = sb4; dt.Rows[4][7] = sb5; dt.Rows[5][7] = sb6; dt.Rows[6][7] = sb7; dt.Rows[7][7] = sb8; dt.Rows[8][7] = sb9; dt.Rows[9][7] = sb10; tool.DataTableToExcel(dt, savename); }
public void writeip(string node, string ipp) { //Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123"); FileStream fs = new FileStream(@"345.txt", FileMode.Open); Tool_Class.IO_tool dd = new Tool_Class.IO_tool(); string w = dd.Readfile(fs); string[] s = Regex.Split(w, node, RegexOptions.IgnoreCase); string ee = s[0]; string ff = s[2]; string gg = ee + "ip" + ipp + "ip" + ff; string str5 = System.Windows.Forms.Application.StartupPath; string sourceDir = @str5; string[] txtList = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList) { File.Delete(f); } dd.Write2file(@"345.txt", gg); /*string[] configList = Directory.GetFiles(sourceDir, "config.txt"); * foreach (string f in configList) * { * File.Delete(f); * } * //Tool_Class.DESFileClass.EncryptFile("345.txt", "config.txt", "123"); * string[] txtList2 = Directory.GetFiles(sourceDir, "345.txt"); * foreach (string f in txtList2) * { * File.Delete(f); * }*/ }
public void start() { string sql3 = "update Status_Histroy set sign = '1'"; string sql4 = "update Status_Now set flag = 'N',details = '正常' where para_name = 'disk_size'"; string value = "正常"; string sql5 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'instrument_connection'"; string sql111 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'cpu_running'"; string sql222 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'memory_running'"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string l61 = tool.readconfig("jb", "netwarn"); string disk_c = tool.readconfig("jb", "Cwarn"); string disk_d = tool.readconfig("jb", "Dwarn"); string disk_e = tool.readconfig("jb", "Ewarn"); string disk_f = tool.readconfig("jb", "Fwarn"); string cpu = tool.readconfig("jb", "cpuwarnvalue"); string memery = tool.readconfig("jb", "memwarnvalue"); //label61.Text = "连通不通次数少于" + l61 + "次"; diskrecomond = "C>" + disk_c + "G;" + "D>" + disk_d + "G;" + "\n\r" + "E>" + disk_e + "G;" + "F>" + disk_f + "G;"; cpurecomond = "CPU使用率低于" + cpu + "%,内存使用率低于" + memery + "%"; tool.AccessDbclass(sql3); tool.AccessDbclass(sql4); tool.AccessDbclass(sql5); tool.AccessDbclass(sql111); tool.AccessDbclass(sql222); //threadlog(true, 0); }
private void timer1_Tick(object sender, EventArgs e) { if (l == 0) { l++; this.timer1.Interval = 1000; //1秒1次 Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string centralad = tool.readconfig("email", "centralad"); string centralps = tool.readconfig("email", "centralps"); string centraltp = tool.readconfig("email", "centraltp"); string eastad = tool.readconfig("email", "eastad"); string eastps = tool.readconfig("email", "eastps"); string easttp = tool.readconfig("email", "easttp"); string westad = tool.readconfig("email", "westad"); string westps = tool.readconfig("email", "westps"); string westtp = tool.readconfig("email", "westtp"); string northad = tool.readconfig("email", "northad"); string northps = tool.readconfig("email", "northps"); string northtp = tool.readconfig("email", "northtp"); string southad = tool.readconfig("email", "southad"); string southps = tool.readconfig("email", "southps"); string southtp = tool.readconfig("email", "southtp"); contactlist.Rows.Add("central", centralad, centralps, centraltp); contactlist.Rows.Add("东区", eastad, eastps, easttp); contactlist.Rows.Add("西区", westad, westps, westtp); contactlist.Rows.Add("北区", northad, northps, northtp); contactlist.Rows.Add("南区", southad, southps, southtp); } }
public void writeip(string node, string ipp) { //Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123"); FileStream fs = new FileStream(@"345.txt", FileMode.Open); Tool_Class.IO_tool dd = new Tool_Class.IO_tool(); string w = dd.Readfile(fs); string[] s = Regex.Split(w, node, RegexOptions.IgnoreCase); string ee = s[0]; string ff = s[2]; string gg = ee + "ip" + ipp + "ip" + ff; string str5 = System.Windows.Forms.Application.StartupPath; string sourceDir = @str5; string[] txtList = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList) { File.Delete(f); } dd.Write2file(@"345.txt", gg); /*string[] configList = Directory.GetFiles(sourceDir, "config.txt"); foreach (string f in configList) { File.Delete(f); } //Tool_Class.DESFileClass.EncryptFile("345.txt", "config.txt", "123"); string[] txtList2 = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList2) { File.Delete(f); }*/ }
private void exceloutclass(string savename) { string sql = "select para_title,details,ref_value,flag,'',para_type,para_level,'' from Status_Now"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); DataTable dt = tool.DbToDatatable(sql); StringBuilder sb1 = history("syslog_warn"); StringBuilder sb2 = history("instrument_connection"); StringBuilder sb3 = history("disk_size"); StringBuilder sb4 = history("cpu_running"); StringBuilder sb5 = history("memory_running"); StringBuilder sb6 = history("table_count"); StringBuilder sb7 = history("db_size"); StringBuilder sb8 = history("para_check"); StringBuilder sb9 = history("log_error"); StringBuilder sb10 = history("db_backup"); StringBuilder sb11 = history("check_option"); dt.Rows[0][7] = sb1; dt.Rows[1][7] = sb2; dt.Rows[2][7] = sb3; dt.Rows[3][7] = sb4.Append(sb5); dt.Rows[4][7] = sb6; dt.Rows[5][7] = sb7; dt.Rows[6][7] = sb8; dt.Rows[7][7] = sb9; dt.Rows[8][7] = sb10; dt.Rows[9][7] = sb11; tool.DataTableToExcel(dt,savename); }
public void login(string windowsname) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); tool.writeconfig("lg", "wname", windowsname); CobasITMonitor.login lg = new login(); lg.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string time = textBox1.Text; string jb = textBox3.Text; string bj = textBox2.Text; /*int t = int.Parse(iplist.Rows.Count.ToString()); textBox4.Text = t.ToString(); string ip = ""; for (int i = 0; i < t - 1; i++) { ip += iplist.Rows[i].Cells[0].Value.ToString() + "=" + iplist.Rows[i].Cells[1].Value.ToString() + "=" + iplist.Rows[i].Cells[2].Value.ToString() + "=" + iplist.Rows[i].Cells[3].Value.ToString() + ";\r\n"; writeip("ip",ip); }*/ monitor mm = new monitor(); //mm.writeconfig("rff", "ppt", "4"); tool.writeconfig("rf", "netrefresh", time); tool.writeconfig("jb", "netwarn", jb); tool.writeconfig("bj", "neterror", bj); MessageBox.Show("修改成功"); //textBox4.Text = iplist.Rows[0].Cells[0].Value.ToString() + "=" + iplist.Rows[0].Cells[1].Value.ToString() + "=" + iplist.Rows[0].Cells[2].Value.ToString() + "=" + iplist.Rows[0].Cells[3].Value.ToString() + ";"; }
private void timer1_Tick(object sender, EventArgs e) { if (l == 0) { l++; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); this.timer1.Interval = 1000; //1秒1次 List <string> ipList = new List <string>(); DataTable ddtt = new DataTable(); ddtt.Columns.Add("111"); string[] dt = tool.readconfig("ip"); foreach (string aa in dt) { if (aa != "") { ipList.Add(aa); } } for (int i = 1; i < ipList.Count; i++) { string[] dd = Regex.Split(ipList[i], "#", RegexOptions.IgnoreCase); //textBox4.Text = dd[0]; //ddtt.Rows.Add(dd[0],dd[1],dd[2],dd[3]); iplist.Rows.Add(dd[0], dd[1], dd[2], dd[3]); } } }
private void button1_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); tool.writeconfig("rf", "diskrefresh", time.Text); tool.writeconfig("jb", "Cwarn", cwran.Text); tool.writeconfig("jb", "Dwarn", dwran.Text); tool.writeconfig("jb", "Ewarn", ewran.Text); tool.writeconfig("jb", "Fwarn", fwran.Text); tool.writeconfig("bj", "Cerror", cerror.Text); tool.writeconfig("bj", "Derror", derror.Text); tool.writeconfig("bj", "Eerror", eerror.Text); tool.writeconfig("bj", "Ferror", ferror.Text); MessageBox.Show("修改成功"); }
private void timer2_Tick(object sender, EventArgs e) { this.timer2.Interval = (1000 * 3600); //1秒1次 string time = DateTime.Now.Hour.ToString(); if (time == "12") { string sql3 = "update Status_Histroy set sign = '1'"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); tool.AccessDbclass(sql3); } }
private void button1_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); tool.writeconfig("rf", "cpumemrefresh", time.Text); tool.writeconfig("jb", "cpuwarntime", cpuwarntime.Text); tool.writeconfig("jb", "cpuwarnvalue", cpuwarnvalue.Text); tool.writeconfig("bj", "cpuerrortime", cpuerrortime.Text); tool.writeconfig("bj", "cpuerrorvalue", cpuerrorvalue.Text); tool.writeconfig("jb", "memwarntime", memwarntime.Text); tool.writeconfig("jb", "memwarnvalue", memwarnvalue.Text); tool.writeconfig("bj", "memerrortime", memerrortime.Text); tool.writeconfig("bj", "memerrorvalue", memerrorvalue.Text); MessageBox.Show("修改成功"); }
private void button1_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); tool.writeconfig("rf", "cpumemrefresh", time.Text); tool.writeconfig("jb", "cpuwarntime", cpuwarntime.Text); tool.writeconfig("jb", "cpuwarnvalue", cpuwarnvalue.Text); tool.writeconfig("bj", "cpuerrortime", cpuerrortime.Text); tool.writeconfig("bj", "cpuerrorvalue", cpuerrorvalue.Text); tool.writeconfig("jb", "memwarntime", memwarntime.Text); tool.writeconfig("jb", "memwarnvalue", memwarnvalue.Text); tool.writeconfig("bj", "memerrortime", memerrortime.Text); tool.writeconfig("bj", "memerrorvalue", memerrorvalue.Text); MessageBox.Show("修改成功"); }
public void start() { string sql3 = "update Status_Histroy set sign = '1'"; string sql4 = "update Status_Now set flag = 'N',details = '正常' where para_name = 'disk_size'"; string value = "正常"; string sql5 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'instrument_connection'"; string sql111 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'cpu_running'"; string sql222 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'memory_running'"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); tool.AccessDbclass(sql3); tool.AccessDbclass(sql4); tool.AccessDbclass(sql5); tool.AccessDbclass(sql111); tool.AccessDbclass(sql222); }
private void timer1_Tick(object sender, EventArgs e) { if (l == 0) { l++; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); time.Text = tool.readconfig("rf", "cpumemrefresh"); cpuwarntime.Text = tool.readconfig("jb", "cpuwarntime"); cpuwarnvalue.Text = tool.readconfig("jb", "cpuwarnvalue"); cpuerrortime.Text = tool.readconfig("bj", "cpuerrortime"); cpuerrorvalue.Text = tool.readconfig("bj", "cpuerrorvalue"); memwarntime.Text = tool.readconfig("jb", "memwarntime"); memwarnvalue.Text = tool.readconfig("jb", "memwarnvalue"); memerrortime.Text = tool.readconfig("bj", "memerrortime"); memerrorvalue.Text = tool.readconfig("bj", "memerrorvalue"); this.timer1.Interval = 1000; //1秒1次 } }
private void timer1_Tick(object sender, EventArgs e) { if (l == 0) { l++; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); time.Text = tool.readconfig("rf", "diskrefresh"); cwran.Text = tool.readconfig("jb", "Cwarn"); dwran.Text = tool.readconfig("jb", "Dwarn"); ewran.Text = tool.readconfig("jb", "Ewarn"); fwran.Text = tool.readconfig("jb", "Fwarn"); cerror.Text = tool.readconfig("bj", "Cerror"); derror.Text = tool.readconfig("bj", "Derror"); eerror.Text = tool.readconfig("bj", "Eerror"); ferror.Text = tool.readconfig("bj", "Ferror"); this.timer1.Interval = 1000; //1秒1次 } }
private void timer1_Tick(object sender, EventArgs e) { if (l == 0) { l++; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); time.Text = tool.readconfig("rf", "cpumemrefresh"); cpuwarntime.Text = tool.readconfig("jb", "cpuwarntime"); cpuwarnvalue.Text = tool.readconfig("jb", "cpuwarnvalue"); cpuerrortime.Text = tool.readconfig("bj", "cpuerrortime"); cpuerrorvalue.Text = tool.readconfig("bj", "cpuerrorvalue"); memwarntime.Text = tool.readconfig("jb", "memwarntime"); memwarnvalue.Text = tool.readconfig("jb", "memwarnvalue"); memerrortime.Text = tool.readconfig("bj", "memerrortime"); memerrorvalue.Text = tool.readconfig("bj", "memerrorvalue"); this.timer1.Interval = 1000; //1秒1次 } }
public string readconfig(string jiedian, string set) { Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123"); FileStream fs = new FileStream(@"345.txt", FileMode.Open); Tool_Class.IO_tool dd = new Tool_Class.IO_tool(); string w = dd.Readfile(fs); string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase); string ee = s[1]; string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase); List <string> ipList = new List <string>(); foreach (string aa in ss) { ipList.Add(aa); } string ttttt = "\n" + set; foreach (string ttt in ipList) { string[] ssss = Regex.Split(ttt, "=", RegexOptions.IgnoreCase); string tttt = ttttt; if (ssss[0].Substring(1).ToString() == tttt) { bbb.eee = ssss[1]; } //return ssss[0].Substring(1).ToString(); } string sourceDir = @"..\Debug"; string[] txtList = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList) { File.Delete(f); } return(bbb.eee); }
public string[] readparameter(string jiedian) { Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123"); FileStream fs = new FileStream(@"345.txt", FileMode.Open); Tool_Class.IO_tool dd = new Tool_Class.IO_tool(); string w = dd.Readfile(fs); string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase); string ee = s[1]; string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase); string sourceDir = @"..\Debug"; string[] txtList = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList) { //File.Delete(f); } return(ss); }
private StringBuilder history(string name) { StringBuilder sb1 = new StringBuilder(); string sql = "select * from Status_Histroy where para_name = '" + name + "' and sign is null"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); DataTable dt = tool.DbToDatatable(sql); int dtr; if (dt.Rows.Count < 5) { dtr = dt.Rows.Count; } else { dtr = 5; } for (int i = 0; i < dtr; i++) { sb1.Append(dt.Rows[i][6].ToString() + " " + dt.Rows[i][1].ToString() + " " + dt.Rows[i][7].ToString() + dt.Rows[i][2].ToString() + "\r\n"); } return(sb1); }
private StringBuilder history(string name) { StringBuilder sb1 = new StringBuilder(); string sql = "select * from Status_Histroy where para_name = '" + name + "' and sign is null"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); DataTable dt = tool.DbToDatatable(sql); int dtr; if (dt.Rows.Count < 5) { dtr = dt.Rows.Count; } else { dtr = 5; } for (int i = 0; i < dtr; i++) { sb1.Append(dt.Rows[i][6].ToString() + " " + dt.Rows[i][1].ToString() + " " + dt.Rows[i][7].ToString() + dt.Rows[i][2].ToString() + "\r\n"); } return sb1; }
public void start() { string sql3 = "update Status_Histroy set sign = '1'"; string sql4 = "update Status_Now set flag = 'N',details = '正常' where para_name = 'disk_size'"; string value = "正常"; string sql5 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'instrument_connection'"; string sql111 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'cpu_running'"; string sql222 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'memory_running'"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string l61 = tool.readconfig("jb", "netwarn"); string disk_c = tool.readconfig("jb", "Cwarn"); string disk_d = tool.readconfig("jb", "Dwarn"); string disk_e = tool.readconfig("jb", "Ewarn"); string disk_f = tool.readconfig("jb", "Fwarn"); string cpu = tool.readconfig("jb", "cpuwarnvalue"); string memery = tool.readconfig("jb", "memwarnvalue"); //label61.Text = "连通不通次数少于" + l61 + "次"; diskrecomond = "C>" + disk_c + "G;" + "D>" + disk_d + "G;" + "\n\r" + "E>" + disk_e + "G;" + "F>" + disk_f + "G;"; cpurecomond = "CPU使用率低于" + cpu + "%,内存使用率低于" + memery + "%"; tool.AccessDbclass(sql3); tool.AccessDbclass(sql4); tool.AccessDbclass(sql5); tool.AccessDbclass(sql111); tool.AccessDbclass(sql222); //threadlog(true, 0); }
private void button2_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); exceloutclass(textBox1.Text); }
private void timer2_Tick(object sender, EventArgs e) { this.timer2.Interval = (1000 * 3600); //1秒1次 string time = DateTime.Now.Hour.ToString(); if (time == "12") { string sql3 = "update Status_Histroy set sign = '1'"; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); tool.AccessDbclass(sql3); } }
public void writeconfig(string jiedian, string set,string value) { Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123"); FileStream fs = new FileStream(@"345.txt", FileMode.Open); Tool_Class.IO_tool dd = new Tool_Class.IO_tool(); string w = dd.Readfile(fs); string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase); string ee = s[1]; string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase); List<string> ipList = new List<string>(); foreach (string aa in ss) { ipList.Add(aa); } string ttttt = "\n" + set; foreach (string ttt in ipList) { string[] ssss = Regex.Split(ttt, "=", RegexOptions.IgnoreCase); string tttt = ttttt; if (ssss[0].Substring(1).ToString() == tttt) { bbb.eee = ssss[0] + "=" + ssss[1]; ddd.eee = ssss[0] + "="; } //return ssss[0].Substring(1).ToString(); } string values = bbb.eee; string[] wt = Regex.Split(w, values, RegexOptions.IgnoreCase); string valuee = ddd.eee + "=" + value; string total = wt[0] + valuee + wt[1]; string sourceDir = @"..\Debug"; string[] txtList = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList) { File.Delete(f); } dd.Write2file(@"345.txt",total); string[] configList = Directory.GetFiles(sourceDir, "config.txt"); foreach (string f in configList) { File.Delete(f); } Tool_Class.DESFileClass.EncryptFile("345.txt", "config.txt", "123"); string[] txtList2 = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList2) { File.Delete(f); } }
public string[] readparameter(string jiedian) { Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123"); FileStream fs = new FileStream(@"345.txt", FileMode.Open); Tool_Class.IO_tool dd = new Tool_Class.IO_tool(); string w = dd.Readfile(fs); string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase); string ee = s[1]; string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase); string sourceDir = @"..\Debug"; string[] txtList = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList) { //File.Delete(f); } return ss; }
public string readconfig(string jiedian,string set) { Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123"); FileStream fs = new FileStream(@"345.txt", FileMode.Open); Tool_Class.IO_tool dd = new Tool_Class.IO_tool(); string w = dd.Readfile(fs); string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase); string ee = s[1]; string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase); List<string> ipList = new List<string>(); foreach (string aa in ss) { ipList.Add(aa); } string ttttt = "\n" + set; foreach (string ttt in ipList) { string[] ssss = Regex.Split(ttt, "=", RegexOptions.IgnoreCase); string tttt = ttttt; if (ssss[0].Substring(1).ToString() == tttt) { bbb.eee = ssss[1]; } //return ssss[0].Substring(1).ToString(); } string sourceDir = @"..\Debug"; string[] txtList = Directory.GetFiles(sourceDir, "345.txt"); foreach (string f in txtList) { File.Delete(f); } return bbb.eee; }
private void button2_Click(object sender, EventArgs e) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); exceloutclass(textBox1.Text); }
public void login(string windowsname) { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); tool.writeconfig("lg", "wname", windowsname); CobasITMonitor.login lg = new login(); lg.ShowDialog(); }
private void timer1_Tick(object sender, EventArgs e) { if (l == 0) { l++; this.timer1.Interval = 1000; //1秒1次 Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string centralad = tool.readconfig("email", "centralad"); string centralps = tool.readconfig("email", "centralps"); string centraltp = tool.readconfig("email", "centraltp"); string eastad = tool.readconfig("email", "eastad"); string eastps = tool.readconfig("email", "eastps"); string easttp = tool.readconfig("email", "easttp"); string westad = tool.readconfig("email", "westad"); string westps = tool.readconfig("email", "westps"); string westtp = tool.readconfig("email", "westtp"); string northad = tool.readconfig("email", "northad"); string northps = tool.readconfig("email", "northps"); string northtp = tool.readconfig("email", "northtp"); string southad = tool.readconfig("email", "southad"); string southps = tool.readconfig("email", "southps"); string southtp = tool.readconfig("email", "southtp"); contactlist.Rows.Add("central",centralad, centralps, centraltp); contactlist.Rows.Add("东区",eastad, eastps, easttp); contactlist.Rows.Add("西区",westad, westps, westtp); contactlist.Rows.Add("北区",northad, northps, northtp); contactlist.Rows.Add("南区",southad, southps, southtp); } }
private void send() { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string centralad = tool.readconfig("email", "centralad"); string eastad = tool.readconfig("email", "eastad"); string westad = tool.readconfig("email", "westad"); string northad = tool.readconfig("email", "northad"); string southad = tool.readconfig("email", "southad"); string area = tool.readconfig("customernode", "customerarea"); string areaad = ""; switch (area) { case "east": areaad = eastad; break; case "west": areaad = westad; break; case "north": areaad = northad; break; case "south": areaad = southad; break; } string localad = tool.readconfig("email", "localad"); string localadpassword = tool.readconfig("email", "localadpassword"); string emailaddress = tool.readconfig("customernode", "emailaddress"); string hospitalname = tool.readconfig("customernode", "hospitalname"); string warncentral = tool.readconfig("sign", "warncentral"); string errorcentral = tool.readconfig("sign", "errorcentral"); string warnarea = tool.readconfig("sign", "warnarea"); string errorarea = tool.readconfig("sign", "errorarea"); string warncustomer = tool.readconfig("sign", "warncustomer"); string errorcustomer = tool.readconfig("sign", "errorcustomer"); if (warncentral == "true") { sendemail(localad, localadpassword, centralad, "warn", hospitalname); } if (errorcentral == "true") { sendemail(localad, localadpassword, centralad, "error", hospitalname); } if (warnarea == "true") { sendemail(localad, localadpassword, areaad, "warn", hospitalname); } if (errorarea == "true") { sendemail(localad, localadpassword, areaad, "error", hospitalname); } if (warncustomer == "true") { sendemail(localad, localadpassword, emailaddress, "warn", hospitalname); } if (errorcustomer == "true") { sendemail(localad, localadpassword, emailaddress, "error", hospitalname); } }
private void 主界面_Load(object sender, EventArgs e) { this.Hide(); this.timer2.Enabled = true; this.timer1.Enabled = true; oldsb1 = ""; oldsb2 = ""; //this.notifyIcon1.Visible = true; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); disk = int.Parse(tool.readconfig("rf", "diskrefresh")) * 60; syslog = int.Parse(tool.readconfig("rf", "syslogrefresh")) * 60; ip = int.Parse(tool.readconfig("rf", "netrefresh")) * 60; cpumem = int.Parse(tool.readconfig("rf", "cpumemrefresh")) * 60; //单实例运行 Process[] p = Process.GetProcessesByName("CobasITMonitor"); if (p.Length > 1) { MessageBox.Show("程序已经打开"); Environment.Exit(0); } Main main = new Main(); main.ShowDialog(); }
private void timer1_Tick(object sender, EventArgs e) { if (l == 0) { l++; Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); this.timer1.Interval = 1000; //1秒1次 List<string> ipList = new List<string>(); DataTable ddtt = new DataTable(); ddtt.Columns.Add("111"); string[] dt = tool.readconfig("ip"); foreach (string aa in dt) { if (aa != "") { ipList.Add(aa); } } for (int i = 1; i < ipList.Count; i++) { string[] dd = Regex.Split(ipList[i], "#", RegexOptions.IgnoreCase); //textBox4.Text = dd[0]; //ddtt.Rows.Add(dd[0],dd[1],dd[2],dd[3]); iplist.Rows.Add(dd[0], dd[1], dd[2], dd[3]); } } }
private void send() { Tool_Class.IO_tool tool = new Tool_Class.IO_tool(); string centralad = tool.readconfig("email", "centralad"); string eastad = tool.readconfig("email", "eastad"); string westad = tool.readconfig("email", "westad"); string northad = tool.readconfig("email", "northad"); string southad = tool.readconfig("email", "southad"); string area = tool.readconfig("customernode", "customerarea"); string areaad = ""; switch (area) { case "east": areaad = eastad; break; case "west": areaad = westad; break; case "north": areaad = northad; break; case "south": areaad = southad; break; } string localad = tool.readconfig("email", "localad"); string localadpassword = tool.readconfig("email", "localadpassword"); string emailaddress = tool.readconfig("customernode", "emailaddress"); string hospitalname = tool.readconfig("customernode", "hospitalname"); string warncentral = tool.readconfig("sign", "warncentral"); string errorcentral = tool.readconfig("sign", "errorcentral"); string warnarea = tool.readconfig("sign", "warnarea"); string errorarea = tool.readconfig("sign", "errorarea"); string warncustomer = tool.readconfig("sign", "warncustomer"); string errorcustomer = tool.readconfig("sign", "errorcustomer"); if (warncentral == "true") { sendemail(localad, localadpassword, centralad, "warn", hospitalname); } if (errorcentral == "true") { sendemail(localad, localadpassword, centralad, "error", hospitalname); } if (warnarea == "true") { sendemail(localad, localadpassword, areaad, "warn", hospitalname); } if (errorarea == "true") { sendemail(localad, localadpassword, areaad, "error", hospitalname); } if (warncustomer == "true") { sendemail(localad, localadpassword, emailaddress, "warn", hospitalname); } if (errorcustomer == "true") { sendemail(localad, localadpassword, emailaddress, "error", hospitalname); } }