Exemplo n.º 1
0
        private ObjectPath CreateEngine(string name, ObjectPath engineSettings)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (engineSettings == null)
            {
                throw new ArgumentNullException("engineSettings");
            }

            if (engines.ContainsKey(name))
            {
                return(engines[name].Path);
            }

            Console.WriteLine("Settings: {0}	-	{1}", engineSettings, engineSettings);
            IEngineSettings settings = this.engineSettings[engineSettings];

            ObjectPath    path    = new ObjectPath(string.Format(EnginePath, name));
            EngineAdapter adapter = new EngineAdapter(name, (EngineSettingsAdapter)settings, path);

            engines.Add(name, adapter);
            TorrentService.Bus.Register(path, adapter);

            return(path);
        }
Exemplo n.º 2
0
        public void DestroyEngine(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (!engines.ContainsKey(name))
            {
                throw new ArgumentException("The engine does not exist");
            }

            EngineAdapter engine = engines[name];

            engines.Remove(name);

            foreach (System.Threading.WaitHandle h in engine.Engine.StopAll())
            {
                h.WaitOne(2000, true);
            }

            engine.SaveState();

            // Dispose will recursively unregister everything from the bus
            engine.Dispose();
        }
Exemplo n.º 3
0
        private ObjectPath CreateEngine(string name, ObjectPath engineSettings)
        {
            if (string.IsNullOrEmpty (name))
                throw new ArgumentNullException ("name");

            if (engineSettings == null)
                throw new ArgumentNullException ("engineSettings");

            if (engines.ContainsKey (name))
                return engines[name].Path;

            Console.WriteLine ("Settings: {0}	-	{1}", engineSettings, engineSettings);
            IEngineSettings settings = this.engineSettings[engineSettings];

            ObjectPath path = new ObjectPath (string.Format (EnginePath, name));
            EngineAdapter adapter = new EngineAdapter (name, (EngineSettingsAdapter)settings, path);

            engines.Add(name, adapter);
            TorrentService.Bus.Register (path, adapter);

            return path;
        }