Sync() public static method

public static Sync ( Subtitles subtitles, SyncPoint start, SyncPoint end, bool syncLast ) : bool
subtitles SubLib.Core.Domain.Subtitles
start SubLib.Core.Domain.SyncPoint
end SubLib.Core.Domain.SyncPoint
syncLast bool
return bool
	/* Public members */

	public bool Sync (SyncPoints syncPoints, bool toSyncAll) {
		SyncPoints pointsToUse = AdaptForOperation(syncPoints, toSyncAll);
		if (!AreSyncArgsValid(pointsToUse)) {
			return false;
		}
		SyncPoint previous = pointsToUse[0];
		for (int index = 1 ; index < pointsToUse.Count ; index++) {
			bool syncLast = (index == pointsToUse.Count - 1);
			SyncPoint current = pointsToUse[index];
			SyncUtil.Sync(subtitles, previous, current, syncLast);

			previous = current;
		}

		return true;
	}
Beispiel #2
0
 /// <summary>Auto adjusts a range of subtitles given their first and last correct frames.</summary>
 /// <remarks>The subtitles are first shifted to the first subtitle's correct frame, and then proportionally
 /// adjusted using the last subtitle's correct frame.</remarks>
 /// <param name="startIndex">The subtitle index to start the adjustment with.</param>
 /// <param name="startFrame">The correct start frame for the first subtitle.</param>
 /// <param name="endIndex">The subtitle index to end the adjustment with.</param>
 /// <param name="endFrame">The correct start frame for the last subtitle.</param>
 /// <returns>Whether the subtitles could be adjusted.</returns>
 public bool Adjust(int startIndex, int startFrame, int endIndex, int endFrame)
 {
     return(SyncUtil.Sync(subtitles, startIndex, startFrame, endIndex, endFrame, true));
 }
Beispiel #3
0
 /// <summary>Auto adjusts a range of subtitles given their first and last correct times.</summary>
 /// <remarks>The subtitles are first shifted to the first subtitle's correct time, and then proportionally
 /// adjusted using the last subtitle's correct time.</remarks>
 /// <param name="startIndex">The subtitle index to start the adjustment with.</param>
 /// <param name="startTime">The correct start time for the first subtitle.</param>
 /// <param name="endIndex">The subtitle index to end the adjustment with.</param>
 /// <param name="endTime">The correct start time for the last subtitle.</param>
 /// <returns>Whether the subtitles could be adjusted.</returns>
 public bool Adjust(int startIndex, TimeSpan startTime, int endIndex, TimeSpan endTime)
 {
     return(SyncUtil.Sync(subtitles, startIndex, startTime, endIndex, endTime, true));
 }