diff --git a/Raylib-cs/Raylib.cs b/Raylib-cs/Raylib.cs index 76a6f6e..bd35710 100644 --- a/Raylib-cs/Raylib.cs +++ b/Raylib-cs/Raylib.cs @@ -478,10 +478,66 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern CBool SaveFileData(sbyte* fileName, void* data, uint bytesToWrite); + // Load text data from file (read), returns a '\0' terminated string + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern char *LoadFileText(sbyte* fileName); + + // Unload file text data allocated by LoadFileText() + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void UnloadFileText(char *text); + + // Save text data to file (write), string must be '\0' terminated, returns true on success + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern CBool SaveFileText(sbyte* fileName, char *text); + + // Check if file exists + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern CBool FileExists(sbyte* fileName); + + // Check if a directory path exists + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern CBool DirectoryExists(sbyte* dirPath); + /// Check file extension [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern CBool IsFileExtension(sbyte* fileName, sbyte* ext); + /// Get pointer to extension for a filename string (includes dot: '.png') + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern sbyte* GetFileExtension(sbyte* fileName); + + /// Get pointer to filename for a path string + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern sbyte* GetFileName(sbyte* filePath); + + /// Get filename string without extension (uses static string) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern sbyte* GetFileNameWithoutExt(sbyte* filePath); + + /// Get full path for a given fileName with path (uses static string) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern sbyte* GetDirectoryPath(sbyte* filePath); + + /// Get previous directory path for a given path (uses static string) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern sbyte* GetPrevDirectoryPath(sbyte* dirPath); + + /// Get current working directory (uses static string) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern sbyte* GetWorkingDirectory(); + + /// Get filenames in a directory path (memory should be freed) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern char **GetDirectoryFiles(sbyte* dirPath, int *count); + + /// Clear directory files paths buffers (free memory) + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void ClearDirectoryFiles(); + + /// Change working directory, return true on success + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern CBool ChangeDirectory(sbyte* dir); + /// Check if a file has been dropped into window [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern CBool IsFileDropped(); @@ -498,6 +554,9 @@ namespace Raylib_cs [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern int GetFileModTime(sbyte* fileName); + + // Compression/Encoding functionality + /// Compress data (DEFLATE algorithm) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern byte* CompressData(byte* data, int dataLength, int* compDataLength);