2
0

ProjectLibrary.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.IO;
  3. using System.Runtime.CompilerServices;
  4. using BansheeEngine;
  5. namespace BansheeEditor
  6. {
  7. public sealed class ProjectLibrary
  8. {
  9. public static void Create(Resource resource, string path)
  10. {
  11. if (Path.IsPathRooted(path))
  12. throw new ArgumentException("Provided path must be relative.", "path");
  13. Internal_Create(resource, path);
  14. }
  15. public static T Load<T>(string path) where T : Resource
  16. {
  17. if (Path.IsPathRooted(path))
  18. throw new ArgumentException("Provided path must be relative.", "path");
  19. return (T) Internal_Load(path);
  20. }
  21. // TODO - Will also need (at least):
  22. // - GetPath
  23. // - Reimport
  24. // - Load
  25. // - Move
  26. // - Rename
  27. // - Delete
  28. // - Copy
  29. // - CreateFolder
  30. [MethodImpl(MethodImplOptions.InternalCall)]
  31. private static extern void Internal_Create(Resource resource, string path);
  32. [MethodImpl(MethodImplOptions.InternalCall)]
  33. private static extern Resource Internal_Load(string path);
  34. }
  35. }