示例#1
0
 internal void ReloadButton()
 {
     if (gadgetIndex >= 0)
     {
         GadgetCoreAPI.DisplayYesNoDialog("Are you sure you want to perform a Gadget reload?\nThe following Gadgets will be reloaded:\n\n" + modEntries[modIndex].Gadgets[gadgetIndex].Dependents.Union(Gadgets.LoadOrderTree.Find(modEntries[modIndex].Gadgets[gadgetIndex]).FlattenUniqueByBreadth()).Select(x => x.Attribute.Name).Concat("\n"), () => {
             Gadgets.ReloadGadget(modEntries[modIndex].Gadgets[gadgetIndex]);
         });
     }
     else
     {
         if (modEntries[modIndex].Type == ModMenuEntryType.GADGET)
         {
             GadgetCoreAPI.DisplayYesNoDialog("<color=red>WARNING: This feature does not work! Unexpected consequences may occur from attempting to use it!</color>\n\nAre you sure you want to perform a mod reload?\nThe following mods will be reloaded:\n\n" + modEntries[modIndex].Gadgets.SelectMany(x => Gadgets.LoadOrderTree.Find(x).FlattenUniqueByBreadth()).Where(x => x != null).Select(x => x.Mod).Distinct().Select(x => x.Name).Concat("\n"), () => {
                 GadgetLoader.ReloadMod(modEntries[modIndex].Gadgets[0].Mod);
             });
         }
         else
         {
             GadgetCoreAPI.DisplayYesNoDialog("UMF mods can only have their configs reloaded at runtime.\nWould you like to reload " + modEntries[modIndex].Name + "'s config?", () => {
                 GadgetCore.UMFAPI.SendCommand("cfgReload " + modEntries[modIndex].Name);
             });
         }
     }
     Rebuild();
     UpdateRestartNeeded();
 }