示例#1
0
        /// <summary>
        /// Формирует строку фильтров
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FindSignals_Click(object sender, RoutedEventArgs e)
        {
            this.CheckCountrySelection();
            this.CheckCategorySelection();
            this.CheckDiapazonSelection();
            this.CheckModulationSelection();
            FILTER filter      = new FILTER(countryes, categoryes, diapazon, modulation, demodulation);
            string FilterQuery = SELECT + FROM + filter.GetFilterQuery();

            FilterExecuter.Execute(FilterQuery);
        }
示例#2
0
        private async void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            SearchButton.Visibility = System.Windows.Visibility.Hidden;
            MessageLable.Visibility = System.Windows.Visibility.Visible;
            Shazam searcher = new Shazam();
            Dictionary <double, string> result = new Dictionary <double, string>();

            Files = Directory.GetFiles(Environment.CurrentDirectory + "\\Data\\Sounds");
            foreach (var file in Files)
            {
                WaveFile whereToFind = new WaveFile(file);
                if ((bool)QuickSearch.IsChecked)
                {
                    int whatToFindMiddlePosition = (int)(whatToFind.Data.Length / 2);
                    searcher.Search(whatToFind, whereToFind, whatToFindMiddlePosition, whatToFindMiddlePosition - 256);
                }
                if ((bool)DefaultSearch.IsChecked)
                {
                    int stepInWhatToFind = whatToFind.Data.Length / 3;
                    searcher.Search(whatToFind, whereToFind, stepInWhatToFind, 0);
                }
                if ((bool)DeepSearch.IsChecked)
                {
                    searcher.Search(whatToFind, whereToFind);
                }
                await Task.Delay(10);

                progressBar.Value++;
                MessageLable.Content = searcher.outputPersents + " " + whereToFind.Name.Replace(Environment.CurrentDirectory + "\\Data\\Sounds\\", null);


                if (searcher.MaxFileCorell > 0.75)
                {
                    string name = whereToFind.Name.Replace(Environment.CurrentDirectory + "\\Data\\Sounds\\", null);
                    name = name.Replace(".wav", null);
                    result.Add(searcher.MaxFileCorell, name);
                }
            }
            progressBar.Value       = 0;
            MessageLable.Content    = "";
            SearchButton.Visibility = System.Windows.Visibility.Visible;
            MessageBox.Show("Максимальное сходство: " + searcher.outputPersents + " " + searcher.fileName.Replace(Environment.CurrentDirectory + "\\Data\\Sounds\\", null));
            FilterExecuter.CreateSearchDTable(result);
            this.Close();
        }