Exemple #1
0
        private async void PerformSearch()
        {
            SetStatus("Searching...");

            Program.Log.InfoFormat(
                "Searching with the following filters: Name: {0}, Sort: {1}, Type: {2}, Size : {3}, Last Modified : {4} to {5}",
                TextboxSearchName.Text,
                SearchSortBy.ToString(),
                SearchFileType.ToArray(),
                NumericSearchGreaterThan.Value,
                DateTimeMinMTime.Value,
                DateTimeMaxMTime.Value);

            EnableSearchControls(false);
            DataGridFiles.Rows.Clear();
            var timer = new Stopwatch();

            timer.Start();

            foreach (FileItem file in
                     from DataItem bookmark in
                     await DataCache.SearchRecords(
                         TextboxSearchName.Text,
                         SearchFileType,
                         StringExtensions.ParseFileSize($"{NumericSearchGreaterThan.Value} {SearchSizePrefix}"),
                         DateTimeMinMTime.Value,
                         DateTimeMaxMTime.Value)
                     let file = FileExtensions.DataItemToFile(bookmark)
                                select file)
            {
                _ = DataGridFiles.Rows.Add(file.Name,
                                           StringExtensions.BytesToPrefix(file.Size),
                                           file.Mtime.ToLocalTime(),
                                           file.Url);
            }

            timer.Stop();
            SetStatus(message: $"{StringExtensions.FormatNumber(DataGridFiles.Rows.Count)} Results ({timer.Elapsed.TotalSeconds:0.000} seconds)");
            timer.Reset();
            EnableSearchControls(true);
        }
Exemple #2
0
        private void BeginSearch()
        {
            SetStatus("Searching...");
            Program.Log.InfoFormat("Searching. Filters: Name: {0}, Sort: {1}, Type: {2}, Size : {3}, Last Modified : {4} to {5}", TextboxSearchName.Text, SearchSortBy.ToString(), SearchFileType.ToArray(), NumericSearchGreaterThan.Value, DatetimeSearchLastModifiedMin.Value, DatetimeSearchLastModifiedMax.Value);
            EnableSearchControls(false);
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            WorkerExtensions.RunWorkAsync(() => _dataCache.Search(SearchSortBy, TextboxSearchName.Text, SearchFileType, StringExtensions.ParseFileSize(NumericSearchGreaterThan.Value + " " + SearchSizePrefix), DatetimeSearchLastModifiedMin.Value, DatetimeSearchLastModifiedMax.Value), (data) =>
            {
                if (InvokeRequired)
                {
                    Invoke(new BeginSearchCallBack(BeginSearch), new object[] { });
                }
                else
                {
                    DataGridFiles.Rows.Clear();
                    foreach (var file in data)
                    {
                        DataGridFiles.Rows.Add(file.Name, StringExtensions.BytesToPrefix(file.Size), file.LastModified.ToLocalTime(), file.Url);
                    }
                    stopWatch.Stop();
                    SetStatus($"{StringExtensions.FormatNumber(DataGridFiles.Rows.Count)} Results ({stopWatch.Elapsed.TotalSeconds:0.000} seconds)");
                    stopWatch.Reset();
                    EnableSearchControls(true);
                }
            });
        }
Exemple #3
0
 private void MenuSearchSearx_Click(object sender, EventArgs e)
 {
     Process.Start(
         $"{Engines.Searx}{TextboxSearchName.Text} %2B({string.Join("|", SearchFileType.ToArray()).ToLower()}) %2Dinurl:(jsp|pl|php|html|aspx|htm|cf|shtml) intitle:index.of %2Dinurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|index-of|wallywashis|downloadmana)");
 }