private void btnPreview_Click(object sender, EventArgs e)
        {
            var filePaths = txbFilePath.Text.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

            if (filePaths.Length == 0)
            {
                MessageBox.Show("未选择字幕文件");
                return;
            }
            SubtitleFiles.Clear();

            stOperator = SubtitleHelper.GetOperatorByFileName(filePaths[0]);
            foreach (var filePath in filePaths)
            {
                var content = FileOperationHelper.ReadFile(filePath);
                var srts    = stOperator.Parse(content);
                SubtitleFiles.Add(filePath, srts);
            }
            richTextBox1.Clear();
            foreach (var subtitleFile in SubtitleFiles)
            {
                richTextBox1.AppendText("----" + subtitleFile.Key + "----\r\n");
                richTextBox1.AppendText(stOperator.Subtitle2String(subtitleFile.Value));
            }
        }
Пример #2
0
        private void ReadAndShowSubtitle()
        {
            var txt = FileOperationHelper.ReadFile(txbSubtitleFilePath.Text);

            stOperator = SubtitleHelper.GetOperatorByFileName(txbSubtitleFilePath.Text);
            var srts = stOperator.Parse(txt);

            srts = stOperator.RemoveChinese(srts);
            srts = stOperator.RemoveFormat(srts);
            ShowSubtitleText(srts.Bodies.Values);
            subtitle = srts;
        }
Пример #3
0
        private void btnParse_Click(object sender, EventArgs e)
        {
            var txt = FileOperationHelper.ReadFile(txbSubtitleFilePath.Text);

            stOperator = SubtitleHelper.GetOperatorByFileName(txbSubtitleFilePath.Text);
            var srts = stOperator.Parse(txt);

            srts = stOperator.RemoveChinese(srts);

            ShowSubtitleText(srts.Bodies);
            subtitle = srts;
        }
Пример #4
0
        private void ReadAndShowSubtitle()
        {
            var txt = FileOperationHelper.ReadFile(txbSubtitleFilePath.Text);
            stOperator = SubtitleHelper.GetOperatorByFileName(txbSubtitleFilePath.Text);
            var srts = stOperator.Parse(txt);

            srts = stOperator.RemoveChinese(srts);
            srts = stOperator.RemoveFormat(srts);
            ShowSubtitleText(srts.Bodies.Values);
            subtitle = srts;
        }
        private void btnPreview_Click(object sender, EventArgs e)
        {
            var filePaths = txbFilePath.Text.Split(new char[] {'|'}, StringSplitOptions.RemoveEmptyEntries);
            if (filePaths.Length == 0)
            {
                MessageBox.Show("未选择字幕文件");
                return;
            }
            SubtitleFiles.Clear();

            stOperator = SubtitleHelper.GetOperatorByFileName(filePaths[0]);
            foreach (var filePath in filePaths)
            {
                var content = FileOperationHelper.ReadFile(filePath);
                var srts = stOperator.Parse(content);
                SubtitleFiles.Add(filePath, srts);
            }
            richTextBox1.Clear();
            foreach (var subtitleFile in SubtitleFiles)
            {
                richTextBox1.AppendText("----"+subtitleFile.Key+"----\r\n");
                richTextBox1.AppendText(stOperator.Subtitle2String(subtitleFile.Value));
            }
        }