public void CombineDirectoryPathFileNameCheckCreateFile_TestCheckFileExistsOrCreateFile() { // Assign var dirPath1 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName; var fileName = @"Ar2mSpellUserList"; // Act var dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath1, dirName); var filePath = Path.Combine(dirPath, fileName); filePath = DirectoryFileOperations.CombineDirectoryPathFileNameCheckCreateFile(dirPath, filePath); // Assert Assert.IsTrue(File.Exists(filePath)); }
/// <summary> /// Read users names list from file. /// </summary> /// <created>art2m,5/20/2019</created> /// <changed>art2m,5/20/2019</changed> private void ReadUserFileFillListBox() { var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName; dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName); if (string.IsNullOrEmpty(dirPath)) { return; } var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName; var filePath = DirectoryFileOperations.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName); if (string.IsNullOrEmpty(filePath)) { return; } /*var dirPath = DirectoryFileOperations.CheckExistsCreateArt2MSpellPathDirectory(); * * if (string.IsNullOrEmpty(dirPath)) * { * return; * } * * var filePath = DirectoryFileOperations.CreatePathToUserFile(dirPath); * * if (string.IsNullOrEmpty(filePath)) * { * return; * } * * if (!SpellingReadWriteClass.ReadUserNameFile(filePath)) * { * return; * } * * this.FillListBoxWithUserNames();*/ }
private void OnDeleteUserButton_Click(object sender, EventArgs e) { var userDirPath = this.GetUsersSpellingListDirectory() var pathUserListName = SpellingPropertiesClass.GetArt2MSpellUserListFileName; var filePath = DirectoryFileOperations.CombineDirectoryPathFileNameCheckCreateFile(pathArt2MSpell, pathUserListName); if (string.IsNullOrEmpty(filePath)) { return; } retVal = SpellingReadWriteClass.ReadUserNameFile(filePath); if (!retVal) { return; } retVal = this.usnc.ContainsItem(SpellingPropertiesClass.UserName); if (!retVal) { return; } var index = this.usnc.GetItemIndex(SpellingPropertiesClass.UserName); retVal = this.usnc.RemoveItemAt(index); if (!retVal) { return; } Directory.Delete(userDirPath, true); //SpellingReadWriteClass.ReadUserNameFile(filePath); }
private void OnDeleteUserButton_Click(object sender, EventArgs e) { var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName; var userName = SpellingPropertiesClass.UserName; dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName); if (string.IsNullOrEmpty(dirPath)) { return; } var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName; var filePath = DirectoryFileOperations.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName); if (string.IsNullOrEmpty(filePath)) { return; } var retVal = SpellingReadWriteClass.ReadUserNameFile(filePath); if (!retVal) { return; } retVal = this.usnc.ContainsItem(SpellingPropertiesClass.UserName); if (!retVal) { return; } var //SpellingReadWriteClass.ReadUserNameFile(filePath); }