r82171 - in trunk/bitsharp/src/MonoTorrent: Client Client/Managers Client/PeerConnections Client/PiecePicking Collections Common Common/TorrentWatchers

0 views
Skip to first unread message

Alan McGovern (alan.mcgovern@gmail.com)

unread,
Jul 17, 2007, 11:48:46 PM7/17/07
to mono-p...@lists.ximian.com, ximian....@gmail.com, mono-svn-patche...@googlegroups.com
Author: alanmc
Date: 2007-07-17 23:48:45 -0400 (Tue, 17 Jul 2007)
New Revision: 82171

Removed:
trunk/bitsharp/src/MonoTorrent/Collections/BEncodedKeyValuePair.cs
trunk/bitsharp/src/MonoTorrent/Collections/BlockCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/IBEncodedValueCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/ITorrentWatcherCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/PeerCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/PeerConnectionIDCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/PieceCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/StringCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/TorrentManagerCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/TraceListenerCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/UInt32Collection.cs
trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/WaitHandleCollection.cs
Modified:
trunk/bitsharp/src/MonoTorrent/Client/AllowedFastAlgorithm.cs
trunk/bitsharp/src/MonoTorrent/Client/ClientEngine.cs
trunk/bitsharp/src/MonoTorrent/Client/Managers/ConnectionManager.cs
trunk/bitsharp/src/MonoTorrent/Client/PeerConnections/PeerConnectionBase.cs
trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/EndGamePicker.cs
trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/PiecePickerBase.cs
trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/StandardPicker.cs
trunk/bitsharp/src/MonoTorrent/Client/TrackerTier.cs
trunk/bitsharp/src/MonoTorrent/Collections/MonoTorrentCollectionBase.cs
trunk/bitsharp/src/MonoTorrent/Common/Torrent.cs
trunk/bitsharp/src/MonoTorrent/Common/TorrentCreator.cs
trunk/bitsharp/src/MonoTorrent/Common/TorrentWatchers/TorrentWatchers.cs
Log:
The library itself will never be .NET 1.0/1.1. There are far too many methods it uses that are 2.0 to make it worthwhile, and it limits extensibility.

Modified: trunk/bitsharp/src/MonoTorrent/Client/AllowedFastAlgorithm.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/AllowedFastAlgorithm.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Client/AllowedFastAlgorithm.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -47,15 +47,15 @@
/// <param name="infohash">The info hash of the torrent</param>
/// <param name="numberOfPieces">The number of pieces in the torrent</param>
/// <returns></returns>
- internal static UInt32Collection Calculate(byte[] addressBytes, byte[] infohash, UInt32 numberOfPieces)
+ internal static MonoTorrentCollection<uint> Calculate(byte[] addressBytes, byte[] infohash, UInt32 numberOfPieces)
{
return Calculate(addressBytes, infohash, AllowedFastPieceCount, numberOfPieces);
}

