RiderScriptEditorData.cs 916 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using UnityEditor;
  3. using UnityEngine;
  4. namespace Packages.Rider.Editor
  5. {
  6. public class RiderScriptEditorData : ScriptableSingleton<RiderScriptEditorData>
  7. {
  8. [SerializeField] internal bool HasChanges = true; // sln/csproj files were changed
  9. [SerializeField] internal bool shouldLoadEditorPlugin;
  10. [SerializeField] internal bool InitializedOnce;
  11. [SerializeField] internal string currentEditorVersion;
  12. public void Init()
  13. {
  14. if (string.IsNullOrEmpty(currentEditorVersion))
  15. Invalidate(RiderScriptEditor.CurrentEditor);
  16. }
  17. public void Invalidate(string editorInstallationPath)
  18. {
  19. currentEditorVersion = RiderPathLocator.GetBuildNumber(editorInstallationPath);
  20. if (!Version.TryParse(currentEditorVersion, out var version))
  21. shouldLoadEditorPlugin = false;
  22. shouldLoadEditorPlugin = version >= new Version("191.7141.156");
  23. }
  24. }
  25. }