Author: alanmc Date: 2008-02-19 17:29:29 -0500 (Tue, 19 Feb 2008) New Revision: 96200
Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/AllowedFastAlgorithm.cs trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/ClientEngine.cs trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/EventArgs/AnnounceResponseEventArgs.cs trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Tracker/TrackerFactory.cs trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Tracker/TrackerTier.cs trunk/bitsharp/src/MonoTorrent/MonoTorrent.Common/MonoTorrentCollectionBase.cs trunk/bitsharp/src/MonoTorrent/MonoTorrent.Common/ToolBox.cs trunk/bitsharp/src/MonoTorrent/MonoTorrent.TorrentWatchers/TorrentWatchers.cs Log: Cosmetics Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/AllowedFastAlgorithm.cs =================================================================== --- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/AllowedFastAlgorithm.cs 2008-02-19 22:15:23 UTC (rev 96199) +++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/AllowedFastAlgorithm.cs 2008-02-19 22:29:29 UTC (rev 96200) @@ -32,6 +32,7 @@ using MonoTorrent.Client.Encryption; using System.Net; using System.Security.Cryptography; +using MonoTorrent.Common; namespace MonoTorrent.Client { Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/ClientEngine.cs =================================================================== --- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/ClientEngine.cs 2008-02-19 22:15:23 UTC (rev 96199) +++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/ClientEngine.cs 2008-02-19 22:29:29 UTC (rev 96200) @@ -155,9 +155,9 @@ static ClientEngine() { // Register builtin tracker clients - TrackerFactory.RegisterTypeForProtocol("udp", typeof(UdpTracker)); - TrackerFactory.RegisterTypeForProtocol("http", typeof(HTTPTracker)); - TrackerFactory.RegisterTypeForProtocol("https", typeof(HTTPTracker)); + TrackerFactory.Register("udp", typeof(UdpTracker)); + TrackerFactory.Register("http", typeof(HTTPTracker)); + TrackerFactory.Register("https", typeof(HTTPTracker)); } Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/EventArgs/AnnounceResponseEventArgs.cs =================================================================== --- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/EventArgs/AnnounceResponseEventArgs.cs 2008-02-19 22:15:23 UTC (rev 96199) +++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/EventArgs/AnnounceResponseEventArgs.cs 2008-02-19 22:29:29 UTC (rev 96200) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using MonoTorrent.Client.Tracker; +using MonoTorrent.Common; namespace MonoTorrent.Client { Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Tracker/TrackerFactory.cs =================================================================== --- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Tracker/TrackerFactory.cs 2008-02-19 22:15:23 UTC (rev 96199) +++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Tracker/TrackerFactory.cs 2008-02-19 22:29:29 UTC (rev 96200) @@ -39,13 +39,13 @@ private static object locker = new object(); static Dictionary<string, Type> trackerTypes = new Dictionary<string, Type>(); - public static void RegisterTypeForProtocol(string protocol, Type trackerType) + public static void Register(string protocol, Type trackerType) { lock (locker) trackerTypes.Add(protocol, trackerType); } - public static Tracker CreateForProtocol(string protocol, Uri announceUrl) + public static Tracker Create(string protocol, Uri announceUrl) { Type type; lock (locker) Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Tracker/TrackerTier.cs =================================================================== --- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Tracker/TrackerTier.cs 2008-02-19 22:15:23 UTC (rev 96199) +++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Tracker/TrackerTier.cs 2008-02-19 22:29:29 UTC (rev 96200) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using System.Collections; +using MonoTorrent.Common; namespace MonoTorrent.Client.Tracker { @@ -40,25 +41,30 @@ #region Constructors - internal TrackerTier(MonoTorrentCollection<string> trackerUrls) + internal TrackerTier(IEnumerable<string> trackerUrls) { Uri result; - List<Tracker> trackerList = new List<Tracker>(trackerUrls.Count); + List<Tracker> trackerList = new List<Tracker>(); - for (int i = 0; i < trackerUrls.Count; i++) + foreach (string trackerUrl in trackerUrls) { // FIXME: Debug spew? - if (!Uri.TryCreate(trackerUrls[i], UriKind.Absolute, out result)) + if (!Uri.TryCreate(trackerUrl, UriKind.Absolute, out result)) + { + Logger.Log(null, "TrackerTier - Invalid tracker Url specified: {0}", trackerUrl); continue; + } - Tracker tracker = TrackerFactory.CreateForProtocol(result.Scheme, result); + Tracker tracker = TrackerFactory.Create(result.Scheme, result); if (tracker != null) { tracker.Tier = this; trackerList.Add(tracker); } else - Console.Error.WriteLine("Unsupported protocol {0}", result); + { + Console.Error.WriteLine("Unsupported protocol {0}", result); // FIXME: Debug spew? + } } this.trackers = trackerList.ToArray(); @@ -71,7 +77,7 @@ internal int IndexOf(Tracker tracker) { - return Array.IndexOf<Tracker>(trackers, tracker); + return Array.IndexOf<Tracker>(trackers, tracker); } Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.Common/MonoTorrentCollectionBase.cs =================================================================== --- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Common/MonoTorrentCollectionBase.cs 2008-02-19 22:15:23 UTC (rev 96199) +++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Common/MonoTorrentCollectionBase.cs 2008-02-19 22:29:29 UTC (rev 96200) @@ -3,7 +3,7 @@ using System.Collections; using System.Collections.Generic; -namespace MonoTorrent +namespace MonoTorrent.Common { public class MonoTorrentCollection<T> : IList<T> { Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.Common/ToolBox.cs =================================================================== --- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Common/ToolBox.cs 2008-02-19 22:15:23 UTC (rev 96199) +++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Common/ToolBox.cs 2008-02-19 22:29:29 UTC (rev 96200) @@ -35,7 +35,7 @@ namespace MonoTorrent.Common { - public delegate int Action<T>(T target); + public delegate int Operation<T>(T target); public static class Toolbox { @@ -51,7 +51,7 @@ return count; } - public static int Accumulate<T>(IEnumerable<T> enumerable, Action<T> action) + public static int Accumulate<T>(IEnumerable<T> enumerable, Operation<T> action) { int count = 0; Modified: trunk/bitsharp/src/MonoTorrent/MonoTorrent.TorrentWatchers/TorrentWatchers.cs =================================================================== --- trunk/bitsharp/src/MonoTorrent/MonoTorrent.TorrentWatchers/TorrentWatchers.cs 2008-02-19 22:15:23 UTC (rev 96199) +++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.TorrentWatchers/TorrentWatchers.cs 2008-02-19 22:29:29 UTC (rev 96200) @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; +using MonoTorrent.Common; namespace MonoTorrent.TorrentWatcher { _______________________________________________ Mono-patches maillist - Mono-patches@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-patches