// This file is part of the Noddybox.WindowsPhone C# suite. // // Noddybox.Emulation is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Noddybox.Emulation is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Noddybox.Emulation. If not, see . // // Copyright (c) 2012 Ian Cowburn // using System; using System.Collections.Generic; namespace Noddybox.WindowsPhone.Net { /// /// Collection of FTPFile objects /// public class FTPFileCollection : IEnumerable { // ------------------------------------------------- // - PUBLIC MEMBERS - // ------------------------------------------------- /// /// Default constructor - initializes all fields to default values /// public FTPFileCollection() { m_list = new List(); } /// /// Number of files in the collection /// public int Count { get {return m_list.Count;} } /// /// Add a file to the collection /// public void Add(FTPFile f) { m_list.Add(f); } /// /// Get a file from the collection /// public FTPFile Get(int index) { return (FTPFile)m_list[index]; } /// /// Sort the collection /// public void Sort() { m_list.Sort(); } /// /// Get iterator /// public Enum GetEnumerator() { return new Enum(this); } /// /// Get iterator /// IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } /// /// Class for enumeration /// public class Enum : IEnumerator { /// /// Default constructor - initializes all fields to default values /// public Enum(FTPFileCollection c) { m_index=-1; m_col=c; } /// /// See IEnumerator /// public bool MoveNext() { m_index++; return m_index /// See IEnumerator /// public FTPFile Current { get {return m_col.Get(m_index);} } /// /// See IEnumerator /// public void Reset() { m_index=-1; } /// /// See IEnumerator /// object IEnumerator.Current { get {return Current;} } private int m_index; private FTPFileCollection m_col; } // ------------------------------------------------- // - PRIVATE MEMBERS - // ------------------------------------------------- private List m_list; } }