Пример #1
0
        public static void GetMods()
        {
            // This list contain the ModInfos and the folder name of each mod
            Mods = new List <ModInfo>();

            if (!Directory.Exists(ModsPath))
            {
                Directory.CreateDirectory(ModsPath);
            }

            var modFolder = new DirectoryInfo(ModsPath);

            int i = 0;

            foreach (var mod in modFolder.GetDirectories())
            {
                var info = new ModInfo();
                info.GenInfo(mod.FullName);
                // If the order change the generation of the list
                if (info.order >= Mods.Count)
                {
                    Mods.Add(info);
                }
                else
                {
                    if (i > 0)
                    {
                        if (info.order == Mods[i - 1].order)
                        {
                            info.order++;
                            info.SaveSettingsJSON(mod.FullName);
                        }
                    }
                    Mods.Insert(info.order, info);
                }
                i++;
            }
        }
Пример #2
0
        private void saveBTN_Click(object sender, RoutedEventArgs e)
        {
            int     order = Int32.Parse(orderTB.Text);
            ModInfo mod   = App.Mods[originalOrder];

            mod.name = nameTB.Text;
            //TODO
            //App.Mods[order].replacedArmors = selectedItems.Items;
            if (order != originalOrder)
            {
                mod.order = order;
                //Number already exists, swap them
                if (App.Mods[order] != null)
                {
                    ModInfo swappedWith = App.Mods[order];
                    swappedWith.order       = originalOrder;
                    App.Mods[order]         = mod;
                    App.Mods[originalOrder] = swappedWith;
                }
            }
            mod.SaveSettingsJSON(System.IO.Path.Combine(App.ModsPath, mod.path));
            Close();
        }