Пример #1
0
        /// <summary>
        /// this method splits given input by separating wherever there's a "*"
        /// </summary>
        public void SplitSearch(string srch)
        {
            InputSearchArray = new string?[6];

            InputSearchArray = srch.Split("*");

            // send the search to the fileSearcher to check for values
            SearchedItem = new SearchedItem(InputSearchArray);

            // send search to the searched item to begin parsing
            SearchedItem.SendSearch();
        }
Пример #2
0
        /// <summary>
        /// constructor that takes the filename to determine which file
        /// to access
        /// </summary>
        /// <param name="fileName1">name of file containing basic info</param>
        /// <param name="fileName1">name of file containing rating info</param>
        /// <param name="searchedItem">user's searched title</param>
        public FileSearcher(string fileName1, string fileName2, string url,
                            SearchedItem searchedItem)
        {
            // set the instances
            SearchedItem = searchedItem;
            FileName1    = fileName1;
            FileName2    = fileName2;

            // sets the title file full path
            TitleFile =
                Path.Combine(Environment.GetFolderPath
                                 (Environment.SpecialFolder.LocalApplicationData)
                             , folder, FileName1);

            // sets the ratings file full path
            RatingFile =
                Path.Combine(Environment.GetFolderPath
                                 (Environment.SpecialFolder.LocalApplicationData)
                             , folder, FileName2);
        }
Пример #3
0
 /// <summary>
 /// this constructor receives a list of titles found in the file as
 /// well as the number and a searched title and sets the searched title
 /// values
 /// </summary>
 /// <param name="titlesInFile">titles found on file</param>
 /// <param name="numberOfTitlesFound">count of titles
 /// </param>
 /// <param name="searchedItem">title params searched by user</param>
 public TitleCollections(List <Title> titlesInFile,
                         SearchedItem searchedItem)
 {
     // sets given values if not null, otherwise turn to "N/A"
     SearchedItem = searchedItem;
     TitlesInFile = titlesInFile ?? null;
     SearchedType = (searchedItem.Type != null)
         ? searchedItem.Type : "N/A";
     SearchedWord = (searchedItem.Title != null)
         ? searchedItem.Title : "N/A";
     SearchedStartYear = (searchedItem.StartYear != null)
         ? searchedItem.StartYear : "N/A";
     SearchedIfAdult = (searchedItem.IsAdult != null)
         ? searchedItem.IsAdult : "N/A";
     SearchedEndYear = (searchedItem.EndYear != null)
         ? searchedItem.EndYear : "N/A";
     SearchedGenres = (searchedItem.Genres != null)
         ? SearchedItem.Genres : null;
     SearchedRating = (searchedItem.Rating != null)
         ? SearchedItem.Rating : null;
 }