private static IEnumerable<string> SplitSongsBySpaces(StreamReader fr, SongStreamSplitProperties props)
        {
            List<string> lines = new List<string>();
            while (!fr.EndOfStream) lines.Add(fr.ReadLine().TrimEnd());
            int i = 0;
            // odstranit prazdne radky na konci
            while (lines.Count > 0 && lines[lines.Count - 1] == "") lines.RemoveAt(lines.Count - 1);

            while (i < lines.Count)
            {
                List<string> songlines = new List<string>();
                while (i < lines.Count && lines[i] == "") i++; // preskoc prazdne
                for (; ; ) // cyklus pres radky jedne pisne
                {
                    bool issep = true;
                    for (int j = 0; i + j < lines.Count && j < props.EmptyLineCount; j++)
                    {
                        if (lines[i + j] != "")
                        {
                            issep = false;
                            break;
                        }
                    }

                    if (issep && props.ConditionalSplit) // jeste kontrola prvni radky
                    {
                        while (i < lines.Count && lines[i] == "") i++; // preskoc prazdne
                        if (i < lines.Count && SongDataAnalyser.LooksLikeTextLine(lines[i]))
                        {
                            issep = false;
                        }
                        else if (i < lines.Count) songlines.Add(""); // aby sme nezapomneli prazdnou radku
                    }

                    if (issep)
                    {
                        break;
                    }

                    if (i >= lines.Count) break;
                    songlines.Add(lines[i]);
                    i++;
                }
                if (songlines.Count > 0)
                {
                    yield return String.Join("\n", songlines.ToArray());
                }
            }
        }
 private static IEnumerable<string> SplitSongsBySeparator(TextReader fr, SongStreamSplitProperties props)
 {
     string data = fr.ReadToEnd();
     int lastindex = 0;
     for (; ; )
     {
         int index = data.IndexOf(props.SongSeparator, lastindex);
         if (index < 0) break;
         yield return data.Substring(lastindex, index - lastindex);
         lastindex = index + props.SongSeparator.Length;
     }
     if (lastindex < data.Length) yield return data.Substring(lastindex);
 }
 public static IEnumerable<string> SplitSongs(StreamReader fr, SongStreamSplitProperties props)
 {
     if (props.PerformSplit)
     {
         if (props.EmptyLineCount > 0) // rozdeleni rizene poctem prazdnych radek
         {
             return SplitSongsBySpaces(fr, props);
         }
         else if (props.SongSeparator != "")
         {
             return SplitSongsBySeparator(fr, props);
         }
     }
     return new string[] { fr.ReadToEnd() };
 }