Line 13... |
Line 13... |
13 |
{
|
13 |
{
|
14 |
type = FILETYPE_EXTRA;
|
14 |
type = FILETYPE_EXTRA;
|
15 |
if ( extradir )
|
15 |
if ( extradir )
|
16 |
*extradir = dir;
|
16 |
*extradir = dir;
|
17 |
}
|
17 |
}
|
18 |
else if ( File.CheckFileExtension("xml") || File.CheckFileExtension("pck") )
|
18 |
else if ( File.isFileExtension("xml") || File.isFileExtension("pck") )
|
19 |
{
|
19 |
{
|
20 |
// TC text file
|
20 |
// TC text file
|
21 |
type = FILETYPE_SCRIPT;
|
21 |
type = FILETYPE_SCRIPT;
|
22 |
if ( File.filename().isin("-L") && ((int)File.filename().left(4)) )
|
22 |
if ( File.filename().isin("-L") && ((int)File.filename().left(4)) )
|
23 |
type = FILETYPE_TEXT;
|
23 |
type = FILETYPE_TEXT;
|
Line 38... |
Line 38... |
38 |
type = FILETYPE_UNINSTALL;
|
38 |
type = FILETYPE_UNINSTALL;
|
39 |
else if ( dir.Compare("director") )
|
39 |
else if ( dir.Compare("director") )
|
40 |
type = FILETYPE_MISSION;
|
40 |
type = FILETYPE_MISSION;
|
41 |
}
|
41 |
}
|
42 |
// could be a model file or scene file
|
42 |
// could be a model file or scene file
|
43 |
else if ( File.CheckFileExtension("pbd") || File.CheckFileExtension("bod") )
|
43 |
else if ( File.isFileExtension("pbd") || File.isFileExtension("bod") )
|
44 |
{
|
44 |
{
|
45 |
if ( dir.isin("cockpit") || basename.IsIn("cockpit") )
|
45 |
if ( dir.isin("cockpit") || basename.IsIn("cockpit") )
|
46 |
type = FILETYPE_COCKPITSCENE;
|
46 |
type = FILETYPE_COCKPITSCENE;
|
47 |
else
|
47 |
else
|
48 |
type = FILETYPE_SHIPSCENE;
|
48 |
type = FILETYPE_SHIPSCENE;
|
49 |
}
|
49 |
}
|
50 |
// can only be a model
|
50 |
// can only be a model
|
51 |
else if ( File.CheckFileExtension("pbb") || File.CheckFileExtension("bob") )
|
51 |
else if ( File.isFileExtension("pbb") || File.isFileExtension("bob") )
|
52 |
type = FILETYPE_SHIPMODEL;
|
52 |
type = FILETYPE_SHIPMODEL;
|
53 |
// texture file
|
53 |
// texture file
|
54 |
else if ( File.CheckFileExtension("dds") )
|
54 |
else if ( File.isFileExtension("dds") )
|
55 |
type = FILETYPE_SHIPOTHER;
|
55 |
type = FILETYPE_SHIPOTHER;
|
56 |
else if ( File.CheckFileExtension("txt") || dir.Compare("readme") )
|
56 |
else if ( File.isFileExtension("txt") || dir.Compare("readme") )
|
57 |
type = FILETYPE_README;
|
57 |
type = FILETYPE_README;
|
58 |
else if ( File.CheckFileExtension("cat") || File.CheckFileExtension("dat") )
|
58 |
else if ( File.isFileExtension("cat") || File.isFileExtension("dat") )
|
59 |
type = FILETYPE_MOD;
|
59 |
type = FILETYPE_MOD;
|
60 |
else if ( File.CheckFileExtension("mp3") )
|
60 |
else if ( File.isFileExtension("mp3") )
|
61 |
type = FILETYPE_SOUND;
|
61 |
type = FILETYPE_SOUND;
|
62 |
else if ( dir.Compare("loadscr") )
|
62 |
else if ( dir.Compare("loadscr") )
|
63 |
type = FILETYPE_SCREEN;
|
63 |
type = FILETYPE_SCREEN;
|
64 |
else if ( dir.Compare("graphics") )
|
64 |
else if ( dir.Compare("graphics") )
|
65 |
type = FILETYPE_ADVERT;
|
65 |
type = FILETYPE_ADVERT;
|
66 |
else if ( File.CheckFileExtension("jpg") || File.CheckFileExtension("bmp") )
|
66 |
else if ( File.isFileExtension("jpg") || File.isFileExtension("bmp") )
|
67 |
type = FILETYPE_SCREEN;
|
67 |
type = FILETYPE_SCREEN;
|
68 |
else if ( File.CheckFileExtension("gif") )
|
68 |
else if ( File.isFileExtension("gif") )
|
69 |
type = FILETYPE_ADVERT;
|
69 |
type = FILETYPE_ADVERT;
|
70 |
|
70 |
|
71 |
return type;
|
71 |
return type;
|
72 |
}
|
72 |
}
|
73 |
|
73 |
|
Line 127... |
Line 127... |
127 |
return s;
|
127 |
return s;
|
128 |
}
|
128 |
}
|
129 |
|
129 |
|
130 |
bool WriteScriptStyleSheet(CyString dest)
|
130 |
bool WriteScriptStyleSheet(CyString dest)
|
131 |
{
|
131 |
{
|
132 |
CyStringList list;
|
132 |
Utils::CStringList list;
|
133 |
list.PushBack("<?xml version=\"1.0\" ?>");
|
133 |
list.pushBack("<?xml version=\"1.0\" ?>");
|
134 |
list.PushBack("<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" >");
|
134 |
list.pushBack("<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" >");
|
135 |
list.PushBack("<xsl:template match=\"/\">");
|
135 |
list.pushBack("<xsl:template match=\"/\">");
|
136 |
list.PushBack("<html>");
|
136 |
list.pushBack("<html>");
|
137 |
list.PushBack("<head>");
|
137 |
list.pushBack("<head>");
|
138 |
list.PushBack("<title>X3TC Script: <xsl:value-of select=\"script/name\"/></title>");
|
138 |
list.pushBack("<title>X3TC Script: <xsl:value-of select=\"script/name\"/></title>");
|
139 |
list.PushBack("</head>");
|
139 |
list.pushBack("</head>");
|
140 |
list.PushBack("<body style=\"color:white;background-color:black\">");
|
140 |
list.pushBack("<body style=\"color:white;background-color:black\">");
|
141 |
list.PushBack("<xsl:apply-templates/>");
|
141 |
list.pushBack("<xsl:apply-templates/>");
|
142 |
list.PushBack("</body>");
|
142 |
list.pushBack("</body>");
|
143 |
list.PushBack("</html>");
|
143 |
list.pushBack("</html>");
|
144 |
list.PushBack("</xsl:template>");
|
144 |
list.pushBack("</xsl:template>");
|
145 |
list.PushBack("<xsl:template match=\"script\">");
|
145 |
list.pushBack("<xsl:template match=\"script\">");
|
146 |
list.PushBack("<h1>Script <xsl:value-of select=\"name\"/></h1>");
|
146 |
list.pushBack("<h1>Script <xsl:value-of select=\"name\"/></h1>");
|
147 |
list.PushBack("Version: <xsl:value-of select=\"version\"/><br/>");
|
147 |
list.pushBack("Version: <xsl:value-of select=\"version\"/><br/>");
|
148 |
list.PushBack("for Script Engine Version: <xsl:value-of select=\"engineversion\"/><br/>");
|
148 |
list.pushBack("for Script Engine Version: <xsl:value-of select=\"engineversion\"/><br/>");
|
149 |
list.PushBack("<h3>Description</h3>");
|
149 |
list.pushBack("<h3>Description</h3>");
|
150 |
list.PushBack("<xsl:value-of select=\"description\"/>");
|
150 |
list.pushBack("<xsl:value-of select=\"description\"/>");
|
151 |
list.PushBack("<xsl:apply-templates/>");
|
151 |
list.pushBack("<xsl:apply-templates/>");
|
152 |
list.PushBack("<xsl:choose><xsl:when test=\"signature\"><br/>signed</xsl:when></xsl:choose>");
|
152 |
list.pushBack("<xsl:choose><xsl:when test=\"signature\"><br/>signed</xsl:when></xsl:choose>");
|
153 |
list.PushBack("</xsl:template>");
|
153 |
list.pushBack("</xsl:template>");
|
154 |
list.PushBack("<xsl:template match=\"name\">");
|
154 |
list.pushBack("<xsl:template match=\"name\">");
|
155 |
list.PushBack("</xsl:template>");
|
155 |
list.pushBack("</xsl:template>");
|
156 |
list.PushBack("<xsl:template match=\"version\">");
|
156 |
list.pushBack("<xsl:template match=\"version\">");
|
157 |
list.PushBack("</xsl:template>");
|
157 |
list.pushBack("</xsl:template>");
|
158 |
list.PushBack("<xsl:template match=\"engineversion\">");
|
158 |
list.pushBack("<xsl:template match=\"engineversion\">");
|
159 |
list.PushBack("</xsl:template>");
|
159 |
list.pushBack("</xsl:template>");
|
160 |
list.PushBack("<xsl:template match=\"description\">");
|
160 |
list.pushBack("<xsl:template match=\"description\">");
|
161 |
list.PushBack("</xsl:template>");
|
161 |
list.pushBack("</xsl:template>");
|
162 |
list.PushBack("<xsl:template match=\"arguments\">");
|
162 |
list.pushBack("<xsl:template match=\"arguments\">");
|
163 |
list.PushBack("<h3>Arguments</h3>");
|
163 |
list.pushBack("<h3>Arguments</h3>");
|
164 |
list.PushBack("<ul>");
|
164 |
list.pushBack("<ul>");
|
165 |
list.PushBack("<xsl:apply-templates/>");
|
165 |
list.pushBack("<xsl:apply-templates/>");
|
166 |
list.PushBack("</ul>");
|
166 |
list.pushBack("</ul>");
|
167 |
list.PushBack("</xsl:template>");
|
167 |
list.pushBack("</xsl:template>");
|
168 |
list.PushBack("<xsl:template match=\"argument\">");
|
168 |
list.pushBack("<xsl:template match=\"argument\">");
|
169 |
list.PushBack("<li>");
|
169 |
list.pushBack("<li>");
|
170 |
list.PushBack("<xsl:value-of select=\"@index\"/>: <xsl:value-of select=\"@name\"/> , <xsl:value-of select=\"@type\"/> , '<xsl:value-of select=\"@desc\"/>'");
|
170 |
list.pushBack("<xsl:value-of select=\"@index\"/>: <xsl:value-of select=\"@name\"/> , <xsl:value-of select=\"@type\"/> , '<xsl:value-of select=\"@desc\"/>'");
|
171 |
list.PushBack("</li>");
|
171 |
list.pushBack("</li>");
|
172 |
list.PushBack("</xsl:template>");
|
172 |
list.pushBack("</xsl:template>");
|
173 |
list.PushBack("<xsl:template match=\"sourcetext\">");
|
173 |
list.pushBack("<xsl:template match=\"sourcetext\">");
|
174 |
list.PushBack("<h3>Source Text</h3>");
|
174 |
list.pushBack("<h3>Source Text</h3>");
|
175 |
list.PushBack("<div style=\"color:white;background-color:darkgray\">");
|
175 |
list.pushBack("<div style=\"color:white;background-color:darkgray\">");
|
176 |
list.PushBack("<br/>");
|
176 |
list.pushBack("<br/>");
|
177 |
list.PushBack("<code>");
|
177 |
list.pushBack("<code>");
|
178 |
list.PushBack("<xsl:apply-templates/>");
|
178 |
list.pushBack("<xsl:apply-templates/>");
|
179 |
list.PushBack("</code>");
|
179 |
list.pushBack("</code>");
|
180 |
list.PushBack("<br/>");
|
180 |
list.pushBack("<br/>");
|
181 |
list.PushBack("</div>");
|
181 |
list.pushBack("</div>");
|
182 |
list.PushBack("</xsl:template>");
|
182 |
list.pushBack("</xsl:template>");
|
183 |
list.PushBack("<xsl:template match=\"line\">");
|
183 |
list.pushBack("<xsl:template match=\"line\">");
|
184 |
list.PushBack("<b style=\"color:blue\"><xsl:value-of select=\"@linenr\"/> <xsl:choose><xsl:when test=\"@interruptable\"><b style=\"color:cyan\"><xsl:value-of select=\"@interruptable\"/></b></xsl:when><xsl:otherwise> </xsl:otherwise></xsl:choose></b> <b style=\"color:#777777\"><xsl:value-of select=\"translate(@indent,' ','|ÿ')\"/></b><xsl:apply-templates/><br/>");
|
184 |
list.pushBack("<b style=\"color:blue\"><xsl:value-of select=\"@linenr\"/> <xsl:choose><xsl:when test=\"@interruptable\"><b style=\"color:cyan\"><xsl:value-of select=\"@interruptable\"/></b></xsl:when><xsl:otherwise> </xsl:otherwise></xsl:choose></b> <b style=\"color:#777777\"><xsl:value-of select=\"translate(@indent,' ','|ÿ')\"/></b><xsl:apply-templates/><br/>");
|
185 |
list.PushBack("</xsl:template>");
|
185 |
list.pushBack("</xsl:template>");
|
186 |
list.PushBack("<xsl:template match=\"text\">");
|
186 |
list.pushBack("<xsl:template match=\"text\">");
|
187 |
list.PushBack("<xsl:value-of select=\".\"/>");
|
187 |
list.pushBack("<xsl:value-of select=\".\"/>");
|
188 |
list.PushBack("</xsl:template>");
|
188 |
list.pushBack("</xsl:template>");
|
189 |
list.PushBack("<xsl:template match=\"var\">");
|
189 |
list.pushBack("<xsl:template match=\"var\">");
|
190 |
list.PushBack("<b style=\"color:darkgreen\">");
|
190 |
list.pushBack("<b style=\"color:darkgreen\">");
|
191 |
list.PushBack("<xsl:value-of select=\".\"/>");
|
191 |
list.pushBack("<xsl:value-of select=\".\"/>");
|
192 |
list.PushBack("</b>");
|
192 |
list.pushBack("</b>");
|
193 |
list.PushBack("</xsl:template>");
|
193 |
list.pushBack("</xsl:template>");
|
194 |
list.PushBack("<xsl:template match=\"comment\"><b style=\"color:black\"><xsl:value-of select=\".\"/></b></xsl:template>");
|
194 |
list.pushBack("<xsl:template match=\"comment\"><b style=\"color:black\"><xsl:value-of select=\".\"/></b></xsl:template>");
|
195 |
list.PushBack("<xsl:template match=\"call\">'<a><xsl:attribute name=\"href\"><xsl:value-of select=\".\"/>.xml</xsl:attribute><xsl:value-of select=\".\"/></a>'</xsl:template>");
|
195 |
list.pushBack("<xsl:template match=\"call\">'<a><xsl:attribute name=\"href\"><xsl:value-of select=\".\"/>.xml</xsl:attribute><xsl:value-of select=\".\"/></a>'</xsl:template>");
|
196 |
list.PushBack("<xsl:template match=\"codearray\">");
|
196 |
list.pushBack("<xsl:template match=\"codearray\">");
|
197 |
list.PushBack("</xsl:template>");
|
197 |
list.pushBack("</xsl:template>");
|
198 |
list.PushBack("<xsl:template match=\"signature\">");
|
198 |
list.pushBack("<xsl:template match=\"signature\">");
|
199 |
list.PushBack("</xsl:template>");
|
199 |
list.pushBack("</xsl:template>");
|
200 |
list.PushBack("</xsl:stylesheet>");
|
200 |
list.pushBack("</xsl:stylesheet>");
|
201 |
|
201 |
|
202 |
CFileIO File(dest + "/x2script.xsl");
|
202 |
CFileIO File(dest + "/x2script.xsl");
|
203 |
return File.WriteFile(&list);
|
203 |
return File.writeFile(&list);
|
204 |
}
|
204 |
}
|
205 |
|
205 |
|
206 |
CyString ConvertTimeString(time_t time)
|
206 |
CyString ConvertTimeString(time_t time)
|
207 |
{
|
207 |
{
|
208 |
struct tm *currDate;
|
208 |
struct tm *currDate;
|