Пример #1
0
        internal void Trim(ThemeListFile themeListFile, string lyricsInputFileName, string lyricsOutputFileName)
        {
            using (TextReader textReader = new StreamReader(lyricsInputFileName))
            {
                using (TextWriter TextWriter = new StreamWriter(lyricsOutputFileName))
                {
                    string currentLine;
                    while (true)
                    {
                        currentLine = textReader.ReadLine();

                        if (currentLine == null)
                            break;

                        currentLine = currentLine.Trim().ToLowerInvariant();

                        if (currentLine.Length > 0)
                        {

                            WordStringStream wordStringStream = new WordStringStream(currentLine);

                            bool isInTheme = false;
                            foreach (string word in wordStringStream)
                            {
                                if (themeListFile.ContainsWord(word,true))
                                {
                                    isInTheme = true;
                                    TextWriter.WriteLine(currentLine);
                                    break;
                                }
                            }
                            if (!isInTheme)
                            {
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Show theme sorting form
        /// </summary>
        /// <param name="currentThemeListFile">current theme list file</param>
        /// <param name="word">word</param>
        public void ShowThemeSortingForm(ThemeListFile currentThemeListFile, string word)
        {
            this.currentWord.Text = word;
            if (themeSelectorLayout.Children.Count < 1)
            {
                IEnumerable<string> sortedThemeNameList = from themeName in currentThemeListFile orderby themeName select themeName;

                foreach (string themeName in sortedThemeNameList)
                    addThemeSelector(new ThemeSelector(themeName));
            }
        }