#include <wx/defs.h>
Go to the source code of this file.
◆ ConvertLegacyProjectFile()
bool ConvertLegacyProjectFile |
( |
const wxFileName & |
filename | ) |
|
Update Audacity 1.0 file in-place to XML format.
- Returns
- true if successful, else no effect on the file
- Exception safety guarantee:
- Strong
Definition at line 249 of file Legacy.cpp.
250{
251 wxTextFile f;
252
253 const wxString
name = filename.GetFullPath();
255 if (!f.IsOpened())
256 return false;
257
258 return GuardedCall< bool >( [&] {
260
261 xmlFile.Write(
wxT(
"<?xml version=\"1.0\"?>\n"));
262
264 wxString value;
265
266 if (f.GetFirstLine() !=
wxT(
"AudacityProject"))
267 return false;
268 if (f.GetNextLine() !=
wxT(
"Version"))
269 return false;
270 if (f.GetNextLine() !=
wxT(
"0.95"))
271 return false;
272 if (f.GetNextLine() !=
wxT(
"projName"))
273 return false;
274
275 xmlFile.StartTag(
wxT(
"audacityproject"));
276 xmlFile.WriteAttr(
wxT(
"projname"), f.GetNextLine());
277 xmlFile.WriteAttr(
wxT(
"version"),
wxT(
"1.1.0"));
278 xmlFile.WriteAttr(
wxT(
"audacityversion"),AUDACITY_VERSION_STRING);
279
280 label = f.GetNextLine();
281 while (
label !=
wxT(
"BeginTracks")) {
282 xmlFile.WriteAttr(
label, f.GetNextLine());
283 label = f.GetNextLine();
284 }
285
286 label = f.GetNextLine();
289 if (!success)
290 return false;
291 label = f.GetNextLine();
292 }
293
294
295 f.Close();
296
297 xmlFile.EndTag(
wxT(
"audacityproject"));
298 xmlFile.Commit();
299
302"Converted a 1.0 project file to the new format.\nThe old file has been saved as '%s'")
303 .
Format( xmlFile.GetBackupName() ),
304 XO(
"Opening Audacity Project"));
305
306 return true;
307 } );
308}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile)
Wrapper to output XML data to files.
References AudacityMessageBox(), ConvertLegacyTrack(), label, name, wxT(), and XO().