示例#1
0
        public info performSearch(string search)
        {
            info x = new info(search, search);

            try
            {
                if (sorted && movieList.Count > 5) //If the list is sorted perform binary search
                {
                    info s = movieList[movieList.BinarySearch(x)];
                    if (s != null)
                    {
                        return(s);
                    }
                }
                else //Else this, only searches for exact matches
                {
                    info s = movieList.Find(
                        delegate(info sm)
                    {
                        return(sm.getTitle().ToLower() == x.getTitle().ToLower());
                    }
                        );

                    if (s != null)
                    {
                        return(s);
                    }
                }
            }
            catch (ArgumentOutOfRangeException a)
            {
                this.GE.GlobalTryCatch(a, search);
            }
            return(null);
        }
示例#2
0
 public void clearAll()
 {
     view = null;
     Data = null;
     titleL.Text = String.Empty;
     fileL.Text = String.Empty;
     genreL.Text = String.Empty;
     ratingL.Text = String.Empty;
     yearL.Text = String.Empty;
     imageL.Text = String.Empty;
     description.Text = String.Empty;
 }
示例#3
0
 public void clearAll()
 {
     view             = null;
     Data             = null;
     titleL.Text      = String.Empty;
     fileL.Text       = String.Empty;
     genreL.Text      = String.Empty;
     ratingL.Text     = String.Empty;
     yearL.Text       = String.Empty;
     imageL.Text      = String.Empty;
     description.Text = String.Empty;
 }
示例#4
0
        //Deletes an entry from list and dictionary, writes modified data to file
        public bool removeEntry(int i, info s, out string result)
        {
            try
            {
                if (movieList[i] != null)
                {
                    if (movieList[i] == s)
                    {
                        movieData.Remove(movieList[i].File);
                        movieList.RemoveAt(i);

                        writeList();
                        result = "Entry Removed";
                        return(true);
                    }
                    else
                    {
                        result = "Entry was not a match to index given";
                        return(false);
                    }
                }
                else
                {
                    result = "Entry Not Found";
                    return(false);
                }
            }
            catch (ArgumentOutOfRangeException a)
            {
                result = "Out Of Bounds Exception";
                this.GE.GlobalTryCatch(a, s);
                return(false);
            }
            catch (Exception e)
            {
                this.GE.GlobalTryCatch(e, s);
                result = "An error occured";
                return(false);
            }
        }
示例#5
0
        public void editItem(info editMovie)
        {
            this.index = DataManager.getIndexOf(editMovie);
            this.selected = DataManager.getMovie(index);
            titleT.Text = editMovie.getTitle();
            fileLocationT.Text = editMovie.File;
            genreCB.SelectedIndex = (int)editMovie.Genre;
            ratingCB.SelectedIndex = (int)editMovie.Rating;
            movieData = DataManager.getdata(editMovie.File);
            yearT.Text = movieData.Year.ToString();
            imageT.Text = movieData.Image;
            actors = movieData.getActors();
            actorListBox.DataSource = actors;
            descriptionT.Text = movieData.Description.Replace("\n", "\r\n");
            if (movieData.Image != "")
            {
                    try
                    {
                        Image image = Image.FromFile(@movieData.Image);
                        Rectangle newRect = ImageHandling.GetScaledRectangle(image, imageP.ClientRectangle);
                        imageP.MaximumSize = imageP.Size;

                        imageP.Image = ImageHandling.GetResizedImage(image, newRect);

                    }
                    catch (ArgumentException ae)
                    {
                        DataManager.GE.GlobalTryCatch(ae, movieData.Image);
                    }
                    catch (FileNotFoundException fnfe)
                    {
                        DataManager.GE.GlobalTryCatch(fnfe, movieData.Image);
                    }
                }
                else
                {

                }
        }
