File.cs 482 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.InteropServices;
  4. using System.Text;
  5. namespace Urho.IO
  6. {
  7. partial class File
  8. {
  9. [DllImport(Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  10. static extern uint File_GetSize(IntPtr handle);
  11. public uint Size => File_GetSize(Handle);
  12. public uint Read(byte[] buffer, uint size)
  13. {
  14. unsafe
  15. {
  16. fixed (byte* b = buffer)
  17. {
  18. return Read((IntPtr)b, size);
  19. }
  20. }
  21. }
  22. }
  23. }