Пример #1
0
    void HandleNodeview2ButtonPressEvent(object o, ButtonPressEventArgs args)
    {
        if ((TorrentInfoRow)nodeview2.NodeSelection.SelectedNode != null)
        {
            if ((args.Event.Button==1))
            {
                XenoTorrent.TorrentSettings ts = new XenoTorrent.TorrentSettings (((TorrentInfoRow)nodeview2.NodeSelection.SelectedNode).TorrentManager);
                ts.Show ();
            }

            if (args.Event.Button==3)
            {
                if (((TorrentInfoRow)nodeview2.NodeSelection.SelectedNode).TorrentManager.State == TorrentState.Seeding)
                    MenuItem3.Sensitive = true;
                else
                    MenuItem3.Sensitive = false;
                jBox.ShowAll ();
                jBox.Popup ();
            }
        }
    }
Пример #2
0
    public void LoadFastResume(List <TorrentManager> managers)
    {
        // Read the main dictionary from disk and iterate through
        // all the fast resume items
        List<TorrentManager> temp = new List<TorrentManager>(managers.Count);
        for (int i = 0; i< managers.Count; i++)
            temp.Add(managers[i]);

        if (File.Exists(fastResumePath))
        {
            BEncodedList list = (BEncodedList) BEncodedValue.Decode (File.ReadAllBytes (fastResumePath));
            foreach (BEncodedDictionary fastResume in list)
            {
                // Decode the FastResume data from the BEncodedDictionary
                FastResume data = new FastResume (fastResume);

                // Find the torrentmanager that the fastresume belongs to
                // and then load it
                foreach (TorrentManager manager in managers)
                    if (manager.InfoHash == data.Infohash)
                    {
                        manager.LoadFastResume (data);
                        temp.Remove(manager);
                    }
            }

            foreach (TorrentManager manager in temp)
                {
                    //manager.HashCheck(true);
                    manager.Stop();
                    XenoTorrent.TorrentSettings ts = new XenoTorrent.TorrentSettings (manager);
                    ts.Show ();
                }

        }
    }