// WARNING - AUTOGENERATED - DO NOT EDIT
//
// Generated using `sharpie urho`
//
// FileSystem.cs
//
// Copyright 2015 Xamarin Inc. All rights reserved.
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using Urho.Urho2D;
using Urho.Gui;
using Urho.Resources;
using Urho.IO;
using Urho.Navigation;
using Urho.Network;
namespace Urho.IO
{
///
/// Subsystem for file and directory operations and access control.
///
public unsafe partial class FileSystem : UrhoObject
{
unsafe partial void OnFileSystemCreated ();
[Preserve]
public FileSystem (IntPtr handle) : base (handle)
{
OnFileSystemCreated ();
}
[Preserve]
protected FileSystem (UrhoObjectFlag emptyFlag) : base (emptyFlag)
{
OnFileSystemCreated ();
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern int FileSystem_GetType (IntPtr handle);
private StringHash UrhoGetType ()
{
Runtime.ValidateRefCounted (this);
return new StringHash (FileSystem_GetType (handle));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr FileSystem_GetTypeName (IntPtr handle);
private string GetTypeName ()
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (FileSystem_GetTypeName (handle));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern int FileSystem_GetTypeStatic ();
private static StringHash GetTypeStatic ()
{
Runtime.Validate (typeof(FileSystem));
return new StringHash (FileSystem_GetTypeStatic ());
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr FileSystem_GetTypeNameStatic ();
private static string GetTypeNameStatic ()
{
Runtime.Validate (typeof(FileSystem));
return Marshal.PtrToStringAnsi (FileSystem_GetTypeNameStatic ());
}
[Preserve]
public FileSystem () : this (Application.CurrentContext)
{
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr FileSystem_FileSystem (IntPtr context);
[Preserve]
public FileSystem (Context context) : base (UrhoObjectFlag.Empty)
{
Runtime.Validate (typeof(FileSystem));
handle = FileSystem_FileSystem ((object)context == null ? IntPtr.Zero : context.Handle);
Runtime.RegisterObject (this);
OnFileSystemCreated ();
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_SetCurrentDir (IntPtr handle, string pathName);
///
/// Set the current working directory.
///
public bool SetCurrentDir (string pathName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_SetCurrentDir (handle, pathName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_CreateDir (IntPtr handle, string pathName);
///
/// Create a directory.
///
public bool CreateDir (string pathName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_CreateDir (handle, pathName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern void FileSystem_SetExecuteConsoleCommands (IntPtr handle, bool enable);
///
/// Set whether to execute engine console commands as OS-specific system command.
///
private void SetExecuteConsoleCommands (bool enable)
{
Runtime.ValidateRefCounted (this);
FileSystem_SetExecuteConsoleCommands (handle, enable);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern int FileSystem_SystemCommand (IntPtr handle, string commandLine, bool redirectStdOutToLog);
///
/// Run a program using the command interpreter, block until it exits and return the exit code. Will fail if any allowed paths are defined.
///
public int SystemCommand (string commandLine, bool redirectStdOutToLog = false)
{
Runtime.ValidateRefCounted (this);
return FileSystem_SystemCommand (handle, commandLine, redirectStdOutToLog);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint FileSystem_SystemCommandAsync (IntPtr handle, string commandLine);
///
/// Run a program using the command interpreter asynchronously. Return a request ID or M_MAX_UNSIGNED if failed. The exit code will be posted together with the request ID in an AsyncExecFinished event. Will fail if any allowed paths are defined.
///
public uint SystemCommandAsync (string commandLine)
{
Runtime.ValidateRefCounted (this);
return FileSystem_SystemCommandAsync (handle, commandLine);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_SystemOpen (IntPtr handle, string fileName, string mode);
///
/// Open a file in an external program, with mode such as "edit" optionally specified. Will fail if any allowed paths are defined.
///
public bool SystemOpen (string fileName, string mode = "")
{
Runtime.ValidateRefCounted (this);
return FileSystem_SystemOpen (handle, fileName, mode);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_Copy (IntPtr handle, string srcFileName, string destFileName);
///
/// Copy a file. Return true if successful.
///
public bool Copy (string srcFileName, string destFileName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_Copy (handle, srcFileName, destFileName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_Rename (IntPtr handle, string srcFileName, string destFileName);
///
/// Rename a file. Return true if successful.
///
public bool Rename (string srcFileName, string destFileName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_Rename (handle, srcFileName, destFileName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_Delete (IntPtr handle, string fileName);
///
/// Delete a file. Return true if successful.
///
public bool Delete (string fileName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_Delete (handle, fileName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern void FileSystem_RegisterPath (IntPtr handle, string pathName);
///
/// Register a path as allowed to access. If no paths are registered, all are allowed. Registering allowed paths is considered securing the Urho3D execution environment: running programs and opening files externally through the system will fail afterward.
///
public void RegisterPath (string pathName)
{
Runtime.ValidateRefCounted (this);
FileSystem_RegisterPath (handle, pathName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_SetLastModifiedTime (IntPtr handle, string fileName, uint newTime);
///
/// Set a file's last modified time as seconds since 1.1.1970. Return true on success.
///
public bool SetLastModifiedTime (string fileName, uint newTime)
{
Runtime.ValidateRefCounted (this);
return FileSystem_SetLastModifiedTime (handle, fileName, newTime);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr FileSystem_GetCurrentDir (IntPtr handle);
///
/// Return the absolute current working directory.
///
private string GetCurrentDir ()
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (FileSystem_GetCurrentDir (handle));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_GetExecuteConsoleCommands (IntPtr handle);
///
/// Return whether is executing engine console commands as OS-specific system command.
///
private bool GetExecuteConsoleCommands ()
{
Runtime.ValidateRefCounted (this);
return FileSystem_GetExecuteConsoleCommands (handle);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_HasRegisteredPaths (IntPtr handle);
///
/// Return whether paths have been registered.
///
public bool HasRegisteredPaths ()
{
Runtime.ValidateRefCounted (this);
return FileSystem_HasRegisteredPaths (handle);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_CheckAccess (IntPtr handle, string pathName);
///
/// Check if a path is allowed to be accessed. If no paths are registered, all are allowed.
///
public bool CheckAccess (string pathName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_CheckAccess (handle, pathName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint FileSystem_GetLastModifiedTime (IntPtr handle, string fileName);
///
/// Returns the file's last modified time as seconds since 1.1.1970, or 0 if can not be accessed.
///
public uint GetLastModifiedTime (string fileName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_GetLastModifiedTime (handle, fileName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_FileExists (IntPtr handle, string fileName);
///
/// Check if a file exists.
///
public bool FileExists (string fileName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_FileExists (handle, fileName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern bool FileSystem_DirExists (IntPtr handle, string pathName);
///
/// Check if a directory exists.
///
public bool DirExists (string pathName)
{
Runtime.ValidateRefCounted (this);
return FileSystem_DirExists (handle, pathName);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr FileSystem_GetProgramDir (IntPtr handle);
///
/// Return the program's directory.
///
private string GetProgramDir ()
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (FileSystem_GetProgramDir (handle));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr FileSystem_GetUserDocumentsDir (IntPtr handle);
///
/// Return the user documents directory.
///
private string GetUserDocumentsDir ()
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (FileSystem_GetUserDocumentsDir (handle));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr FileSystem_GetAppPreferencesDir (IntPtr handle, string org, string app);
///
/// Return the application preferences directory.
///
public string GetAppPreferencesDir (string org, string app)
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (FileSystem_GetAppPreferencesDir (handle, org, app));
}
public override StringHash Type {
get {
return UrhoGetType ();
}
}
public override string TypeName {
get {
return GetTypeName ();
}
}
[Preserve]
public static StringHash TypeStatic {
get {
return GetTypeStatic ();
}
}
public static string TypeNameStatic {
get {
return GetTypeNameStatic ();
}
}
///
/// Return the absolute current working directory.
///
public string CurrentDir {
get {
return GetCurrentDir ();
}
}
///
/// Return whether is executing engine console commands as OS-specific system command.
/// Or
/// Set whether to execute engine console commands as OS-specific system command.
///
public bool ExecuteConsoleCommands {
get {
return GetExecuteConsoleCommands ();
}
set {
SetExecuteConsoleCommands (value);
}
}
///
/// Return the program's directory.
///
public string ProgramDir {
get {
return GetProgramDir ();
}
}
///
/// Return the user documents directory.
///
public string UserDocumentsDir {
get {
return GetUserDocumentsDir ();
}
}
}
}