mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-01-14 07:06:15 +08:00
feat: improve UI/UX of font loading
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QuickLook.Plugin.FontViewer;
|
||||
|
||||
public class ObservableFileStream(string path, FileMode mode, FileAccess access, FileShare share) : FileStream(path, mode, access, share)
|
||||
{
|
||||
public bool IsEndOfStream { get; protected set; } = false;
|
||||
|
||||
public override int Read(byte[] array, int offset, int count)
|
||||
{
|
||||
int result = base.Read(array, offset, count);
|
||||
if (result == 0)
|
||||
IsEndOfStream = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
int result = await base.ReadAsync(buffer, offset, count, cancellationToken);
|
||||
if (result == 0)
|
||||
IsEndOfStream = true;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user