~hyperair/do-plugins/drop-obsolete-urls

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Linq;
using System.Collections.Generic;

using Mono.Addins;

using Do.Universe;
using Do.Platform;

namespace Transmission {

	public class TorrentOperateAction: Act {

	    public override string Name {
			get { return AddinManager.CurrentLocalizer.GetString ("Operate on files"); }
	    }

		public override string Description {
			get { return AddinManager.CurrentLocalizer.GetString ("Operate on downloaded file"); }
		}

		public override string Icon {
			get { return "file"; }
		}

		public override IEnumerable<Type> SupportedItemTypes {
			get { yield return typeof (ITorrentEntry); }
		}

		public override IEnumerable<Item> Perform(IEnumerable<Item> items, IEnumerable<Item> modItems) {
			foreach (Item item in items) {
				ITorrentEntry entry = (ITorrentEntry)item;
				yield return Services.UniverseFactory.NewFileItem(entry.Path) as Item;
			}
		}
	}
}