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); }
public void UpdateItem(ecProto.ecTag tag) { ecProto.ecTagInt itag = (ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SIZE_DONE); if (itag != null) { m_size_done = itag.Value64(); } itag = (ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SIZE_XFER); if (itag != null) { m_size_xfered = itag.Value64(); } itag = (ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SPEED); if (itag != null) { m_speed = (Int32)itag.Value64(); } itag = (ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SOURCE_COUNT); if (itag != null) { m_src_count = (Int32)itag.Value64(); } itag = (ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SOURCE_COUNT_A4AF); if (itag != null) { m_a4af_src_count = (Int32)itag.Value64(); } itag = (ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SOURCE_COUNT_NOT_CURRENT); if (itag != null) { m_non_current_src_count = (Int32)itag.Value64(); } itag = (ecProto.ecTagInt)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_SOURCE_COUNT_XFER); if (itag != null) { m_xfer_src_count = (Int32)itag.Value64(); } ecProto.ecTagCustom gapstat = (ecProto.ecTagCustom)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_GAP_STATUS); ecProto.ecTagCustom partstat = (ecProto.ecTagCustom)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_PART_STATUS); m_decoder.Decode(gapstat.Value(), partstat.Value()); ecProto.ecTagCustom reqstat = (ecProto.ecTagCustom)tag.SubTag(ECTagNames.EC_TAG_PARTFILE_REQ_STATUS); BinaryReader br = new BinaryReader(new MemoryStream(reqstat.Value())); m_req_parts = new GapBuffer(reqstat.Value(), reqstat.Value().Length); DrawLine(); }
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); }