当前位置: 首页>>代码示例>>C#>>正文


C# Subtitle.ReloadLoadSubtitle方法代码示例

本文整理汇总了C#中Subtitle.ReloadLoadSubtitle方法的典型用法代码示例。如果您正苦于以下问题:C# Subtitle.ReloadLoadSubtitle方法的具体用法?C# Subtitle.ReloadLoadSubtitle怎么用?C# Subtitle.ReloadLoadSubtitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subtitle的用法示例。


在下文中一共展示了Subtitle.ReloadLoadSubtitle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsSubtitle

        private bool IsSubtitle(string s)
        {
            if (s.Contains("\0"))
            {
                return false;
            }
            if (!s.Contains("xml") && !s.Contains(" --> ") && !s.Contains("00:00"))
            {
                return false;
            }

            var list = new List<string>(s.SplitToLines());
            var subtitle = new Subtitle();
            return subtitle.ReloadLoadSubtitle(list, null, null) != null;
        }
开发者ID:YangEunYong,项目名称:subtitleedit,代码行数:15,代码来源:MxfParser.cs

示例2: IsSubtitle

        private bool IsSubtitle(string s)
        {
            if (s.Contains("\0"))
            {
                return false;
            }

            if (!s.Contains("xml") && !s.Contains(" --> ") && !s.Contains("00:00"))
            {
                return false;
            }

            var list = s.Replace(Environment.NewLine, "\r").Replace("\n", "\r").Split('\r').ToList();
            var subtitle = new Subtitle();
            return subtitle.ReloadLoadSubtitle(list, null) != null;
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni-Projects,代码行数:16,代码来源:MxfParser.cs

示例3: OpenSubtitle

        private void OpenSubtitle(string fileName, Encoding encoding, string videoFileName, string originalFileName)
        {
            if (File.Exists(fileName))
            {
                bool videoFileLoaded = false;
                var file = new FileInfo(fileName);
                var ext = file.Extension.ToLowerInvariant();

                // save last first visible index + first selected index from listview
                if (!string.IsNullOrEmpty(_fileName))
                    Configuration.Settings.RecentFiles.Add(_fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, originalFileName);

                openFileDialog1.InitialDirectory = file.DirectoryName;

                if (ext == ".sub" && IsVobSubFile(fileName, false))
                {
                    if (MessageBox.Show(this, _language.ImportThisVobSubSubtitle, _title, MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        ImportAndOcrVobSubSubtitleNew(fileName, _loading);
                    }
                    return;
                }

                if (ext == ".sup")
                {
                    if (FileUtil.IsBluRaySup(fileName))
                    {
                        ImportAndOcrBluRaySup(fileName, _loading);
                        return;
                    }
                    else if (FileUtil.IsSpDvdSup(fileName))
                    {
                        ImportAndOcrSpDvdSup(fileName, _loading);
                        return;
                    }
                }

                if (ext == ".mkv" || ext == ".mks")
                {
                    ImportSubtitleFromMatroskaFile(fileName);
                    return;
                }

                if (ext == ".divx" || ext == ".avi")
                {
                    if (ImportSubtitleFromDivX(fileName))
                        return;
                }

                if ((ext == ".ts" || ext == ".rec" || ext == ".mpeg" || ext == ".mpg") && file.Length > 10000 && FileUtil.IsTransportStream(fileName))
                {
                    ImportSubtitleFromTransportStream(fileName);
                    return;
                }

                if (((ext == ".m2ts" || ext == ".ts") && file.Length > 10000 && FileUtil.IsM2TransportStream(fileName)) ||
                    (ext == ".textst" && FileUtil.IsMpeg2PrivateStream2(fileName)))
                {
                    bool isTextSt = false;
                    if (file.Length < 2000000)
                    {
                        var textSt = new TextST();
                        isTextSt = textSt.IsMine(null, fileName);
                    }

                    if (!isTextSt)
                    {
                        ImportSubtitleFromTransportStream(fileName);
                        return;
                    }
                }

                if ((ext == ".mp4" || ext == ".m4v" || ext == ".3gp") && file.Length > 10000)
                {
                    if (ImportSubtitleFromMp4(fileName))
                        OpenVideo(fileName);
                    return;
                }

                if (ext == ".mxf")
                {
                    if (FileUtil.IsMaterialExchangeFormat(fileName))
                    {
                        var parser = new MxfParser(fileName);
                        if (parser.IsValid)
                        {
                            var subtitles = parser.GetSubtitles();
                            if (subtitles.Count > 0)
                            {
                                SetEncoding(Configuration.Settings.General.DefaultEncoding);
                                encoding = GetCurrentEncoding();
                                var list = new List<string>(subtitles[0].SplitToLines());
                                _subtitle = new Subtitle();
                                var mxfFormat = _subtitle.ReloadLoadSubtitle(list, null, null);
                                SetCurrentFormat(mxfFormat);
                                _fileName = Path.GetFileNameWithoutExtension(fileName);
                                SetTitle();
                                ShowStatus(string.Format(_language.LoadedSubtitleX, _fileName));
                                _sourceViewChange = false;
                                _changeSubtitleToString = _subtitle.GetFastHashCode();
//.........这里部分代码省略.........
开发者ID:m1croN,项目名称:subtitleedit,代码行数:101,代码来源:Main.cs

示例4: TabControlSubtitleSelecting

        private void TabControlSubtitleSelecting(object sender, TabControlCancelEventArgs e)
        {
            if (this.tabControlSubtitle.SelectedIndex != TabControlSourceView && this.textBoxSource.Text.Trim().Length > 1)
            {
                var currentFormat = this.GetCurrentSubtitleFormat();
                if (currentFormat != null && !currentFormat.IsTextBased)
                {
                    return;
                }

                var temp = new Subtitle(this._subtitle);
                SubtitleFormat format = temp.ReloadLoadSubtitle(new List<string>(this.textBoxSource.Lines), null);
                if (format == null)
                {
                    e.Cancel = true;
                }
            }
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni-Projects,代码行数:18,代码来源:Main.cs

示例5: ReloadFromSourceView

        private void ReloadFromSourceView()
        {
            if (this._sourceViewChange)
            {
                this.SaveSubtitleListviewIndices();
                if (!string.IsNullOrWhiteSpace(this.textBoxSource.Text))
                {
                    var temp = new Subtitle(this._subtitle);
                    SubtitleFormat format = this.GetCurrentSubtitleFormat();
                    var list = new List<string>(this.textBoxSource.Lines);
                    if (format != null && format.IsMine(list, null))
                    {
                        format.LoadSubtitle(temp, list, null);
                    }
                    else
                    {
                        format = temp.ReloadLoadSubtitle(new List<string>(this.textBoxSource.Lines), null);
                    }

                    if (format == null)
                    {
                        MessageBox.Show(this._language.UnableToParseSourceView);
                        return;
                    }

                    this._sourceViewChange = false;
                    this.MakeHistoryForUndo(this._language.BeforeChangesMadeInSourceView);
                    this._subtitle.ReloadLoadSubtitle(new List<string>(this.textBoxSource.Lines), null);
                    if (format.IsFrameBased)
                    {
                        this._subtitle.CalculateTimeCodesFromFrameNumbers(this.CurrentFrameRate);
                    }

                    int index = 0;
                    foreach (object obj in this.comboBoxSubtitleFormats.Items)
                    {
                        if (obj.ToString() == format.FriendlyName)
                        {
                            this.comboBoxSubtitleFormats.SelectedIndex = index;
                        }

                        index++;
                    }

                    if (format.GetType() == typeof(AdvancedSubStationAlpha) || format.GetType() == typeof(SubStationAlpha))
                    {
                        string errors = AdvancedSubStationAlpha.CheckForErrors(this._subtitle.Header);
                        if (!string.IsNullOrEmpty(errors))
                        {
                            MessageBox.Show(errors, this.Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else if (format.GetType() == typeof(SubRip))
                    {
                        string errors = (format as SubRip).Errors;
                        if (!string.IsNullOrEmpty(errors))
                        {
                            MessageBox.Show(errors, this.Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else if (format.GetType() == typeof(MicroDvd))
                    {
                        string errors = (format as MicroDvd).Errors;
                        if (!string.IsNullOrEmpty(errors))
                        {
                            MessageBox.Show(errors, this.Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                else
                {
                    this._sourceViewChange = false;
                    this.MakeHistoryForUndo(this._language.BeforeChangesMadeInSourceView);
                    this._sourceViewChange = false;
                    this._subtitle.Paragraphs.Clear();
                }

                this._subtitleListViewIndex = -1;
                this.SubtitleListview1.Fill(this._subtitle, this._subtitleAlternate);
                this.RestoreSubtitleListviewIndices();
            }
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni-Projects,代码行数:82,代码来源:Main.cs

示例6: IsSubtitle

        private bool IsSubtitle(string s)
        {
            if (s.Contains("\0"))
            {
                return false;
            }

            if (!s.Contains("xml") && !s.Contains(" --> ") && !s.Contains("00:00"))
            {
                return false;
            }

            List<string> list = new List<string>();
            foreach (string line in s.Replace(Environment.NewLine, "\r").Replace("\n", "\r").Split('\r'))
            {
                list.Add(line);
            }

            Subtitle subtitle = new Subtitle();
            return subtitle.ReloadLoadSubtitle(list, null) != null;
        }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:21,代码来源:MxfParser.cs


注:本文中的Subtitle.ReloadLoadSubtitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。