public void SearchCat(NavigatorCategory currentCat)
 {
     foreach (ALFA.Shared.IListBoxItem item in currentCat.ContainedItems)
     {
         string[] rowDataEntries = item.TextFields.ToLower().Split(';');
         foreach (string rowData in rowDataEntries)
         {
             string[] rowBit = rowData.Split('=');
             if (rowBit.Length > 1)
             {
                 if (rowBit[1].Contains(currentUser.LastSearchString.ToLower()) &&
                     !responseObject.ContainedItems.Contains(item))
                 {
                     responseObject.ContainedItems.Add(item);
                 }
             }
         }
         if (this.CancellationPending)
         {
             return;
         }
     }
     foreach (NavigatorCategory childCat in currentCat.ContainedCategories)
     {
         SearchCat(childCat);
     }
 }
 public static void DrawNavigatorCategory(CLRScriptBase script, NavigatorCategory nav)
 {
     if (nav != null)
     {
         script.ClearListBox(script.OBJECT_SELF, "SCREEN_DMC_CREATOR", "LISTBOX_ACR_CREATOR");
         if (nav.ParentCategory != null)
         {
             string textFields = "LISTBOX_ITEM_TEXT=  ..";
             string variables  = "5=Category:..";
             script.AddListBoxRow(script.OBJECT_SELF, "SCREEN_DMC_CREATOR", "LISTBOX_ACR_CREATOR", "Category:..", textFields, "LISTBOX_ITEM_ICON=folder.tga", variables, "unhide");
         }
         foreach (NavigatorCategory navCat in nav.ContainedCategories)
         {
             string textFields = String.Format("LISTBOX_ITEM_TEXT=  {0}", navCat.DisplayName);
             string variables  = String.Format("5={0}", "Category:" + navCat.Name);
             script.AddListBoxRow(script.OBJECT_SELF, "SCREEN_DMC_CREATOR", "LISTBOX_ACR_CREATOR", "Category:" + navCat.Name, textFields, "LISTBOX_ITEM_ICON=folder.tga", variables, "unhide");
         }
         foreach (IListBoxItem navItem in nav.ContainedItems)
         {
             script.AddListBoxRow(script.OBJECT_SELF, "SCREEN_DMC_CREATOR", "LISTBOX_ACR_CREATOR", navItem.RowName, navItem.TextFields, navItem.Icon, navItem.Variables, "unhide");
         }
     }
     else
     {
         script.SendMessageToPC(script.OBJECT_SELF, "Error: Navigator category is null. Cannot draw a list.");
     }
 }
 public void SearchCreator(object Sender, EventArgs e)
 {
     responseObject = new NavigatorCategory();
     responseObject.ParentCategory = baseCat;
     SearchCat(baseCat);
     if (this.CancellationPending)
     {
         return;
     }
     currentUser.CreatorSearchResponse = responseObject;
 }
 public static void DefaultSortNavigators(NavigatorCategory cat)
 {
     try
     {
         foreach (NavigatorCategory containedCat in cat.ContainedCategories)
         {
             DefaultSortNavigators(containedCat);
         }
         cat.ContainedCategories.Sort();
         cat.ContainedItems.Sort();
     }
     catch (Exception ex)
     {
         loaderError += "\nSorting Error: " + ex.Message;
     }
 }
        public static NavigatorCategory GetCategoryByName(NavigatorCategory ContainingCat, string SeekingName)
        {
            foreach (NavigatorCategory containedCat in ContainingCat.ContainedCategories)
            {
                if (containedCat.Name == SeekingName)
                {
                    return(containedCat);
                }
            }
            NavigatorCategory newCat = new NavigatorCategory();

            newCat.Name           = SeekingName;
            newCat.ParentCategory = ContainingCat;
            newCat.DisplayName    = ALFA.Shared.DisplayString.ShortenStringToWidth(newCat.Name, 214);
            ContainingCat.ContainedCategories.Add(newCat);
            return(newCat);
        }
        public static void LoadNavigator(List <ALFA.Shared.IListBoxItem> list, Navigator bottomNavigator)
        {
            try
            {
                foreach (ALFA.Shared.IListBoxItem boxItem in list)
                {
                    try
                    {
                        NavigatorCategory cat = null;
                        // first, find out if there even is a classification for this.
                        if (String.IsNullOrWhiteSpace(boxItem.Classification))
                        {
                            cat = bottomNavigator.bottomCategory;
                        }
                        // next, we want to find out if we're in one classification or in many.
                        else if (boxItem.Classification.Contains('|'))
                        {
                            string[]          cats    = boxItem.Classification.Split('|');
                            NavigatorCategory tempCat = bottomNavigator.bottomCategory;

                            foreach (string category in cats)
                            {
                                tempCat = GetCategoryByName(tempCat, category);
                            }
                            cat = tempCat;
                        }
                        // Looks like it's only one classification deep. Don't need to do anything fancy.
                        else
                        {
                            cat = GetCategoryByName(bottomNavigator.bottomCategory, boxItem.Classification);
                        }

                        cat.ContainedItems.Add(boxItem);
                    }
                    catch (Exception ex)
                    {
                        loaderError += "\n Placeable Loading Error: " + ex.Message;
                    }
                }
            }
            finally
            {
                bottomNavigator.SetResourcesLoaded();
            }
        }