private bool check_cms_in_vms(int vms_index) { for (int i = 0; i < 6; i++) { string _name = "gdm." + inc._vms[vms_index]._id.ToString() + "." + (i + 1).ToString() + ".txt"; string _path = "gdm" + inc._vms[vms_index]._id.ToString(); string _workdir = fn_global.get_workdir(_path); string file_name = _workdir + "\\" + _name; if (fn_global.fn_file_exist(_path, _name)) { if (fn_global.fn_get_file(_path, _name, _name)) { MyFile f = new MyFile(); f.FileName = file_name; for (int j = 1; j < 4; j++) { string name = "cp" + j.ToString() + "_cms_id"; string temp = ""; temp = f.search_file_line(name); if (temp == CMS_id.ToString()) { return(true); } } f.close(); } } } return(false); }
private void add_timezone_data() { string _week = ""; //dataGridView3.Rows.Clear(); if (comboBox1.SelectedIndex != 6) { _week = "." + (comboBox1.SelectedIndex + 1).ToString(); } string _path = "cms" + CMS_id.ToString(); string _name = "cms." + CMS_id.ToString() + _week + ".txt"; for (int r = 0; r < dataGridView3.Rows.Count; r++) { for (int j = 1; j <= 16; j++) { dataGridView3.Rows[r].Cells[j].Value = ""; } dataGridView3.EndEdit(); } if (!fn_global.fn_get_file(_path, _name, _name)) { return; } MyFile ftimeoffset = new MyFile(); try { string _workdir = fn_global.get_workdir(_path); ftimeoffset.FileName = _workdir + "\\" + _name; for (int r = 0; r < dataGridView3.Rows.Count; r++) { int i = fn_global.fn_vms_name2index(dataGridView3.Rows[r].Cells[0].Value.ToString()); if (i >= 0) { string name_head = "gdm" + inc._vms[i]._id.ToString() + "_"; for (int j = 1; j <= 16; j++) { string name = name_head + "zone" + j.ToString(); dataGridView3.Rows[r].Cells[j].Value = ftimeoffset.search_file_line(name); } dataGridView3.EndEdit(); } } ftimeoffset.close(); } catch (Exception e) { MessageBox.Show(e.Message); ftimeoffset.close(); //ftimeoffset = new MyFile("temp"); } }