Example #1
0
    public bool TryGetInstallationForPath(string editorPath, out ScriptEditor.Installation installation)
    {
        var lowerCasePath = editorPath.ToLower();
        var filename      = Path.GetFileName(lowerCasePath).Replace(" ", "");

        if (filename.StartsWith("code"))
        {
            try
            {
                installation = Installations.First(inst => inst.Path == editorPath);
            }
            catch (InvalidOperationException)
            {
                installation = new ScriptEditor.Installation
                {
                    Name = "Visual Studio Code",
                    Path = editorPath
                };
            }

            return(true);
        }

        installation = default;
        return(false);
    }
Example #2
0
        public override bool Commit()
        {
            var defaultInstallation = Installations.First(i => i.IsDefault.Value);

            _settingsService.AddInstalls(Installations.Select(i => i.ConcreteInstall.Directory).ToArray());
            _settingsService.SelectedInstall = defaultInstallation.ConcreteInstall;

            return(base.Commit());
        }
Example #3
0
        public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation)
        {
            if (IsRiderInstallation(editorPath))
            {
                try
                {
                    installation = Installations.First(inst => inst.Path == editorPath);
                }
                catch (InvalidOperationException)
                {
                    installation = new CodeEditor.Installation {
                        Name = editorPath, Path = editorPath
                    };
                }
                return(true);
            }

            installation = default;
            return(false);
        }