~do-plugins/do-plugins/trunk

« back to all changes in this revision

Viewing changes to Transmission/src/TorrentOperateAction.cs

  • Committer: Christopher James Halse Rogers
  • Date: 2013-05-02 07:23:58 UTC
  • mfrom: (684.1.9 do-plugins)
  • Revision ID: chris@ed-20130502072358-ddn5oxyjngeearme
Merge long-awaited Transmission control plugin

Ported to Json.NET, as this has packages in the Debian and Ubuntu archives.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Linq;
 
3
using System.Collections.Generic;
 
4
 
 
5
using Mono.Addins;
 
6
 
 
7
using Do.Universe;
 
8
using Do.Platform;
 
9
 
 
10
namespace Transmission {
 
11
 
 
12
        public class TorrentOperateAction: Act {
 
13
 
 
14
            public override string Name {
 
15
                        get { return AddinManager.CurrentLocalizer.GetString ("Operate on files"); }
 
16
            }
 
17
 
 
18
                public override string Description {
 
19
                        get { return AddinManager.CurrentLocalizer.GetString ("Operate on downloaded file"); }
 
20
                }
 
21
 
 
22
                public override string Icon {
 
23
                        get { return "file"; }
 
24
                }
 
25
 
 
26
                public override IEnumerable<Type> SupportedItemTypes {
 
27
                        get { yield return typeof (ITorrentEntry); }
 
28
                }
 
29
 
 
30
                public override IEnumerable<Item> Perform(IEnumerable<Item> items, IEnumerable<Item> modItems) {
 
31
                        foreach (Item item in items) {
 
32
                                ITorrentEntry entry = (ITorrentEntry)item;
 
33
                                yield return Services.UniverseFactory.NewFileItem(entry.Path) as Item;
 
34
                        }
 
35
                }
 
36
        }
 
37
}