public fTimkiemnhap()
 {
     filter = new XFilter();
     InitializeComponent();
     bgW_loadfile.WorkerReportsProgress      = true;
     bgW_loadfile.WorkerSupportsCancellation = true;
     listBox_timkiem.DrawMode = DrawMode.OwnerDrawVariable;
     txtSearch.Focus();
 }
 public fBoloc(XFilter boLoc)
 {
     InitializeComponent();
     this.boloc = boLoc;
     if (boloc.ext == null)
     {
         checkBox1.Checked = false;
     }
     else
     {
         checkBox1.Checked = true;
         cb_ext.Text       = boloc.ext;
     }
     if (boloc.createTimeFrom == null)
     {
         checkBox2.Checked = false;
     }
     else
     {
         checkBox2.Checked = true;
         dtp_from.Value    = (DateTime)boloc.createTimeFrom;
         dtp_to.Value      = (DateTime)boloc.createTimeTo;
     }
     if (boloc.lenghtMax == 0)
     {
         checkBox3.Checked = false;
     }
     else
     {
         checkBox3.Checked = true;
         nud_min.Value     = boloc.lenghtMin;
         nud_max.Value     = boloc.lenghtMax;
     }
     if (boloc.loailoc == Loailoc.Loctheochuoi)
     {
         rb_cachuoi.Checked = true;
     }
     else
     {
         rb_tungtu.Checked = true;
     }
     gb_ext.Enabled    = checkBox1.Checked;
     gb_date.Enabled   = checkBox2.Checked;
     gb_lenght.Enabled = checkBox3.Checked;
 }
Example #3
0
        //Trả về danh sách path thỏa mãn vào hàng đợi chứa 1 từ trong số các từ tìm kiếm
        public static void GetOne_BFS(Queue <string> queue_result, string root, string[] keyword, XFilter boloc)//tìm kiếm theo chiều rộng
        {
            var path = root;

            string[] next = null;
            try
            {
                next = XFolder.GetDirectories(path).ToArray();              //lấy ra toàn bộ folder con
            }
            catch { }
            if (next != null)
            {
                foreach (string item in next)                       //kiếm tra trong các folder tên có chứa chuối cần tìm
                {
                    if (boloc.IsSatisfy(item) && XPath.IsEqualName(item, keyword))
                    {
                        queue_result.Enqueue(item);
                    }
                }
            }
            try
            {
                next = XFolder.GetFiles(path).ToArray();                    //lấy ra toàn bộ file trong folder đấy
            }
            catch { }
            if (next != null)
            {
                foreach (string item in next)                       //kiếm tra trong các file tên có chứa chuối cần tìm
                {
                    if (boloc.IsSatisfy(item) && XPath.IsEqualName(item, keyword))
                    {
                        queue_result.Enqueue(item);
                    }
                }
            }
        }
Example #4
0
        //Trả về danh sách path thỏa mãn vào hàng đợi chứa 1 từ trong số các từ tìm kiếm
        public static void GetAll_BFS(Queue <string> queue_result, string root, string[] keyword, XFilter boloc)//tìm kiếm theo chiều rộng
        {
            Queue <string> pending = new Queue <string>();

            pending.Enqueue(root);
            while (pending.Count != 0)
            {
                var      path = pending.Dequeue();
                string[] next = null;
                try
                {
                    next = XFolder.GetDirectories(path).ToArray();              //lấy ra toàn bộ folder con
                    foreach (var subdir in next)
                    {
                        pending.Enqueue(subdir);                           //cho vào trong stackif (next != null) all += next.Count();
                    }
                }
                catch { }
                if (next != null)
                {
                    foreach (string item in next)                       //kiếm tra trong các folder tên có chứa chuối cần tìm
                    {
                        if (boloc.IsSatisfy(item) && XPath.IsEqualName(item, keyword))
                        {
                            queue_result.Enqueue(item);
                        }
                    }
                }
                try
                {
                    next = XFolder.GetFiles(path).ToArray();                    //lấy ra toàn bộ file trong folder đấy
                }
                catch { }
                if (next != null)
                {
                    foreach (string item in next)                       //kiếm tra trong các file tên có chứa chuối cần tìm
                    {
                        if (boloc.IsSatisfy(item) && XPath.IsEqualName(item, keyword))
                        {
                            queue_result.Enqueue(item);
                        }
                    }
                }
            }
        }
Example #5
0
        public static void GetAll_BFS(Queue <string> queue_result, string root, string search, XFilter loc, bool IsSearchAllFolder)
        {
            if (IsSearchAllFolder)
            {
                //boloc = loc;
                switch (loc.loailoc)
                {
                case Loailoc.Loctheotungtu:
                    string[] keyword = search.Split(',');
                    GetAll_BFS(queue_result, root, keyword, loc);
                    break;

                case Loailoc.Loctheochuoi:
                    GetAll_BFS(queue_result, root, search, loc);
                    break;

                default:
                    break;
                }
            }
            else
            {
                //boloc = loc;
                switch (loc.loailoc)
                {
                case Loailoc.Loctheotungtu:
                    string[] keyword = search.Split(',');
                    GetOne_BFS(queue_result, root, keyword, loc);
                    break;

                case Loailoc.Loctheochuoi:
                    GetOne_BFS(queue_result, root, search, loc);
                    break;

                default:
                    break;
                }
            }
        }