diff --git a/CHANGELOG.md b/CHANGELOG.md index c10d708..68ba37a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,8 @@ These are the changes to each version that has been released on the official Visual Studio extension gallery. -## 1.0.27 -**2017-08-21** +## 1.0.28 +**2017-08-22** - [x] Minor bug fixes ## 1.0.25 diff --git a/SolutionOpenPopUp/VSPackage.cs b/SolutionOpenPopUp/VSPackage.cs index 4b5fc13..a6daeb0 100644 --- a/SolutionOpenPopUp/VSPackage.cs +++ b/SolutionOpenPopUp/VSPackage.cs @@ -26,6 +26,7 @@ public sealed class VSPackage : Package private string bulletPoint = " - "; private string solutionFolder; private List textFileDtos; + private bool popUpBodyIsPopulated; public VSPackage() { @@ -43,16 +44,16 @@ protected override void Initialize() private void OnSolutionOpened() { - textFileDtos = new List(); + popUpBodyIsPopulated = false; popUpFooter = string.Empty; + textFileDtos = new List(); SolutionOpenPopUpDotTxtHandler(); - ReadMeDotTxtHandler(); var popUpBody = GetPopUpBody(textFileDtos); - if (!string.IsNullOrEmpty(popUpBody)) + if (popUpBodyIsPopulated) { if (GeneralOptionsDto.ShowFileNamesInPopUp) { @@ -131,7 +132,9 @@ private string GetPopUpMessage(TextFileDto textFileDto) if (textFileDto.FileExists) { var linesToUse = textFileDto.AllLines.Take(textFileDto.MaxLinesToShow); - var linesToUseJoined = string.Join(Environment.NewLine, linesToUse); + var toUse = linesToUse as IList ?? linesToUse.ToList(); + SetPopUpBodyIsPopulated(toUse); + var linesToUseJoined = string.Join(Environment.NewLine, toUse); linesToUseJoined.TrimPrefix(Environment.NewLine); result += linesToUseJoined; @@ -152,6 +155,18 @@ private string GetPopUpMessage(TextFileDto textFileDto) return result; } + private void SetPopUpBodyIsPopulated(IList linesToUse) + { + if (!popUpBodyIsPopulated) + { + if (linesToUse.Any(x => !string.IsNullOrEmpty(x)) || + linesToUse.Any(x => !string.IsNullOrWhiteSpace(x))) + { + popUpBodyIsPopulated = true; + } + } + } + private string GetPopUpFooter() { string result = null; diff --git a/SolutionOpenPopUp/source.extension.cs b/SolutionOpenPopUp/source.extension.cs index a3ba540..3dbee93 100644 --- a/SolutionOpenPopUp/source.extension.cs +++ b/SolutionOpenPopUp/source.extension.cs @@ -12,7 +12,7 @@ static class Vsix public const string Description = @"Display the contents of certain text files when the solution is opened in a pop-up window. A handy way to share solution-specific gotchas, non-critical team messages or your own personal notes for a solution. "; public const string Language = "en-US"; - public const string Version = "1.0.27"; + public const string Version = "1.0.28"; public const string Author = "Greg Trevellick"; public const string Tags = "solution open, popup, pop-up, pop up, gotcha, gotchas, read me, readme, readme.txt"; } diff --git a/SolutionOpenPopUp/source.extension.vsixmanifest b/SolutionOpenPopUp/source.extension.vsixmanifest index 75cbb4f..7bf5929 100644 --- a/SolutionOpenPopUp/source.extension.vsixmanifest +++ b/SolutionOpenPopUp/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + Solution Open Pop Up Display the contents of certain text files when the solution is opened in a pop-up window. A handy way to share solution-specific gotchas, non-critical team messages or your own personal notes for a solution.