private void ShowSelectedFile() { var fileName = GetSelectedFileName(); this.ClearEditor(); if (fileName == null) { diffLines = new string[0]; return; } try { if (this.tabControl1.SelectedIndex != 0) { this.tabControl1.SelectedIndex = 0; } string tmpFileName = ""; var status = tracker.GetFileStatus(fileName); if (status == GitFileStatus.NotControlled || status == GitFileStatus.New) { tmpFileName = Path.Combine(tracker.WorkingDirectory, fileName); } else { if (this.activeListView == listView1) { tmpFileName = tracker.DiffFile(fileName); } else { var diffAgainstIndex = this.activeListView == this.listStaged; tmpFileName = tracker.DiffFileAdv(fileName, diffAgainstIndex); } } if (!string.IsNullOrWhiteSpace(tmpFileName) && File.Exists(tmpFileName)) { if (tracker.IsBinaryFile(tmpFileName)) { this.DiffEditor.Content = $"File \"{fileName}\" is binary that cannot be displayed. Double click to to view."; } //if (new FileInfo(tmpFileName).Length > 2 * 1024 * 1024) //{ // this.DiffEditor.Content = "File is too big to display: " + fileName; //} else { diffLines = File.ReadAllLines(tmpFileName); this.ShowFile(tmpFileName); } } } catch (Exception ex) { string message = ex.Message; ShowStatusMessage(message); } }