Пример #1
0
        public CodeEditor.Installation[] PathCallback()
        {
            var res = RiderPathLocator.GetAllRiderPaths()
                      .Select(riderInfo => new CodeEditor.Installation
            {
                Path = riderInfo.Path,
                Name = riderInfo.Presentation
            })
                      .ToList();

            var editorPath = RiderScriptEditor.CurrentEditor;

            if (RiderScriptEditor.IsRiderInstallation(editorPath) &&
                !res.Any(a => a.Path == editorPath) &&
                FileSystemUtil.EditorPathExists(editorPath))
            {
                // External editor manually set from custom location
                var info         = new RiderPathLocator.RiderInfo(editorPath, false);
                var installation = new CodeEditor.Installation
                {
                    Path = info.Path,
                    Name = info.Presentation
                };
                res.Add(installation);
            }

            return(res.ToArray());
        }
Пример #2
0
        public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation)
        {
            if (FileSystemUtil.EditorPathExists(editorPath) && IsRiderInstallation(editorPath))
            {
                var info = new RiderPathLocator.RiderInfo(editorPath, false);
                installation = new CodeEditor.Installation
                {
                    Name = info.Presentation,
                    Path = info.Path
                };
                return(true);
            }

            installation = default;
            return(false);
        }