bool SaveCaptureProject(ProjectLongoMatch project)
{
Guid projectID = project.ID;
// FIXME
string filePath = project.Description.FileSet.First ().FilePath;
/* scan the new file to build a new PreviewMediaFile with all the metadata */
try {
Log.Debug ("Saving capture project: " + project.ID);
#if !OSTYPE_ANDROID && !OSTYPE_IOS
RemuxOutputFile (Capturer.CaptureSettings.EncodingSettings);
#endif
Log.Debug ("Reloading saved file: " + filePath);
project.Description.FileSet [0] = multimediaToolkit.DiscoverFile (filePath);
project.Periods = new ObservableCollection<Period> (Capturer.Periods);
App.Current.DatabaseManager.ActiveDB.Store<ProjectLongoMatch> (project);
return true;
} catch (Exception ex) {
Log.Exception (ex);
Log.Debug ("Backing up project to file");
string filePathNoExtension = Path.GetDirectoryName (filePath) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension (filePath);
string projectFile = DateTime.Now.ToString ().Replace ("-", "_");
projectFile = projectFile.Replace (":", "_");
projectFile = projectFile.Replace (" ", "_");
projectFile = projectFile.Replace ("/", "_");
projectFile = filePathNoExtension + "_" + projectFile;
Project.Export (OpenedProject, projectFile);
App.Current.Dialogs.ErrorMessage (Catalog.GetString ("An error occured saving the project:\n") + ex.Message + "\n\n" +
Catalog.GetString ("The video file and a backup of the project has been " +
"saved. Try to import it later:\n") +
filePath + "\n" + projectFile + Constants.PROJECT_EXT);
App.Current.DatabaseManager.ActiveDB.Delete<ProjectLongoMatch> (project);
return false;
}
}