From e078a2887cf2dc61da49ce302324ff1485f95af9 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 1 Oct 2012 20:59:12 +0000 Subject: Added non-working code for an attempt at FTP --- Noddybox.WindowsPhone.FTP/FTPFileCollection.cs | 145 +++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Noddybox.WindowsPhone.FTP/FTPFileCollection.cs (limited to 'Noddybox.WindowsPhone.FTP/FTPFileCollection.cs') diff --git a/Noddybox.WindowsPhone.FTP/FTPFileCollection.cs b/Noddybox.WindowsPhone.FTP/FTPFileCollection.cs new file mode 100644 index 0000000..1f8d4cb --- /dev/null +++ b/Noddybox.WindowsPhone.FTP/FTPFileCollection.cs @@ -0,0 +1,145 @@ +// 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; + } +} -- cgit v1.2.3