public void TestOpenSaveFiles() { var path = "E:\\Temp\\xml"; var fileOpen = "courseplay.xml"; var fileSave = "courseplay_gen.xml"; var coursePlay = CourseFileManger.OpenFile(Path.Combine(path, fileOpen)); CourseFileManger.SaveFile(Path.Combine(path, fileSave), coursePlay); }
private void OnExecute() { if (_content.CourseFileModel == null) { throw new Exception("Не открыто не одного файла."); } if (string.IsNullOrEmpty(_content.OpenFilePath)) { throw new Exception("Нет пути сохранения открыто файла."); } CourseFileManger.SaveFile(_content.OpenFilePath, _content.CourseFileModel.Save(), _settings.IsCreateBackup, _settings.CountBackups); }
private void OnExecute() { _openFileDialog.FileName = null; var rezult = _openFileDialog.ShowDialog(); if (!rezult.HasValue || !rezult.Value) { return; } var fileName = _openFileDialog.FileName; _content.OpenFilePath = fileName; _content.CourseFileModel = CourseFileModel.Load(CourseFileManger.OpenFile(fileName)); }
private void OnExecute() { if (_content.CourseFileModel == null) { throw new Exception("Не открыто не одного файла."); } if (!string.IsNullOrEmpty(_content.OpenFilePath)) { _saveFileDialog.InitialDirectory = Path.GetDirectoryName(_content.OpenFilePath); _saveFileDialog.FileName = Path.GetFileName(_content.OpenFilePath); } var rezult = _saveFileDialog.ShowDialog(); if (!rezult.HasValue || !rezult.Value) { return; } CourseFileManger.SaveAsFile(_saveFileDialog.FileName, _content.CourseFileModel.Save()); }