UnZipService.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "stdafx.h"
  2. #include "UnZipService.h"
  3. #include "../jsonLib/json/json.h"
  4. #include <list>
  5. #include "../Util/Util.h"
  6. #include "../SmartEvaluationLogic/ScanDll.h"
  7. #define UM_TERMINATE WM_USER + 100
  8. CDataBaseService g_dataBaseService;
  9. CUnZipService::CUnZipService(const wstring& _indexdbpath, const wstring& _batchdbpath,
  10. const wstring& _iamgepath, const wstring& _workpath,
  11. const wstring& _sharefilename, const wstring& _sharefilepath)
  12. {
  13. m_strIamgePath = _iamgepath;
  14. m_strWorkPath = _workpath;
  15. CString strFilePath(_sharefilepath.c_str());
  16. strFilePath.Replace(L"\\", L"/");
  17. wstring _filePath(strFilePath);
  18. g_dataBaseService.SetDataBasePath(_indexdbpath, _batchdbpath, _sharefilename, _filePath, _workpath);
  19. }
  20. CUnZipService::CUnZipService(const wstring& _indexdbpath, vector<int>& vct)
  21. {
  22. g_dataBaseService.LoadUnhandleBatch(_indexdbpath, vct);
  23. }
  24. CUnZipService::~CUnZipService()
  25. {
  26. }
  27. bool CUnZipService::ParseImageDir(int& last_id)
  28. {
  29. vector<string> _listImage;
  30. DetectDirectory(m_strIamgePath, _listImage);
  31. if (_listImage.size() == 0 || _listImage.size() % 2 == 1)
  32. {
  33. g_dataBaseService.InsertBatchFail(batch_exc_multiple, _listImage.size());
  34. return false;
  35. }
  36. g_dataBaseService.InsertPapers(_listImage);
  37. g_dataBaseService.InsertIndex(_listImage.size() / 2, last_id);
  38. return true;
  39. }
  40. void CUnZipService::InsertBatchFail(int state, int zipfile_cnt)
  41. {
  42. g_dataBaseService.InsertBatchFail(state, zipfile_cnt);
  43. }
  44. void CUnZipService::InsertBatchInfo()
  45. {
  46. g_dataBaseService.InsertBatchInfo();
  47. }