Exemplo n.º 1
0
 public void SelectedItemsToCommand(ecProto.ecPacket cmd)
 {
     foreach (ListViewItem i in SelectedItems)
     {
         DownloadQueueItem it  = i.Tag as DownloadQueueItem;
         ecProto.ecTagMD5  tag = new ecProto.ecTagMD5(ECTagNames.EC_TAG_PARTFILE, it.ID);
         cmd.AddSubtag(tag);
     }
 }
Exemplo n.º 2
0
        private void buttonAddLink_Click(object sender, EventArgs e)
        {
            AddLinkDialog dlg = new AddLinkDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string              link    = dlg.textBoxLink.Text;
                ecProto.ecPacket    cmd     = new ecProto.ecPacket(ECOpCodes.EC_OP_ADD_LINK);
                ecProto.ecTagString linktag = new ecProto.ecTagString(ECTagNames.EC_TAG_STRING, link);
                cmd.AddSubtag(linktag);
                m_amuleRemote.SendPacket(cmd);
            }
        }
Exemplo n.º 3
0
        void ProcessUpdate(ecProto.ecPacket packet, ecProto.ecPacket full_req)
        {
            m_owner.MyBeginUpdate();
            LinkedList <ecProto.ecTag> .Enumerator i = packet.GetTagIterator();
            while (i.MoveNext())
            {
                ecProto.ecTag t = i.Current;
                // sometimes reply contains additional tags
                if (t.Name() != m_item_tagname)
                {
                    continue;
                }
                ecProto.ecMD5 item_id = ((ecProto.ecTagMD5)t).ValueMD5();
                if (m_items_hash.ContainsKey(item_id))
                {
                    T item = m_items_hash[item_id];
                    ProcessItemUpdate(item, t);

                    if (m_owner != null)
                    {
                        m_owner.UpdateItem(item);
                    }
                }
                else
                {
                    if (m_inc_tags)
                    {
                        T item = CreateItem(t);
                        m_items.AddLast(item);
                        m_items_hash[item_id] = item;

                        if (m_owner != null)
                        {
                            m_owner.InsertItem(item);
                        }
                    }
                    else
                    {
                        full_req.AddSubtag(CreateItemTag(item_id));
                    }
                }
                //
                // now process item deletion
                //
                // TODO
            }
            m_owner.MyEndUpdate();
        }