private void Open()
        {
            Regex unit = new Regex(@"(?<sequence>\d+)\r\n(?<start>\d{2}\:\d{2}\:\d{2},\d{3}) --\> " + @"(?<end>\d{2}\:\d{2}\:\d{2},\d{3})\r\n(?<text>[\s\S]*?\r\n\r\n)", RegexOptions.Compiled | RegexOptions.ECMAScript);

            _openFileDialog.Filter = @"SRT File|*.srt";
            if (_openFileDialog.ShowDialog() == DialogResult.OK)
            {
                //textSrtFile.Text = sfd.FileName;
                var sw = new StreamReader(_openFileDialog.FileName);

                string subtitles = sw.ReadToEnd();

                MatchCollection matchCollection = unit.Matches(subtitles);
                int             serial          = 0;

                listSubtitles.Items.Clear();
                foreach (Match match in matchCollection)
                {
                    Int32.TryParse(match.Groups[1].Value, out serial);
                    var subtitle = new Subtitle
                    {
                        Serial = serial,
                        Start  = match.Groups[2].Value,
                        End    = match.Groups[3].Value,
                        Text   = match.Groups[4].Value.Trim()
                    };
                    listSubtitles.Items.Add(subtitle.ToListViewItem());
                }


                sw.Close();
            }
        }
        private void tbAdd_Click(object sender, EventArgs e)
        {
            var subtitle = new Subtitle()
            {
                Text = textSRT.Text, Serial = listSubtitles.Items.Count
            };

            listSubtitles.Items.Add(subtitle.ToListViewItem());
        }
        private void tbReload_Click(object sender, EventArgs e)
        {
            var strings = textSRT.Text.Split('\n');

            listSubtitles.Items.Clear();
            foreach (var s in strings)
            {
                if (s.Trim().Length != 0)
                {
                    var subtitle = new Subtitle()
                    {
                        Text = s.Trim(), Serial = listSubtitles.Items.Count + 1
                    };
                    listSubtitles.Items.Add(subtitle.ToListViewItem());
                }
            }
        }
 private void tbReload_Click(object sender, EventArgs e)
 {
     var strings = textSRT.Text.Split('\n');
     listSubtitles.Items.Clear();
     foreach (var s in strings)
     {
         if (s.Trim().Length != 0)
         {
             var subtitle = new Subtitle() { Text = s.Trim(), Serial = listSubtitles.Items.Count + 1 };
             listSubtitles.Items.Add(subtitle.ToListViewItem());
         }
     }
 }
 private void tbAdd_Click(object sender, EventArgs e)
 {
     var subtitle = new Subtitle() { Text = textSRT.Text, Serial = listSubtitles.Items.Count };
     listSubtitles.Items.Add(subtitle.ToListViewItem());
 }
        private void Open()
        {
            Regex unit = new Regex(@"(?<sequence>\d+)\r\n(?<start>\d{2}\:\d{2}\:\d{2},\d{3}) --\> " + @"(?<end>\d{2}\:\d{2}\:\d{2},\d{3})\r\n(?<text>[\s\S]*?\r\n\r\n)", RegexOptions.Compiled | RegexOptions.ECMAScript);

            _openFileDialog.Filter = @"SRT File|*.srt";
            if (_openFileDialog.ShowDialog() == DialogResult.OK)
            {
                //textSrtFile.Text = sfd.FileName;
                var sw = new StreamReader(_openFileDialog.FileName);

                string subtitles = sw.ReadToEnd();

                MatchCollection matchCollection = unit.Matches(subtitles);
                int serial = 0;

                listSubtitles.Items.Clear();
                foreach (Match match in matchCollection)
                {
                    Int32.TryParse(match.Groups[1].Value, out serial);
                    var subtitle = new Subtitle
                                       {
                                           Serial = serial,
                                           Start = match.Groups[2].Value,
                                           End = match.Groups[3].Value,
                                           Text = match.Groups[4].Value.Trim()
                                       };
                    listSubtitles.Items.Add(subtitle.ToListViewItem());
                }

                sw.Close();
            }
        }