Esempio n. 1
0
        private void DoImage(HttpProcessor oHttpProcessor)
        {
            if (DoCacheResponseIfWarranted(oHttpProcessor))
            {
                return;
            }

            LoadBinary(oHttpProcessor);

            string sImagePath = htCachedBinaryPaths[oHttpProcessor.pathParts[1].ToLower()]?.ToString();

            if (string.IsNullOrWhiteSpace(sImagePath) || !File.Exists(sImagePath))
            {
                htCachedImageHTML[oHttpProcessor.pathParts[1]] = Properties.Resources.HTML_NoResource
                                                                 .Replace("<!-- SecondsBetweenRefresh -->",
                                                                          (PluginAppSettings.GetInt("SecondsBetweenRefresh")).ToString())
                                                                 .Replace("<!-- Path -->", sImagePath)
                                                                 .Replace("<!-- Title -->", PluginHelper.StateManager.GetAllSelectedGames()[0].Title)
                ;

                htCachedImagePaths[oHttpProcessor.pathParts[1]] = "";
            }
            else if (htCachedImagePaths[oHttpProcessor.pathParts[1].ToLower()]?.ToString() != sImagePath)
            {
                htCachedImagePaths[oHttpProcessor.pathParts[1]] = sImagePath;

                htCachedImageHTML[oHttpProcessor.pathParts[1]] =
                    Properties.Resources.HTML_Marque
                    .Replace("<!-- SecondsBetweenRefresh -->", PluginAppSettings.GetString("SecondsBetweenRefresh"))
                    .Replace("<!-- Base64Image -->",
                             MakeBinarySrcData(sImagePath, (byte[])htCachedBinaries[oHttpProcessor.pathParts[1]]));
            }

            WriteImageHTML(oHttpProcessor, htCachedImageHTML[oHttpProcessor.pathParts[1]]?.ToString());
        }
Esempio n. 2
0
        private void SetHelpText()
        {
            toolTip1.SetToolTip(txtPort, AddNewLinesForTooltip(PluginAppSettings.GetString("Port_Help").Replace("  ", " ")));
            toolTip1.SetToolTip(chkPortEnabled, AddNewLinesForTooltip(PluginAppSettings.GetString("PortEnabled_Help").Replace("  ", " ")));

            toolTip1.SetToolTip(txtSecurePort, AddNewLinesForTooltip(PluginAppSettings.GetString("SecurePort_Help").Replace("  ", " ")));
            toolTip1.SetToolTip(chkSecurePortEnabled, AddNewLinesForTooltip(PluginAppSettings.GetString("SecurePortEnabled_Help").Replace("  ", " ")));
            toolTip1.SetToolTip(nudSecondsBetweenRefresh, AddNewLinesForTooltip(PluginAppSettings.GetString("SecondsBetweenRefresh_Help").Replace("  ", " ")));
            toolTip1.SetToolTip(cmbAutomaticUpdates, AddNewLinesForTooltip(PluginAppSettings.GetString("AutomaticUpdates_Help").Replace("  ", " ")));

            toolTip1.SetToolTip(lblLaunchPort, AddNewLinesForTooltip("Browse index."));
            toolTip1.SetToolTip(lblLaunchSecurePort, AddNewLinesForTooltip("Browse index."));
        }
Esempio n. 3
0
        new public void Initialize()
        {
            if (!int.TryParse(PluginAppSettings.GetString("GetAllGamesLimit"), out giGetAllGamesLimit))
            {
                giGetAllGamesLimit = 50;
            }

            gsAccessControlAllowOrigin = PluginAppSettings.GetString("Access-Control-Allow-Origin");
            if (string.IsNullOrEmpty(gsAccessControlAllowOrigin))
            {
                gsAccessControlAllowOrigin = "*";
            }

            base.Initialize();
        }
Esempio n. 4
0
        private void frmSettings_Load(object sender, EventArgs e)
        {
            txtPort.Text       = PluginAppSettings.GetInt("Port") == 0 ? "80" : PluginAppSettings.GetInt("Port").ToString();
            txtSecurePort.Text = PluginAppSettings.GetInt("SecurePort") == 0 ? "443" : PluginAppSettings.GetInt("SecurePort").ToString();

            chkPortEnabled.Checked            = PluginAppSettings.GetBoolean("PortEnabled");
            chkSecurePortEnabled.Checked      = PluginAppSettings.GetBoolean("SecurePortEnabled");
            nudSecondsBetweenRefresh.Value    = (PluginAppSettings.GetInt("SecondsBetweenRefresh") > 0 && PluginAppSettings.GetInt("SecondsBetweenRefresh") < 1000) ? PluginAppSettings.GetInt("SecondsBetweenRefresh") : 15;
            cmbAutomaticUpdates.SelectedIndex = cmbAutomaticUpdates.FindString(PluginAppSettings.GetBoolean("AutomaticUpdates") ? "On" : "Off");
            chkWriteEnabled.Checked           = PluginAppSettings.GetBoolean("WriteEnabled");

            SetServerStatus();

            btnSave.Enabled            = false;
            btnCheckForUpdates.Enabled = true;

            lblVersion.Text = PluginAppSettings.GetString("Version");

            // The version information in the config file overrides the assembly version.
            if (string.IsNullOrEmpty(lblVersion.Text))
            {
                lblVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }