/// <summary> /// Imports the given file into the writing system store. /// </summary> /// <param name="fileName">Full path of file to import</param> public void ImportFile(string fileName) { if (!_usingRepository) { throw new InvalidOperationException("Unable to import file when not using writing system store."); } if (fileName == null) { throw new ArgumentNullException("fileName"); } if (!System.IO.File.Exists(fileName)) { throw new ArgumentException("File does not exist.", "fileName"); } var adaptor = new LdmlDataMapper(_writingSystemFactory); WritingSystemDefinition ws = _writingSystemFactory.Create(); adaptor.Read(fileName, ws); WritingSystemDefinitions.Add(ws); OnAddOrDelete(); CurrentDefinition = ws; }
/// <summary> /// Exports the current writing system to a file. /// </summary> /// <param name="filePath"></param> public void ExportCurrentWritingSystemAsFile(string filePath) { if (!HasCurrentSelection) { throw new InvalidOperationException ("Unable to export current selection when there is no current selection."); } var adaptor = new LdmlDataMapper(_writingSystemFactory); adaptor.Write(filePath, _currentWritingSystem, null); }