/// <summary> /// Used to setup the ViewA/ViewB view that shows the left and right text views /// with the textual content and imaginary lines. /// each other. /// </summary> /// <param name="filename"></param> /// <param name="lines"></param> /// <param name="text"></param> /// <param name="spacesPerTab"></param> internal void SetData(string filename, IDiffLines lines, string text, int spacesPerTab) { this.FileName = filename; try { string ext = System.IO.Path.GetExtension(filename); var hlManager = GetService <IThemedHighlightingManager>(); // Use fallback to actual service implementation if injector is not used here... if (hlManager == null) { hlManager = HL.Manager.ThemedHighlightingManager.Instance; } if (IsHighlightingDefinitionOff == false) { HighlightingDefinition = hlManager.GetDefinitionByExtension(ext); } } catch { // We go without highlighting in case System.IO throws an exception here HighlightingDefinition = null; } _position.SetPosition(0, 0); _spacesPerTab = spacesPerTab; Line = 0; Column = 0; if (lines != null) { _diffEndLines = lines.DiffEndLines; _diffStartLines = lines.DiffStartLines; _maxImaginaryLineNumber = lines.MaxImaginaryLineNumber; _DocLineDiffs.ReplaceRange(lines.DocLineDiffs); } else { _diffEndLines = null; _diffStartLines = null; _maxImaginaryLineNumber = 1; _DocLineDiffs.Clear(); } Document = new TextDocument(text); NotifyPropertyChanged(() => Document); }
/// <summary> /// Used to setup the ViewA/ViewB view that shows the left and right text views /// with the textual content and imaginary lines. /// each other. /// </summary> /// <param name="filename"></param> /// <param name="lines"></param> /// <param name="text"></param> /// <param name="spacesPerTab"></param> internal void SetData(string filename, IDiffLines lines, string text, int spacesPerTab) { this.FileName = filename; try { string ext = System.IO.Path.GetExtension(filename); HighlightingDefinition = HighlightingManager.Instance.GetDefinitionByExtension(ext); } catch { // We go without highlighting in case System.IO throws an exception here HighlightingDefinition = null; } _position.SetPosition(0, 0); _spacesPerTab = spacesPerTab; Line = 0; Column = 0; if (lines != null) { _diffEndLines = lines.DiffEndLines; _diffStartLines = lines.DiffStartLines; _maxImaginaryLineNumber = lines.MaxImaginaryLineNumber; _DocLineDiffs.ReplaceRange(lines.DocLineDiffs); } else { _diffEndLines = null; _diffStartLines = null; _maxImaginaryLineNumber = 1; _DocLineDiffs.Clear(); } Document = new TextDocument(text); NotifyPropertyChanged(() => Document); }