示例#6
0
        public void viewItem(info view)
        {
            this.view = view;
            titleL.Text = view.getTitle();
            fileL.Text = view.File;
            genreL.Text = view.Genre.ToString();
            ratingL.Text = view.Rating.ToString();

            if ((this.Data = dm.getdata(view.File)) != null)
            {
                yearL.Text = Data.Year.ToString();
                imageL.Text = Data.Image;
                description.Text = Data.Description;
                actor = null;
                actor = Data.getActors();
                actors.DataSource = null;
                actors.DataSource = actor;
                secondsIn.Text = String.Format("{0}{1}", "Time: ", Data.SecondsIn * 1000);
                string imageFile = Data.Image;
                if (imageFile == "")
                {
                    imageFile = @"noImage.png";

                }

                DoImage(imageFile, false);

            }
            else
            {
                yearL.Text = "No Year";
                imageL.Text = "No Image";
                description.Text = "No Description";
                actor.Clear();
                actor.Add("No Actors");
                actors.DataSource = null;
                actors.DataSource = actor;
            }
        }
示例#7
0
        public void editItem(info editMovie)
        {
            this.index             = DataManager.getIndexOf(editMovie);
            this.selected          = DataManager.getMovie(index);
            titleT.Text            = editMovie.getTitle();
            fileLocationT.Text     = editMovie.File;
            genreCB.SelectedIndex  = (int)editMovie.Genre;
            ratingCB.SelectedIndex = (int)editMovie.Rating;
            movieData               = DataManager.getdata(editMovie.File);
            yearT.Text              = movieData.Year.ToString();
            imageT.Text             = movieData.Image;
            actors                  = movieData.getActors();
            actorListBox.DataSource = actors;
            descriptionT.Text       = movieData.Description.Replace("\n", "\r\n");
            if (movieData.Image != "")
            {
                try
                {
                    Image     image   = Image.FromFile(@movieData.Image);
                    Rectangle newRect = ImageHandling.GetScaledRectangle(image, imageP.ClientRectangle);
                    imageP.MaximumSize = imageP.Size;


                    imageP.Image = ImageHandling.GetResizedImage(image, newRect);
                }
                catch (ArgumentException ae)
                {
                    DataManager.GE.GlobalTryCatch(ae, movieData.Image);
                }
                catch (FileNotFoundException fnfe)
                {
                    DataManager.GE.GlobalTryCatch(fnfe, movieData.Image);
                }
            }
            else
            {
            }
        }
示例#8
0
        public void viewItem(info view)
        {
            this.view    = view;
            titleL.Text  = view.getTitle();
            fileL.Text   = view.File;
            genreL.Text  = view.Genre.ToString();
            ratingL.Text = view.Rating.ToString();

            if ((this.Data = dm.getdata(view.File)) != null)
            {
                yearL.Text        = Data.Year.ToString();
                imageL.Text       = Data.Image;
                description.Text  = Data.Description;
                actor             = null;
                actor             = Data.getActors();
                actors.DataSource = null;
                actors.DataSource = actor;
                secondsIn.Text    = String.Format("{0}{1}", "Time: ", Data.SecondsIn * 1000);
                string imageFile = Data.Image;
                if (imageFile == "")
                {
                    imageFile = @"noImage.png";
                }

                DoImage(imageFile, false);
            }
            else
            {
                yearL.Text       = "No Year";
                imageL.Text      = "No Image";
                description.Text = "No Description";
                actor.Clear();
                actor.Add("No Actors");
                actors.DataSource = null;
                actors.DataSource = actor;
            }
        }
