public ScriptLine Insert(string character, MidiTime offset) { ScriptLine scriptLine1 = new ScriptLine(); scriptLine1.Character = character; scriptLine1.Offset = offset; ScriptLine scriptLine2 = GetFirstLine(); while (scriptLine2.NextByTime != null && scriptLine2.Offset < offset) { scriptLine2 = scriptLine2.NextByTime; } if (scriptLine2.Offset >= offset) { scriptLine1.NextByTime = scriptLine2; scriptLine1.PrevByTime = scriptLine2.PrevByTime; if (scriptLine1.PrevByTime != null) { scriptLine1.PrevByTime.NextByTime = scriptLine1; } else { m_list = scriptLine1; } scriptLine2.PrevByTime = scriptLine1; } else { scriptLine1.PrevByTime = scriptLine2; scriptLine2.NextByTime = scriptLine1; } UpdateCharacterLinks(); return(scriptLine1); }
public ScriptLine GetNearestLineAfter(MidiTime time) { ScriptLine scriptLine = m_list; while (scriptLine != null && scriptLine.Offset < time) { scriptLine = scriptLine.NextByTime; } return(scriptLine); }
public ScriptLine GetNearestLine(MidiTime time) { ScriptLine scriptLine = m_list; for (ScriptLine nextByTime = m_list.NextByTime; nextByTime != null && scriptLine.Offset < time; nextByTime = nextByTime.NextByTime) { if (Math.Abs(time.Difference(nextByTime.Offset)) < Math.Abs(time.Difference(scriptLine.Offset))) { scriptLine = nextByTime; } } return(scriptLine); }
public ScriptLine GetNearestLineAfter(string character, MidiTime time) { ScriptLine scriptLine = m_list; while (scriptLine != null && scriptLine.Character != character) { scriptLine = scriptLine.NextByTime; } while (scriptLine != null && scriptLine.Offset < time) { scriptLine = scriptLine.NextByCharacter; } return(scriptLine); }
private void TimeBoxLeft(object sender, EventArgs e) { if (ParentForm == null) { return; } MidiTime zero = MidiTime.Zero; bool flag = true; try { zero = MidiTime.Parse(_mTimebox.Text); } catch (FormatException ex) { flag = false; } catch (OverflowException ex) { flag = false; } catch (IndexOutOfRangeException ex) { flag = false; } if (flag) { _mTimebox.Width = (int)CreateGraphics().MeasureString(_mTimebox.Text, _mTimebox.Font, ParentForm.Width).Width + 5; if (!LinkedLine.Offset.Equals(zero)) { SetSaveNeeded(); LinkedLine.Offset = zero; SaveFocus(); SortScript(); } else { _mTimebox.Text = LinkedLine.Offset.ToString().Substring(3, 5); } } else { int num = (int)MessageBox.Show("Could not parse time offset. Please make sure that the offset is in the right format.", "Midi time parser problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public ScriptLine GetNearestLine(string character, MidiTime time) { ScriptLine scriptLine1 = m_list; while (scriptLine1 != null && scriptLine1.Character != character) { scriptLine1 = scriptLine1.NextByTime; } ScriptLine scriptLine2 = scriptLine1; for (ScriptLine nextByCharacter = scriptLine1.NextByCharacter; nextByCharacter != null && scriptLine2.Offset < time; nextByCharacter = nextByCharacter.NextByCharacter) { time.Difference(nextByCharacter.Offset); time.Difference(scriptLine2.Offset); if (Math.Abs(time.Difference(nextByCharacter.Offset)) < Math.Abs(time.Difference(scriptLine2.Offset))) { scriptLine2 = nextByCharacter; } } return(scriptLine2); }