예제 #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);
             }
         }
     }
 }
예제 #2
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);
        }