/// ********************************************************************************
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static void AddNewUserToUserNameFile()
        {
            MyMessagesClass.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var unc = new UsersNameCollection();

            if (unc.ContainsItem(SpellingPropertiesClass.UserName))
            {
                MyMessagesClass.InformationMessage = Resources.Art2MSpellMainForm_AddNewUserToUserNameFile_This_user_all_ready_exists_;
                MyMessagesClass.ShowInformationMessageBox();
            }

            unc.AddItem(SpellingPropertiesClass.UserName);

            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName;

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            SpellingReadWriteClass.WriteUserNameFile(filePath);
        }
        /// ********************************************************************************
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static void AddNewUserToUserNameFile()
        {
            NameOfMethod = MethodBase.GetCurrentMethod().Name;

            if (UsersNameCollection.ContainsItem(SpellingPropertiesClass.UserName))
            {
                InformationMessage = V2;
                ShowInformationMessageBox();
            }

            UsersNameCollection.AddItem(SpellingPropertiesClass.UserName);

            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName;

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(
                dirPath,
                fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            SpellingReadWriteClass.WriteUserNameFile(filePath);
        }
        private void GetUnformattedDataFrom()
        {
            // TODO: Check to see if any unformatted data for the selected author
            // TODO: Only show unformatted data for author selected.
            // TODO; Instead of list box use next previous first last.

            var dirPath = BookListPropertiesClass.PathToAuthorsDirectory;

            if (!AuthorsFileNamesCollection.ContainsItem(BookListPropertiesClass.AuthorsNameCurrent))
            {
                return;
            }

            var index = AuthorsFileNamesCollection.GetItemIndex(BookListPropertiesClass.AuthorsNameCurrent);

            var fileName = AuthorsFileNamesCollection.GetItemAt(index);

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirPath, fileName);

            this.GetAuthorsName(fileName);

            if (!DataStorageOperationsClass.AddToBackUpList(filePath))
            {
                return;
            }
        }
        /// <summary>
        ///     Display all of the users spelling list in the list box.
        /// </summary>
        /// <created>art2m,5/22/2019</created>
        /// <changed>art2m,5/22/2019</changed>
        private void DisplayUsersSpellingList()
        {
            MyMessagesClass.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var fileName = SpellingPropertiesClass.SpellingListPathsFileName;

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            var retVal = SpellingReadWriteClass.ReadUsersSpellingListPathsFile(filePath);

            if (!retVal)
            {
                return;
            }

            this.FillListBoxWithPathsToUsersSpellingListFiles();
        }
Exemple #5
0
        public void CreateUserSpellingListDirectory_TestArgumentPathToLongException()
        {
            // Assign
            const string DirPath = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                                   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

            SpellingPropertiesClass.UserName = "******";

            // Act
            var retVal = DirectoryFileOperationsClass.CreateUserSpellingListDirectory(DirPath);

            // Assert
            Assert.IsFalse(retVal);
        }
        /// ********************************************************************************
        /// <summary>
        /// Read users names list from file.
        /// </summary>
        /// <created>art2m,5/20/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private void ReadUserFileFillListBox()
        {
            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName;

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            if (!SpellingReadWriteClass.ReadUsersSpellingListPathsFile(filePath))
            {
                return;
            }

            this.FillListBoxWithUserNames();
        }
Exemple #7
0
        /// <summary>
        /// The OnSaveRecordButton_Clicked
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>The source of the event.</param>
        /// <param name="e">The e<see cref="EventArgs"/>Instance containing the event data.</param>
        private void OnSaveRecordButton_Clicked(object sender, EventArgs e)
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var authorOp = new AuthorsTextOperations();
            var fileName = string.Empty;

            if (this.rbtnOneAuthor.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text);
            }
            else if (this.rbtnTwoAuthors.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text, this.txtSecondAuthor.Text);
            }
            else if (this.rbtnThreeAuthors.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text, this.txtSecondAuthor.Text, this
                                                   .txtThirdAuthor.Text);
            }

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            if (!Directory.Exists(dirAuthors))
            {
                return;
            }

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors, fileName);

            DirectoryFileOperationsClass.CreateNewFile(filePath);
        }
