public override void SaveSettingsToStorage() { string path = mSettingsPathBuilder.GetPath(kGeneralSettingsFileName); var updatedConfig = new ClangFormatOptions { EnableFormatOnSave = this.EnableFormatOnSave, FileExtensions = string.IsNullOrEmpty(this.FileExtensions) ? this.FileExtensions : this.FileExtensions.Replace(" ", "").Trim(';'), SkipFiles = string.IsNullOrEmpty(this.FilesToIgnore) ? this.FilesToIgnore : this.FilesToIgnore.Replace(" ", "").Trim(';'), AssumeFilename = string.IsNullOrEmpty(this.AssumeFilename) ? this.AssumeFilename : this.AssumeFilename.Replace(" ", "").Trim(';'), FallbackStyle = this.FallbackStyle, //SortIncludes = this.SortIncludes, Style = this.Style, ClangFormatPath = this.ClangFormatPath }; SaveToFile(path, updatedConfig); }
public override void SaveSettingsToStorage() { string path = mSettingsPathBuilder.GetPath(kTidyOptionsFileName); var updatedConfig = new ClangTidyOptions { TidyChecksCollection = string.IsNullOrEmpty(this.TidyChecks) ? this.TidyChecks : this.TidyChecks.Replace(" ", "").Trim(';') }; SaveToFile(path, updatedConfig); }
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); } }
public void DeleteFormatFolder() { var settingsPathBuilder = new SettingsPathBuilder(); string folderPath = Path.Combine(settingsPathBuilder.GetPath(""), "Format"); FileSystem.DeleteDirectory(folderPath); }
/// <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); }
private bool CheckLocalLicense() { SettingsPathBuilder settingsPathBuilder = new SettingsPathBuilder(); string filePath = settingsPathBuilder.GetPath("ctpjwt"); return(File.Exists(filePath)); }
public bool CheckLocalLicense() { SettingsPathBuilder settingsPathBuilder = new SettingsPathBuilder(); string filePath = settingsPathBuilder.GetPath(fileName); return(File.Exists(filePath)); }
public override void SaveSettingsToStorage() { string path = mSettingsPathBuilder.GetPath(kGeneralSettingsFileName); var updatedConfig = LoadFromFile(path); updatedConfig.EnableFormatOnSave = this.EnableFormatOnSave; updatedConfig.FileExtensions = this.FileExtensions; updatedConfig.SkipFiles = this.SkipFiles; updatedConfig.AssumeFilename = this.AssumeFilename; updatedConfig.FallbackStyle = this.FallbackStyle; //updatedConfig.SortIncludes = this.SortIncludes; updatedConfig.Style = this.Style; SaveToFile(path, updatedConfig); }
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); }
/// <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(); }