| |
26 |
26 |
#include "BufferSizeDlg.h" |
| |
27 |
27 |
#include "FilterDlg.h" |
| |
28 |
28 |
#include "StringHelpers.h" |
| |
29 |
29 |
#include "ch.h" |
| |
30 |
30 |
#include "../libicpf/file.h" |
| |
31 |
31 |
#include "../libchcore/TTaskConfigBufferSizes.h" |
| |
32 |
32 |
|
| |
33 |
33 |
#ifdef _DEBUG |
| |
34 |
34 |
#define new DEBUG_NEW |
| |
35 |
35 |
#undef THIS_FILE |
| |
36 |
36 |
static char THIS_FILE[] = __FILE__; |
| |
37 |
37 |
#endif |
| |
38 |
38 |
|
| |
39 |
39 |
|
| |
40 |
40 |
|
| |
41 |
41 |
|
| |
42 |
42 |
|
| |
43 |
43 |
CCustomCopyDlg::CCustomCopyDlg() : |
| |
44 |
44 |
ictranslate::CLanguageDialog(CCustomCopyDlg::IDD) |
| |
45 |
45 |
{ |
| |
46 |
|
m_bOnlyCreate = FALSE; |
| |
47 |
|
m_bIgnoreFolders = FALSE; |
| |
48 |
|
m_bFilters = FALSE; |
| |
49 |
|
m_bAdvanced = FALSE; |
| |
50 |
|
m_bForceDirectories = FALSE; |
| |
51 |
|
|
| |
52 |
46 |
GetConfig().ExtractSubConfig(BRANCH_TASK_SETTINGS, m_tTaskDefinition.GetConfiguration()); |
| |
53 |
|
|
| |
54 |
|
m_bActualisation = false; |
| |
55 |
47 |
} |
| |
56 |
48 |
|
| |
57 |
49 |
CCustomCopyDlg::CCustomCopyDlg(const chcore::TTaskDefinition& rTaskDefinition) : |
| |
58 |
50 |
ictranslate::CLanguageDialog(CCustomCopyDlg::IDD), |
| |
59 |
51 |
m_tTaskDefinition(rTaskDefinition) |
| |
60 |
52 |
{ |
| |
61 |
53 |
} |
| |
62 |
54 |
|
| |
63 |
55 |
void CCustomCopyDlg::DoDataExchange(CDataExchange* pDX) |
| |
64 |
56 |
{ |
| |
65 |
57 |
CLanguageDialog::DoDataExchange(pDX); |
| |
66 |
58 |
|
| |
67 |
59 |
DDX_Control(pDX, IDC_DESTPATH_COMBOBOXEX, m_ctlDstPath); |
| |
68 |
60 |
DDX_Control(pDX, IDC_FILTERS_LIST, m_ctlFilters); |
| |
69 |
61 |
DDX_Control(pDX, IDC_BUFFERSIZES_LIST, m_ctlBufferSizes); |
| |
70 |
62 |
DDX_Control(pDX, IDC_OPERATION_COMBO, m_ctlOperation); |
| |
71 |
63 |
DDX_Control(pDX, IDC_PRIORITY_COMBO, m_ctlPriority); |
| |
72 |
64 |
DDX_Control(pDX, IDC_FILES_LIST, m_ctlFiles); |
| |
73 |
65 |
DDX_Check(pDX, IDC_ONLYSTRUCTURE_CHECK, m_bOnlyCreate); |
| |
74 |
66 |
DDX_Check(pDX, IDC_IGNOREFOLDERS_CHECK, m_bIgnoreFolders); |
|
| |
889 |
881 |
CEdit* pEdit=m_ctlDstPath.GetEditCtrl(); |
| |
890 |
882 |
if (!pEdit) |
| |
891 |
883 |
return; |
| |
892 |
884 |
|
| |
893 |
885 |
pEdit->SetSel(-1, -1); |
| |
894 |
886 |
} |
| |
895 |
887 |
|
| |
896 |
888 |
void CCustomCopyDlg::OnEditchangeDestpathComboboxex() |
| |
897 |
889 |
{ |
| |
898 |
890 |
if (m_bActualisation) |
| |
899 |
891 |
return; |
| |
900 |
892 |
m_bActualisation=true; |
| |
901 |
893 |
UpdateComboIcon(); |
| |
902 |
894 |
m_bActualisation=false; |
| |
903 |
895 |
} |
| |
904 |
896 |
|
| |
905 |
897 |
void CCustomCopyDlg::OnImportButton() |
| |
906 |
898 |
{ |
| |
907 |
899 |
boost::shared_array<BYTE> spBuffer; |
| |
908 |
900 |
|
| |
909 |
|
ulong_t ulSize = 0; |
| |
910 |
|
|
| |
911 |
901 |
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, GetResManager().LoadString(IDS_FLTALLFILTER_STRING)); |
| |
912 |
902 |
if(dlg.DoModal() == IDOK) |
| |
913 |
903 |
{ |
| |
|
904 |
unsigned long ulSize = 0; |
| |
914 |
905 |
UINT uiCount=0; |
| |
915 |
906 |
try |
| |
916 |
907 |
{ |
| |
917 |
908 |
icpf::file file; |
| |
918 |
909 |
file.open(dlg.GetPathName(), FA_READ); |
| |
919 |
910 |
|
| |
920 |
911 |
|
| |
921 |
912 |
ll_t llSize = file.get_size(); |
| |
922 |
913 |
if(llSize > 1*1024*1024 || llSize < 2) |
| |
923 |
914 |
{ |
| |
924 |
915 |
AfxMessageBox(GetResManager().LoadString(IDS_IMPORTERROR_STRING)); |
| |
925 |
916 |
return; |
| |
926 |
917 |
} |
| |
927 |
918 |
|
| |
928 |
|
ulSize = boost::numeric_cast<ulong_t>(llSize); |
| |
|
919 |
ulSize = boost::numeric_cast<unsigned long>(llSize); |
| |
929 |
920 |
spBuffer.reset(new BYTE[ulSize + 3]); |
| |
930 |
921 |
memset(spBuffer.get(), 0, ulSize + 3); |
| |
931 |
922 |
|
| |
932 |
923 |
ulSize = file.read(spBuffer.get(), ulSize); |
| |
933 |
924 |
file.close(); |
| |
934 |
925 |
} |
| |
935 |
926 |
catch(...) |
| |
936 |
927 |
{ |
| |
937 |
928 |
AfxMessageBox(GetResManager().LoadString(IDS_IMPORTERROR_STRING)); |
| |
938 |
929 |
return; |
| |
939 |
930 |
} |
| |
940 |
931 |
|
| |
941 |
932 |
|
| |
942 |
933 |
if(!spBuffer || ulSize < 3) |
| |
943 |
934 |
{ |
| |
944 |
935 |
AfxMessageBox(GetResManager().LoadString(IDS_IMPORTERROR_STRING)); |
| |
945 |
936 |
return; |
| |
946 |
937 |
} |
| |
947 |
938 |
|
| |
948 |
939 |
|