public void Close() { if (FilePointer != IntPtr.Zero) { LuaDLL.FileImage_Close(FilePointer); FilePointer = IntPtr.Zero; } }
//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); }