void CLogPlayerTabController::_OpenFile(const _TSTRING& fileName) { HANDLE hFile = NULL; static TCHAR BASED_CODE szFilter[] = _T("CSV Files (*.csv)|*.csv|All Files (*.*)|*.*||"); CFileDialog open(TRUE, NULL, NULL, NULL, szFilter, NULL); if (fileName.empty() && open.DoModal() != IDOK) return; //пользователь передумал mp_log_reader->SetSeparatingSymbol(mp_settings->GetCSVSepSymbol()); LogReader::FileError error_id; _TSTRING file_path = fileName.empty() ? open.GetPathName().GetBuffer(0) : fileName; bool result = mp_log_reader->OpenFile(file_path, error_id); if (false==result) { if (error_id==LogReader::FE_OPEN) AfxMessageBox(MLL::LoadString(IDS_LP_CANT_OPEN_FILE)); else if (error_id==LogReader::FE_FORMAT) { AfxMessageBox(MLL::LoadString(IDS_LP_INCORRECT_FILE_FORMAT)); } else ASSERT(0); mp_log_reader->CloseFile(); return; //не можем продолжать, так как произошла ошибка } //////////////////////////////////////////////////////////////// mp_view->mp_LPPanelDlg->SetOpenFileButtonText(MLL::GetString(IDS_LP_CLOSE_FILE)); //obtain file name from full path TCHAR stripped_name[MAX_PATH+1] = {0}; file_path.copy(stripped_name, file_path.size()); PathStripPath(stripped_name); CString string; string.Format(MLL::LoadString(IDS_LP_FILE_INFO_FMT_STRING), stripped_name, mp_log_reader->GetCount()); mp_view->mp_LPPanelDlg->SetFileIndicator(string.GetBuffer(0)); mp_view->mp_MIDeskDlg->Enable(true); mp_view->mp_CEDeskDlg->Enable(true); mp_view->mp_LMDeskDlg->Enable(true); mp_view->mp_LPPanelDlg->EnableAll(true); mp_view->mp_OScopeCtrl->EnableWindow(true); //инициализируем логику плеера и начинаем сразу проигрывать if (mp_log_reader->GetCount() > 0) { _InitPlayer(); _Play(true); } //////////////////////////////////////////////////////////////// }