NETProjectSystem.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include <Atomic/Core/Object.h>
  24. using namespace Atomic;
  25. namespace ToolCore
  26. {
  27. class Project;
  28. class Subprocess;
  29. // AtomicProject.dll state (this shouldn't be in resources too)
  30. enum NETProjectState
  31. {
  32. NETPROJECT_CLEAN,
  33. NETPROJECT_DIRTY,
  34. NETPROJECT_ERROR
  35. };
  36. class NETProjectSystem : public Object
  37. {
  38. ATOMIC_OBJECT(NETProjectSystem, Object)
  39. public:
  40. NETProjectSystem(Context* context);
  41. virtual ~NETProjectSystem();
  42. bool GetIDEAvailable() const { return idePath_.Length() != 0; }
  43. /// Returns true if there is a solution available for the loaded project (true = managed app)
  44. bool GetSolutionAvailable() const { return solutionPath_.Length() != 0; }
  45. const String& GetSolutionPath() const { return solutionPath_; }
  46. void BuildAtomicProject();
  47. /// Open the solution, if opening a source file, better to call OpenSourceFile as will launch VS instance with source file loaded
  48. /// otherwise, no guarantee where source file will load when multiple VS instances running
  49. void OpenSolution();
  50. void OpenSourceFile(const String& sourceFilePath);
  51. bool GenerateSolution();
  52. bool GenerateResourcePak();
  53. private:
  54. void HandleUpdate(StringHash eventType, VariantMap& eventData);
  55. void HandleNETBuildResult(StringHash eventType, VariantMap& eventData);
  56. void HandleFileChanged(StringHash eventType, VariantMap& eventData);
  57. void HandleResourceAdded(StringHash eventType, VariantMap& eventData);
  58. void HandleResourceRemoved(StringHash eventType, VariantMap& eventData);
  59. void HandleAssetRenamed(StringHash eventType, VariantMap& eventData);
  60. void HandleAssetMoved(StringHash eventType, VariantMap& eventData);
  61. void HandleAssetNew(StringHash eventType, VariantMap& eventData);
  62. void HandleAssetScanBegin(StringHash eventType, VariantMap& eventData);
  63. void HandleAssetScanEnd(StringHash eventType, VariantMap& eventData);
  64. void HandleProjectLoaded(StringHash eventType, VariantMap& eventData);
  65. void HandleProjectUnloaded(StringHash eventType, VariantMap& eventData);
  66. void Clear();
  67. void Initialize();
  68. String idePath_;
  69. String projectPath_;
  70. String solutionPath_;
  71. String projectAssemblyPath_;
  72. float quietPeriod_;
  73. bool solutionDirty_;
  74. bool projectAssemblyDirty_;
  75. // Visual Studio subprocess
  76. WeakPtr<Subprocess> ideSubprocess_;
  77. };
  78. /// Copies the core Atomic NET assemblies to a specified folder
  79. bool AtomicNETCopyAssemblies(Context* context, const String& dstFolder);
  80. }