private void PopulateChangePropertiesSubMenu(MOG_Ini specialMenuIni, string menu, MenuItem menuRoot, MogMenuItem_Click method) { // Loop through all the keys of this section and recursivly add all of them to the menu for (int x = 0; x < specialMenuIni.CountProperty(menu, "MenuItem"); x++) { string option = specialMenuIni.GetKeyPropertyNameByIndex(menu, "MenuItem", x); // Check if this menu item is an actual item or a pointer to another menu. // Do this by checking for a matching section? if (specialMenuIni.SectionExist(option)) { // Create the subMenu MenuItem subMenu = new MenuItem(); subMenu.Text = option.ToLower().Replace("menu", ""); PopulateChangePropertiesSubMenu(specialMenuIni, option, subMenu, method); menuRoot.MenuItems.Add(subMenu); } else { // Add menu item menuRoot.MenuItems.Add(AddChangePropertiesToolsMenu(specialMenuIni, option, method)); } } }