Ejemplo n.º 1
0
        public static void CopyVSKToIDEDir(string fileToCopy)
        {
            // Bail out if file does not exist
            if (!File.Exists(fileToCopy))
            {
                return;
            }

            CopyFileUsingXCopy(fileToCopy, VSPathUtils.GetVsInstallPath());
        }
Ejemplo n.º 2
0
        //---------- Mapping Schemes ----------------

        private static void ExecuteImportMappingScheme()
        {
            // Open Browse dialog - search for VSK files.
            const string vskFileFilter = "VS keyboard files (*.vsk)|*.vsk|All files (*.*)|*.*";
            string       fileToImport  = FileUtils.BrowseForFile(vskFileFilter, VSPathUtils.GetVsInstallPath());

            if (!File.Exists(fileToImport))
            {
                // No file to copy. Abort operation.
                return;
            }

            // Check that it's a VSK file.
            if (!Path.GetExtension(fileToImport).Equals(".vsk", StringComparison.InvariantCultureIgnoreCase))
            {
                MessageBox.Show($"The chosen file is not a valid Visual Studio keyboard mapping scheme. Please chose a VSK file.", MSG_CAPTION_IMPORT_VSK);
                return;
            }

            // Copy VSK file to IDE directory
            FileUtils.CopyVSKToIDEDir(fileToImport);
        }
Ejemplo n.º 3
0
        private bool IsSelected(string mappingSchemeName)
        {
            using (var vsKey = Registry.CurrentUser.OpenSubKey(VSPathUtils.GetRegistryRoot()))
            {
                if (vsKey != null)
                {
                    using (var keyboardKey = vsKey.OpenSubKey("Keyboard"))
                    {
                        if (keyboardKey != null)
                        {
                            var schemeName = keyboardKey.GetValue("SchemeName") as string;
                            if (string.IsNullOrEmpty(schemeName))
                            {
                                return(mappingSchemeName == DEFAULT_MAPPING_SCHEME_NAME);
                            }

                            return(string.Equals(mappingSchemeName + ".vsk", Path.GetFileName(schemeName), StringComparison.InvariantCultureIgnoreCase));
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 4
0
 private List <string> FetchListOfMappingSchemes()
 {
     // PERFORMS FILE IO! We want to minimize how often this occurs, plus delay this call as long as possible.
     return(Directory.EnumerateFiles(VSPathUtils.GetVsInstallPath(), "*.vsk").Select(fn => Path.GetFileNameWithoutExtension(fn)).ToList());
 }
 private string GetAllUsersExtensionsPath()
 {
     return(Path.Combine(VSPathUtils.GetVsInstallPath(), "Extensions"));
 }
Ejemplo n.º 6
0
 public static void CopyVSKToIDEDir(string fileToCopy)
 {
     CopyFileUsingXCopy(fileToCopy, VSPathUtils.GetVsInstallPath());
 }