Exemplo n.º 1
0
 private void MenuSearchSearx_Click(object sender, EventArgs e)
 {
     Process.Start(UrlSearchSearx + string.Format("{0} %2B({1}) %2Dinurl:(jsp|pl|php|html|aspx|htm|cf|shtml) intitle:index.of %2Dinurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|index-of|wallywashis|downloadmana)", TextBoxSearchQuery.Text, string.Join("|", SelectedFilesType.ToArray()).ToLower()));
 }
Exemplo n.º 2
0
        public void QueryFiles()
        {
            SetStatus("Searching files...");
            Program.Log.InfoFormat("Starting to search files. Preferences - Query: {0}, Sort: {1}, Type: {2}, Host: {3}", TextBoxSearchQuery.Text, SelectedFilesSort.ToString(), SelectedFilesType.ToArray(), SelectedFilesHost);
            Stopwatch stopWatch = new Stopwatch();

            EnableSearchControls(false);
            stopWatch.Start();
            BackGroundWorker.RunWorkAsync(() => Query.Search(DbOpenFiles, TextBoxSearchQuery.Text, SelectedFilesSort, SelectedFilesType, SelectedFilesHost), (ftpFiles) =>
            {
                if (InvokeRequired)
                {
                    Invoke(new QueryFilesCallBack(QueryFiles), new object[] { });
                }
                else
                {
                    DataGridFiles.Rows.Clear();
                    ComboBoxHost.Items.Clear(); ComboBoxHost.Items.Add("Any");
                    //foreach (var ftpFile in data)
                    //{
                    //    DataGridFiles.Rows.Add(ftpFile.Name, StringExtensions.BytesToPrefix(ftpFile.Size), StringExtensions.TimeSpanAge(ftpFile.DateModified), new Uri(ftpFile.URL).Host, ftpFile.URL);
                    //    if (!(ComboBoxHost.Items.Contains(new Uri(ftpFile.URL).Host)))
                    //        ComboBoxHost.Items.Add(new Uri(ftpFile.URL).Host);
                    //}

                    ftpFiles.ForEach(ftpFile =>
                    {
                        DataGridFiles.Rows.Add(ftpFile.Name, StringExtensions.BytesToPrefix(ftpFile.Size), StringExtensions.TimeSpanAge(ftpFile.DateModified), new Uri(ftpFile.URL).Host, ftpFile.URL);
                        if (!(ComboBoxHost.Items.Contains(new Uri(ftpFile.URL).Host)))
                        {
                            ComboBoxHost.Items.Add(new Uri(ftpFile.URL).Host);
                        }
                    });

                    //for (int i = 0; i < ftpFiles.Count; ++i)
                    //{
                    //    var ftpFile = ftpFiles[i];
                    //    DataGridFiles.Rows.Add(ftpFile.Name, StringExtensions.BytesToPrefix(ftpFile.Size), StringExtensions.TimeSpanAge(ftpFile.DateModified), new Uri(ftpFile.URL).Host, ftpFile.URL);
                    //    if (!(ComboBoxHost.Items.Contains(new Uri(ftpFile.URL).Host))) ComboBoxHost.Items.Add(new Uri(ftpFile.URL).Host);
                    //}

                    stopWatch.Stop();
                    SetStatus(string.Format("{0} Files ({1} seconds)", StringExtensions.FormatNumber(DataGridFiles.Rows.Count.ToString()), String.Format("{0:0.000}", stopWatch.Elapsed.TotalSeconds)));
                    stopWatch.Reset();

                    // Sets selected item to host
                    if (SelectedFilesHost == "")
                    {
                        ComboBoxHost.SelectedIndex = 0;
                    }
                    else
                    {
                        ComboBoxHost.SelectedItem = SelectedFilesHost;
                    }

                    EnableSearchControls(true);
                    Program.Log.Info(StatusStripStatus.Text);
                }
            });
        }
Exemplo n.º 3
0
        private void comboBoxSearchHome_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxSearchHome.SelectedIndex == 0 | comboBoxSearchHome.SelectedIndex == -1)
            {
                SelectedFilesSearch = exploreUrlGoogle;
            }
            else if (comboBoxSearchHome.SelectedIndex == 1)
            {
                SelectedFilesSearch = exploreUrlGoogol;
            }
            else if (comboBoxSearchHome.SelectedIndex == 2)
            {
                SelectedFilesSearch = exploreUrlStartpage;
            }
            else if (comboBoxSearchHome.SelectedIndex == 3)
            {
                SelectedFilesSearch = exploreUrlSearx;
            }

            Process.Start(SelectedFilesSearch + String.Format("{0} %2B({1}) %2Dinurl:(jsp|pl|php|html|aspx|htm|cf|shtml) intitle:index.of %2Dinurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|index-of|wallywashis|downloadmana)", textBoxSearchHome.Text, String.Join("|", SelectedFilesType.ToArray()).ToLower()));
        }