Example #1
0
    static byte[] ReadAllBytes(string filePath)
    {
#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_IOS
        return(System.IO.File.ReadAllBytes(filePath));
#elif UNITY_SWITCH
        nn.fs.FileHandle fileHandle = new nn.fs.FileHandle();
        nn.Result        result     = nn.fs.File.Open(ref fileHandle, filePath, nn.fs.OpenFileMode.Read);
        result.abortUnlessSuccess();

        long fileSize = 0;
        result = nn.fs.File.GetSize(ref fileSize, fileHandle);
        result.abortUnlessSuccess();

        byte[] data = new byte[fileSize];
        result = nn.fs.File.Read(fileHandle, 0, data, fileSize);
        result.abortUnlessSuccess();

        nn.fs.File.Close(fileHandle);
        return(data);
#else
        return(null);
#endif
    }
Example #2
0
 public static extern Result Flush(FileHandle handle);                                                                             // 0x00A159C0-0x00A159E0
 public static extern Result SetSize(FileHandle handle, long size);                                                                // 0x00A159E0-0x00A15A00
Example #3
0
 public static extern Result Write(FileHandle handle, long offset, byte[] buffer, long size, WriteOption option);                  // 0x00A15990-0x00A159C0
 public static extern Result Flush(FileHandle handle);                                                                             // 0x00A159C0-0x00A159E0
Example #4
0
 public static extern Result Read(ref long outValue, FileHandle handle, long offset, byte[] buffer, long size);                    // 0x00A15960-0x00A15990
 public static extern Result Write(FileHandle handle, long offset, byte[] buffer, long size, WriteOption option);                  // 0x00A15990-0x00A159C0
Example #5
0
 public static extern Result Read(ref long outValue, FileHandle handle, long offset, byte[] buffer, long size, ReadOption option); // 0x00A15930-0x00A15960
 public static extern Result Read(ref long outValue, FileHandle handle, long offset, byte[] buffer, long size);                    // 0x00A15960-0x00A15990
Example #6
0
 public static extern Result Read(FileHandle handle, long offset, byte[] buffer, long size, ReadOption option);                    // 0x00A158D0-0x00A15900
 public static extern Result Read(FileHandle handle, long offset, byte[] buffer, long size);                                       // 0x00A15900-0x00A15930
Example #7
0
 public static extern nn.Result Open(
     ref FileHandle outValue, string path, OpenFileMode mode);
Example #8
0
 public static extern OpenFileMode GetOpenMode(FileHandle handle);                                                                 // 0x00A15A20-0x00A15A30
 public static extern void Close(FileHandle handle);                                                                               // 0x00A15A30-0x00A15A40
Example #9
0
 public static extern OpenFileMode GetOpenMode(FileHandle handle);
Example #10
0
 public static extern nn.Result GetSize(ref long outValue, FileHandle handle);
Example #11
0
 public static extern nn.Result SetSize(FileHandle handle, long size);
Example #12
0
 public static extern nn.Result Flush(FileHandle handle);
Example #13
0
 public static extern nn.Result Write(
     FileHandle handle, long offset, byte[] buffer, long size, WriteOption option);
Example #14
0
 public static extern nn.Result Read(
     ref long outValue, FileHandle handle, long offset, byte[] buffer, long size);
Example #15
0
 public static extern nn.Result Read(
     FileHandle handle, long offset, byte[] buffer, long size, ReadOption option);
Example #16
0
 public static extern Result SetSize(FileHandle handle, long size);                                                                // 0x00A159E0-0x00A15A00
 public static extern Result GetSize(ref long outValue, FileHandle handle);                                                        // 0x00A15A00-0x00A15A20
Example #17
0
 public static extern Result GetSize(ref long outValue, FileHandle handle);                                                        // 0x00A15A00-0x00A15A20
 public static extern OpenFileMode GetOpenMode(FileHandle handle);                                                                 // 0x00A15A20-0x00A15A30
Example #18
0
 public static extern void Close(FileHandle handle);
Example #19
0
 public static extern Result Rename(string currentPath, string newPath);                                                           // 0x00A15AC0-0x00A15B20
 public static extern Result Open(ref FileHandle outValue, string path, OpenFileMode mode);                                        // 0x00A15B20-0x00A15B80
Example #20
0
 // Methods
 public static extern Result Read(FileHandle handle, long offset, byte[] buffer, long size, ReadOption option);                    // 0x00A158D0-0x00A15900