Exemple #1
0
        public void DeleteFormatFolder()
        {
            var    settingsPathBuilder = new SettingsPathBuilder();
            string folderPath          = Path.Combine(settingsPathBuilder.GetPath(""), "Format");

            FileSystem.DeleteDirectory(folderPath);
        }
        public void Remove(string directoryPath)
        {
            var clangTidyFilePath       = Path.Combine(directoryPath, CLANG_TIDY_FILE);
            var clangTidyBackupFilePath = Path.Combine(directoryPath, CLANG_TIDY_BACKUP_FILE);

            var settingsPathBuilder   = new SettingsPathBuilder();
            var settingsPath          = settingsPathBuilder.GetPath("");
            var tempClangTidyFilePath = Path.Combine(settingsPath, CLANG_TIDY_FILE);

            // if in the same directory already exists a .clang-tidy file
            if (File.Exists(tempClangTidyFilePath))
            {
                // if the backup file from script still exists
                if (File.Exists(clangTidyBackupFilePath))
                {
                    File.Copy(clangTidyBackupFilePath, clangTidyFilePath, true);
                    File.Delete(clangTidyBackupFilePath);
                }
                else // backup file from script was deleted but we still have the backup file from %appdata%
                {
                    File.Copy(tempClangTidyFilePath, clangTidyFilePath, true);
                }
                File.Delete(tempClangTidyFilePath);
                return;
            }

            // the .clang-tidy file was created by the script
            // if it wasn't deteled by the script then delete it now
            if (File.Exists(clangTidyFilePath) && File.Exists(tempClangTidyFilePath))
            {
                File.Delete(clangTidyFilePath);
            }
        }
        private bool CheckLocalLicense()
        {
            SettingsPathBuilder settingsPathBuilder = new SettingsPathBuilder();
            string filePath = settingsPathBuilder.GetPath("ctpjwt");

            return(File.Exists(filePath));
        }
Exemple #4
0
        /// <summary>
        /// Get the license token path
        /// </summary>
        /// <returns>License token path if the file exists. Empty string otherwise.</returns>
        private string GetTokenPath()
        {
            var    settingsPathBuilder = new SettingsPathBuilder();
            string filePath            = settingsPathBuilder.GetPath(fileName);

            return(File.Exists(filePath) == true ? filePath : string.Empty);
        }
Exemple #5
0
        public bool CheckLocalLicense()
        {
            SettingsPathBuilder settingsPathBuilder = new SettingsPathBuilder();
            string filePath = settingsPathBuilder.GetPath(fileName);

            return(File.Exists(filePath));
        }
        private void SaveToken(string token)
        {
            var    settingsPathBuilder = new SettingsPathBuilder();
            string filePath            = settingsPathBuilder.GetPath("ctpjwt");

            DeleteExistingToken(filePath);

            using var streamWriter = new StreamWriter(filePath);
            streamWriter.WriteLine(token);
            File.SetAttributes(filePath, File.GetAttributes(filePath) | FileAttributes.Hidden);
        }
        private TokenModel CheckToken(TokenModel tokenModel)
        {
            SettingsPathBuilder settingsPathBuilder = new SettingsPathBuilder();
            string filePath = settingsPathBuilder.GetPath("ctpjwt");

            if (File.Exists(filePath))
            {
                using (StreamReader streamReader = new StreamReader(filePath))
                {
                    tokenModel.jwt = streamReader.ReadLine();
                }
            }
            return(tokenModel);
        }
Exemple #8
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        public void LogoutUser()
        {
            var    settingsPathBuilder = new SettingsPathBuilder();
            string path = settingsPathBuilder.GetPath("ctpjwt");

            if (File.Exists(path) == true)
            {
                File.Delete(path);
            }

            LoginView loginView = new LoginView();

            loginView.ShowDialog();
        }
Exemple #9
0
        private static string GetUsedLlvmVersionPath(string llvmVersion)
        {
            var settingsPathBuilder = new SettingsPathBuilder();

            return(settingsPathBuilder.GetLlvmBinPath(llvmVersion));
        }