本文整理汇总了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;
}
示例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;
}
示例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();
//.........这里部分代码省略.........
示例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;
}
}
}
示例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();
}
}
示例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;
}