Esempio n. 1
0
 private void btn_Import_txt_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Filter      = "文本文件|*.txt";
         ofd.Multiselect = false;                                                       //是否允许多选,false表示单选
         if (ofd.ShowDialog() == DialogResult.OK)                                       //如果点击的是打开文件
         {
             string[] arr_files = Helper_Txt.ReadAllLines(ofd.FileName, Encoding.UTF8); //获取全路径文件名
             int      i_count   = order_controler.Get_My_Videos(tv_videos, arr_files);
             lb_video_order_found.Text = string.Format(str_video_format, i_count);
         }
     }
 }
Esempio n. 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter      = "文本文件|*.txt";
                ofd.Multiselect = false;                 //是否允许多选,false表示单选
                if (ofd.ShowDialog() == DialogResult.OK) //如果点击的是打开文件
                {
                    lb_Files.Items.Clear();
                    lb_Files.Tag = null;
                    try
                    {
                        //int i_success = 0, i_fail = 0;
                        //string str_temp = "";
                        //List<T_Video> lts = new List<T_Video>();
                        //string[] arr_files = Helper_Txt.ReadAllLines(ofd.FileName, Encoding.UTF8);  //获取全路径文件名

                        //for (int i = 0; i < arr_files.Length; i++)
                        //{
                        //    T_Video v = MyVideoBussiness.GetList_Video_Info(arr_files[i]);
                        //    if (v == null)
                        //    {
                        //        i_fail++;
                        //        str_temp = "NO  NULL  " + arr_files[i];

                        //    }
                        //    else
                        //    {
                        //        i_success++;
                        //        str_temp = "OK  "+ v.FILE_ROOT + "  " + arr_files[i];
                        //        lts.Add(v);
                        //    }
                        //    lb_Files.Items.Add(str_temp);
                        //}
                        //SetMyTextBoxValue(lb_Task_Info, string.Format(str_match_file, i_success, i_fail));
                        //lb_Files.Tag = lts;

                        //if (lts.Count > 0)
                        //{
                        //    Command_info c = new Command_info();
                        //    c.type = 3;
                        //    if (rb_dir.Checked)
                        //    {
                        //        c.msg = string.Join(",.,", lts.Select(s => s.FILE_DIR).Distinct());
                        //        c.msg2 = "1";
                        //    }
                        //    else
                        //    {
                        //        c.msg = string.Join(",.,", lts.Select(s => s.FILE_FULLPATH));
                        //        c.msg2 = "0";
                        //    }
                        //    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);
                        //}

                        List <T_Video> lts       = new List <T_Video>();
                        string[]       arr_files = Helper_Txt.ReadAllLines(ofd.FileName, Encoding.UTF8); //获取全路径文件名
                        for (int i = 0; i < arr_files.Length; i++)
                        {
                            T_Video v = MyVideoBussiness.GetList_Video_Info(arr_files[i]);
                            if (v != null)
                            {
                                lts.Add(v);
                            }
                            else
                            {
                                lb_Files.Items.Add("NO  " + arr_files[i]);
                            }
                        }
                        Add_Task_Node(lts);
                    }
                    catch (Exception ex)
                    {
                        Helper_log.Write_Error(ex.Message);
                    }
                }
            }
        }