예제 #1
0
 /// <summary>
 /// Verifies a configuration (validates routes in case these don't exist anymore)
 /// </summary>
 /// <param name="configuration">FormAttributes class with every setting of a configuration</param>
 /// <returns>True if configuration is valid, false if not.</returns>
 private bool VerifyConfig(FormAttributes configuration)
 {
     if (configuration != null &&
         Directory.Exists(configuration.pluginsRoute) &&
         Directory.Exists(configuration.reticlesRoute) &&
         Directory.Exists(configuration.fileRoute))
     {
         if (File.Exists(configuration.pluginsRoute + "\\" + configuration.pluginName) &&
             File.Exists(configuration.reticlesRoute + "\\" + configuration.reticleName))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
        /// <summary>
        /// Used to select a file to load a configuration
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadConfig_Click(object sender, EventArgs e)
        {
            openFileConfig.FileName = "";
            openFileConfig.Title    = "Seleccione un archivo para cargar una configuración";
            openFileConfig.Filter   = "Archivo JSON (*.json)|*.json";
            SettingsManager settings = new SettingsManager();

            if (openFileConfig.ShowDialog() == DialogResult.OK)
            {
                //  Opening settings
                var            filePath          = openFileConfig.FileName;
                FormAttributes settingsAttribute = settings.LoadSettings(filePath);
                if (VerifyConfig(settingsAttribute))
                {
                    pluginsCurrentRoute  = settingsAttribute.pluginsRoute;
                    reticlesCurrentRoute = settingsAttribute.reticlesRoute;
                    dataSaveCurrentRoute = settingsAttribute.fileRoute;
                    pluginsRoute.Text    = settingsAttribute.pluginsRoute;
                    reticlesRoute.Text   = settingsAttribute.reticlesRoute;
                    controlMouse.Checked = settingsAttribute.mouseControl;
                    clickTimer.Value     = settingsAttribute.clickTime;
                    saveData.Checked     = settingsAttribute.saveData;
                    fileNameTextBox.Text = settingsAttribute.fileName;
                    saveFileRoute.Text   = settingsAttribute.fileRoute;
                    InitializeComboBox(trackingPlugins, pluginsRoute.Text, "*.dll");
                    InitializeComboBox(reticleSelected, reticlesRoute.Text, "*.png");
                    trackingPlugins.SelectedIndex = trackingPlugins.FindStringExact(settingsAttribute.pluginName);
                    reticleSelected.SelectedIndex = reticleSelected.FindStringExact(settingsAttribute.reticleName);
                    MessageBox.Show("Configuración cargada con éxito");
                }
                else
                {
                    MessageBox.Show("No se pudo cargar la configuración seleccionada.\n" +
                                    "El archivo pudo ser modificado o los directorios\n" +
                                    "y archivos señalados ya no existen o han sido   \n" +
                                    "movidos a otra ubicación.");
                }
            }
        }
예제 #3
0
 public extern static ReactElement Form(FormAttributes properties, params ReactElementOrText[] children);