private Encoding GetEncoding(GherkinFileInfo fileInfo) { var encodings = Encoding.GetEncodings(); var encoding = encodings.FirstOrDefault(x => x.CodePage == fileInfo.CodePage); return(encoding?.GetEncoding()); }
private void LoadFileInfo(string filePath) { GherkinFileInfo fileInfo = m_AppSettings.GetFileInfo(filePath); FontFamily = new FontFamily(fileInfo.FontFamilyName); FontSize = fileInfo.FontSize; }
public void Load(string filePath, Encoding encoding = null) { LoadFileInfo(filePath); if (!IsEditorViewLoaded) { CurrentFilePath = filePath; } else if ((filePath != null) && File.Exists(filePath)) { GherkinFileInfo fileInfo = m_AppSettings.GetFileInfo(filePath); MainEditor.Encoding = encoding ?? GetEncoding(fileInfo); MainEditor.Load(filePath); HideHSplitView = !NeedShowHSplitView(filePath); HideVSplitView = !NeedShowVSplitView(filePath); m_AppSettings.UpdateCodePage(filePath, MainEditor.Encoding.CodePage); ScrollCursorTo(fileInfo.CursorLine, fileInfo.CursorColumn); EventAggregator <FileLoadedArg> .Instance.Publish(this, new FileLoadedArg()); UpdateEditor(filePath); UpdateFoldingsByDefault(); } }