Scene.cs 774 B

12345678910111213141516171819202122232425262728293031323334
  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. return Scene_LoadXMLFromCache(handle, cache.Handle, file);
  14. }
  15. public bool LoadXml(string path)
  16. {
  17. using (var file = new File(Context, path, FileMode.Read))
  18. {
  19. return LoadXml(file);
  20. }
  21. }
  22. public bool SaveXml(string path, string indentation = "\t")
  23. {
  24. using (var file = new File(Context, path, FileMode.Write))
  25. {
  26. return SaveXml(file, indentation);
  27. }
  28. }
  29. }
  30. }