示例#9
0
        private void doSearch(object sender, MouseEventArgs e)
        {
            searchParam = searchT.Text.Trim();
            treeList = new List<TreeNode>();
            resultList.Clear();
            resultKey.Clear();
            resultTree.Nodes.Clear();
            bool exact = false;
            string extraParams = "No additional parameters";
            if (searchParam != "")
            {
                DateTime start = DateTime.Now;
                if (searchCB.CheckedItems.Count > 0 && searchCB.CheckedIndices.Contains(0)) //Actor only search ignores all other search parameters
                {

                    extraParams = "Returing only results matching from Actor's Field";
                    DateTime startActor = DateTime.Now;
                    DataManager.performActorOnlySearch(searchParam, searchCB.CheckedIndices.Contains(1), ref resultList); //Determinds if each word is searched, or if exact matches are
                    DateTime endActor = DateTime.Now;
                    if ((endActor - startActor).TotalMilliseconds > 1000)
                    {
                        resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Search Completed: ", decimal.Round((decimal)(endActor - startActor).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                    }
                    else
                    {
                        resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Search Completed: ", decimal.Round((decimal)(endActor - startActor).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                    }
                    if (resultList.Count == 0)
                    {
                        searchCB.SetItemChecked(0, false);
                        searchCB.SetItemChecked(1, false);
                        searchCB.SetItemChecked(2, false);
                        searchCB.SetItemChecked(3, false);
                        searchButton_Click(sender, e);
                        extraParams = "No results found, performing default search";
                        resultString = String.Format("{0}{1}{2}\r\n{3}\r\n{4}\r\n", ">>> ", searchParam, " <<<", extraParams, resultString);
                        resultInfoT.SelectionStart = 0;
                        resultInfoT.SelectionLength = 0;
                        resultInfoT.SelectedText = resultString;
                        return;
                    }
                }
                else
                {
                    DateTime startSearch = DateTime.Now;
                    exactMovie = DataManager.performSearch(searchParam);
                    DateTime endSearch = DateTime.Now;
                    if ((endSearch - startSearch).TotalMilliseconds > 1000)
                    {
                        resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Search Completed: ", decimal.Round((decimal)(endSearch - startSearch).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                    }
                    else
                    {
                        resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Search Completed: ", decimal.Round((decimal)(endSearch - startSearch).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                    }

                    DateTime startRegex = DateTime.Now;
                    if (exactMovie != null)
                    {
                        exactMatch = new TreeNode(exactMovie.getTitle());
                        TreeNode[] array = new TreeNode[] { exactMatch };
                        TreeNode treeNode = new TreeNode("Exact Match", array);
                        treeNode.Expand();
                        resultTree.Nodes.Add(treeNode);
                        exact = true;
                        exactMatch.Tag = exactMovie;
                    }

                    DataManager.performRegexSearch(searchParam, ref resultList);
                    DateTime endRegex = DateTime.Now;
                    if ((endRegex - startRegex).TotalMilliseconds > 1000)
                    {
                        resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Regex Search Completed: ", decimal.Round((decimal)(endRegex - startRegex).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                    }
                    else
                    {
                        resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Regex Search Completed: ", decimal.Round((decimal)(endRegex - startRegex).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                    }

                    if (searchCB.CheckedItems.Count > 0 && searchCB.CheckedIndices.Contains(2) && !searchCB.CheckedIndices.Contains(3)) //Detailed but not advanced
                    {
                        DateTime startDetailed = DateTime.Now;
                        DataManager.performDetailedSearch(searchParam, ref resultList);
                        DateTime endDetailed = DateTime.Now;
                        if ((endDetailed - startDetailed).TotalMilliseconds > 1000)
                        {
                            resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Detailed Search Completed: ", decimal.Round((decimal)(endDetailed - startDetailed).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                        }
                        else
                        {
                            resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Detailed Search Completed: ", decimal.Round((decimal)(endDetailed - startDetailed).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                        }
                        extraParams = "Detailed but not Advanced";
                    }
                    else if (searchCB.CheckedItems.Count > 0 && searchCB.CheckedIndices.Contains(3) && !searchCB.CheckedIndices.Contains(2)) //Advanced but not detailed
                    {
                        DateTime startAdvanced = DateTime.Now;
                        DataManager.performAdvancedSearch(searchParam, ref resultList);
                        DateTime endAdvanced = DateTime.Now;
                        if ((endAdvanced - startAdvanced).TotalMilliseconds > 1000)
                        {
                            resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Advanced Search Completed: ", decimal.Round((decimal)(endAdvanced - startAdvanced).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                        }
                        else
                        {
                            resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Advanced Search Completed: ", decimal.Round((decimal)(endAdvanced - startAdvanced).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                        }
                        extraParams = "Advanced but not detailed";
                    }
                    else if (searchCB.CheckedItems.Count > 0 && searchCB.CheckedIndices.Contains(2) && searchCB.CheckedIndices.Contains(3)) //Detailed and Advanced
                    {
                        DateTime startAdvancedDetailed = DateTime.Now;
                        DataManager.performDetailedAdvancedSearch(searchParam, ref resultList);
                        DateTime endAdvancedDetailed = DateTime.Now;
                        if ((endAdvancedDetailed - startAdvancedDetailed).TotalMilliseconds > 1000)
                        {
                            resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Advanced Detailed Search Completed: ", decimal.Round((decimal)(endAdvancedDetailed - startAdvancedDetailed).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                        }
                        else
                        {
                            resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Advanced Detailed Search Completed: ", decimal.Round((decimal)(endAdvancedDetailed - startAdvancedDetailed).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                        }
                        extraParams = "Detailed and Advanced";
                    }
                }
                DataManager.quickSort(ref resultList);
                DataManager.cullSorted(ref resultList);
                DateTime buildList = DateTime.Now;
                resultList.Remove(exactMovie);
                if (resultList.Count > 0)
                {
                    TreeNode[] anotherArray;
                    int i = 0;
                    int k = 0;
                    anotherArray = new TreeNode[resultList.Count];

                    for (; i < resultList.Count; i++)
                    {
                        anotherArray[k] = new TreeNode(resultList[i].getTitle());
                        anotherArray[k].Tag = resultList[i];
                        k++;
                        resultKey.Add(i);
                    }

                    TreeNode node = new TreeNode("Partial Match", anotherArray);
                    if (!exact)
                    {
                        node.Expand();
                    }
                    resultTree.Nodes.Add(node);
                }
                DateTime builtList = DateTime.Now;
                if ((builtList - buildList).TotalMilliseconds > 1000)
                {
                    resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "List Built: ", decimal.Round((decimal)(builtList - buildList).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                }
                else
                {
                    resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "List Built: ", decimal.Round((decimal)(builtList - buildList).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                }

                if (resultList.Count == 0 && !exact)
                {
                    resultTree.Nodes.Add(new TreeNode("No Results"));
                }
                DateTime end = DateTime.Now;
                int f = 0;
                if (exactMatch != null)
                {
                    f = 1;
                    exactMatch = null;
                }
                if ((end - start).TotalMilliseconds < 1000)
                {
                    resultString = String.Format("{0}\r\n{1}{2}{3}\r\n\r\n{4}{5}\r\n", resultString, "Entire Operation: ", decimal.Round((decimal)(end - start).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds", resultList.Count + f, " results returned");
                }
                else
                {
                    resultString = String.Format("{0}\r\n{1}{2}{3}\r\n\r\n{4}{5}\r\n", resultString, "Entire Operation: ", decimal.Round((decimal)(end - start).TotalSeconds, 0, MidpointRounding.AwayFromZero), " seconds", resultList.Count + f, " results returned");
                }

                resultString = String.Format("{0}{1}{2}\r\n{3}\r\n{4}\r\n", ">>> ", searchParam, " <<<", extraParams, resultString);
                resultInfoT.SelectionStart = 0;
                resultInfoT.SelectionLength = 0;
                resultInfoT.SelectedText = resultString;
                resultString = "";
            }
            else
            {
                resultInfoT.SelectionStart = 0;
                resultInfoT.SelectionLength = 0;
                resultInfoT.SelectedText = "Not a valid search\r\n";
            }

            exactMovie = null;
            performSearch = false;
        }
示例#10
0
        private void doSearch(object sender, MouseEventArgs e)
        {
            searchParam = searchT.Text.Trim();
            treeList    = new List <TreeNode>();
            resultList.Clear();
            resultKey.Clear();
            resultTree.Nodes.Clear();
            bool   exact       = false;
            string extraParams = "No additional parameters";

            if (searchParam != "")
            {
                DateTime start = DateTime.Now;
                if (searchCB.CheckedItems.Count > 0 && searchCB.CheckedIndices.Contains(0)) //Actor only search ignores all other search parameters
                {
                    extraParams = "Returing only results matching from Actor's Field";
                    DateTime startActor = DateTime.Now;
                    DataManager.performActorOnlySearch(searchParam, searchCB.CheckedIndices.Contains(1), ref resultList); //Determinds if each word is searched, or if exact matches are
                    DateTime endActor = DateTime.Now;
                    if ((endActor - startActor).TotalMilliseconds > 1000)
                    {
                        resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Search Completed: ", decimal.Round((decimal)(endActor - startActor).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                    }
                    else
                    {
                        resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Search Completed: ", decimal.Round((decimal)(endActor - startActor).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                    }
                    if (resultList.Count == 0)
                    {
                        searchCB.SetItemChecked(0, false);
                        searchCB.SetItemChecked(1, false);
                        searchCB.SetItemChecked(2, false);
                        searchCB.SetItemChecked(3, false);
                        searchButton_Click(sender, e);
                        extraParams  = "No results found, performing default search";
                        resultString = String.Format("{0}{1}{2}\r\n{3}\r\n{4}\r\n", ">>> ", searchParam, " <<<", extraParams, resultString);
                        resultInfoT.SelectionStart  = 0;
                        resultInfoT.SelectionLength = 0;
                        resultInfoT.SelectedText    = resultString;
                        return;
                    }
                }
                else
                {
                    DateTime startSearch = DateTime.Now;
                    exactMovie = DataManager.performSearch(searchParam);
                    DateTime endSearch = DateTime.Now;
                    if ((endSearch - startSearch).TotalMilliseconds > 1000)
                    {
                        resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Search Completed: ", decimal.Round((decimal)(endSearch - startSearch).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                    }
                    else
                    {
                        resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Search Completed: ", decimal.Round((decimal)(endSearch - startSearch).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                    }

                    DateTime startRegex = DateTime.Now;
                    if (exactMovie != null)
                    {
                        exactMatch = new TreeNode(exactMovie.getTitle());
                        TreeNode[] array    = new TreeNode[] { exactMatch };
                        TreeNode   treeNode = new TreeNode("Exact Match", array);
                        treeNode.Expand();
                        resultTree.Nodes.Add(treeNode);
                        exact          = true;
                        exactMatch.Tag = exactMovie;
                    }

                    DataManager.performRegexSearch(searchParam, ref resultList);
                    DateTime endRegex = DateTime.Now;
                    if ((endRegex - startRegex).TotalMilliseconds > 1000)
                    {
                        resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Regex Search Completed: ", decimal.Round((decimal)(endRegex - startRegex).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                    }
                    else
                    {
                        resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Regex Search Completed: ", decimal.Round((decimal)(endRegex - startRegex).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                    }



                    if (searchCB.CheckedItems.Count > 0 && searchCB.CheckedIndices.Contains(2) && !searchCB.CheckedIndices.Contains(3)) //Detailed but not advanced
                    {
                        DateTime startDetailed = DateTime.Now;
                        DataManager.performDetailedSearch(searchParam, ref resultList);
                        DateTime endDetailed = DateTime.Now;
                        if ((endDetailed - startDetailed).TotalMilliseconds > 1000)
                        {
                            resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Detailed Search Completed: ", decimal.Round((decimal)(endDetailed - startDetailed).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                        }
                        else
                        {
                            resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Detailed Search Completed: ", decimal.Round((decimal)(endDetailed - startDetailed).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                        }
                        extraParams = "Detailed but not Advanced";
                    }
                    else if (searchCB.CheckedItems.Count > 0 && searchCB.CheckedIndices.Contains(3) && !searchCB.CheckedIndices.Contains(2)) //Advanced but not detailed
                    {
                        DateTime startAdvanced = DateTime.Now;
                        DataManager.performAdvancedSearch(searchParam, ref resultList);
                        DateTime endAdvanced = DateTime.Now;
                        if ((endAdvanced - startAdvanced).TotalMilliseconds > 1000)
                        {
                            resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Advanced Search Completed: ", decimal.Round((decimal)(endAdvanced - startAdvanced).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                        }
                        else
                        {
                            resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Advanced Search Completed: ", decimal.Round((decimal)(endAdvanced - startAdvanced).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                        }
                        extraParams = "Advanced but not detailed";
                    }
                    else if (searchCB.CheckedItems.Count > 0 && searchCB.CheckedIndices.Contains(2) && searchCB.CheckedIndices.Contains(3)) //Detailed and Advanced
                    {
                        DateTime startAdvancedDetailed = DateTime.Now;
                        DataManager.performDetailedAdvancedSearch(searchParam, ref resultList);
                        DateTime endAdvancedDetailed = DateTime.Now;
                        if ((endAdvancedDetailed - startAdvancedDetailed).TotalMilliseconds > 1000)
                        {
                            resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "Advanced Detailed Search Completed: ", decimal.Round((decimal)(endAdvancedDetailed - startAdvancedDetailed).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                        }
                        else
                        {
                            resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "Advanced Detailed Search Completed: ", decimal.Round((decimal)(endAdvancedDetailed - startAdvancedDetailed).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                        }
                        extraParams = "Detailed and Advanced";
                    }
                }
                DataManager.quickSort(ref resultList);
                DataManager.cullSorted(ref resultList);
                DateTime buildList = DateTime.Now;
                resultList.Remove(exactMovie);
                if (resultList.Count > 0)
                {
                    TreeNode[] anotherArray;
                    int        i = 0;
                    int        k = 0;
                    anotherArray = new TreeNode[resultList.Count];

                    for (; i < resultList.Count; i++)
                    {
                        anotherArray[k]     = new TreeNode(resultList[i].getTitle());
                        anotherArray[k].Tag = resultList[i];
                        k++;
                        resultKey.Add(i);
                    }

                    TreeNode node = new TreeNode("Partial Match", anotherArray);
                    if (!exact)
                    {
                        node.Expand();
                    }
                    resultTree.Nodes.Add(node);
                }
                DateTime builtList = DateTime.Now;
                if ((builtList - buildList).TotalMilliseconds > 1000)
                {
                    resultString = String.Format("{0}\r\n{1}{2}{3}", resultString, "List Built: ", decimal.Round((decimal)(builtList - buildList).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds");
                }
                else
                {
                    resultString = String.Format("{0}\r\n{1}0.{2}{3}", resultString, "List Built: ", decimal.Round((decimal)(builtList - buildList).TotalMilliseconds, 0, MidpointRounding.AwayFromZero), " seconds");
                }

                if (resultList.Count == 0 && !exact)
                {
                    resultTree.Nodes.Add(new TreeNode("No Results"));
                }
                DateTime end = DateTime.Now;
                int      f   = 0;
                if (exactMatch != null)
                {
                    f          = 1;
                    exactMatch = null;
                }
                if ((end - start).TotalMilliseconds < 1000)
                {
                    resultString = String.Format("{0}\r\n{1}{2}{3}\r\n\r\n{4}{5}\r\n", resultString, "Entire Operation: ", decimal.Round((decimal)(end - start).TotalSeconds, 2, MidpointRounding.AwayFromZero), " seconds", resultList.Count + f, " results returned");
                }
                else
                {
                    resultString = String.Format("{0}\r\n{1}{2}{3}\r\n\r\n{4}{5}\r\n", resultString, "Entire Operation: ", decimal.Round((decimal)(end - start).TotalSeconds, 0, MidpointRounding.AwayFromZero), " seconds", resultList.Count + f, " results returned");
                }

                resultString = String.Format("{0}{1}{2}\r\n{3}\r\n{4}\r\n", ">>> ", searchParam, " <<<", extraParams, resultString);
                resultInfoT.SelectionStart  = 0;
                resultInfoT.SelectionLength = 0;
                resultInfoT.SelectedText    = resultString;
                resultString = "";
            }
            else
            {
                resultInfoT.SelectionStart  = 0;
                resultInfoT.SelectionLength = 0;
                resultInfoT.SelectedText    = "Not a valid search\r\n";
            }

            exactMovie    = null;
            performSearch = false;
        }
示例#11
0
 public int getIndexOf(info x)
 {
     return(movieList.IndexOf(x));
 }