private void b_SearchFile_Click(object sender, EventArgs e) { Command_info c = new Command_info(); c.type = 2; c.msg = "D:\\,.,E:\\"; c.msg2 = str_search; string str_c = Helper_Json.Encode(c); long r_l = h_redis.RedisPub(str_r_rep, str_c); SetrichTextBox(str_r_rep + ":" + str_c); }
private void button2_Click_1(object sender, EventArgs e) { Command_info c = new Command_info(); c.type = 2; c.msg = "D:\\,E:\\"; c.msg2 = str_search; string str_c = Helper_Json.Encode(c); long r_l = h_redis.RedisPub(str_r_rep, str_c); SetMyTextBoxValue(str_r_rep + ":" + str_c); }
private void b_Sender_Click(object sender, EventArgs e) { Command_info c = new Command_info(); c.type = 1; c.msg = ""; c.msg2 = ""; string str_c = Helper_Json.Encode(c); long r_l = h_redis.RedisPub(str_r_rep, str_c); SetMyTextBoxValue(str_r_rep + ":" + str_c); }
private void b_Sender_Click(object sender, EventArgs e) { Command_info c = new Command_info(); c.type = 1; c.msg = ""; c.msg2 = ""; string str_c = Helper_Json.Encode(c); SetrichTextBox("刷新所有硬盘信息....."); long r_l = h_redis.RedisPub(str_r_rep, str_c); Helper_log.Write_log(str_r_rep + ":" + str_c); }
private void button5_Click(object sender, EventArgs e) { if (lb_Files.Tag != null && cb_disk.Tag != null) { List <T_Video> lts = (List <T_Video>)lb_Files.Tag; List <T_DISK_INFO> dis = (List <T_DISK_INFO>)cb_disk.Tag; T_DISK_INFO di = dis[cb_disk.SelectedIndex]; double d_source_size = 0; if (lb_Total_Size.Tag != null) { d_source_size = Math.Round((double)lb_Total_Size.Tag, 4); } Task_Info ti = new Task_Info(); ti.id = Guid.NewGuid().ToString(); List <string> arr_file_path = new List <string>(); List <string> arr_copy_type = new List <string>(); foreach (var v in lts) { arr_file_path.Add(v.FILE_FULLPATH); if (v.FILE_INDEX == "1") { arr_copy_type.Add(v.FILE_INDEX); } else { arr_copy_type.Add("0"); } } ti.arr_source = arr_file_path.ToArray(); ti.copy_type = string.Join(",.,", arr_copy_type); ti.source_size = d_source_size; ti.target = di.LOGICAL_NAME; if (di.LOGICAL_TOTALSIZE.HasValue) { ti.target_size = Math.Round(di.LOGICAL_TOTALSIZE.Value, 4); } if (di.LOGICAL_FREESPACE.HasValue) { ti.target_free_size = di.LOGICAL_FREESPACE.Value; } int i_exists = -1; //是否存在相同的硬盘拷贝 for (int i = 0; i < lts.Count; i++) { if (lts[i].FILE_ROOT == ti.target) { i_exists = i; break; } } //此处应该增加排除相同任务的判定,待到重构时增加 if (i_exists > -1) { if (MessageBox.Show("拷贝任务中拷贝文件【" + (i_exists + 1) + "】存在源硬盘与目标硬盘名称相同【" + ti.target + "】,是否继续?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.OK) { return; } } //待添加硬盘剩余空间的判定 DataGridViewRow dr = new DataGridViewRow(); dr.CreateCells(dgv_Task); dr.Cells[0].Value = "0"; dr.Cells[1].Value = ti.source_size; dr.Cells[2].Value = ti.target; dr.Cells[3].Value = ti.target_size; dr.Tag = ti; //添加的行作为第一行 dgv_Task.Rows.Insert(0, dr); int i_count = Convert.ToInt16(lb_Task_count.Tag); i_count++; string str_format = "数量:{0}"; lb_Task_count.Tag = i_count; lb_Task_count.Text = string.Format(str_format, i_count); Command_info c = new Command_info(); c.type = 4; c.msg = string.Join(",.,", ti.arr_source); c.msg2 = ti.copy_type; c.tag = Helper_Json.Encode(ti); //c.tag = ti.id; string str_c = Helper_Json.Encode(c); int i_success = MyVideoBussiness.Add_Task_Info(ti, lts); if (i_success > 0) { long r_l = h_redis.RedisPub(str_r_rep, str_c); SetrichTextBox("拷贝任务....." + ti.arr_source.Length + "..." + i_success); } else { SetrichTextBox("记录失败....." + i_success + "..."); } } }
private void button3_Click(object sender, EventArgs e) { List <string> arr_disklist = new List <string>(); List <int> arr_disk_id_list = new List <int>(); List <string> arr_disk_list_offline = new List <string>(); int i_count_disk_online = 0, i_count_disk_offline = 0; List <T_DISK_INFO> l_tdi = Get_Selected_DISK_INFO(); if (l_tdi.Count > 0) { foreach (var di in l_tdi) { if (di.IS_ONLINE == 1) { i_count_disk_online++; arr_disklist.Add(di.LOGICAL_NAME); arr_disk_id_list.Add(Convert.ToInt32(di.ID)); } else { i_count_disk_offline++; arr_disk_list_offline.Add(di.LOGICAL_NAME); } } //if (i_count_disk_online > 0) //{ // str_disklist = str_disklist.Substring(0, str_disklist.Length - 3); // str_disk_id_list = str_disk_id_list.Substring(0, str_disk_id_list.Length - 3); //} if (i_count_disk_online == 0) { SetrichTextBox("请选择待扫描的在线硬盘"); return; } if (i_count_disk_offline > 0) { SetrichTextBox("以下硬盘离线,系统将不扫描。" + string.Join(",", arr_disk_list_offline)); } //删除影片表中对应盘符下的影片,以备重新扫描 foreach (var id in arr_disk_id_list) { MyVideoBussiness.Delete_Video_Info(id); } Command_info c = new Command_info(); c.type = 2; for (int i = 0; i < arr_disklist.Count; i++) { if (i == arr_disklist.Count - 1) { c.msg += arr_disklist[i] + "\\"; } else { c.msg += arr_disklist[i] + "\\,.,"; } } //c.msg = @"D:\chao\工作\电影程序\Data"; c.msg2 = str_search; c.tag = string.Join(",.,", arr_disk_id_list); string str_c = Helper_Json.Encode(c); SetrichTextBox("开始扫描....." + i_count_disk_online + "..." + string.Join(",", arr_disklist)); str_Scan_dir = ""; long r_l = h_redis.RedisPub(str_r_rep, str_c); } }