public bool Read(byte[] pBuffer, uint bufferLength) { if (FilePointer == IntPtr.Zero) { return(false); } return(LuaDLL.FileImage_Read(FilePointer, pBuffer, bufferLength)); }
//static List<FileBytesInfo> _AllFilesRecords = new List<FileBytesInfo>(); public static byte[] ReadAllBytes(string filename) { byte[] data = null; IntPtr file = LuaDLL.FileImage_Open(filename, false); if (file != IntPtr.Zero) { int len = LuaDLL.FileImage_GetFileLength(file); //_AllFilesRecords.Add(new FileBytesInfo(filename, len)); data = new byte[len]; if (!LuaDLL.FileImage_Read(file, data, (uint)len)) { data = null; } LuaDLL.FileImage_Close(file); } return(data); }