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
コード例 #1
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;
	}
コード例 #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);
        }
コード例 #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);
			}
		}

	}
コード例 #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;
   	}