本文整理汇总了C#中Nikse类的典型用法代码示例。如果您正苦于以下问题:C# Nikse类的具体用法?C# Nikse怎么用?C# Nikse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Nikse类属于命名空间,在下文中一共展示了Nikse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeFixCommonErrorsLine
private static void InitializeFixCommonErrorsLine(Nikse.SubtitleEdit.Forms.FixCommonErrors target, string line, string line2)
{
var subtitle = new Subtitle();
subtitle.Paragraphs.Add(new Paragraph(line, 100, 10000));
subtitle.Paragraphs.Add(new Paragraph(line2, 10001, 30000));
target.Initialize(subtitle, new Nikse.SubtitleEdit.Logic.SubtitleFormats.SubRip(), System.Text.Encoding.UTF8);
}
示例2: Initialize
internal void Initialize(Nikse.SubtitleEdit.Logic.Networking.NikseWebServiceSession networkSession)
{
_networkSession = networkSession;
Text = Configuration.Settings.Language.NetworkChat.Title + " - " + _networkSession.CurrentUser.UserName;
listViewUsers.Items.Clear();
foreach (var user in _networkSession.Users)
{
AddUser(user);
}
listViewChat.Items.Clear();
foreach (var message in _networkSession.ChatLog)
{
AddChatMessage(message.User, message.Message);
listViewChat.EnsureVisible(listViewChat.Items.Count - 1);
}
}
示例3: Initialize
internal bool Initialize(string vobSubFileName, VobSubOcrSettings vobSubOcrSettings, bool useNewSubIdxCode, Nikse.SubtitleEdit.Forms.Main main)
{
_main = main;
_useNewSubIdxCode = useNewSubIdxCode;
buttonOK.Enabled = false;
buttonCancel.Enabled = false;
buttonStartOcr.Enabled = false;
buttonStop.Enabled = false;
buttonNewCharacterDatabase.Enabled = false;
buttonEditCharacterDatabase.Enabled = false;
labelStatus.Text = string.Empty;
progressBar1.Visible = false;
progressBar1.Maximum = 100;
progressBar1.Value = 0;
numericUpDownPixelsIsSpace.Value = vobSubOcrSettings.XOrMorePixelsMakesSpace;
numericUpDownNumberOfPixelsIsSpaceNOCR.Value = vobSubOcrSettings.XOrMorePixelsMakesSpace;
_vobSubOcrSettings = vobSubOcrSettings;
InitializeModi();
InitializeTesseract();
LoadImageCompareCharacterDatabaseList();
SetOcrMethod();
FileName = vobSubFileName;
Text += " - " + Path.GetFileName(FileName);
return InitializeSubIdx(vobSubFileName);
}
示例4: AudioWaveForm_OnPositionSelected
void AudioWaveForm_OnPositionSelected(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
mediaPlayer.CurrentPosition = e.Seconds;
if (e.Paragraph != null)
SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.GetIndex(e.Paragraph));
}
示例5: MovePrevNext
private void MovePrevNext(Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e, Paragraph paragraph, Paragraph beforeParagraph, int index)
{
if (e.MovePreviousOrNext)
{
if (e.MouseDownParagraphType == AudioVisualizer.MouseDownParagraphType.Start)
{
var prev = _subtitle.GetParagraphOrDefault(index - 1);
if (prev != null)
{
prev.EndTime.TotalMilliseconds = prev.EndTime.TotalMilliseconds + (e.Paragraph.StartTime.TotalMilliseconds - beforeParagraph.StartTime.TotalMilliseconds);
SubtitleListview1.SetStartTime(index - 1, prev);
SubtitleListview1.SetDuration(index - 1, prev);
audioVisualizer.Invalidate();
}
}
else if (e.MouseDownParagraphType == AudioVisualizer.MouseDownParagraphType.End)
{
var next = _subtitle.GetParagraphOrDefault(index + 1);
if (next != null)
{
next.StartTime.TotalMilliseconds = next.StartTime.TotalMilliseconds + (e.Paragraph.EndTime.TotalMilliseconds - beforeParagraph.EndTime.TotalMilliseconds);
SubtitleListview1.SetStartTime(index + 1, next);
SubtitleListview1.SetDuration(index + 1, next);
audioVisualizer.Invalidate();
}
}
}
}
示例6: AudioWaveForm_OnTimeChanged
void AudioWaveForm_OnTimeChanged(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
var paragraph = e.Paragraph;
var beforeParagraph = e.BeforeParagraph;
if (beforeParagraph == null)
beforeParagraph = paragraph;
if (beforeParagraph.StartTime.TotalMilliseconds == paragraph.StartTime.TotalMilliseconds &&
beforeParagraph.EndTime.TotalMilliseconds == paragraph.EndTime.TotalMilliseconds)
_makeHistoryPaused = true;
int selectedIndex = FirstSelectedIndex;
int index = _subtitle.Paragraphs.IndexOf(paragraph);
if (index == _subtitleListViewIndex)
{
// Make history item for rollback (change paragraph back for history + change again)
_subtitle.Paragraphs[index] = new Paragraph(beforeParagraph);
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.VideoControls.BeforeChangingTimeInWaveFormX, "#" + paragraph.Number + " " + paragraph.Text));
_subtitle.Paragraphs[index] = paragraph;
_makeHistoryPaused = true;
MovePrevNext(e, paragraph, beforeParagraph, index);
Paragraph original = null;
if (_subtitleAlternate != null && SubtitleListview1.IsAlternateTextColumnVisible)
original = Utilities.GetOriginalParagraph(index, beforeParagraph, _subtitleAlternate.Paragraphs);
if (Configuration.Settings.General.UseTimeFormatHHMMSSFF)
{ // so we don't get weird rounds we'll use whole frames when moving start time
double fr = 1000.0 / Configuration.Settings.General.CurrentFrameRate;
if (e.BeforeParagraph != null && e.BeforeParagraph.StartTime.TotalMilliseconds != e.Paragraph.StartTime.TotalMilliseconds &&
e.BeforeParagraph.Duration.TotalMilliseconds == e.Paragraph.Duration.TotalMilliseconds)
{
// move paragraph
paragraph.StartTime.TotalMilliseconds = ((int)Math.Round(paragraph.StartTime.TotalMilliseconds / fr)) * fr;
paragraph.EndTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds + e.BeforeParagraph.Duration.TotalMilliseconds;
}
else if (e.BeforeParagraph != null && e.BeforeParagraph.EndTime.TotalMilliseconds == e.Paragraph.EndTime.TotalMilliseconds)
{
paragraph.EndTime.TotalMilliseconds = ((int)Math.Round(paragraph.EndTime.TotalMilliseconds / fr)) * fr;
int end = SubtitleFormat.MillisecondsToFrames(paragraph.EndTime.TotalMilliseconds);
int dur = SubtitleFormat.MillisecondsToFrames(paragraph.Duration.TotalMilliseconds);
paragraph.StartTime.TotalMilliseconds = SubtitleFormat.FramesToMilliseconds(end - dur);
}
}
timeUpDownStartTime.TimeCode = paragraph.StartTime;
decimal durationInSeconds = (decimal) (paragraph.Duration.TotalSeconds);
if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum)
SetDurationInSeconds((double)durationInSeconds);
if (original != null)
{
original.StartTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds;
original.EndTime.TotalMilliseconds = paragraph.EndTime.TotalMilliseconds;
}
}
else
{
if (_subtitleAlternate != null && SubtitleListview1.IsAlternateTextColumnVisible && Configuration.Settings.General.ShowOriginalAsPreviewIfAvailable)
{
index = _subtitleAlternate.GetIndex(paragraph);
if (index >= 0)
{
// Make history item for rollback (change paragraph back for history + change again)
_subtitleAlternate.Paragraphs[index] = new Paragraph(beforeParagraph);
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.VideoControls.BeforeChangingTimeInWaveFormX, "#" + paragraph.Number + " " + paragraph.Text));
_subtitleAlternate.Paragraphs[index] = paragraph;
_makeHistoryPaused = true;
var current = Utilities.GetOriginalParagraph(index, beforeParagraph, _subtitle.Paragraphs);
if (current != null)
{
current.StartTime.TotalMilliseconds = paragraph.StartTime.TotalMilliseconds;
current.EndTime.TotalMilliseconds = paragraph.EndTime.TotalMilliseconds;
index = _subtitle.GetIndex(current);
SubtitleListview1.SetStartTime(index, paragraph);
SubtitleListview1.SetDuration(index, paragraph);
if (index == selectedIndex)
{
timeUpDownStartTime.TimeCode = paragraph.StartTime;
decimal durationInSeconds = (decimal)(paragraph.Duration.TotalSeconds);
if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum)
SetDurationInSeconds((double)durationInSeconds);
}
}
}
}
else if (_subtitleAlternate != null && SubtitleListview1.IsAlternateTextColumnVisible)
{
index = _subtitle.GetIndex(paragraph);
if (index >= 0)
{
// Make history item for rollback (change paragraph back for history + change again)
_subtitle.Paragraphs[index] = new Paragraph(beforeParagraph);
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.VideoControls.BeforeChangingTimeInWaveFormX, "#" + paragraph.Number + " " + paragraph.Text));
_subtitle.Paragraphs[index] = paragraph;
//.........这里部分代码省略.........
示例7: AudioWaveForm_OnNewSelectionRightClicked
void AudioWaveForm_OnNewSelectionRightClicked(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.GetIndex(e.Paragraph));
addParagraphHereToolStripMenuItem.Visible = true;
addParagraphAndPasteToolStripMenuItem.Visible = Clipboard.ContainsText();
deleteParagraphToolStripMenuItem.Visible = false;
toolStripMenuItemFocusTextbox.Visible = false;
splitToolStripMenuItem1.Visible = false;
mergeWithPreviousToolStripMenuItem.Visible = false;
mergeWithNextToolStripMenuItem.Visible = false;
contextMenuStripWaveForm.Show(MousePosition.X, MousePosition.Y);
}
示例8: AudioWaveForm_OnSingleClick
void AudioWaveForm_OnSingleClick(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
timerWaveForm.Stop();
_endSeconds = -1;
if (mediaPlayer.VideoPlayer != null)
mediaPlayer.Pause();
mediaPlayer.CurrentPosition = e.Seconds;
int index = -1;
if (SubtitleListview1.SelectedItems.Count > 0)
index = SubtitleListview1.SelectedItems[0].Index;
SetWaveFormPosition(audioVisualizer.StartPositionSeconds, e.Seconds, index);
timerWaveForm.Start();
}
示例9: AudioWaveForm_OnTimeChangedAndOffsetRest
void AudioWaveForm_OnTimeChangedAndOffsetRest(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
if (mediaPlayer.VideoPlayer == null)
return;
int index = _subtitle.Paragraphs.IndexOf(e.Paragraph);
if (index < 0)
{
if (_subtitleAlternate != null && SubtitleListview1.IsAlternateTextColumnVisible && Configuration.Settings.General.ShowOriginalAsPreviewIfAvailable)
{
index = _subtitleAlternate.GetIndex(e.Paragraph);
if (index >= 0)
{
var current = Utilities.GetOriginalParagraph(index, e.Paragraph, _subtitle.Paragraphs);
if (current != null)
{
index = _subtitle.Paragraphs.IndexOf(current);
}
}
}
else if (_subtitleAlternate != null && SubtitleListview1.IsAlternateTextColumnVisible)
{
index = _subtitle.GetIndex(e.Paragraph);
}
}
if (index >= 0)
{
SubtitleListview1.SelectIndexAndEnsureVisible(index);
mediaPlayer.CurrentPosition = e.Seconds;
ButtonSetStartAndOffsetRestClick(null, null);
}
audioVisualizer.Invalidate();
}
示例10: AudioWaveForm_OnDoubleClickNonParagraph
void AudioWaveForm_OnDoubleClickNonParagraph(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
if (mediaPlayer.VideoPlayer != null)
{
_endSeconds = -1;
if (e.Paragraph == null)
{
if (Configuration.Settings.VideoControls.WaveFormDoubleClickOnNonParagraphAction == "PlayPause")
mediaPlayer.TogglePlayPause();
}
else
{
SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.GetIndex(e.Paragraph));
}
}
}
示例11: AudioWaveForm_OnNonParagraphRightClicked
void AudioWaveForm_OnNonParagraphRightClicked(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
addParagraphHereToolStripMenuItem.Visible = false;
addParagraphAndPasteToolStripMenuItem.Visible = false;
deleteParagraphToolStripMenuItem.Visible = false;
toolStripMenuItemFocusTextbox.Visible = !string.IsNullOrEmpty(Configuration.Settings.Language.WaveForm.FocusTextBox); //TODO: Remove in 3.4
splitToolStripMenuItem1.Visible = false;
mergeWithPreviousToolStripMenuItem.Visible = false;
mergeWithNextToolStripMenuItem.Visible = false;
toolStripSeparator11.Visible = false;
toolStripMenuItemWaveFormPlaySelection.Visible = false;
toolStripSeparator24.Visible = false;
contextMenuStripWaveForm.Show(MousePosition.X, MousePosition.Y);
}
示例12: AudioWaveform_OnNonParagraphRightClicked
private void AudioWaveform_OnNonParagraphRightClicked(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
addParagraphHereToolStripMenuItem.Visible = false;
addParagraphAndPasteToolStripMenuItem.Visible = false;
deleteParagraphToolStripMenuItem.Visible = false;
toolStripMenuItemFocusTextbox.Visible = true;
splitToolStripMenuItem1.Visible = false;
mergeWithPreviousToolStripMenuItem.Visible = false;
mergeWithNextToolStripMenuItem.Visible = false;
toolStripSeparator11.Visible = false;
toolStripMenuItemWaveformPlaySelection.Visible = false;
toolStripSeparator24.Visible = false;
contextMenuStripWaveform.Show(MousePosition.X, MousePosition.Y);
}
示例13: AudioWaveForm_OnParagraphRightClicked
private void AudioWaveForm_OnParagraphRightClicked(object sender, Nikse.SubtitleEdit.Controls.AudioVisualizer.ParagraphEventArgs e)
{
SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.GetIndex(e.Paragraph));
addParagraphHereToolStripMenuItem.Visible = false;
addParagraphAndPasteToolStripMenuItem.Visible = false;
deleteParagraphToolStripMenuItem.Visible = true;
toolStripMenuItemFocusTextbox.Visible = true;
splitToolStripMenuItem1.Visible = true;
mergeWithPreviousToolStripMenuItem.Visible = true;
mergeWithNextToolStripMenuItem.Visible = true;
toolStripSeparator11.Visible = true;
toolStripMenuItemWaveFormPlaySelection.Visible = true;
toolStripSeparator24.Visible = true;
_audioWaveFormRightClickSeconds = e.Seconds;
contextMenuStripWaveForm.Show(MousePosition.X, MousePosition.Y);
}
示例14: ShowSubtitle
public void ShowSubtitle(Nikse.SubtitleEdit.Core.Paragraph p)
{
View.ShowSubtitle(p);
}
示例15: ShowSubtitle
public void ShowSubtitle(Nikse.SubtitleEdit.Core.Paragraph p)
{
if (p == null)
{
_subtitleWebView.MainFrame.LoadHtmlString(new NSString("<body style='background-color:black'></body>"), null);
}
else
{
var sb = new StringBuilder();
bool first = true;
foreach (var line in p.Text.SplitToLines())
{
if (!first)
{
sb.Append("<br />");
}
sb.Append(line);
first = false;
}
_subtitleWebView.MainFrame.LoadHtmlString(new NSString("<body style='background-color:black;color:white;text-align:center'>" + sb.ToString() + "<body>"), null);
}
}