- internal static UInt32Collection Calculate(byte[] addressBytes, byte[] infohash, int count, UInt32 numberOfPieces)
+ internal static MonoTorrentCollection<uint> Calculate(byte[] addressBytes, byte[] infohash, int count, UInt32 numberOfPieces)
{
byte[] hashBuffer = new byte[24]; // The hash buffer to be used in hashing
- UInt32Collection results = new UInt32Collection(count); // The results array which will be returned
+ MonoTorrentCollection<uint> results = new MonoTorrentCollection<uint>(count); // The results array which will be returned

// 1) Convert the bytes into an int32 and make them Network order
int ip = IPAddress.HostToNetworkOrder(BitConverter.ToInt32(addressBytes, 0));

Modified: trunk/bitsharp/src/MonoTorrent/Client/ClientEngine.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/ClientEngine.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Client/ClientEngine.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -75,7 +75,7 @@
private EngineSettings settings;
private System.Timers.Timer timer; // The timer used to call the logic methods for the torrent managers
private int tickCount;
- private TorrentManagerCollection torrents;
+ private MonoTorrentCollection<TorrentManager> torrents;
internal ReaderWriterLock torrentsLock;

#endregion
@@ -123,7 +123,7 @@
/// <summary>
/// The TorrentManager's loaded into the engine
/// </summary>
- internal TorrentManagerCollection Torrents
+ internal MonoTorrentCollection<TorrentManager> Torrents
{
get { return this.torrents; }
set { this.torrents = value; }
@@ -150,7 +150,7 @@
this.listener = new ConnectionListener(this);
this.peerId = GeneratePeerId();
this.timer = new System.Timers.Timer(TickLength);
- this.torrents = new TorrentManagerCollection();
+ this.torrents = new MonoTorrentCollection<TorrentManager>();
this.torrentsLock = new ReaderWriterLock();

this.timer.Elapsed += new ElapsedEventHandler(LogicTick);

Modified: trunk/bitsharp/src/MonoTorrent/Client/Managers/ConnectionManager.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/Managers/ConnectionManager.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Client/Managers/ConnectionManager.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -83,7 +83,7 @@
private EncryptorIOErrorHandler onEncryptorIOErrorHandler;
private EncryptorEncryptionErrorHandler onEncryptorEncryptionErrorHandler;

- private TorrentManagerCollection torrents;
+ private MonoTorrentCollection<TorrentManager> torrents;

internal MessageHandler MessageHandler
{
@@ -149,7 +149,7 @@
this.messageLengthReceivedCallback = new MessagingCallback(this.onPeerMessageLengthReceived);
this.messageReceivedCallback = new MessagingCallback(this.onPeerMessageReceived);
this.messageSentCallback = new MessagingCallback(this.onPeerMessageSent);
- this.torrents = new TorrentManagerCollection();
+ this.torrents = new MonoTorrentCollection<TorrentManager>();
this.onEncryptorReadyHandler = new EncryptorReadyHandler(onEncryptorReady);
this.onEncryptorIOErrorHandler = new EncryptorIOErrorHandler(onEncryptorError);
this.onEncryptorEncryptionErrorHandler = new EncryptorEncryptionErrorHandler(onEncryptorError);

Modified: trunk/bitsharp/src/MonoTorrent/Client/PeerConnections/PeerConnectionBase.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/PeerConnections/PeerConnectionBase.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Client/PeerConnections/PeerConnectionBase.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -45,7 +45,7 @@
{
#region Member Variables

- private UInt32Collection amAllowedFastPieces;
+ private MonoTorrentCollection<uint> amAllowedFastPieces;
private bool amChoking;
private bool amInterested;
private int amRequestingPiecesCount;
@@ -57,7 +57,7 @@
private Software clientApp;
private IPeerMessageInternal currentlySendingMessage;
private IEncryptorInternal encryptor;
- private UInt32Collection isAllowedFastPieces;
+ private MonoTorrentCollection<uint> isAllowedFastPieces;
private bool isChoking;
private bool isInterested;
private bool isinterestingtoMe;
@@ -73,7 +73,7 @@
internal ArraySegment<byte> recieveBuffer = BufferManager.EmptyBuffer; // The byte array used to buffer data while it's being received
internal ArraySegment<byte> sendBuffer = BufferManager.EmptyBuffer; // The byte array used to buffer data before it's sent
private Queue<IPeerMessageInternal> sendQueue; // This holds the peermessages waiting to be sent
- private IntCollection suggestedPieces;
+ private MonoTorrentCollection<int> suggestedPieces;
private bool supportsFastPeer;

#endregion Member Variables
@@ -88,7 +88,7 @@
/// <summary>
/// Contains the indexs of all the pieces we will let the peer download even if they are choked
/// </summary>
- internal UInt32Collection AmAllowedFastPieces
+ internal MonoTorrentCollection<uint> AmAllowedFastPieces
{
get { return this.amAllowedFastPieces; }
set { this.amAllowedFastPieces = value; }
@@ -208,7 +208,7 @@
/// <summary>
/// Contains the indexes of all the pieces which the peer will let us download even if we are choked
/// </summary>
- internal UInt32Collection IsAllowedFastPieces
+ internal MonoTorrentCollection<uint> IsAllowedFastPieces
{
get { return this.isAllowedFastPieces; }
set { this.isAllowedFastPieces = value; }
@@ -332,7 +332,7 @@
/// A list of pieces that this peer has suggested we download. These should be downloaded
/// with higher priority than standard pieces.
/// </summary>
- internal IntCollection SuggestedPieces
+ internal MonoTorrentCollection<int> SuggestedPieces
{
get { return this.suggestedPieces; }
}
@@ -348,15 +348,15 @@
/// <param name="peerEndpoint">The IPEndpoint to connect to</param>
protected PeerConnectionBase(int bitfieldLength, IEncryptorInternal encryptor)
{
- this.suggestedPieces = new IntCollection();
+ this.suggestedPieces = new MonoTorrentCollection<int>();
this.encryptor = encryptor;
this.amChoking = true;
this.isChoking = true;
this.bitField = new BitField(bitfieldLength);
this.monitor = new ConnectionMonitor();
this.sendQueue = new Queue<IPeerMessageInternal>(12);
- this.isAllowedFastPieces = new UInt32Collection();
- this.amAllowedFastPieces = new UInt32Collection();
+ this.isAllowedFastPieces = new MonoTorrentCollection<uint>();
+ this.amAllowedFastPieces = new MonoTorrentCollection<uint>();
}

#endregion

Modified: trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/EndGamePicker.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/EndGamePicker.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/EndGamePicker.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -39,7 +39,7 @@
{
#region Member Variables
private object requestsLocker = new object(); // Used to synchronise access to the lists
- private PieceCollection pieces; // A list of all the remaining pieces to download
+ private MonoTorrentCollection<Piece> pieces; // A list of all the remaining pieces to download
private BlockCollection blocks; // A list of all the blocks in the remaining pieces to download
Dictionary<PeerIdInternal, BlockCollection> requests; // Used to remember which blocks each peer is downloading
Dictionary<Block, PeerIdCollection> blockRequestees; // Used to remember which peers are getting each block so i can issue cancel messages
@@ -47,12 +47,12 @@

#region Constructors

- public EndGamePicker(BitField myBitfield, Torrent torrent, Dictionary<PeerIdInternal, PieceCollection> existingRequests)
+ public EndGamePicker(BitField myBitfield, Torrent torrent, Dictionary<PeerIdInternal, MonoTorrentCollection<Piece>> existingRequests)
{
this.myBitfield = myBitfield;
this.requests = new Dictionary<PeerIdInternal, BlockCollection>();
this.blockRequestees = new Dictionary<Block, PeerIdCollection>();
- this.pieces = new PieceCollection();
+ this.pieces = new MonoTorrentCollection<Piece>();

// For all the pieces that we have *not* requested yet, add them into our list of pieces
for (int i = 0; i < this.myBitfield.Length; i++)
@@ -74,9 +74,9 @@

#region Private Methods

- private void AddExistingRequests(Dictionary<PeerIdInternal, PieceCollection> existingRequests)
+ private void AddExistingRequests(Dictionary<PeerIdInternal, MonoTorrentCollection<Piece>> existingRequests)
{
- foreach (KeyValuePair<PeerIdInternal, PieceCollection> keypair in existingRequests)
+ foreach (KeyValuePair<PeerIdInternal, MonoTorrentCollection<Piece>> keypair in existingRequests)
{
if (!this.requests.ContainsKey(keypair.Key))
this.requests.Add(keypair.Key, new BlockCollection());

Modified: trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/PiecePickerBase.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/PiecePickerBase.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/PiecePickerBase.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -79,7 +79,7 @@
return -1;
}

- internal static Piece GetPieceFromIndex(PieceCollection pieces, int pieceIndex)
+ internal static Piece GetPieceFromIndex(MonoTorrentCollection<Piece> pieces, int pieceIndex)
{
for (int i = 0; i < pieces.Count; i++)
if (pieces[i].Index == pieceIndex)

Modified: trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/StandardPicker.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/StandardPicker.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Client/PiecePicking/StandardPicker.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -45,8 +45,8 @@


private TorrentFile[] torrentFiles;
- private PieceCollection requests;
- internal PieceCollection Requests
+ private MonoTorrentCollection<Piece> requests;
+ internal MonoTorrentCollection<Piece> Requests
{
get { return this.requests; }
}
@@ -86,7 +86,7 @@
this.previousBitfields = new List<BitField>();
this.previousBitfields.Add(new BitField(bitField.Length));
this.priorities = (int[])Enum.GetValues(typeof(Priority));
- this.requests = new PieceCollection(16);
+ this.requests = new MonoTorrentCollection<Piece>(16);
this.torrentFiles = torrentFiles;
this.unhashedPieces = new BitField(bitField.Length);

Modified: trunk/bitsharp/src/MonoTorrent/Client/TrackerTier.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/TrackerTier.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Client/TrackerTier.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -39,7 +39,7 @@

#region Constructors

- internal TrackerTier(stringCollection trackerUrls, AsyncCallback announceCallback,
+ internal TrackerTier(MonoTorrentCollection<string> trackerUrls, AsyncCallback announceCallback,
AsyncCallback scrapeCallback)
{
Uri result;

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/BEncodedKeyValuePair.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/BEncodedKeyValuePair.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/BEncodedKeyValuePair.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,29 +0,0 @@
-using System;
-using System.Text;
-
-using MonoTorrent.BEncoding;
-
-namespace MonoTorrent
-{
- public class BEncodedKeyValuePair
- {
- #region Fields
-
- private BEncodedString key;
- private BEncodedValue _value;
-
- #endregion Fields
-
- public BEncodedString Key
- {
- get { return key; }
- set { key = value; }
- }
-
- public BEncodedValue Value
- {
- get { return _value; }
- set { _value = value; }
- }
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/BlockCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/BlockCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/BlockCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,177 +0,0 @@
-using System;
-using System.Text;
-using System.Collections;
-using MonoTorrent.Client;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class BlockCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<Block> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public BlockCollection()
- {
-#if NET_2_0
- list = new List<Block>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public BlockCollection(int capacity)
- {
-#if NET_2_0
- list = new List<Block>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public Block this[int index]
- {
- get { return (Block)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(Block value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- BlockCollection clone = new BlockCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(Block value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(Block value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, Block value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(Block value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((Block)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((Block)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((Block)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (Block)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((Block)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (Block)value; }
- }
-
- #endregion
- }
-}
\ No newline at end of file

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/IBEncodedValueCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/IBEncodedValueCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/IBEncodedValueCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,177 +0,0 @@
-using System;
-using System.Text;
-using System.Collections;
-using MonoTorrent.BEncoding;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class IBEncodedValueCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- protected List<BEncodedValue> list;
-#else
- protected ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public IBEncodedValueCollection()
- {
-#if NET_2_0
- list = new List<BEncodedValue>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public IBEncodedValueCollection(int capacity)
- {
-#if NET_2_0
- list = new List<BEncodedValue>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public BEncodedValue this[int index]
- {
- get { return (BEncodedValue)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(BEncodedValue value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- IBEncodedValueCollection clone = new IBEncodedValueCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(BEncodedValue value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(BEncodedValue value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, BEncodedValue value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(BEncodedValue value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((BEncodedValue)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((BEncodedValue)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((BEncodedValue)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (BEncodedValue)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((BEncodedValue)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (BEncodedValue)value; }
- }
-
- #endregion
- }
-}
\ No newline at end of file

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/ITorrentWatcherCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/ITorrentWatcherCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/ITorrentWatcherCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,179 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-using MonoTorrent.Common;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class ITorrentWatcherCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<ITorrentWatcher> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public ITorrentWatcherCollection()
- {
-#if NET_2_0
- list = new List<ITorrentWatcher>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public ITorrentWatcherCollection(int capacity)
- {
-#if NET_2_0
- list = new List<ITorrentWatcher>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public ITorrentWatcher this[int index]
- {
- get { return (ITorrentWatcher)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(ITorrentWatcher value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- ITorrentWatcherCollection clone = new ITorrentWatcherCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(ITorrentWatcher value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(ITorrentWatcher value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, ITorrentWatcher value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(ITorrentWatcher value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((ITorrentWatcher)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((ITorrentWatcher)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((ITorrentWatcher)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (ITorrentWatcher)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((ITorrentWatcher)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (ITorrentWatcher)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,176 +0,0 @@
-using System;
-using System.Text;
-using System.Collections;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class IntCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<int> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public IntCollection()
- {
-#if NET_2_0
- list = new List<int>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public IntCollection(int capacity)
- {
-#if NET_2_0
- list = new List<int>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public int this[int index]
- {
- get { return (int)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(int value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- IntCollection clone = new IntCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(int value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(int value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, int value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(int value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((int)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((int)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((int)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (int)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((int)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (int)value; }
- }
-
- #endregion
- }
-}
\ No newline at end of file

Modified: trunk/bitsharp/src/MonoTorrent/Collections/MonoTorrentCollectionBase.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/MonoTorrentCollectionBase.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/MonoTorrentCollectionBase.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,11 +1,33 @@
using System;
using System.Text;
using System.Collections;
+using System.Collections.Generic;

namespace MonoTorrent
{
- public interface MonoTorrentCollectionBase : IList
+ public class MonoTorrentCollection<T> : List<T>
{
- MonoTorrentCollectionBase Clone();
+ public MonoTorrentCollection()
+ : base()
+ {
+
+ }
+
+ public MonoTorrentCollection(IEnumerable<T> collection)
+ : base(collection)
+ {
+ }
+
+ public MonoTorrentCollection(int capacity)
+ : base(capacity)
+ {
+ }
+
+ public MonoTorrentCollection<T> Clone()
+ {
+ MonoTorrentCollection<T> clone = new MonoTorrentCollection<T>(base.Count);
+ clone.AddRange(this);
+ return clone;
+ }
}
}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/PeerCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/PeerCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/PeerCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,179 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-using MonoTorrent.Client;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- internal class PeerCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<Peer> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public PeerCollection()
- {
-#if NET_2_0
- list = new List<Peer>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public PeerCollection(int capacity)
- {
-#if NET_2_0
- list = new List<Peer>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public Peer this[int index]
- {
- get { return (Peer)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(Peer value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- PeerCollection clone = new PeerCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(Peer value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(Peer value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, Peer value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(Peer value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((Peer)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((Peer)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((Peer)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (Peer)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((Peer)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (Peer)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/PeerConnectionIDCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/PeerConnectionIDCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/PeerConnectionIDCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,179 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-using MonoTorrent.Client;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- internal class PeerIdCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<PeerIdInternal> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public PeerIdCollection()
- {
-#if NET_2_0
- list = new List<PeerIdInternal>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public PeerIdCollection(int capacity)
- {
-#if NET_2_0
- list = new List<PeerIdInternal>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public PeerIdInternal this[int index]
- {
- get { return (PeerIdInternal)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(PeerIdInternal value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- PeerIdCollection clone = new PeerIdCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(PeerIdInternal value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(PeerIdInternal value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, PeerIdInternal value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(PeerIdInternal value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((PeerIdInternal)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((PeerIdInternal)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((PeerIdInternal)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (PeerIdInternal)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((PeerIdInternal)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (PeerIdInternal)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/PieceCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/PieceCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/PieceCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,179 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-using MonoTorrent.Client;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class PieceCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<Piece> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public PieceCollection()
- {
-#if NET_2_0
- list = new List<Piece>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public PieceCollection(int capacity)
- {
-#if NET_2_0
- list = new List<Piece>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public Piece this[int index]
- {
- get { return (Piece)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(Piece value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- PieceCollection clone = new PieceCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(Piece value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(Piece value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, Piece value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(Piece value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((Piece)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((Piece)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((Piece)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (Piece)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((Piece)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (Piece)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/StringCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/StringCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/StringCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,178 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class stringCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<string> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public stringCollection()
- {
-#if NET_2_0
- list = new List<string>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public stringCollection(int capacity)
- {
-#if NET_2_0
- list = new List<string>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public string this[int index]
- {
- get { return (string)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(string value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- stringCollection clone = new stringCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(string value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(string value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, string value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(string value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((string)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((string)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((string)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (string)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((string)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (string)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/TorrentManagerCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/TorrentManagerCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/TorrentManagerCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,179 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-using MonoTorrent.Client;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class TorrentManagerCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<TorrentManager> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public TorrentManagerCollection()
- {
-#if NET_2_0
- list = new List<TorrentManager>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public TorrentManagerCollection(int capacity)
- {
-#if NET_2_0
- list = new List<TorrentManager>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public TorrentManager this[int index]
- {
- get { return (TorrentManager)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(TorrentManager value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- TorrentManagerCollection clone = new TorrentManagerCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(TorrentManager value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(TorrentManager value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, TorrentManager value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(TorrentManager value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((TorrentManager)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((TorrentManager)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((TorrentManager)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (TorrentManager)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((TorrentManager)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (TorrentManager)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/TraceListenerCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/TraceListenerCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/TraceListenerCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,179 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-using System.Diagnostics;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class TraceListenerCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<TraceListener> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public TraceListenerCollection()
- {
-#if NET_2_0
- list = new List<TraceListener>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public TraceListenerCollection(int capacity)
- {
-#if NET_2_0
- list = new List<TraceListener>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public TraceListener this[int index]
- {
- get { return (TraceListener)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(TraceListener value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- TraceListenerCollection clone = new TraceListenerCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(TraceListener value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(TraceListener value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, TraceListener value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(TraceListener value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((TraceListener)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((TraceListener)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((TraceListener)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (TraceListener)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((TraceListener)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (TraceListener)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,178 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class TrackerCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<MonoTorrent.Client.Tracker> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public TrackerCollection()
- {
-#if NET_2_0
- list = new List<MonoTorrent.Client.Tracker>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public TrackerCollection(int capacity)
- {
-#if NET_2_0
- list = new List<MonoTorrent.Client.Tracker>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public MonoTorrent.Client.Tracker this[int index]
- {
- get { return (MonoTorrent.Client.Tracker)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(MonoTorrent.Client.Tracker value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- TrackerCollection clone = new TrackerCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(MonoTorrent.Client.Tracker value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(MonoTorrent.Client.Tracker value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, MonoTorrent.Client.Tracker value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(MonoTorrent.Client.Tracker value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((MonoTorrent.Client.Tracker)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((MonoTorrent.Client.Tracker)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((MonoTorrent.Client.Tracker)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (MonoTorrent.Client.Tracker)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((MonoTorrent.Client.Tracker)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (MonoTorrent.Client.Tracker)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/UInt32Collection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/UInt32Collection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/UInt32Collection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,178 +0,0 @@
-
-
-using System;
-using System.Text;
-using System.Collections;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class UInt32Collection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<UInt32> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public UInt32Collection()
- {
-#if NET_2_0
- list = new List<UInt32>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public UInt32Collection(int capacity)
- {
-#if NET_2_0
- list = new List<UInt32>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public UInt32 this[int index]
- {
- get { return (UInt32)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(UInt32 value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- UInt32Collection clone = new UInt32Collection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(UInt32 value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(UInt32 value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, UInt32 value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(UInt32 value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((UInt32)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((UInt32)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((UInt32)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (UInt32)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((UInt32)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (UInt32)value; }
- }
-
- #endregion
- }
-}

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,179 +0,0 @@
-/*
-
-using System;
-using System.Text;
-using System.Collections;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class @TYPE@Collection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<@TYPE@> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public @TYPE@Collection()
- {
-#if NET_2_0
- list = new List<@TYPE@>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public @TYPE@Collection(int capacity)
- {
-#if NET_2_0
- list = new List<@TYPE@>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public @TYPE@ this[int index]
- {
- get { return (@TYPE@)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(@TYPE@ value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- @TYPE@Collection clone = new @TYPE@Collection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(@TYPE@ value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(@TYPE@ value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, @TYPE@ value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(@TYPE@ value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((@TYPE@)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((@TYPE@)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((@TYPE@)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (@TYPE@)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((@TYPE@)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (@TYPE@)value; }
- }
-
- #endregion
- }
-}
-*/
\ No newline at end of file

Deleted: trunk/bitsharp/src/MonoTorrent/Collections/WaitHandleCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/WaitHandleCollection.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Collections/WaitHandleCollection.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -1,182 +0,0 @@
-using System;
-using System.Text;
-using System.Collections;
-using System.Threading;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace MonoTorrent
-{
- public class WaitHandleCollection : MonoTorrentCollectionBase
- {
- #region Private Fields
-
-#if NET_2_0
- private List<WaitHandle> list;
-#else
- private ArrayList list;
-#endif
-
- #endregion Private Fields
-
-
- #region Constructors
-
- public WaitHandleCollection()
- {
-#if NET_2_0
- list = new List<WaitHandle>();
-#else
- list = new ArrayList();
-#endif
- }
-
- public WaitHandleCollection(int capacity)
- {
-#if NET_2_0
- list = new List<WaitHandle>(capacity);
-#else
- list = new ArrayList(capacity);
-#endif
- }
-
- #endregion
-
-
- #region Methods
-
- public WaitHandle this[int index]
- {
- get { return (WaitHandle)list[index]; }
- set { list[index] = value; }
- }
-
- public int Add(WaitHandle value)
- {
-#if NET_2_0
- list.Add(value);
- return list.Count;
-#else
- return this.list.Add(value);
-#endif
- }
-
- public void Clear()
- {
- this.list.Clear();
- }
-
- public MonoTorrentCollectionBase Clone()
- {
- WaitHandleCollection clone = new WaitHandleCollection(list.Count);
- for (int i = 0; i < list.Count; i++)
- clone.Add(this[i]);
- return clone;
- }
-
- public bool Contains(WaitHandle value)
- {
- return list.Contains(value);
- }
-
- public void CopyTo(Array array, int index)
- {
- ((IList)list).CopyTo(array, index);
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
-
- public int IndexOf(WaitHandle value)
- {
- return list.IndexOf(value);
- }
-
- public void Insert(int index, WaitHandle value)
- {
- list.Insert(index, value);
- }
-
- public bool IsSynchronized
- {
- get { return ((IList)list).IsSynchronized; }
- }
-
- public void Remove(WaitHandle value)
- {
- list.Remove(value);
- }
-
- public void RemoveAt(int index)
- {
- list.RemoveAt(index);
- }
-
- public object SyncRoot
- {
- get { return ((IList)list).SyncRoot; }
- }
-
- #endregion Methods
-
-
- #region Explicit Implementation
-
- int IList.Add(object value)
- {
- return Add((WaitHandle)value);
- }
-
- int IList.IndexOf(object value)
- {
- return IndexOf((WaitHandle)value);
- }
-
- bool IList.Contains(object value)
- {
- return Contains((WaitHandle)value);
- }
-
- void IList.Insert(int index, object value)
- {
- Insert(index, (WaitHandle)value);
- }
-
- bool IList.IsFixedSize
- {
- get { return ((IList)list).IsFixedSize; }
- }
-
- bool IList.IsReadOnly
- {
- get { return ((IList)list).IsReadOnly; }
-
- }
-
- void IList.Remove(object value)
- {
- Remove((WaitHandle)value);
- }
-
- object IList.this[int index]
- {
- get { return this[index]; }
- set { this[index] = (WaitHandle)value; }
- }
-
- #endregion
-
- internal WaitHandle[] ToArray()
- {
- return (WaitHandle[])list.ToArray();
- }
- }
-}
\ No newline at end of file

Modified: trunk/bitsharp/src/MonoTorrent/Common/Torrent.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Common/Torrent.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Common/Torrent.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -48,7 +48,7 @@
#region Private Fields

private BEncodedValue azureusProperties;
- private List<stringCollection> announceUrls;
+ private List<MonoTorrentCollection<string>> announceUrls;
private string comment;
private string createdBy;
private DateTime creationDate;
@@ -76,7 +76,7 @@
/// <summary>
/// The announce URLs contained within the .torrent file
/// </summary>
- public List<stringCollection> AnnounceUrls
+ public List<MonoTorrentCollection<string>> AnnounceUrls
{
get { return this.announceUrls; }
}
@@ -264,7 +264,7 @@

private Torrent()
{
- this.announceUrls = new List<stringCollection>();
+ this.announceUrls = new List<MonoTorrentCollection<string>>();
this.comment = string.Empty;
this.createdBy = string.Empty;
this.creationDate = new DateTime(1970, 1, 1, 0, 0, 0);
@@ -597,7 +597,7 @@
switch (keypair.Key.Text)
{
case ("announce"):
- t.announceUrls.Add(new stringCollection());
+ t.announceUrls.Add(new MonoTorrentCollection<string>());
t.announceUrls[0].Add(keypair.Value.ToString());
break;

@@ -650,7 +650,7 @@

case ("announce-list"):
BEncodedList announces = (BEncodedList)keypair.Value;
- t.announceUrls = new List<stringCollection>(announces.Count);
+ t.announceUrls = new List<MonoTorrentCollection<string>>(announces.Count);

for (int j = 0; j < announces.Count; j++)
{
@@ -662,7 +662,7 @@

Toolbox.Randomize<string>(tier);

- stringCollection collection = new stringCollection(tier.Count);
+ MonoTorrentCollection<string> collection = new MonoTorrentCollection<string>(tier.Count);
for (int k = 0; k < tier.Count; k++)
collection.Add(tier[k]);
t.announceUrls.Add(collection);

Modified: trunk/bitsharp/src/MonoTorrent/Common/TorrentCreator.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Common/TorrentCreator.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Common/TorrentCreator.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -48,7 +48,7 @@
{
#region Private Fields

- private List<stringCollection> announces; // The list of announce urls
+ private List<MonoTorrentCollection<string>> announces; // The list of announce urls
private bool ignoreHiddenFiles; // True if you want to ignore hidden files when making the torrent
private string path; // The path from which the torrent will be created (can be file or directory)
private bool storeMd5; // True if an MD5 hash of each file should be included
@@ -62,7 +62,7 @@
/// <summary>
/// The list of announce urls for this
/// </summary>
- public List<stringCollection> Announces
+ public List<MonoTorrentCollection<string>> Announces
{
get { return this.announces; }
}
@@ -191,7 +191,7 @@
public TorrentCreator()
{
BEncodedDictionary info = new BEncodedDictionary();
- this.announces = new List<stringCollection>();
+ this.announces = new List<MonoTorrentCollection<string>>();
this.ignoreHiddenFiles = true;
this.torrent = new BEncodedDictionary();
this.torrent.Add("info", info);
@@ -213,7 +213,7 @@
///<param name="dir">the top directory to start from</param>
///<param name="filesList">the list to store the file information</param>
///<param name="paths">a list of all files found. used for piece hashing later</param>
- private void AddAllFileInfoDicts(string dir, BEncodedList filesList, stringCollection paths)
+ private void AddAllFileInfoDicts(string dir, BEncodedList filesList, MonoTorrentCollection<string> paths)
{
GetAllFilePaths(dir, paths);

@@ -222,7 +222,7 @@
}


- private void GetAllFilePaths(string directory, stringCollection paths)
+ private void GetAllFilePaths(string directory, MonoTorrentCollection<string> paths)
{
string[] subs = Directory.GetFileSystemEntries(directory);
foreach (string path in subs)
@@ -329,7 +329,7 @@
///<summary>
///calculates all hashes over the files which should be included in the torrent
///</summmary>
- private byte[] CalcPiecesHash(stringCollection fullPaths)
+ private byte[] CalcPiecesHash(MonoTorrentCollection<string> fullPaths)
{
SHA1 hasher = SHA1.Create();
byte[] piece = new byte[PieceLength];//holds one piece for sha1 calcing
@@ -413,7 +413,7 @@
AddCommonStuff(this.torrent);
BEncodedDictionary info = (BEncodedDictionary)this.torrent["info"];

- stringCollection fullPaths = new stringCollection();//store files to hash over
+ MonoTorrentCollection<string> fullPaths = new MonoTorrentCollection<string>();//store files to hash over
BEncodedList files = new BEncodedList();//the dict which hold the file infos


@@ -446,7 +446,7 @@

infoDict.Add("name", new BEncodedString(System.IO.Path.GetFileName(Path)));
Console.WriteLine("name == " + System.IO.Path.GetFileName(Path));
- stringCollection files = new stringCollection();
+ MonoTorrentCollection<string> files = new MonoTorrentCollection<string>();
files.Add(Path);
infoDict.Add("pieces", new BEncodedString(CalcPiecesHash(files)));
}
@@ -500,7 +500,7 @@
}


- private long GetPieceCount(stringCollection fullPaths)
+ private long GetPieceCount(MonoTorrentCollection<string> fullPaths)
{
long size = 0;
foreach (string file in fullPaths)
@@ -518,7 +518,7 @@
///</summary>
public long GetSize()
{
- stringCollection paths = new stringCollection();
+ MonoTorrentCollection<string> paths = new MonoTorrentCollection<string>();

if (Directory.Exists(this.path))
GetAllFilePaths(this.path, paths);
@@ -584,11 +584,11 @@
///<summary>
public class CatStreamReader : IDisposable
{
- private stringCollection _files;
+ private MonoTorrentCollection<string> _files;
private int _currentFile = 0;
private FileStream _currentStream = null;

- public CatStreamReader(stringCollection files)
+ public CatStreamReader(MonoTorrentCollection<string> files)
{
_files = files;
_currentStream = new FileStream(files[_currentFile++], FileMode.Open, FileAccess.Read, FileShare.Read);

Modified: trunk/bitsharp/src/MonoTorrent/Common/TorrentWatchers/TorrentWatchers.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Common/TorrentWatchers/TorrentWatchers.cs 2007-07-18 03:35:59 UTC (rev 82170)
+++ trunk/bitsharp/src/MonoTorrent/Common/TorrentWatchers/TorrentWatchers.cs 2007-07-18 03:48:45 UTC (rev 82171)
@@ -35,7 +35,7 @@
/// <summary>
/// Main controller class for ITorrentWatcher
/// </summary>
- public class TorrentWatchers : ITorrentWatcherCollection
+ public class TorrentWatchers : MonoTorrentCollection<ITorrentWatcher>
{
#region Constructors

Reply all
Reply to author
Forward
0 new messages