| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- // WARNING - AUTOGENERATED - DO NOT EDIT
- //
- // Generated using `sharpie urho`
- //
- // File.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
- {
- /// <summary>
- /// %File opened either through the filesystem or from within a package file.
- /// </summary>
- public unsafe partial class File : UrhoObject, IAbstractFile
- {
- unsafe partial void OnFileCreated ();
- [Preserve]
- public File (IntPtr handle) : base (handle)
- {
- OnFileCreated ();
- }
- [Preserve]
- protected File (UrhoObjectFlag emptyFlag) : base (emptyFlag)
- {
- OnFileCreated ();
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int File_GetType (IntPtr handle);
- private StringHash UrhoGetType ()
- {
- Runtime.ValidateRefCounted (this);
- return new StringHash (File_GetType (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr File_GetTypeName (IntPtr handle);
- private string GetTypeName ()
- {
- Runtime.ValidateRefCounted (this);
- return Marshal.PtrToStringAnsi (File_GetTypeName (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int File_GetTypeStatic ();
- private static StringHash GetTypeStatic ()
- {
- Runtime.Validate (typeof(File));
- return new StringHash (File_GetTypeStatic ());
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr File_GetTypeNameStatic ();
- private static string GetTypeNameStatic ()
- {
- Runtime.Validate (typeof(File));
- return Marshal.PtrToStringAnsi (File_GetTypeNameStatic ());
- }
- [Preserve]
- public File () : this (Application.CurrentContext)
- {
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr File_File (IntPtr context);
- [Preserve]
- public File (Context context) : base (UrhoObjectFlag.Empty)
- {
- Runtime.Validate (typeof(File));
- handle = File_File ((object)context == null ? IntPtr.Zero : context.Handle);
- Runtime.RegisterObject (this);
- OnFileCreated ();
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr File_File0 (IntPtr context, string fileName, FileMode mode);
- [Preserve]
- public File (Context context, string fileName, FileMode mode = FileMode.Read) : base (UrhoObjectFlag.Empty)
- {
- Runtime.Validate (typeof(File));
- handle = File_File0 ((object)context == null ? IntPtr.Zero : context.Handle, fileName, mode);
- Runtime.RegisterObject (this);
- OnFileCreated ();
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr File_File1 (IntPtr context, IntPtr package, string fileName);
- [Preserve]
- public File (Context context, PackageFile package, string fileName) : base (UrhoObjectFlag.Empty)
- {
- Runtime.Validate (typeof(File));
- handle = File_File1 ((object)context == null ? IntPtr.Zero : context.Handle, (object)package == null ? IntPtr.Zero : package.Handle, fileName);
- Runtime.RegisterObject (this);
- OnFileCreated ();
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint File_Read (IntPtr handle, IntPtr dest, uint size);
- /// <summary>
- /// Read bytes from the file. Return number of bytes actually read.
- /// </summary>
- public uint Read (IntPtr dest, uint size)
- {
- Runtime.ValidateRefCounted (this);
- return File_Read (handle, dest, size);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint File_Seek (IntPtr handle, uint position);
- /// <summary>
- /// Set position from the beginning of the file.
- /// </summary>
- public uint Seek (uint position)
- {
- Runtime.ValidateRefCounted (this);
- return File_Seek (handle, position);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint File_Write (IntPtr handle, void* data, uint size);
- /// <summary>
- /// Write bytes to the file. Return number of bytes actually written.
- /// </summary>
- public uint Write (void* data, uint size)
- {
- Runtime.ValidateRefCounted (this);
- return File_Write (handle, data, size);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr File_GetName (IntPtr handle);
- /// <summary>
- /// Return the file name.
- /// </summary>
- private string GetName ()
- {
- Runtime.ValidateRefCounted (this);
- return Marshal.PtrToStringAnsi (File_GetName (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint File_GetChecksum (IntPtr handle);
- /// <summary>
- /// Return a checksum of the file contents using the SDBM hash algorithm.
- /// </summary>
- private uint GetChecksum ()
- {
- Runtime.ValidateRefCounted (this);
- return File_GetChecksum (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool File_Open (IntPtr handle, string fileName, FileMode mode);
- /// <summary>
- /// Open a filesystem file. Return true if successful.
- /// </summary>
- public bool Open (string fileName, FileMode mode = FileMode.Read)
- {
- Runtime.ValidateRefCounted (this);
- return File_Open (handle, fileName, mode);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool File_Open2 (IntPtr handle, IntPtr package, string fileName);
- /// <summary>
- /// Open from within a package file. Return true if successful.
- /// </summary>
- public bool Open (PackageFile package, string fileName)
- {
- Runtime.ValidateRefCounted (this);
- return File_Open2 (handle, (object)package == null ? IntPtr.Zero : package.Handle, fileName);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void File_Close (IntPtr handle);
- /// <summary>
- /// Close the file.
- /// </summary>
- public void Close ()
- {
- Runtime.ValidateRefCounted (this);
- File_Close (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void File_Flush (IntPtr handle);
- /// <summary>
- /// Flush any buffered output to the file.
- /// </summary>
- public void Flush ()
- {
- Runtime.ValidateRefCounted (this);
- File_Flush (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void File_SetName (IntPtr handle, string name);
- /// <summary>
- /// Change the file name. Used by the resource system.
- /// </summary>
- private void SetName (string name)
- {
- Runtime.ValidateRefCounted (this);
- File_SetName (handle, name);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern FileMode File_GetMode (IntPtr handle);
- /// <summary>
- /// Return the open mode.
- /// </summary>
- private FileMode GetMode ()
- {
- Runtime.ValidateRefCounted (this);
- return File_GetMode (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool File_IsOpen (IntPtr handle);
- /// <summary>
- /// Return whether is open.
- /// </summary>
- public bool IsOpen ()
- {
- Runtime.ValidateRefCounted (this);
- return File_IsOpen (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr File_GetHandle (IntPtr handle);
- /// <summary>
- /// Return the file handle.
- /// </summary>
- private IntPtr GetHandle ()
- {
- Runtime.ValidateRefCounted (this);
- return File_GetHandle (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool File_IsPackaged (IntPtr handle);
- /// <summary>
- /// Return whether the file originates from a package.
- /// </summary>
- private bool IsPackaged ()
- {
- Runtime.ValidateRefCounted (this);
- return File_IsPackaged (handle);
- }
- 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 ();
- }
- }
- /// <summary>
- /// Return the file name.
- /// Or
- /// Change the file name. Used by the resource system.
- /// </summary>
- public string Name {
- get {
- return GetName ();
- }
- set {
- SetName (value);
- }
- }
- /// <summary>
- /// Return a checksum of the file contents using the SDBM hash algorithm.
- /// </summary>
- public uint Checksum {
- get {
- return GetChecksum ();
- }
- }
- /// <summary>
- /// Return the open mode.
- /// </summary>
- public FileMode Mode {
- get {
- return GetMode ();
- }
- }
- /// <summary>
- /// Return the file handle.
- /// </summary>
- public IntPtr FileHandle {
- get {
- return GetHandle ();
- }
- }
- /// <summary>
- /// Return whether the file originates from a package.
- /// </summary>
- public bool Packaged {
- get {
- return IsPackaged ();
- }
- }
- }
- }
|