Exemplo n.º 1
0
        override protected void ProcessItemUpdate(DownloadQueueItem item, ecProto.ecTag tag)
        {
            item.UpdateItem(tag);

            ecProto.ecMD5 id = ((ecProto.ecTagMD5)tag).ValueMD5();
            if (!m_enc_map.ContainsKey(id))
            {
                throw new Exception("No RLE decoder for download queue item");
            }
        }
Exemplo n.º 2
0
        override protected SharedFileItem CreateItem(ecProto.ecTag tag)
        {
            ecProto.ecMD5  id       = ((ecProto.ecTagMD5)tag).ValueMD5();
            string         filename = ((ecProto.ecTagString)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_NAME)).StringValue();
            Int64          filesize = (Int64)((ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SIZE_FULL)).Value64();
            SharedFileItem i        = new SharedFileItem(id, filename, filesize);

            //i.UpdateItem(tag);

            return(i);
        }
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();
        }
Exemplo n.º 4
0
        override protected DownloadQueueItem CreateItem(ecProto.ecTag tag)
        {
            ecProto.ecMD5 id       = ((ecProto.ecTagMD5)tag).ValueMD5();
            string        filename = ((ecProto.ecTagString)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_NAME)).StringValue();
            Int64         filesize = (Int64)((ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SIZE_FULL)).Value64();

            PartFileEncoderData e = new PartFileEncoderData((int)(filesize / 9728000), 10);

            m_enc_map[id] = e;

            DownloadQueueItem i = new DownloadQueueItem(id, filename, filesize, e);

            i.AllocColorLine(m_new_item_status_length);

            i.UpdateItem(tag);

            return(i);
        }
Exemplo n.º 5
0
 public SharedFileItem(ecProto.ecMD5 id, string name, Int64 size)
     : base(id, name, size)
 {
 }
Exemplo n.º 6
0
 public DownloadQueueItem(ecProto.ecMD5 id, string name, Int64 size, PartFileEncoderData encoder)
     : base(id, name, size)
 {
     m_decoder        = encoder;
     m_color_gap_buff = new ColoredGapBuffer((Int32)(size / FILE_PARTSIZE) + 1 + 1);
 }
Exemplo n.º 7
0
 public amuleFileItem(ecProto.ecMD5 id, string name, Int64 size)
 {
     m_id       = id;
     m_filename = name;
     m_filesize = size;
 }
Exemplo n.º 8
0
 protected virtual ecProto.ecTag CreateItemTag(ecProto.ecMD5 id)
 {
     return(null);
 }