/// <summary> /// Save current file /// </summary> /// <param name="saveAs">true: show save as diaglog</param> /// <param name="newEncoding">not null: use new encoding to save file</param> /// <returns>true : if file saved</returns> public bool SaveFile(bool saveAs, Encoding newEncoding = null) { string filePath2Save = CurrentFilePath; if (string.IsNullOrEmpty(CurrentFilePath) || saveAs) { filePath2Save = NewFilePath(CurrentFilePath); if (filePath2Save == null) { return(false); } } if (newEncoding != null) { MainEditor.Encoding = newEncoding; } MainEditor.Save(filePath2Save); if (CurrentFilePath != filePath2Save) { UpdateLastUsedFile(filePath2Save); } UpdateEditor(filePath2Save); DocumentSavedEvent?.Invoke(); return(true); }