Exemple #8
0
        /// <summary>
        /// if user enters text save it to user name.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Instance containing the event data.</param>
        private void OnButtonOk_Click(object sender, EventArgs e)
        {
            var name = this.txtUserName.Text.Trim();

            if (string.IsNullOrEmpty(name) || name.Length < 1)
            {
                SpellingPropertiesClass.UserName = string.Empty;
                return;
            }

            SpellingPropertiesClass.UserName = name;

            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName;

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            SpellingReadWriteClass.WriteUserNameFile(filePath);
        }
        private void OnTitleSearchButtonClicked(object sender, EventArgs e)
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors,
                                                                                         BookListPropertiesClass.CurrentWorkingFileName);
        }
        /// <summary>
        /// if user enters text save it to user name.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Instance containing the event data.</param>
        private void OnButtonOk_Click(object sender, EventArgs e)
        {
            var name = this.txtUserName.Text.Trim();

            if (string.IsNullOrEmpty(name) || name.Length < 1)
            {
                SpellingPropertiesClass.UserName = string.Empty;
                return;
            }

            SpellingPropertiesClass.UserName = name;

            if (UsersNameCollection.ContainsItem(name))
            {
                MyMessagesClass.InformationMessage =
                    "This user name all ready exists. Go to select user name to use this name.";

                MyMessagesClass.ShowInformationMessageBox();

                return;
            }

            SpellingReadWriteClass.WriteUserNameFile(SpellingPropertiesClass.UserNameFilePath);

            var dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(
                SpellingPropertiesClass.Art2MSpellDirectoryPath,
                SpellingPropertiesClass.UserName);


            DirectoryFileOperationsClass.CheckDirectoryExistsCreateDirectory(dirPath);
        }
Exemple #11
0
        /// <summary>
        /// The OnSaveRecordButton_Clicked
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>The source of the event.</param>
        /// <param name="e">The e<see cref="EventArgs"/>Instance containing the event data.</param>
        private void OnSaveRecordButton_Clicked(object sender, EventArgs e)
        {
            // TODO: need to put multiple autors to gether before creating author names.
            // TODO: need to check file does not exist then after creating file does exist.

            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var fileName = this.CreateAuthorsFileName();

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            if (!Directory.Exists(dirAuthors))
            {
                return;
            }

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors, fileName);

            if (!File.Exists(filePath))
            {
                File.Create(filePath).Dispose();
            }
        }
        /// ********************************************************************************
        /// <summary>
        ///     Get directory path to Art2MSpell Directory path used in other places.
        /// </summary>
        /// <created>art2m,5/26/2019</created>
        /// <changed>art2m,5/26/2019</changed>
        /// ********************************************************************************
        private void GetPathToArt2MSpellDirectory()
        {
            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(dirPath, dirName);

            SpellingPropertiesClass.Art2MSpellDirectoryPath = dirPath;
        }
        /// ********************************************************************************
        /// <summary>
        ///     Get the path to file containing all users names.
        /// </summary>
        /// <returns></returns>
        /// <created>art2m,5/23/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static string GetAllUserNamesFile(string userDirPath)
        {
            var pathUserListName = SpellingPropertiesClass.SpellingListPathsFileName;

            var filePath =
                DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(userDirPath, pathUserListName);

            return string.IsNullOrEmpty(filePath) ? string.Empty : filePath;
        }
        /// <summary>
        ///     Open spelling list so user can edit the list or delete the list.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/17/2019</changed>
        private void OpenSpellingList()
        {
            MyMessagesClass.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var value = string.Empty;



            DialogResult retVal;

            using (var dlgInput = new SelectSpellingListForm())
            {
                retVal = dlgInput.GetSpellingListPath(value); i
            }

            if (DialogResult.OK == retVal)
            {
                if (string.IsNullOrEmpty(value))
                {
                    MyMessagesClass.WarningMessage = "You need to name this file in order to save it.";
                    MyMessagesClass.ShowWarningMessageBox();
                    return;
                }

                var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(
                    dirPath,
                    value);

                WriteWordsToFile(filePath, words);
            }
            else
            {
                MyMessagesClass.WarningMessage = "You need to name this file in order to save it.";
                MyMessagesClass.ShowWarningMessageBox();
            }

            /*using (var openDlg = new OpenFileDialog())
             * {
             *  openDlg.ShowDialog();
             *
             *  SpellingPropertiesClass.SpellingListPath = openDlg.FileName;
             *  SpellingPropertiesClass.OpenedSpellingList = true;
             *  SpellingPropertiesClass.CreatingNewSpellingList = false;
             *
             *
             *
             *  this.lstWords.Items.Clear();
             *
             *  if (!this.GetWordsFromFile())
             *  {
             *      return;
             *  }
             *
             *  this.SetButtonsEnabledState_OpenSpellingListButtonStateClicked();
             *  this.ChangeControlsBackgroundColors();
             * }*/
        }
        private static void GetRawDataFromFile()
        {
            var dirPath = BookListPropertiesClass.PathToAuthorsDirectory;

            var fileName = AuthorsFileNamesCollection.GetItemAt(0);

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirPath, fileName);

            if (!DataStorageOperationsClass.AddRawDataReadFromFileToRawDataCollection(filePath)) return;
        }
