mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-24 01:34:45 +03:00
Use new ReadAllLines extensions
This commit is contained in:
@@ -35,11 +35,11 @@ namespace MediaBrowser.Common.Extensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads all lines in the <see cref="StreamReader" />.
|
||||
/// Reads all lines in the <see cref="TextReader" />.
|
||||
/// </summary>
|
||||
/// <param name="reader">The <see cref="StreamReader" /> to read from.</param>
|
||||
/// <param name="reader">The <see cref="TextReader" /> to read from.</param>
|
||||
/// <returns>All lines in the stream.</returns>
|
||||
public static IEnumerable<string> ReadAllLines(this StreamReader reader)
|
||||
public static IEnumerable<string> ReadAllLines(this TextReader reader)
|
||||
{
|
||||
string? line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
@@ -47,5 +47,19 @@ namespace MediaBrowser.Common.Extensions
|
||||
yield return line;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads all lines in the <see cref="TextReader" />.
|
||||
/// </summary>
|
||||
/// <param name="reader">The <see cref="TextReader" /> to read from.</param>
|
||||
/// <returns>All lines in the stream.</returns>
|
||||
public static async IAsyncEnumerable<string> ReadAllLinesAsync(this TextReader reader)
|
||||
{
|
||||
string? line;
|
||||
while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null)
|
||||
{
|
||||
yield return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user