NETProjectSystem.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 GetVisualStudioAvailable() const { return visualStudioPath_.Length() != 0; }
  43. const String& GetSolutionPath() const { return solutionPath_; }
  44. void BuildAtomicProject();
  45. /// Open the solution, if opening a source file, better to call OpenSourceFile as will launch VS instance with source file loaded
  46. /// otherwise, no guarantee where source file will load when multiple VS instances running
  47. void OpenSolution();
  48. void OpenSourceFile(const String& sourceFilePath);
  49. bool GenerateSolution();
  50. private:
  51. void HandleUpdate(StringHash eventType, VariantMap& eventData);
  52. void HandleNETBuildResult(StringHash eventType, VariantMap& eventData);
  53. void HandleFileChanged(StringHash eventType, VariantMap& eventData);
  54. void HandleResourceAdded(StringHash eventType, VariantMap& eventData);
  55. void HandleResourceRemoved(StringHash eventType, VariantMap& eventData);
  56. void HandleAssetRenamed(StringHash eventType, VariantMap& eventData);
  57. void HandleAssetMoved(StringHash eventType, VariantMap& eventData);
  58. void HandleAssetNew(StringHash eventType, VariantMap& eventData);
  59. void HandleAssetScanBegin(StringHash eventType, VariantMap& eventData);
  60. void HandleAssetScanEnd(StringHash eventType, VariantMap& eventData);
  61. void HandleProjectLoaded(StringHash eventType, VariantMap& eventData);
  62. void HandleProjectUnloaded(StringHash eventType, VariantMap& eventData);
  63. void Clear();
  64. void Initialize();
  65. String visualStudioPath_;
  66. String solutionPath_;
  67. String projectAssemblyPath_;
  68. float quietPeriod_;
  69. bool solutionDirty_;
  70. bool projectAssemblyDirty_;
  71. // Visual Studio subprocess
  72. WeakPtr<Subprocess> vsSubprocess_;
  73. };
  74. }