private void OnPieceHashed(object sender, PieceHashedEventArgs e)
        {
            float progress       = EnumAdapter.Adapt(manager.State) == TorrentState.Hashing ? (float)e.PieceIndex / manager.Bitfield.Length : 1;
            PieceHashedHandler h = PieceHashed;

            if (h != null)
            {
                h(Path, e.PieceIndex, e.HashPassed, progress);
            }
        }
        public TorrentManagerAdapter(TorrentManager manager, TorrentAdapter torrent, TorrentSettingsAdapter settings, ObjectPath path)
        {
            this.manager         = manager;
            this.torrent         = torrent;
            this.settingsAdapter = settings;
            this.path            = path;

            manager.TorrentStateChanged += delegate(object sender, TorrentStateChangedEventArgs e) {
                if (StateChanged != null)
                {
                    StateChanged(path, EnumAdapter.Adapt(e.OldState), EnumAdapter.Adapt(e.NewState));
                }
            };

            manager.PieceHashed += OnPieceHashed;

            LoadTrackers(manager.TrackerManager.TrackerTiers);
        }