Scene.cs 885 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using Urho.IO;
  4. using Urho.Resources;
  5. namespace Urho
  6. {
  7. partial class Scene
  8. {
  9. [DllImport(Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  10. internal static extern bool Scene_LoadXMLFromCache(IntPtr handle, IntPtr cache, string file);
  11. public bool LoadXmlFromCache(ResourceCache cache, string file)
  12. {
  13. Runtime.ValidateRefCounted(this);
  14. return Scene_LoadXMLFromCache(handle, cache.Handle, file);
  15. }
  16. public bool LoadXml(string path)
  17. {
  18. Runtime.ValidateRefCounted(this);
  19. using (var file = new File(Context, path, FileMode.Read))
  20. {
  21. return LoadXml(file);
  22. }
  23. }
  24. public bool SaveXml(string path, string indentation = "\t")
  25. {
  26. Runtime.ValidateRefCounted(this);
  27. using (var file = new File(Context, path, FileMode.Write))
  28. {
  29. return SaveXml(file, indentation);
  30. }
  31. }
  32. }
  33. }