private void SetDataManager(DataManager value)
        {
            if(value == datamanager)
                return;

            if(null != datamanager)
                datamanager.DataAdded   -=Datamanager_DataAdded;

            datamanager = value;
            if(null != datamanager)
                datamanager.DataAdded   +=Datamanager_DataAdded;

            UpdateUI();
        }
Esempio n. 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            DataManager = new DataManager();
            ModManager  = new ModManager();

            if(Config.Instance.DataDir != null)
            {
                #if ENABLE_MOD
                try
                {
                    if(Directory.Exists(Config.Instance.DataDir))
                        LoadMods(Config.Instance.DataDir);
                } catch(Exception ex)
                {
                    System.Diagnostics.Debug.Print(ex.ToString());
                }
                #endif

                try
                {
                    if(Directory.Exists(Config.Instance.DataDir))
                    {
                        LoadFile(Config.Instance.DataDir);
                    }

                    foreach(var i in Directory.GetFiles(Config.Instance.DataDir, "*.arc"))
                    {
                        var tsb = new ToolStripButton(Path.GetFileName(i));
                        tsb.Tag = i;
                        tsb.Click += tsbArchive_Click;

                        tsddbArchive.DropDownItems.Add(tsb);
                    }
                } catch(Exception ex)
                {
                    System.Diagnostics.Debug.Print(ex.ToString());
                }
            }

            try { tsddbArchive.Enabled= null != Config.Instance.CM3D2Tool  && File.Exists(Config.Instance.CM3D2Tool);  } catch {}
            try { tsbRunGame.Enabled  = null != Config.Instance.ReiPatcher && File.Exists(Config.Instance.ReiPatcher); } catch {}

            tscbArch.SelectedItem   = Config.Instance.RunArch;

            if(DataManager.Empty)
            {
                panel1.Visible              = true;
                dataManagerControl1.Visible = false;
            }
        }