Remove .Any

H2 Records
This commit is contained in:
2023-09-27 23:05:40 -07:00
parent 4ba2a42ed1
commit f810af3ebe
13 changed files with 307 additions and 61 deletions

View File

@ -96,7 +96,7 @@ internal static partial class HelperKanbanMetadata
return results;
}
internal static void SetMetadata(ILogger log, AppSettings appSettings, string sourceDirectory)
internal static void SetMetadata(ILogger log, AppSettings appSettings, string sourceDirectory, bool addTicks)
{
bool? match;
string? paramCase;
@ -119,11 +119,12 @@ internal static partial class HelperKanbanMetadata
if (itemLineNumber == 0)
throw new NotSupportedException();
(lines, lineNumber) = HelperMarkdown.GetStatusAndFrontMatterYamlEndLineNumbers(fileInfo);
if (!lines.Any())
if (lines.Count == 0)
continue;
statusLine = $"status: \"{groupCount}-{group}\"";
paramCase = lineNumber.H1 is null ? null : GetParamCase(lines[lineNumber.H1.Value]);
indexFileLines[itemLineNumber] = $"{fileInfo.LastWriteTime.Ticks}~~~{indexFileLines[itemLineNumber]}";
if (addTicks)
indexFileLines[itemLineNumber] = $"{fileInfo.LastWriteTime.Ticks}~~~{indexFileLines[itemLineNumber]}";
match = lineNumber.H1 is null || paramCase is null ? null : Path.GetFileNameWithoutExtension(fileInfo.Name) == paramCase;
if (lineNumber.FrontMatterYamlEnd is null)
throw new NotSupportedException($"{nameof(SetMetadata)} must be executed first!");
@ -139,7 +140,8 @@ internal static partial class HelperKanbanMetadata
}
File.WriteAllLines(fileInfo.FullName, lines);
}
File.WriteAllLines(indexFile, indexFileLines);
if (addTicks)
File.WriteAllLines(indexFile, indexFileLines);
}
}