Changeset 16 for trunk/tmdmcreator/src/tmdmcreator.cpp
- Timestamp:
- 02/21/13 16:20:42 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tmdmcreator/src/tmdmcreator.cpp
r15 r16 16 16 17 17 #include "tmdmcreator.h" 18 #include "tmdmcopier.h" 18 19 19 tmdmcreator::tmdmcreator() {20 TmDmCreator::TmDmCreator() { 20 21 } 21 22 22 23 23 24 24 tmdmcreator::~tmdmcreator() {25 TmDmCreator::~TmDmCreator() { 25 26 } 26 27 27 28 28 29 29 void tmdmcreator::SetBaseSQL(wxFileName value) {30 void TmDmCreator::SetBaseSQL(wxFileName value) { 30 31 m_FileNameBaseSQL = value; 31 32 } … … 33 34 34 35 35 void tmdmcreator::SetUserSQL(wxFileName value) {36 void TmDmCreator::SetUserSQL(wxFileName value) { 36 37 m_FileNameUserSQL = value; 37 38 } … … 39 40 40 41 41 void tmdmcreator::SetUserContent(wxFileName value) {42 void TmDmCreator::SetUserContent(wxFileName value) { 42 43 m_FileNameUserContent = value; 43 44 } … … 45 46 46 47 47 void tmdmcreator::SetOutSQL(wxFileName value) {48 void TmDmCreator::SetOutSQL(wxFileName value) { 48 49 m_FileNameOutSQL = value; 49 50 } 50 51 51 52 52 53 bool tmdmcreator::CheckFiles(wxArrayString & errormsg) { 54 return false; 53 bool TmDmCreator::_CheckExistsAndExt(const wxFileName & filename, const wxString & extension, wxArrayString * errormsg){ 54 wxASSERT(errormsg); 55 if (filename.Exists() == false) { 56 errormsg->Add(wxString::Format(_("File: %s didn't exists!"), filename.GetFullPath())); 57 return false; 58 } 59 if (filename.GetExt().Lower() != extension) { 60 errormsg->Add(wxString::Format(_("Wrong extension for: %s (expected: %s)"), filename.GetFullPath(), extension)); 61 return false; 62 } 63 return true; 55 64 } 56 65 57 66 58 67 59 bool tmdmcreator::ProcessFiles(wxArrayString & errorsmsg) { 60 return false; 68 bool TmDmCreator::CheckFiles(wxArrayString & errormsg) { 69 errormsg.Clear(); 70 if (_CheckExistsAndExt(m_FileNameBaseSQL, _T("sql"), &errormsg) == false) { 71 return false; 72 } 73 if (_CheckExistsAndExt(m_FileNameUserSQL, _T("sql"), &errormsg) == false) { 74 return false; 75 } 76 if (_CheckExistsAndExt(m_FileNameUserContent, _T("txt"), &errormsg) == false) { 77 return false; 78 } 79 if (m_FileNameOutSQL.Exists()) { 80 errormsg.Add(wxString::Format(_("output file: %s allready exists!"), m_FileNameOutSQL.GetFullPath())); 81 return false; 82 } 83 if (m_FileNameOutSQL.IsDirWritable() == false){ 84 errormsg.Add(wxString::Format(_T("Writing not permitted into %s"), m_FileNameOutSQL.GetPath())); 85 return false; 86 } 87 return true; 61 88 } 62 89 90 91 92 bool TmDmCreator::ProcessFiles(wxArrayString & errorsmsg) { 93 errorsmsg.Clear(); 94 // Copy structure to out 95 TmDmCopier myCopier(m_FileNameOutSQL); 96 if (myCopier.CopyFrom(m_FileNameBaseSQL) == false) { 97 errorsmsg.Add(wxString::Format(_("Copying: %s failed!"), m_FileNameBaseSQL.GetFullPath())); 98 return false; 99 } 100 101 if (myCopier.CopyFrom(m_FileNameUserSQL) == false) { 102 errorsmsg.Add(wxString::Format(_("Copying: %s failed!"), m_FileNameUserSQL.GetFullPath())); 103 return false; 104 } 105 106 107 108 return true; 109 } 110
Note: See TracChangeset
for help on using the changeset viewer.