///<summary>Start the Tracker. Start Watching the TORRENT_DIR Directory for new Torrents.</summary> public MySimpleTracker() { #region Changes to use DhtTracker BrunetDht dht = (BrunetDht)DictionaryServiceFactory.GetServiceInstance( typeof(BrunetDht)); DictionaryServiceProxy proxy = new DictionaryServiceProxy(dht, 0); DictionaryServiceTracker dictTracker = new DictionaryServiceTracker(proxy, "http://*:24132"); tracker = dictTracker.Tracker; dictTracker.Start(); #endregion SetupTorrentWatcher(); while (true) { lock (tracker) foreach (SimpleTorrentManager m in tracker) { Console.Write("Name: {0} ", m.Trackable.Name); Console.WriteLine("Complete: {1} Incomplete: {2} Downloaded: {0}", m.Downloaded, m.Complete, m.Incomplete); IList <Peer> peers = m.GetPeers(); foreach (Peer pr in peers) { Console.WriteLine(pr.ClientAddress); } Console.WriteLine(); } System.Threading.Thread.Sleep(10000); } }
public override string FormatErrorMessage(string name) { var phrase = !string.IsNullOrEmpty(this.DictionaryKey) ? DictionaryServiceFactory.GetConfiguredInstance().Translate(this.DictionaryKey, this.DefaultTranslation, this.Editable) : this.DefaultTranslation; phrase = phrase.Replace("{0}", this.Minimum.ToString()); phrase = phrase.Replace("{1}", this.Maximum.ToString()); return(phrase); }
public void Configure(IServiceCollection serviceCollection) { serviceCollection.AddTransient(provider => DictionaryServiceFactory.GetConfiguredInstance()); serviceCollection.AddSingleton(provider => DictionarySettingsFactory.ConfiguredInstance); serviceCollection.AddSingleton(provider => DictionarySettingsFactory.ConfiguredInstance.DictionarySettings); serviceCollection.AddSingleton(provider => DictionarySettingsFactory.ConfiguredInstance.DictionaryIconSettings); serviceCollection.AddTransient(provider => Factory.CreateObject("vohil/dictionary/itemRepository", true) as DictionaryItemRepository); serviceCollection.AddSingleton(provider => Factory.CreateObject("vohil/dictionary/cache", true) as DictionaryCache); }
/// <summary> /// Registers ServiceConfigSection.ServiceHandlersSet event /// </summary> static void OnServiceHandlersSet(object sender, EventArgs e) { ServiceConfigSection config = (ServiceConfigSection)sender; foreach (ServiceHandlerMapping handler in config.serviceHandlers) { Type type = Type.GetType(handler.type); Uri uri = new Uri(handler.uri); DictionaryServiceFactory.RegisterServiceType(type, uri); Logger.WriteLineIf(LogLevel.Info, _log_props, string.Format("{0} service at {1} registered", type.Name, uri.ToString())); } }
public override string FormatErrorMessage(string name) { return(!string.IsNullOrEmpty(this.DictionaryKey) ? DictionaryServiceFactory.GetConfiguredInstance().Translate(this.DictionaryKey, this.DefaultTranslation, this.Editable) : this.DefaultTranslation); }
public static MvcDictionaryServiceWrapper Dictionary(this SitecoreHelper helper) { return(new MvcDictionaryServiceWrapper(DictionaryServiceFactory.GetConfiguredInstance())); }