-
-
Save Thomas-Giaroli/6c1553cce846ff2c5c43b2a4a7b1d026 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public NtStatus ReadFile(string fileName, byte[] buffer, out int bytesRead, long offset, IDokanFileInfo info) | |
{ | |
if (info.Context is Attachment att) | |
{ | |
if (att.rawData != null) | |
{ | |
Console.WriteLine(att.rawData.Length); | |
Byte[] arr = Convert.FromBase64String(att.rawData); | |
bytesRead = Math.Min(buffer.Length, (arr.Length - (int)offset)); | |
Array.Copy(arr, offset, buffer, 0, bytesRead); //The error happens here, because of the Math.min just a line up. | |
if ((int)offset + bytesRead >= arr.Length) //don't mind this if, it's for my caching system. | |
alreadyIncrementated = false; | |
return DokanResult.Success; | |
} | |
bytesRead = 0; | |
return DokanResult.Unsuccessful; | |
} | |
bytesRead = 0; | |
return DokanResult.Unsuccessful; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment