Author: alanmc
Date: 2007-04-30 17:13:57 -0400 (Mon, 30 Apr 2007)
New Revision: 76508
Added:
trunk/bitsharp/src/MonoTorrent/Collections/
trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs
trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs
Log:
Added some Collection classes to aid with .NET 1.0/1.1 support.
Added: trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs 2007-04-30
19:33:06 UTC (rev 76507)
+++ trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs 2007-04-30
21:13:57 UTC (rev 76508)
@@ -0,0 +1,155 @@
+using System;
+using System.Text;
+using System.Collections;
+#if NET_2_0
+using System.Collections.Generic;
+#endif
+
+namespace MonoTorrent
+{
+ public class intCollection : IList
+ {
+ #region Private Fields
+
+#if NET_2_0
+ private List<int> list;
+#else
+ private ArrayList list;
+#endif
+
+ #endregion Private Fields
+
+
+ #region Constructors
+
+ public intCollection()
+ {
+ list = new ArrayList();
+ }
+
+ public intCollection(int capacity)
+ {
+ list = new ArrayList(capacity);
+ }
+
+ #endregion
+
+
+ #region Methods
+
+ public int this[int index]
+ {
+ get { return (int)list[index]; }
+ set { list[index] = value; }
+ }
+
+ public void Add(int value)
+ {
+ this.list.Add(value);
+ }
+
+ public void Clear()
+ {
+ this.list.Clear();
+ }
+
+ public bool Contains(int value)
+ {
+ return list.Contains(value);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ list.CopyTo(array, index);
+ }
+
+ public int Count
+ {
+ get { return list.Count; }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator();
+ }
+
+ public int IndexOf(int value)
+ {
+ list.IndexOf(value);
+ }
+
+ public void Insert(int index, int value)
+ {
+ list.Insert(index, value);
+ }
+
+ public bool IsSynchronized
+ {
+ get { list.IsSynchronized; }
+ }
+
+ public void Remove(int value)
+ {
+ list.Remove(value);
+ }
+
+ public void RemoveAt(int index)
+ {
+ RemoveAt(index);
+ }
+
+ public object SyncRoot
+ {
+ get { return list.SyncRoot; }
+ }
+
+ #endregion Methods
+
+
+ #region Explicit Implementation
+
+ int IList.Add(object value)
+ {
+ Add((int)value);
+ }
+
+ int IList.IndexOf(object value)
+ {
+ IndexOf((int)value);
+ }
+
+ bool IList.Contains(object value)
+ {
+ Contains((int)value);
+ }
+
+ void IList.Insert(int index, object value)
+ {
+ Insert(index, (int)value);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get { return list.IsFixedSize; }
+ }
+
+ bool IList.IsReadOnly
+ {
+ get { return list.IsReadOnly; }
+
+ }
+
+ void IList.Remove(object value)
+ {
+ Remove((int)value);
+ }
+
+ object IList.this[int index]
+ {
+ get { return this[index]; }
+ set { this[index] = value; }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Property changes on: trunk/bitsharp/src/MonoTorrent/Collections/IntCollection.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs
2007-04-30 19:33:06 UTC (rev 76507)
+++ trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs
2007-04-30 21:13:57 UTC (rev 76508)
@@ -0,0 +1,155 @@
+using System;
+using System.Text;
+using System.Collections;
+#if NET_2_0
+using System.Collections.Generic;
+#endif
+
+namespace MonoTorrent
+{
+ public class TrackerCollection : IList
+ {
+ #region Private Fields
+
+#if NET_2_0
+ private List<Tracker> list;
+#else
+ private ArrayList list;
+#endif
+
+ #endregion Private Fields
+
+
+ #region Constructors
+
+ public TrackerCollection()
+ {
+ list = new ArrayList();
+ }
+
+ public TrackerCollection(int capacity)
+ {
+ list = new ArrayList(capacity);
+ }
+
+ #endregion
+
+
+ #region Methods
+
+ public Tracker this[int index]
+ {
+ get { return (Tracker)list[index]; }
+ set { list[index] = value; }
+ }
+
+ public void Add(Tracker value)
+ {
+ this.list.Add(value);
+ }
+
+ public void Clear()
+ {
+ this.list.Clear();
+ }
+
+ public bool Contains(Tracker value)
+ {
+ return list.Contains(value);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ list.CopyTo(array, index);
+ }
+
+ public int Count
+ {
+ get { return list.Count; }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator();
+ }
+
+ public int IndexOf(Tracker value)
+ {
+ list.IndexOf(value);
+ }
+
+ public void Insert(int index, Tracker value)
+ {
+ list.Insert(index, value);
+ }
+
+ public bool IsSynchronized
+ {
+ get { list.IsSynchronized; }
+ }
+
+ public void Remove(Tracker value)
+ {
+ list.Remove(value);
+ }
+
+ public void RemoveAt(int index)
+ {
+ RemoveAt(index);
+ }
+
+ public object SyncRoot
+ {
+ get { return list.SyncRoot; }
+ }
+
+ #endregion Methods
+
+
+ #region Explicit Implementation
+
+ int IList.Add(object value)
+ {
+ Add((int)value);
+ }
+
+ int IList.IndexOf(object value)
+ {
+ IndexOf((int)value);
+ }
+
+ bool IList.Contains(object value)
+ {
+ Contains((int)value);
+ }
+
+ void IList.Insert(int index, object value)
+ {
+ Insert(index, (int)value);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get { return list.IsFixedSize; }
+ }
+
+ bool IList.IsReadOnly
+ {
+ get { return list.IsReadOnly; }
+
+ }
+
+ void IList.Remove(object value)
+ {
+ Remove((int)value);
+ }
+
+ object IList.this[int index]
+ {
+ get { return this[index]; }
+ set { this[index] = value; }
+ }
+
+ #endregion
+ }
+}
Property changes on:
trunk/bitsharp/src/MonoTorrent/Collections/TrackerCollection.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs
2007-04-30 19:33:06 UTC (rev 76507)
+++ trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs
2007-04-30 21:13:57 UTC (rev 76508)
@@ -0,0 +1,158 @@
+/*
+using System;
+using System.Text;
+using System.Collections;
+#if NET_2_0
+using System.Collections.Generic;
+#endif
+
+namespace MonoTorrent
+{
+ public class @[EMAIL PROTECTED] : IList
+ {
+ #region Private Fields
+
+#if NET_2_0
+ private List<@TYPE@> list;
+#else
+ private ArrayList list;
+#endif
+
+ #endregion Private Fields
+
+
+ #region Constructors
+
+ public @[EMAIL PROTECTED]()
+ {
+ list = new ArrayList();
+ }
+
+ public @[EMAIL PROTECTED](int capacity)
+ {
+ list = new ArrayList(capacity);
+ }
+
+ #endregion
+
+
+ #region Methods
+
+ public @TYPE@ this[int index]
+ {
+ get { return (@TYPE@)list[index]; }
+ set { list[index] = value; }
+ }
+
+ public void Add(@TYPE@ value)
+ {
+ this.list.Add(value);
+ }
+
+ public void Clear()
+ {
+ this.list.Clear();
+ }
+
+ public bool Contains(@TYPE@ value)
+ {
+ return list.Contains(value);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ list.CopyTo(array, index);
+ }
+
+ public int Count
+ {
+ get { return list.Count; }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator();
+ }
+
+ public int IndexOf(@TYPE@ value)
+ {
+ list.IndexOf(value);
+ }
+
+ public void Insert(int index, @TYPE@ value)
+ {
+ list.Insert(index, value);
+ }
+
+ public bool IsSynchronized
+ {
+ get { list.IsSynchronized; }
+ }
+
+ public void Remove(@TYPE@ value)
+ {
+ list.Remove(value);
+ }
+
+ public void RemoveAt(int index)
+ {
+ RemoveAt(index);
+ }
+
+ public object SyncRoot
+ {
+ get { return list.SyncRoot; }
+ }
+
+ #endregion Methods
+
+
+ #region Explicit Implementation
+
+ int IList.Add(object value)
+ {
+ Add((int)value);
+ }
+
+ int IList.IndexOf(object value)
+ {
+ IndexOf((int)value);
+ }
+
+ bool IList.Contains(object value)
+ {
+ Contains((int)value);
+ }
+
+ void IList.Insert(int index, object value)
+ {
+ Insert(index, (int)value);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get { return list.IsFixedSize; }
+ }
+
+ bool IList.IsReadOnly
+ {
+ get { return list.IsReadOnly; }
+
+ }
+
+ void IList.Remove(object value)
+ {
+ Remove((int)value);
+ }
+
+ object IList.this[int index]
+ {
+ get { return this[index]; }
+ set { this[index] = value; }
+ }
+
+ #endregion
+ }
+}
+
+*/
\ No newline at end of file
Property changes on:
trunk/bitsharp/src/MonoTorrent/Collections/UntypedCollection.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches