PackageFile.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // PackageFile.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho.IO
  18. {
  19. /// <summary>
  20. /// Stores files of a directory tree sequentially for convenient access.
  21. /// </summary>
  22. public unsafe partial class PackageFile : UrhoObject
  23. {
  24. unsafe partial void OnPackageFileCreated ();
  25. [Preserve]
  26. public PackageFile (IntPtr handle) : base (handle)
  27. {
  28. OnPackageFileCreated ();
  29. }
  30. [Preserve]
  31. protected PackageFile (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnPackageFileCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int PackageFile_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (PackageFile_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr PackageFile_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (PackageFile_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int PackageFile_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(PackageFile));
  54. return new StringHash (PackageFile_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr PackageFile_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(PackageFile));
  61. return Marshal.PtrToStringAnsi (PackageFile_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public PackageFile () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr PackageFile_PackageFile (IntPtr context);
  69. [Preserve]
  70. public PackageFile (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(PackageFile));
  73. handle = PackageFile_PackageFile ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnPackageFileCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern IntPtr PackageFile_PackageFile0 (IntPtr context, string fileName, uint startOffset);
  79. [Preserve]
  80. public PackageFile (Context context, string fileName, uint startOffset = 0) : base (UrhoObjectFlag.Empty)
  81. {
  82. Runtime.Validate (typeof(PackageFile));
  83. handle = PackageFile_PackageFile0 ((object)context == null ? IntPtr.Zero : context.Handle, fileName, startOffset);
  84. Runtime.RegisterObject (this);
  85. OnPackageFileCreated ();
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern bool PackageFile_Open (IntPtr handle, string fileName, uint startOffset);
  89. /// <summary>
  90. /// Open the package file. Return true if successful.
  91. /// </summary>
  92. public bool Open (string fileName, uint startOffset = 0)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. return PackageFile_Open (handle, fileName, startOffset);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern bool PackageFile_Exists (IntPtr handle, string fileName);
  99. /// <summary>
  100. /// Check if a file exists within the package file. This will be case-insensitive on Windows and case-sensitive on other platforms.
  101. /// </summary>
  102. public bool Exists (string fileName)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. return PackageFile_Exists (handle, fileName);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern PackageEntry* PackageFile_GetEntry (IntPtr handle, string fileName);
  109. /// <summary>
  110. /// Return the file entry corresponding to the name, or null if not found. This will be case-insensitive on Windows and case-sensitive on other platforms.
  111. /// </summary>
  112. public PackageEntry* GetEntry (string fileName)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return PackageFile_GetEntry (handle, fileName);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern IntPtr PackageFile_GetName (IntPtr handle);
  119. /// <summary>
  120. /// Return the package file name.
  121. /// </summary>
  122. private string GetName ()
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. return Marshal.PtrToStringAnsi (PackageFile_GetName (handle));
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern int PackageFile_GetNameHash (IntPtr handle);
  129. /// <summary>
  130. /// Return hash of the package file name.
  131. /// </summary>
  132. private StringHash GetNameHash ()
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. return new StringHash (PackageFile_GetNameHash (handle));
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern uint PackageFile_GetNumFiles (IntPtr handle);
  139. /// <summary>
  140. /// Return number of files.
  141. /// </summary>
  142. private uint GetNumFiles ()
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. return PackageFile_GetNumFiles (handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern uint PackageFile_GetTotalSize (IntPtr handle);
  149. /// <summary>
  150. /// Return total size of the package file.
  151. /// </summary>
  152. private uint GetTotalSize ()
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. return PackageFile_GetTotalSize (handle);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern uint PackageFile_GetTotalDataSize (IntPtr handle);
  159. /// <summary>
  160. /// Return total data size from all the file entries in the package file.
  161. /// </summary>
  162. private uint GetTotalDataSize ()
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. return PackageFile_GetTotalDataSize (handle);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern uint PackageFile_GetChecksum (IntPtr handle);
  169. /// <summary>
  170. /// Return checksum of the package file contents.
  171. /// </summary>
  172. private uint GetChecksum ()
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. return PackageFile_GetChecksum (handle);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern bool PackageFile_IsCompressed (IntPtr handle);
  179. /// <summary>
  180. /// Return whether the files are compressed.
  181. /// </summary>
  182. private bool IsCompressed ()
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. return PackageFile_IsCompressed (handle);
  186. }
  187. public override StringHash Type {
  188. get {
  189. return UrhoGetType ();
  190. }
  191. }
  192. public override string TypeName {
  193. get {
  194. return GetTypeName ();
  195. }
  196. }
  197. [Preserve]
  198. public static StringHash TypeStatic {
  199. get {
  200. return GetTypeStatic ();
  201. }
  202. }
  203. public static string TypeNameStatic {
  204. get {
  205. return GetTypeNameStatic ();
  206. }
  207. }
  208. /// <summary>
  209. /// Return the package file name.
  210. /// </summary>
  211. public string Name {
  212. get {
  213. return GetName ();
  214. }
  215. }
  216. /// <summary>
  217. /// Return hash of the package file name.
  218. /// </summary>
  219. public StringHash NameHash {
  220. get {
  221. return GetNameHash ();
  222. }
  223. }
  224. /// <summary>
  225. /// Return number of files.
  226. /// </summary>
  227. public uint NumFiles {
  228. get {
  229. return GetNumFiles ();
  230. }
  231. }
  232. /// <summary>
  233. /// Return total size of the package file.
  234. /// </summary>
  235. public uint TotalSize {
  236. get {
  237. return GetTotalSize ();
  238. }
  239. }
  240. /// <summary>
  241. /// Return total data size from all the file entries in the package file.
  242. /// </summary>
  243. public uint TotalDataSize {
  244. get {
  245. return GetTotalDataSize ();
  246. }
  247. }
  248. /// <summary>
  249. /// Return checksum of the package file contents.
  250. /// </summary>
  251. public uint Checksum {
  252. get {
  253. return GetChecksum ();
  254. }
  255. }
  256. /// <summary>
  257. /// Return whether the files are compressed.
  258. /// </summary>
  259. public bool Compressed {
  260. get {
  261. return IsCompressed ();
  262. }
  263. }
  264. }
  265. }