| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- // WARNING - AUTOGENERATED - DO NOT EDIT
- //
- // Generated using `sharpie urho`
- //
- // Resource.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.Resources
- {
- /// <summary>
- /// Base class for resources.
- /// </summary>
- public unsafe partial class Resource : UrhoObject
- {
- unsafe partial void OnResourceCreated ();
- [Preserve]
- public Resource (IntPtr handle) : base (handle)
- {
- OnResourceCreated ();
- }
- [Preserve]
- protected Resource (UrhoObjectFlag emptyFlag) : base (emptyFlag)
- {
- OnResourceCreated ();
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int Resource_GetType (IntPtr handle);
- private StringHash UrhoGetType ()
- {
- Runtime.ValidateRefCounted (this);
- return new StringHash (Resource_GetType (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr Resource_GetTypeName (IntPtr handle);
- private string GetTypeName ()
- {
- Runtime.ValidateRefCounted (this);
- return Marshal.PtrToStringAnsi (Resource_GetTypeName (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int Resource_GetTypeStatic ();
- private static StringHash GetTypeStatic ()
- {
- Runtime.Validate (typeof(Resource));
- return new StringHash (Resource_GetTypeStatic ());
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr Resource_GetTypeNameStatic ();
- private static string GetTypeNameStatic ()
- {
- Runtime.Validate (typeof(Resource));
- return Marshal.PtrToStringAnsi (Resource_GetTypeNameStatic ());
- }
- [Preserve]
- public Resource () : this (Application.CurrentContext)
- {
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr Resource_Resource (IntPtr context);
- [Preserve]
- public Resource (Context context) : base (UrhoObjectFlag.Empty)
- {
- Runtime.Validate (typeof(Resource));
- handle = Resource_Resource ((object)context == null ? IntPtr.Zero : context.Handle);
- Runtime.RegisterObject (this);
- OnResourceCreated ();
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_Load_File (IntPtr handle, IntPtr source);
- /// <summary>
- /// Load resource synchronously. Call both BeginLoad()
- /// &
- /// EndLoad() and return true if both succeeded.
- /// </summary>
- public bool Load (File source)
- {
- Runtime.ValidateRefCounted (this);
- return Resource_Load_File (handle, (object)source == null ? IntPtr.Zero : source.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_Load_MemoryBuffer (IntPtr handle, IntPtr source);
- /// <summary>
- /// Load resource synchronously. Call both BeginLoad()
- /// &
- /// EndLoad() and return true if both succeeded.
- /// </summary>
- public bool Load (MemoryBuffer source)
- {
- Runtime.ValidateRefCounted (this);
- return Resource_Load_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_BeginLoad_File (IntPtr handle, IntPtr source);
- /// <summary>
- /// Load resource from stream. May be called from a worker thread. Return true if successful.
- /// </summary>
- public virtual bool BeginLoad (File source)
- {
- Runtime.ValidateRefCounted (this);
- return Resource_BeginLoad_File (handle, (object)source == null ? IntPtr.Zero : source.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_BeginLoad_MemoryBuffer (IntPtr handle, IntPtr source);
- /// <summary>
- /// Load resource from stream. May be called from a worker thread. Return true if successful.
- /// </summary>
- public virtual bool BeginLoad (MemoryBuffer source)
- {
- Runtime.ValidateRefCounted (this);
- return Resource_BeginLoad_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_EndLoad (IntPtr handle);
- /// <summary>
- /// Finish resource loading. Always called from the main thread. Return true if successful.
- /// </summary>
- public virtual bool EndLoad ()
- {
- Runtime.ValidateRefCounted (this);
- return Resource_EndLoad (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_Save_File (IntPtr handle, IntPtr dest);
- /// <summary>
- /// Save resource. Return true if successful.
- /// </summary>
- public virtual bool Save (File dest)
- {
- Runtime.ValidateRefCounted (this);
- return Resource_Save_File (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_Save_MemoryBuffer (IntPtr handle, IntPtr dest);
- /// <summary>
- /// Save resource. Return true if successful.
- /// </summary>
- public virtual bool Save (MemoryBuffer dest)
- {
- Runtime.ValidateRefCounted (this);
- return Resource_Save_MemoryBuffer (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_LoadFile (IntPtr handle, string fileName);
- /// <summary>
- /// Load resource from file.
- /// </summary>
- public bool LoadFile (string fileName)
- {
- Runtime.ValidateRefCounted (this);
- return Resource_LoadFile (handle, fileName);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Resource_SaveFile (IntPtr handle, string fileName);
- /// <summary>
- /// Save resource to file.
- /// </summary>
- public virtual bool SaveFile (string fileName)
- {
- Runtime.ValidateRefCounted (this);
- return Resource_SaveFile (handle, fileName);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Resource_SetName (IntPtr handle, string name);
- /// <summary>
- /// Set name.
- /// </summary>
- private void SetName (string name)
- {
- Runtime.ValidateRefCounted (this);
- Resource_SetName (handle, name);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Resource_SetMemoryUse (IntPtr handle, uint size);
- /// <summary>
- /// Set memory use in bytes, possibly approximate.
- /// </summary>
- private void SetMemoryUse (uint size)
- {
- Runtime.ValidateRefCounted (this);
- Resource_SetMemoryUse (handle, size);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Resource_ResetUseTimer (IntPtr handle);
- /// <summary>
- /// Reset last used timer.
- /// </summary>
- public void ResetUseTimer ()
- {
- Runtime.ValidateRefCounted (this);
- Resource_ResetUseTimer (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Resource_SetAsyncLoadState (IntPtr handle, AsyncLoadState newState);
- /// <summary>
- /// Set the asynchronous loading state. Called by ResourceCache. Resources in the middle of asynchronous loading are not normally returned to user.
- /// </summary>
- private void SetAsyncLoadState (AsyncLoadState newState)
- {
- Runtime.ValidateRefCounted (this);
- Resource_SetAsyncLoadState (handle, newState);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr Resource_GetName (IntPtr handle);
- /// <summary>
- /// Return name.
- /// </summary>
- private string GetName ()
- {
- Runtime.ValidateRefCounted (this);
- return Marshal.PtrToStringAnsi (Resource_GetName (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int Resource_GetNameHash (IntPtr handle);
- /// <summary>
- /// Return name hash.
- /// </summary>
- private StringHash GetNameHash ()
- {
- Runtime.ValidateRefCounted (this);
- return new StringHash (Resource_GetNameHash (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint Resource_GetMemoryUse (IntPtr handle);
- /// <summary>
- /// Return memory use in bytes, possibly approximate.
- /// </summary>
- private uint GetMemoryUse ()
- {
- Runtime.ValidateRefCounted (this);
- return Resource_GetMemoryUse (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint Resource_GetUseTimer (IntPtr handle);
- /// <summary>
- /// Return time since last use in milliseconds. If referred to elsewhere than in the resource cache, returns always zero.
- /// </summary>
- private uint GetUseTimer ()
- {
- Runtime.ValidateRefCounted (this);
- return Resource_GetUseTimer (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern AsyncLoadState Resource_GetAsyncLoadState (IntPtr handle);
- /// <summary>
- /// Return the asynchronous loading state.
- /// </summary>
- private AsyncLoadState GetAsyncLoadState ()
- {
- Runtime.ValidateRefCounted (this);
- return Resource_GetAsyncLoadState (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 name.
- /// Or
- /// Set name.
- /// </summary>
- public string Name {
- get {
- return GetName ();
- }
- set {
- SetName (value);
- }
- }
- /// <summary>
- /// Return memory use in bytes, possibly approximate.
- /// Or
- /// Set memory use in bytes, possibly approximate.
- /// </summary>
- public uint MemoryUse {
- get {
- return GetMemoryUse ();
- }
- set {
- SetMemoryUse (value);
- }
- }
- /// <summary>
- /// Return the asynchronous loading state.
- /// Or
- /// Set the asynchronous loading state. Called by ResourceCache. Resources in the middle of asynchronous loading are not normally returned to user.
- /// </summary>
- public AsyncLoadState AsyncLoadState {
- get {
- return GetAsyncLoadState ();
- }
- set {
- SetAsyncLoadState (value);
- }
- }
- /// <summary>
- /// Return name hash.
- /// </summary>
- public StringHash NameHash {
- get {
- return GetNameHash ();
- }
- }
- /// <summary>
- /// Return time since last use in milliseconds. If referred to elsewhere than in the resource cache, returns always zero.
- /// </summary>
- public uint UseTimer {
- get {
- return GetUseTimer ();
- }
- }
- }
- }
|