Exemple #16
0
        public void CreateUserSpellingListDirectory_TestInvalidCharactersInPathString()
        {
            // Assign
            const string DirPath = @"c:\Are<Done >";

            // Act
            var retVal = DirectoryFileOperationsClass.CreateUserSpellingListDirectory(DirPath);

            // Assert

            Assert.IsFalse(retVal);
        }
        /// ********************************************************************************
        /// <summary>
        /// File user name property with selected user name.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Instance containing the event data.</param>
        /// <created>art2m,5/20/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private void OnButtonOk_Click(object sender, EventArgs e)
        {
            SpellingPropertiesClass.UserName = this.txtName.Text;

            var dirPath = SpellingPropertiesClass.Art2MSpellDirectoryPath;

            dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(
                dirPath,
                SpellingPropertiesClass.UserName);

            SpellingPropertiesClass.CurrentUserSpellingListDirectory = dirPath;
        }
Exemple #18
0
        private static void GetRawDataFromFile()
        {
            var datStore = new DataStorageOperationsClass();
            var dirpath  = BookListPropertiesClass.PathToAuthorsDirectory;
            var fileName = AuthorsFileNamesCollection.GetItemAt(0);
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirpath, fileName);

            if (!datStore.AddRawDataReadFromFileToRawDataCollection(filePath))
            {
                return;
            }
        }
        /// <summary>
        /// The OnSaveRecordButton_Clicked
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>The source of the event.</param>
        /// <param name="e">The e<see cref="EventArgs"/>Instance containing the event data.</param>
        private void OnSaveRecordButton_Clicked(object sender, EventArgs e)
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var fileName = this.CreateAuthorsFileName();

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors, fileName);
        }
Exemple #20
0
        public void CreateUserSpellingListDirectory_TestArgumentDirectoryNotFoundException()
        {
            // Assign
            var dirPath = string.Empty;

            SpellingPropertiesClass.UserName = string.Empty;

            // Act
            var retVal = DirectoryFileOperationsClass.CreateUserSpellingListDirectory(dirPath);

            // Assert
            Assert.IsFalse(retVal);
        }
Exemple #21
0
        private void SearchBookTitlesAllAuthors()
        {
            AuthorsDirectoryFilesClass.GetAllAuthorFilePathsContainedInAuthorDirectory();

            for (var i = 0; i < AuthorsFileNamesCollection.ItemsCount(); i++)
            {
                var fileName   = AuthorsFileNamesCollection.GetItemAt(i);
                var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();
                var filePath   = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors,
                                                                                               fileName);
                this.txtAuthorName.Text = fileName;
            }
        }
