NETToolSystem.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #include <Atomic/IO/Log.h>
  8. #include <AtomicNET/NETCore/NETCore.h>
  9. #include "NETToolSystem.h"
  10. namespace ToolCore
  11. {
  12. NETToolSystem::NETToolSystem(Context* context) : Object(context)
  13. {
  14. if (context->GetEditorContext())
  15. {
  16. NETCore* core = GetSubsystem<NETCore>();
  17. if (!core->CreateDelegate("AtomicNETTools", "AtomicTools.AtomicTools", "InspectAssembly", (void**) &inspectAssemblyFunction_))
  18. {
  19. LOGERROR("NETToolSystem::NETToolSystem - Unable to resolve delagate AtomicNETTools.InspectAssembly");
  20. }
  21. }
  22. }
  23. NETToolSystem::~NETToolSystem()
  24. {
  25. }
  26. bool NETToolSystem::InspectAssembly(const String& pathToAssembly, JSONValue &json)
  27. {
  28. json.SetType(JSON_NULL);
  29. if (!inspectAssemblyFunction_)
  30. return false;
  31. String jsonString = inspectAssemblyFunction_(pathToAssembly.CString());
  32. if (!jsonString.Length())
  33. return false;
  34. return JSONFile::ParseJSON(jsonString, json);
  35. }
  36. }