DownloadThreadCallback.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "DownloadThreadCallback.h"
  2. //#include "Poco/Thread.h"
  3. CDownloadThreadCallback::CDownloadThreadCallback(void)
  4. :m_nStart(0), m_nEnd(0)
  5. {
  6. }
  7. CDownloadThreadCallback::CDownloadThreadCallback(string stringUri, string stringLocalFile, unsigned long nStart, unsigned long nEnd, CInternalNetIntetface* pNet)
  8. :m_stringUri(stringUri), m_stringLocalFile(stringLocalFile), m_nStart(nStart), m_nEnd(nEnd), m_pNet(pNet)
  9. {
  10. }
  11. CDownloadThreadCallback::~CDownloadThreadCallback(void)
  12. {
  13. }
  14. void CDownloadThreadCallback::SetUri(string stringUri)
  15. {
  16. m_stringUri = stringUri;
  17. }
  18. void CDownloadThreadCallback::SetLocalFile(string stringLocalFile)
  19. {
  20. m_stringLocalFile = stringLocalFile;
  21. }
  22. void CDownloadThreadCallback::SetStart(unsigned long nStart)
  23. {
  24. m_nStart = nStart;
  25. }
  26. void CDownloadThreadCallback::SetEnd(unsigned long nEnd)
  27. {
  28. m_nEnd = nEnd;
  29. }
  30. void CDownloadThreadCallback::SetNet(CInternalNetIntetface* pNet)
  31. {
  32. m_pNet = pNet;
  33. }
  34. unsigned long CDownloadThreadCallback::GetStart()
  35. {
  36. return m_nStart;
  37. }
  38. unsigned long CDownloadThreadCallback::GetEnd()
  39. {
  40. return m_nEnd;
  41. }
  42. void CDownloadThreadCallback::run()
  43. {
  44. //Poco::Thread::sleep(1000*2);
  45. m_pNet->SetSaveType(2);
  46. m_pNet->SetFilePath(m_stringLocalFile);
  47. m_pNet->DownloadFileSegment(m_stringUri, m_nStart, m_nEnd);
  48. }