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