2
* This file is part of SubLib.
3
* Copyright (C) 2005-2006 Pedro Castro
5
* SubLib is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* SubLib is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
using System.Collections;
24
/// <summary>A container that represents a collection of incomplete subtitles.</summary>
25
public class IncompleteSubtitleCollection {
26
private ArrayList subtitles = new ArrayList();
29
/// <summary>The number of subtitles in the collection.</summary>
31
get { return subtitles.Count; }
34
/// <summary>Returns an enumerator that can iterate through the collection.</summary>
35
/// <returns>An <see cref="IEnumerator" /> for the entire <see cref="IncompleteSubtitleCollection" />.</returns>
36
public IEnumerator GetEnumerator () {
37
return subtitles.GetEnumerator();
40
/// <summary>Returns the subtitle at the specified index.</summary>
41
/// <param name="index">The zero-based subtitle's index.</param>
42
/// <returns>The subtitle at the specified index.</returns>
43
public IncompleteSubtitle Get (int index){
44
return (IncompleteSubtitle)subtitles[index];
47
/// <summary>Adds an incomplete subtitle to the end of the collection.</summary>
48
/// <param name="subtitle">The subtitle to add.</param>
49
public void Add (IncompleteSubtitle subtitle){
50
subtitles.Add(subtitle);
53
/// <summary>Adds an incomplete subtitle to the collection, inserting it at the specified index.</summary>
54
/// <param name="subtitle">The subtitle to add.</param>
55
/// <param name="index">The zero-based index at which the subtitle should be inserted.</param>
56
public void Add (IncompleteSubtitle subtitle, int index){
57
subtitles.Insert(index, subtitle);
60
public override string ToString(){
61
string result = "\t* SUBTITLE LIST *\n";
62
foreach(IncompleteSubtitle subtitle in subtitles){
63
result += subtitle.ToString();