public void AddItemToModsList(FileInfo modFile)
        {
            string modName;
            bool   isBtdApiMod   = modFile.FullName.Contains(".btd6mod");
            bool   isLastUsedMod = Settings.LoadedSettings.LastUsedMods.Contains(modFile.FullName);
            bool   isDisabled    = modFile.FullName.EndsWith(disabledKey);

            if (!isLastUsedMod && !isDisabled)
            {
                string newPath = modFile.FullName + disabledKey;
                if (File.Exists(newPath))
                {
                    File.Delete(newPath);
                }

                File.Move(modFile.FullName, newPath);
                modFile = new FileInfo(newPath);
            }

            if (isBtdApiMod && !Settings.LoadedSettings.ShownBtdApiInjectorMessage)
            {
                Logger.Log("One or more of your mods are BTD API mods. This means you need to use an injector to inject them into BTD6.", OutputType.Both);

                string btd6ModsDir = SessionData.ModsDir;
                if (!BtdApi_Handler.DoesInjectorExist(SessionData.ModsDir))
                {
                    BtdApi_Handler.AskDownloadInjector();
                }

                Settings.LoadedSettings.ShownBtdApiInjectorMessage = true;
                SessionData.ShownInjectorRequiredMessage           = true;
            }

            modName = modFile.Name.Replace(disabledKey, "");

            ModItem_UserControl item = new ModItem_UserControl();

            item.MinWidth     = Mods_ListBox.ActualWidth - 31;
            item.ModName.Text = modName;
            item.modName      = modName;
            item.modPath      = modFile.FullName;

            Thickness margin = item.Margin;

            if (Mods_ListBox.Items.Count == 0)
            {
                margin.Top  = 10;
                item.Margin = margin;
            }

            Mods_ListBox.Items.Add(item);
            modItems.Add(item);
        }
Exemple #2
0
        public void AddItemToModsList(FileInfo modFile)
        {
            /*if (Mods_ListBox.ActualWidth <= 0)
             *  return;*/

            ModItem_UserControl item = new ModItem_UserControl();

            item.MinWidth     = Mods_ListBox.ActualWidth - 31;
            item.ModName.Text = modFile.Name;
            item.modName      = modFile.Name;
            item.modPath      = modFile.FullName;

            Thickness margin = item.Margin;

            if (Mods_ListBox.Items.Count == 0)
            {
                margin.Top  = 10;
                item.Margin = margin;
            }

            Mods_ListBox.Items.Add(item);
            modItems.Add(item);
        }