Fix newline skipping

This commit is contained in:
Matt Nadareski
2022-01-01 22:24:03 -08:00
parent 814c2d9149
commit dd2116f8a6
2 changed files with 20 additions and 15 deletions

View File

@@ -21,6 +21,7 @@
- Tweak more Disc Info window formatting
- Skip unnecessary newlines in parsing
- Force scroll visibility, tweak text sizes again
- Fix newline skipping
### 2.2 (2021-12-30)
- Fix Saturn header finding

View File

@@ -1429,11 +1429,16 @@ namespace MPF.Library
if (!commentLine.Contains("[T:"))
{
if (addToLast && lastSiteCode != null)
info.CommonDiscInfo.CommentsSpecialFields[lastSiteCode] += $"\n{commentLine}";
{
if (!string.IsNullOrWhiteSpace(info.CommonDiscInfo.CommentsSpecialFields[lastSiteCode]))
info.CommonDiscInfo.CommentsSpecialFields[lastSiteCode] += "\n";
info.CommonDiscInfo.CommentsSpecialFields[lastSiteCode] += commentLine;
}
else
{
newComments += $"{commentLine}\n";
continue;
}
}
// Otherwise, we need to find what tag is in use
@@ -1449,12 +1454,8 @@ namespace MPF.Library
// If we don't already have this site code, add it to the dictionary
if (!info.CommonDiscInfo.CommentsSpecialFields.ContainsKey(siteCode))
{
string strippedLine = commentLine.Replace(siteCode.ShortName(), string.Empty).Trim();
if (!string.IsNullOrWhiteSpace(strippedLine))
info.CommonDiscInfo.CommentsSpecialFields[siteCode] = strippedLine;
}
info.CommonDiscInfo.CommentsSpecialFields[siteCode] = commentLine.Replace(siteCode.ShortName(), string.Empty).Trim();
// A subset of tags can be multiline
switch (siteCode)
{
@@ -1533,9 +1534,16 @@ namespace MPF.Library
if (!contentLine.Contains("[T:"))
{
if (addToLast && lastSiteCode != null)
info.CommonDiscInfo.ContentsSpecialFields[lastSiteCode] += $"\n{contentLine}";
{
if (!string.IsNullOrWhiteSpace(info.CommonDiscInfo.ContentsSpecialFields[lastSiteCode]))
info.CommonDiscInfo.ContentsSpecialFields[lastSiteCode] += "\n";
info.CommonDiscInfo.ContentsSpecialFields[lastSiteCode] += contentLine;
}
else
{
newContents += $"{contentLine}\n";
}
continue;
}
@@ -1553,11 +1561,7 @@ namespace MPF.Library
// If we don't already have this site code, add it to the dictionary
if (!info.CommonDiscInfo.ContentsSpecialFields.ContainsKey(siteCode))
{
string strippedLine = contentLine.Replace(siteCode.ShortName(), string.Empty).Trim();
if (!string.IsNullOrWhiteSpace(strippedLine))
info.CommonDiscInfo.ContentsSpecialFields[siteCode] = strippedLine;
}
info.CommonDiscInfo.ContentsSpecialFields[siteCode] = contentLine.Replace(siteCode.ShortName(), string.Empty).Trim();
// A subset of tags can be multiline
switch (siteCode)