Exemplo n.º 1
0
        void btnMergeFiles_Click(object sender, EventArgs e)
        {
            if (!Paths.ValidateModsDirectory() ||
                (treConflicts.FileNodes.Any(node => ModFile.IsScript(node.Text)) && !Paths.ValidateScriptsDirectory()) ||
                (treConflicts.FileNodes.Any(node => ModFile.IsBundle(node.Text)) && !Paths.ValidateBundlesDirectory()))
            {
                return;
            }

            var mergedModName = Paths.RetrieveMergedModName();

            if (mergedModName == null)
            {
                return;
            }

            InitializeProgressScreen("Merging");

            Program.Inventory = MergeInventory.Load(Paths.Inventory);

            var merger = new FileMerger(Program.Inventory, OnMergeProgressChanged, OnMergeComplete);

            var fileNodes = treConflicts.FileNodes.Where(node => node.GetTreeNodes().Count(modNode => modNode.Checked) > 1);

            merger.MergeByTreeNodesAsync(fileNodes, mergedModName);
        }
Exemplo n.º 2
0
        async Task <bool> RefreshMergeInventory()
        {
            InitializeProgressScreen("Loading Merges", ProgressBarStyle.Continuous);

            lblProgressCurrentAction.Text = "Loading MergeInventory.xml file";
            Program.Inventory             = await Task.Run(() =>
                                                           MergeInventory.Load(Paths.Inventory)
                                                           );

            progressBar.Value = 25;

            lblProgressCurrentAction.Text = "Loading mods.settings file";
            Program.LoadOrder             = await Task.Run(() =>
                                                           new CustomLoadOrder()
                                                           );

            progressBar.Value = 50;

            if (Program.Settings.Get <bool>("ValidateCustomLoadOrder") && Program.Inventory.Merges.Any())
            {
                lblProgressCurrentAction.Text = "Validating load order";
                await Task.Run(() =>
                               LoadOrderValidator.ValidateAndFix(Program.LoadOrder)
                               );
            }
            progressBar.Value = 75;

            lblProgressCurrentAction.Text = "Refreshing merge tree";
            return(await Task.Run(() =>
                                  RefreshMergeTree()
                                  ));
        }