2
0

nullable types removed

This commit is contained in:
glax 2023-06-27 23:25:35 +02:00
parent 82f6c7b3fe
commit a38fcf50ca

View File

@ -60,7 +60,7 @@ public abstract class Connector
{ {
string volume = singleResultRegex.Match(volumeRegex.Match(searchTerm).Value).Value; string volume = singleResultRegex.Match(volumeRegex.Match(searchTerm).Value).Value;
string chapter = singleResultRegex.Match(chapterRegex.Match(searchTerm).Value).Value; string chapter = singleResultRegex.Match(chapterRegex.Match(searchTerm).Value).Value;
return availableChapters.Where(aCh => aCh.volumeNumber is not null && aCh.chapterNumber is not null && return availableChapters.Where(aCh => aCh.volumeNumber is not null &&
aCh.volumeNumber.Equals(volume, StringComparison.InvariantCultureIgnoreCase) && aCh.volumeNumber.Equals(volume, StringComparison.InvariantCultureIgnoreCase) &&
aCh.chapterNumber.Equals(chapter, StringComparison.InvariantCultureIgnoreCase)) aCh.chapterNumber.Equals(chapter, StringComparison.InvariantCultureIgnoreCase))
.ToArray(); .ToArray();
@ -94,15 +94,13 @@ public abstract class Connector
string range = rangeResultRegex.Match(chapter).Value; string range = rangeResultRegex.Match(chapter).Value;
int start = Convert.ToInt32(range.Split('-')[0]); int start = Convert.ToInt32(range.Split('-')[0]);
int end = Convert.ToInt32(range.Split('-')[1]); int end = Convert.ToInt32(range.Split('-')[1]);
return availableChapters.Where(aCh => aCh.chapterNumber is not null && return availableChapters.Where(aCh => Convert.ToInt32(aCh.chapterNumber) >= start &&
Convert.ToInt32(aCh.chapterNumber) >= start &&
Convert.ToInt32(aCh.chapterNumber) <= end).ToArray(); Convert.ToInt32(aCh.chapterNumber) <= end).ToArray();
} }
else if (singleResultRegex.IsMatch(chapter)) else if (singleResultRegex.IsMatch(chapter))
{ {
string chapterNumber = singleResultRegex.Match(chapter).Value; string chapterNumber = singleResultRegex.Match(chapter).Value;
return availableChapters.Where(aCh => return availableChapters.Where(aCh =>
aCh.chapterNumber is not null &&
aCh.chapterNumber.Equals(chapterNumber, StringComparison.InvariantCultureIgnoreCase)).ToArray(); aCh.chapterNumber.Equals(chapterNumber, StringComparison.InvariantCultureIgnoreCase)).ToArray();
} }
} }