设为首页 加入收藏

TOP

VC资源文件版本解析类: (2) 源文件 (四)
2014-11-23 21:34:49 】 浏览:2211
Tags:源文件 版本 解析
20 m_ullFileVer = StrToVerA(strVal,',');
221 }
222 else if (ParseVersionInfo(strLine,"PRODUCTVERSION",strVal)!=string::npos)
223 {
224 m_ullProductVer = StrToVerA(strVal,',');
225 }
226 else if (ParseBlockInfo(strLine,"VALUE \"CompanyName\"",strVal)!=string::npos)
227 {
228 astr2tstr(strVal.c_str(),m_tstrCompanyName);
229 }
230 else if (ParseBlockInfo(strLine,"VALUE \"FileDescription\"",strVal)!=string::npos)
231 {
232 astr2tstr(strVal.c_str(),m_tstrFileDesc);
233 }
234 else if (ParseBlockInfo(strLine,"VALUE \"FileVersion\"",strVal)!=string::npos)
235 {
236 m_ullOtherFileVer = StrToVerA(strVal);
237 }
238 else if (ParseBlockInfo(strLine,"VALUE \"InternalName\"",strVal)!=string::npos)
239 {
240 astr2tstr(strVal.c_str(),m_tstrInternalName);
241 }
242 else if (ParseBlockInfo(strLine,"VALUE \"LegalCopyright\"",strVal)!=string::npos)
243 {
244 astr2tstr(strVal.c_str(),m_tstrCopyright);
245 }
246 else if (ParseBlockInfo(strLine,"VALUE \"OriginalFilename\"",strVal)!=string::npos)
247 {
248 astr2tstr(strVal.c_str(),m_tstrOriginalFileName);
249 }
250 else if (ParseBlockInfo(strLine,"VALUE \"ProductName\"",strVal)!=string::npos)
251 {
252 astr2tstr(strVal.c_str(),m_tstrProductName);
253 }
254 else if (ParseBlockInfo(strLine,"VALUE \"ProductVersion\"",strVal)!=string::npos)
255 {
256 m_ullOtherProductVer = StrToVerA(strVal);
257 }
258}
259
260size_t CRCVersion::ParseVersionInfo(const string& strLine,const string& strType,string& strVal)
261{
262 size_t pos = strLine.find(strType);
263 if (pos == string::npos)
264 {
265 return string::npos;
266 }
267 pos += strType.length();
268 pos = strLine.find(',',pos);
269 if (pos == string::npos)
270 {
271 return string::npos;
272 }
273 size_t pos3 = pos;
274 size_t pos1 = strLine.rfind(' ',pos);
275 size_t pos2 = strLine.rfind('\t',pos);
276 if (pos1 == string::npos && pos2 == string::npos)
277 {
278 return string::npos;
279 }
280 else if (pos1 == string::npos || pos2 == string::npos)
281 {
282 pos = min(pos1, pos2);
283 }
284 else
285 {
286 pos = max(pos1, pos2);
287 }
288 pos2 = ++pos;
289 pos = strLine.find(',', ++pos3);
290 if (pos == string::npos)
291 {
292 return string::npos;
293 }
294 pos = strLine.find(',',++pos);
295 if (pos == string::npos)
296 {
297 return string::npos;
298 }
299 pos1 = ++pos;
300 pos = strLine.find(' ',pos1);
301 if (pos == string::npos)
302 {
303 pos = strLine.find('\t',pos1);
304 }
305 if (pos == string::npos)
306 {
307 pos = strLine.find('\r',pos1);
308 }
309 if (pos == string::npos)
310 {
311 pos = strLine.find('\n',pos1);
312 }
313 if (pos == string::npos)
314 {
315 return string::npos;
316 }
317 strVal = strLine.substr(pos2,pos-pos2);
318 return pos2;
319}
320
321size_t CRCVersion::ParseBlockInfo(const string& strLine,const string& strType,string& strVal)
322{
323 size_t pos = strLine.find(strType);
324 if (pos == string::npos)
325 {
326 return string::npos;
327 }
328 pos += strType.length();
329 pos = strLine.find(',',pos);
330 if (pos == string:
首页 上一页 1 2 3 4 5 6 下一页 尾页 4/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇VC中Unicode字符串的处理 下一篇VC++ MFC的ActiveX窗口处理相关知..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目