/// <summary> /// Writes ConfigFileStruct FileStruct to XML file. /// If writing fails, return false and write to debug log /// </summary> /// <returns>True if the saving was successful</returns> public bool SaveConfig() { if (!Directory.Exists(ConfigDirPath)) { Directory.CreateDirectory(ConfigDirPath); } try { _xmlDeSerializer.SerializeData(FilePath, Config); return(true); } catch (Exception) { return(false); } }
/// <summary> /// Save all project data from the local ProjectSpace instance to disk /// </summary> /// <returns> /// A success flag and a message in case of an error. /// </returns> public (bool, string) SaveProject() { try { // Save the project configuration in XML (excluding 3D model) _xmlDeSerializer.SerializeData(Path.Combine(CurrentProjectDir, ProjectConfigFile), CurrentProject); // Save the hierarchy of the GameObject 3D model ModelManager.SerializeModel( Path.Combine(CurrentProjectDir, ProjectModelFile), CurrentProject.ObjectModel.transform ); return(true, ""); } catch (ModelManager.ToplevelComponentException e) { return(false, e.ComponentName + " cannot be on top-level."); } catch (Exception) { return(false, "The project couldn't \n be saved!"); } }