mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 10:32:10 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
a2129b957e
|
|||
61cd632df6
|
@@ -6,6 +6,6 @@ using TweetDuck;
|
||||
|
||||
namespace TweetDuck {
|
||||
internal static class Version {
|
||||
public const string Tag = "1.22";
|
||||
public const string Tag = "1.22.0.1";
|
||||
}
|
||||
}
|
||||
|
@@ -10,8 +10,6 @@ namespace TweetLib.Browser.CEF.Logic {
|
||||
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public sealed class ByteArrayResourceHandlerLogic<TResponse> : ByteArrayResourceHandlerLogic {
|
||||
public int RemainingBytes => resource.Length - position;
|
||||
|
||||
private readonly ByteArrayResource resource;
|
||||
private readonly IResponseAdapter<TResponse> responseAdapter;
|
||||
|
||||
@@ -46,20 +44,21 @@ namespace TweetLib.Browser.CEF.Logic {
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Read<T>(WriteToOut<T> write, T dataOut, int bytesToRead, out int bytesRead, IDisposable callback) {
|
||||
public bool Read<T>(WriteToOut<T> write, T dataOut, long maxBytesToRead, out int bytesRead, IDisposable callback) {
|
||||
callback.Dispose();
|
||||
|
||||
if (bytesToRead > 0) {
|
||||
if (maxBytesToRead == 0) {
|
||||
bytesRead = 0;
|
||||
}
|
||||
else {
|
||||
int bytesToRead = (int) Math.Min(maxBytesToRead, resource.Length - position);
|
||||
|
||||
write(dataOut, resource.Contents, position, bytesToRead);
|
||||
position += bytesToRead;
|
||||
}
|
||||
|
||||
bytesRead = bytesToRead;
|
||||
return bytesRead > 0;
|
||||
}
|
||||
|
||||
public bool Read<T>(WriteToOut<T> write, T dataOut, out int bytesRead, IDisposable callback) {
|
||||
return Read(write, dataOut, RemainingBytes, out bytesRead, callback);
|
||||
return bytesRead > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ namespace TweetImpl.CefGlue.Handlers.Resource {
|
||||
}
|
||||
|
||||
protected override bool Read(IntPtr dataOut, int bytesToRead, out int bytesRead, CefResourceReadCallback callback) {
|
||||
return logic!.Read(WriteToOut, dataOut, Math.Min(bytesToRead, logic.RemainingBytes), out bytesRead, callback);
|
||||
return logic!.Read(WriteToOut, dataOut, bytesToRead, out bytesRead, callback);
|
||||
}
|
||||
|
||||
protected override void Cancel() {}
|
||||
|
@@ -39,7 +39,7 @@ namespace TweetImpl.CefSharp.Handlers {
|
||||
}
|
||||
|
||||
bool IResourceHandler.Read(Stream dataOut, out int bytesRead, IResourceReadCallback callback) {
|
||||
return logic.Read(WriteToOut, dataOut, out bytesRead, callback);
|
||||
return logic.Read(WriteToOut, dataOut, dataOut.Length, out bytesRead, callback);
|
||||
}
|
||||
|
||||
bool IResourceHandler.ProcessRequest(IRequest request, ICallback callback) {
|
||||
|
Reference in New Issue
Block a user