Пример #1
0
        /// <summary>
        /// Set globals, get data from LB, and set controls.
        /// </summary>
        private void InitManager()
        {
            LaunchBoxInstallFolder = AppDomain.CurrentDomain.BaseDirectory;
            LaunchBoxPluginsFolder = $@"{LaunchBoxInstallFolder}Plugins\TBPM\";
            PluginTempFolder       = $@"{LaunchBoxPluginsFolder}t\";

            if (PluginHelper.DataManager != null)
            {
                List <IEmulator> emulators = PluginHelper.DataManager.GetAllEmulators().ToList();
                emulator = emulators.Find(e => e.ApplicationPath.ToLower().Contains("retroarch.exe"));
            }

            txtRetroInstallationFolder.BackColor = DefaultBackColor;
            EmulatorInstallPath = (emulator != null) ? emulator.ApplicationPath : "Please configure Retroarch in LaunchBox before continuing.";
            int i = EmulatorInstallPath.LastIndexOf(Path.DirectorySeparatorChar);

            if (i > 0)
            {
                EmulatorInstallPath = EmulatorInstallPath.Substring(0, i);
                txtRetroInstallationFolder.ForeColor = System.Drawing.Color.Black;
            }
            else
            {
                txtRetroInstallationFolder.ForeColor = System.Drawing.Color.Red;
#if DEBUG
                EmulatorInstallPath = @"E:\Games\Emulation\LaunchBox\Emulators\RetroArch\";
#endif
            }

            txtRetroInstallationFolder.Text = EmulatorInstallPath;
            Directory.CreateDirectory(PluginTempFolder);

            SupportedSystemData = BezelManagerHelper.GetBezelData(Path.Combine(LaunchBoxPluginsFolder, "BezelManagerSupportedSystems.json"));
            SelectedBezel       = new SelectedBezelData();

            foreach (var item in SupportedSystemData.Systems.System)
            {
                this.cbSystemList.Items.Add(item.SystemName);
            }

            pbProgressStatus.Maximum = 100;
            pbProgressStatus.Step    = 1;
            pbProgressStatus.MarqueeAnimationSpeed = 25;

            progressInfo = new Progress <ProgressInfo>(info =>
            {
                pbProgressStatus.Style = (info.ProgressValue > 0) ? ProgressBarStyle.Continuous : ProgressBarStyle.Marquee;
                pbProgressStatus.Value = info.ProgressValue;
                lblProgessStatus.Text  = info.ProgressStatus;
            });

            DisableButtons();

            toolTip.SetToolTip(this.btnInstallBezel, "Downloads and processes selected Bezel package.");
            toolTip.SetToolTip(this.chkKeepMasterFile, "Zip file(s) will be located in the 't' folder inside the plugin folder.");
            toolTip.SetToolTip(this.btnCancel, "Cancels Bezel installation process.");
        }