LRESULT CDialogCCD::OnGetTemplate(WPARAM wParam, LPARAM lParam) { CURRENT_TEMPLATE_NAME *_p = (CURRENT_TEMPLATE_NAME*)lParam; if (_p->strTemplateName.IsEmpty()) { return 0L; } if(_p->strTemplateName.Find("C:\\bin\\", 0) < 0) { _p->strTemplateName = "C:\\bin\\" +_p->strTemplateName; } m_wndWorkFile.SetWindowText(_p->strTemplateName); bool _bRet = false; vector<TRACK> _vecTrackTemplate; _bRet = ReadTemplate(_p->strTemplateName, m_curVecTrackTemplate); if (!_bRet) { return 0L; } return 0L; }
int TemplateCommand :: Execute( ALib::CommandLine & cmd ) { GetSkipOptions( cmd ); ReadTemplate( cmd ); if ( cmd.HasFlag( FLAG_FNAMES ) ) { mFileTemplate = cmd.GetValue( FLAG_FNAMES ); } IOManager io( cmd ); CSVRow row; while( io.ReadCSV( row ) ) { if ( Skip( row ) ) { continue; } if ( mFileTemplate.empty() ) { io.Out() << ReplaceColumns( mTemplate, row ); } else { FileOut( row ); } } return 0; }
void TemplateDlg::LoadNest(const char *path, bool main, bool recurse) { FindFile ff(AppendFileName(path, "*.*")); while(ff) { String p = AppendFileName(path, ff.GetName()); if(ff.IsFolder()) { if(recurse) LoadNest(p, main); } else if(ToLower(GetFileExt(ff.GetName())) == ".upt") { try { PackageTemplate t = ReadTemplate(p); if(main && t.main || !main && t.sub) pt.Add() = pick(t); } catch(CParser::Error e) { Exclamation("Package template [* " + DeQtf(p) + "] is invalid&[* " + e); } } ff.Next(); } }
void CDialogCCD::AddTFileList(CString strFile_) { bool _bRet = false; vector<TRACK> _template; _bRet = ReadTemplate(strFile_, _template); if (!_bRet) { return; } SEQ_KEYS _key; GetTemplateKeys(_template[0], _key); CString _strOneLine; _strOneLine.Format("Area=%.6f;Len=%.6f;LongSide=%.6f;ShortSide=%.6f;CenterX=%.6f;CenterY=%.6f;FX=%.6f;FY=%.6f;FcX=%.6f;FcY=%.6f;Angle=%.6f;%s", _key.fArea, _key.fLen, _key.fLongSide, _key.fShortSide, _key.ptCenter.Doub2D.x, _key.ptCenter.Doub2D.y, _key.ptF.Doub2D.x, _key.ptF.Doub2D.y, _key.ptFoucs.Doub2D.x, _key.ptFoucs.Doub2D.y, _key.fAngle, strFile_.GetBuffer()); int _n = strFile_.ReverseFind('\\'); CString _strList = strFile_.Mid(0, _n+1); _strList += "TFileList.txt"; CFileTxt _fileTemplate; vector<CString> _vecLine; _fileTemplate.OpenFileTxt(_strList); _fileTemplate.ReadLine(_vecLine); if (_vecLine.empty()) { _fileTemplate.WriteOneLine(_strOneLine); return; } _fileTemplate.CloseFile(); _fileTemplate.DeleteFile(_strList); _fileTemplate.OpenFileTxt(_strList); CString _strFileName = strFile_.Mid(_n); bool _bFind = false; for (size_t _i=0; _i<_vecLine.size(); _i++) { if (_vecLine[_i].Find(_strFileName) >= 0) { _vecLine[_i] = _strOneLine; _bFind = true; break; } } if (!_bFind) { _vecLine.push_back(_strOneLine); } _fileTemplate.WriteLine(_vecLine); }