Ejemplo n.º 1
0
        internal static void Build(Menu menu, JObject translations, bool createSaveHandler)
        {
            if (Roots.Exists(root => root.Id == menu.Id))
            {
                throw new InvalidOperationException($"Menu with id \"{menu.Id}\" already exists as root!");
            }

            Roots.Add(menu);

            if (translations != null)
            {
                menu.translations.Add(translations);
            }
            else
            {
                menu.UpdateSizes();
            }

            if (createSaveHandler)
            {
                menu.CreateSaveHandler(Folder.Menu);
            }
            else
            {
                menu.SetToken(null);
            }

            menu.UpdateTranslations();
        }