Exemple #22
0
        public void CheckDirectoryExistsCreateDirectory_TestDirectoryExistsOrIsCreated()
        {
            // Assign
            SpellingPropertiesClass.AppDataDirectoryPath =
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            var dirPath1 = SpellingPropertiesClass.AppDataDirectoryPath;

            // Act
            var dirPath = DirectoryFileOperationsClass.CheckDirectoryExistsCreateDirectory(dirPath1);

            // Assert
            Assert.IsTrue(Directory.Exists(dirPath));
        }
        private void GetUnformattedDataFrom()
        {
            var dirPath = BookListPropertiesClass.PathToAuthorsDirectory;

            if (!AuthorsFileNamesCollection.ContainsItem(BookListPropertiesClass.AuthorsNameCurrent)) return;

            var index = AuthorsFileNamesCollection.GetItemIndex(BookListPropertiesClass.AuthorsNameCurrent);

            var fileName = AuthorsFileNamesCollection.GetItemAt(index);

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");
            this.filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirPath, fileName);

            this.GetAuthorsName(fileName);
        }
Exemple #24
0
        public void CreateUserSpellingListDirectory_TestArgumentNullException()
        {
            // Assign
            const string DirPath = null;

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            SpellingPropertiesClass.UserName = "******";

            // Act
            var retVal = DirectoryFileOperationsClass.CreateUserSpellingListDirectory(DirPath);

            // Assert
            Assert.IsFalse(retVal);
        }
        /// ********************************************************************************
        /// <summary>
        ///     Get the path to the users spelling list directory.
        /// </summary>
        /// <returns></returns>
        /// <created>art2m,5/23/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static string GetUsersSpellingListDirectoryPath()
        {
            var pathArt2MSpell = SpellingPropertiesClass.Art2MSpellDirectoryPath;

            if (string.IsNullOrEmpty(pathArt2MSpell))
            {
                return(string.Empty);
            }

            var userName = SpellingPropertiesClass.UserName;

            var userDirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(pathArt2MSpell, userName);

            return(string.IsNullOrEmpty(userDirPath) ? string.Empty : userDirPath);
        }
        /// ********************************************************************************
        /// <summary>
        ///     Read user name file into the collection so it can be used in other places.
        /// </summary>
        /// <created>art2m,5/26/2019</created>
        /// <changed>art2m,5/26/2019</changed>
        /// ********************************************************************************
        private void ReadUserNameFile()
        {
            var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName;

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(SpellingPropertiesClass.Art2MSpellDirectoryPath, fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            SpellingPropertiesClass.UserNameFilePath = filePath;

            SpellingReadWriteClass.ReadUsersSpellingListPathsFile(filePath);
        }
Exemple #27
0
        public void CombineStringsMakeDirectoryPath_TestCombineTwoDirectories()

        {
            // Assign
            SpellingPropertiesClass.AppDataDirectoryPath =
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            // Act
            dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(dirPath, dirName);

            // Assert
            Assert.IsTrue(Directory.Exists(dirPath));
        }
Exemple #28
0
        public void CombineDirectoryPathFileNameCheckCreateFile_TestCheckFileExistsOrCreateFile()
        {
            // Assign
            var dirPath1 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            const string FileName = "Ar2mSpellUserList";

            // Act
            var dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(dirPath1, dirName);

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(dirPath, FileName);

            // Assert
            Assert.IsTrue(File.Exists(filePath));
        }
        private void SearchBookTitlesBySingleAuthor()
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors,
                                                                                         BookListPropertiesClass.CurrentWorkingFileName);

            TitleNamesCollection.ClearCollection();

            FileInputClass.ReadTitlesFromFile(filePath);

            this.FindTitlesInString();

            if (this.lstTiltes.Items.Count < 1)
            {
                this.lstTiltes.Items.Add("No titles with this search criteria were found.");
            }
        }
Exemple #30
0
        public void CreateUserSpellingListDirectory_TestDirectoryExistsOrIsCreated()
        {
            // Assign
            SpellingPropertiesClass.AppDataDirectoryPath =
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            SpellingPropertiesClass.UserName = "******";

            // Act

            var retVal = DirectoryFileOperationsClass.CreateUserSpellingListDirectory(
                SpellingPropertiesClass.AppDataDirectoryPath);

            // Assert
            Assert.IsTrue(retVal);
        }