Add() public method

Adds a subtitle to the end of the collection.
public Add ( Subtitle subtitle ) : void
subtitle Subtitle The subtitle to add.
return void
	/* Public methods */

	public SubtitleCollection Clone (SubtitleProperties propertiesClone) {
		SubtitleCollection collectionClone = new SubtitleCollection();
		foreach (Subtitle subtitle in this.subtitles) {
			Subtitle subtitleClone = subtitle.Clone(propertiesClone);
			collectionClone.Add(subtitleClone);
		}
		return collectionClone;
	}
Example #2
0
        /* Public methods */

        public SubtitleCollection Clone(SubtitleProperties propertiesClone)
        {
            SubtitleCollection collectionClone = new SubtitleCollection();

            foreach (Subtitle subtitle in this.subtitles)
            {
                Subtitle subtitleClone = subtitle.Clone(propertiesClone);
                collectionClone.Add(subtitleClone);
            }
            return(collectionClone);
        }
Example #3
0
	private void ReadSubtitles (Encoding encoding, ParsingProperties properties, SubtitleCollection collection) {

		string[] lines = text.Split(new char[] {'\n'});
		for (int i = 0; i < lines.Length; i++) {
			SubtitleText stext = ParseSubtitleText(lines[i]);
			Style style = new Style();
			if(!stext.IsEmpty) {
				Subtitle subtitle = new Subtitle(null, stext, style);
				collection.Add(subtitle);
			}
		}

	}
Example #4
0
	private int ReadSubtitles (string text, int bodyIndex, int textLength, Regex subtitleRegex, SubtitleFormat format,
		ParsingProperties properties, SubtitleCollection collection, IncompleteSubtitleCollection incompleteSubtitles) {

		Subtitle previousSubtitle = null;

		/* Read the subtitles. BodyIndex points to the start of the subtitles, skipping its possible beginning text*/
		while (bodyIndex < textLength) {
			Match match = subtitleRegex.Match(text, bodyIndex);
			if (match.Success) {
    			Subtitle subtitle = ParseSubtitle(match, format, properties, previousSubtitle);
    			collection.Add(subtitle);
				AddIncompleteSubtitleIfExists(text, match, bodyIndex, collection.Count, incompleteSubtitles);
	    		bodyIndex = match.Index + match.Length;
				previousSubtitle = subtitle;
   			}
   			else
    			break;
   		}
   		return bodyIndex;
   	}