Exemple #1
0
        private void ImportObjects(Dictionary <string, CustomObjectImport> imports)
        {
            if (imports.Any())
            {
                var enableImport = false;

                foreach (var kvpImport in imports)
                {
                    foreach (var kvpMdl in kvpImport.Value.Data.CustomModels)
                    {
                        kvpImport.Value.DestModelBanks.AddOrUpdate(kvpMdl.Key, rommgr.GlobalModelBank);
                    }
                    kvpImport.Value.DestBehaviorBank  = rommgr.GlobalBehaviorBank;
                    kvpImport.Value.DestCustomAsmBank = rommgr.GlobalCustomAsmBank;
                }

                var frm = new CustomObjectImportDialog(rommgr, imports);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    enableImport = true;
                }

                if (!rommgr.GlobalBehaviorBank.Config.Enabled)
                {
                    if (MessageBoxEx.Show(this, MsgBox_ObjectsNeedGlobalBehavBank, MsgBox_ObjectsNeedGlobalBehavBank_Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        rommgr.LoadGlobalBehaviorBank(true);
                    }
                    else
                    {
                        enableImport = false;
                    }
                }

                if (enableImport)
                {
                    foreach (var import in imports.Values)
                    {
                        customObjectCollection.Import(import);
                    }
                    rommgr.CalculateGlobalBehaviorBankAddresses();
                    LoadObjects();
                }
            }
        }