/// <summary> /// Function to save the editor file. /// </summary> /// <param name="path">Path to the new file.</param> /// <param name="plugIn">The plug-in used to save the file.</param> public static void Save(string path, FileWriterPlugIn plugIn) { if (path == null) { throw new ArgumentNullException("path"); } if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException(APIResources.GOREDIT_ERR_PARAMETER_MUST_NOT_BE_EMPTY, "path"); } // We don't have a writer plug-in, at this point, that's not good. if (plugIn == null) { throw new IOException(string.Format(APIResources.GOREDIT_ERR_NO_WRITER_PLUGIN, path)); } // Write the meta data file to the file system. EditorMetaDataFile.Save(); // Write the file. if (!plugIn.Save(path)) { return; } Filename = Path.GetFileName(path); FilePath = path; // Remove all changed items. FileChanged = false; }
/// <summary> /// Function to retrieve the file types that can be written by the available file system writers. /// </summary> /// <param name="plugIn">File system writer plug-in.</param> private static void GetWriterFileTypes(FileWriterPlugIn plugIn) { foreach (var extension in plugIn.FileExtensions) { _writerFiles[extension] = plugIn; } }
/// <summary> /// Function to assign the specified writer plug-in as current in the meta data. /// </summary> /// <param name="plugIn">Plug-in to assign.</param> public static void SetWriterPlugIn(FileWriterPlugIn plugIn) { if (plugIn == null) { EditorMetaDataFile.WriterPlugInType = string.Empty; return; } EditorMetaDataFile.WriterPlugInType = plugIn.Name; }