-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcMain.cpp
More file actions
83 lines (57 loc) · 1.83 KB
/
ProcMain.cpp
File metadata and controls
83 lines (57 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "analyseXml.h"
#include "procMain.h"
extern stringstream framess;
extern ofstream logFile;
extern string logname;
extern stringstream frameobj;
extern stringstream totalFrame;
extern vector<string> xmlContent; // 存放xml中应显示的内容
extern vector<string> addInXml; // 存放每个obj中的transfrom属性
extern vector<string> abcProp; // 存放每个abc的属性(文件名除外)
extern size_t tabNum; // 单行增加制表符,用于控制格式
//用来写帧文件的信息(一共有多少帧,每一帧xml文件对应的路径)
ofstream infofile;
string infoname;
//生成每一帧的xml以及obj文件
void generatexml(string xmlPath,double frame1)
{
objCount=0;
objPath=xmlPath.substr(0,xmlPath.find_last_of("\\"))+"\\";
char tmp[40];
time_t t=time(0);
strftime( tmp, sizeof(tmp), "%Y-%m-%d %X",localtime(&t) );
frameobj.clear();
frameobj.str("");
frameobj<<frame1;
//解析程序开始,打印log
logname=objPath+frameobj.str()+".log";
logFile.open((logname).c_str());
logFile<<tmp<<"\tstart"<< '\n';
string xmlFile;
xmlFile=xmlPath;
cout<<xmlFile<<'\n';
frame=frame1;
cout<<frame<<'\n';//用来控制Obj文件的帧数
xmlAnalyze(xmlFile);
framess.clear();
framess.str("");
framess<<frame;
string framename=objPath+"frame"+framess.str()+".xml";
//cout<<"framename:"<<framename<<endl;
ofstream fout(framename.c_str());
for (size_t i = 0; i != xmlContent.size(); ++i)
fout << xmlContent[i] << '\n';
infofile.open(infoname.c_str(),ios::app);
infofile<<framename<<'\n';
infofile.close();
char tmpfinal[40];
time_t tfinal=time(0);
strftime( tmpfinal, sizeof(tmpfinal), "%Y-%m-%d %X",localtime(&tfinal) );
logFile<<tmpfinal<<"\tcompleted"<<'\n';
logFile.close();
}
////使用命令行
int main(int argc,char** argv)
{
generatexml(argv[1],atoi(argv[2]));
}