Beispiel #1
0
 protected static void ParseSubMenu(Script.Section i, CreateMenuEntry parent, Script.BaseScript tObj)
 {
     foreach (Script.TagDataPair t in i.TagDataPairs)
     {
         if (t.Tag == "MENU")
         {
             // do menu parsing here
             string         mToFind = "MENUENTRY " + t.Data;
             Script.Section k       = tObj.FindSection(mToFind);
             if (k != null)
             {
                 CreateMenuEntry cmeMade = new CreateMenuEntry(k);
                 parent.AddSubmenu(cmeMade);
                 Script.Section l = tObj.FindSection("SUBMENU " + t.Data);
                 if (l != null)
                 {
                     ParseSubMenu(l, cmeMade, tObj);
                 }
             }
             else
             {
                 missingMenus.Add(t.Tag + " " + t.Data);
             }
         }
         else if (t.Tag == "ITEM")
         {
             // do item parsing here
             string         iToFind = "ITEM " + t.Data;
             Script.Section j       = tObj.FindSection(iToFind);
             if (j != null)
             {
                 CreateItemEntry cieMade = new CreateItemEntry(j);
                 parent.AddItem(cieMade);
             }
             else
             {
                 missingItems.Add(t.Tag + " " + t.Data);
             }
         }
     }
 }
Beispiel #2
0
 public CreateMenuEntry FindMenu(ushort menuNumber)
 {
     if (menuEntries != null)
     {
         foreach (CreateMenuEntry cme in menuEntries)
         {
             if (cme.MenuID == menuNumber)
             {
                 return(cme);
             }
         }
         foreach (CreateMenuEntry cmeSub in menuEntries)
         {
             CreateMenuEntry tmp = cmeSub.FindMenu(menuNumber);
             if (tmp != null)
             {
                 return(tmp);
             }
         }
     }
     return(null);
 }
Beispiel #3
0
        public static ArrayList CreateStructureFromScript(Script.BaseScript tObj)
        {
            ArrayList retVal = new ArrayList();

            foreach (Script.ScriptSection i in tObj.Sections)
            {
                if (i.SectionName.StartsWith("SUBMENU "))
                {
                    string         toFind = "MENUENTRY " + i.SectionName.Remove(0, 8);
                    Script.Section j      = tObj.FindSection(toFind);
                    if (j == null)
                    {
                        CreateMenuEntry rootMenu = new CreateMenuEntry(i);
                        rootMenu.IsRoot = true;
                        retVal.Add(rootMenu);
                        ParseSubMenu(i, rootMenu, tObj);
                    }
                }
            }

            return(retVal);
        }
Beispiel #4
0
 public void AddSubmenu(CreateMenuEntry nSubMenu)
 {
     nSubMenu.ParentMenu = menuID;
     menuEntries.Add(nSubMenu);
 }