Ejemplo n.º 1
0
        /// <summary>
        /// Method for initializating IntermediateClasss, receives the parameters contained in a configuration.
        /// </summary>
        /// <param name="pluginName">Full route to the plugin to be loaded as an assembly</param>
        /// <param name="reticleRoute">Full route to the image to be used as a reticle</param>
        /// <param name="mouseControl">Bool value that indicates if the user will control the mouse with its gaze</param>
        /// <param name="countdown">Number of seconds to be used as the countdown for generating a click</param>
        /// <param name="saveData">Bool value that indicates if the eye tracking data will be saved to a file</param>
        /// <param name="saveRoute">Route where the files will be saved</param>
        /// <param name="fileName">Name of the file to be generated</param>
        public void InitializeClass(string pluginName, string reticleRoute, bool mouseControl, int countdown, bool saveData, string saveRoute, string fileName)
        {
            proxyInstance.CreateAppDomain(pluginName);
            ClickTimer        = countdown * 1000;
            this.mouseControl = mouseControl;
            this.saveData     = saveData;

            //  If a reticle is selected, the class for managing its drawing is created
            if (reticleRoute != null)
            {
                if (drawingClass != null)
                {
                    drawingClass.ClearUp();
                }
                drawingClass = new ReticleDrawing(reticleRoute);
            }
            else if (reticleRoute == null && drawingClass != null)
            {
                drawingClass.ClearUp();
                drawingClass = null;
            }

            //  If saveData was selected, a file where contents will be written is created, after checking if a file has been
            //  created before (in which case, it's closed before creating the new file).
            if (saveData)
            {
                if (logging != null)
                {
                    logging.CloseLogTarget();
                }
                logging  = new StandardLogging();
                fileName = fileName + " - " + DateTime.Now.ToString("dd-M-yyyy_HH-mm-ss");
                logging.CreateLogTarget(saveRoute, fileName + ".csv");
            }

            //  If mouseControl was selected, the class for controlling the mouse through eye movements is instantiated
            if (mouseControl)
            {
                if (controller == null)
                {
                    controller = new MouseControl();
                }
                clickRegister = 0;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     The main program entry-point.
        /// </summary>
        /// <param name="args">
        ///     Command-line arguments.
        /// </param>
        static async Task Main(string[] args)
        {
            await new HostBuilder()
            .ConfigureAppConfiguration((context, config) =>
            {
                config.AddJsonFile("appsettings.json");
                config.AddUserSecrets(
                    typeof(Program).Assembly
                    );
                config.AddEnvironmentVariables(prefix: "DAAS_");
            })
            .ConfigureLogging((context, logging) =>
            {
                Log.Logger = StandardLogging.ConfigureSerilog(context.Configuration,
                                                              daasComponentName: "Provisioning"
                                                              );

                logging.ClearProviders();
                logging.AddSerilog(Log.Logger);
            })
            .ConfigureServices((hostContext, services) =>
            {
                services.AddOptions();
                services.AddDaaSOptions(hostContext.Configuration);

                services.AddDaaSDataAccess(
                    createIndexes: true
                    );

                services.AddKubeClient();
                services.AddDatabaseProxyApiClient();
                services.AddVaultClient();
                services.AddProvisioning();

                DatabaseOptions databaseOptions = DatabaseOptions.From(hostContext.Configuration);
                if (String.IsNullOrWhiteSpace(databaseOptions.ConnectionString))
                {
                    throw new InvalidOperationException("Application configuration is missing database connection string.");
                }

                services.AddScoped <IHostedService, ProvisioningService>();
            })
            .RunConsoleAsync();
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Create the application web host.
        /// </summary>
        /// <param name="args">
        ///     Command-line arguments.
        /// </param>
        /// <returns>
        ///     The <see cref="IWebHost"/>.
        /// </returns>
        public static IWebHost BuildWebHost(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
        .UseStartup <Startup>()
        .ConfigureAppConfiguration((context, config) =>
        {
            config.AddJsonFile("appsettings.json");
            config.AddUserSecrets <Startup>();
            config.AddEnvironmentVariables(prefix: "DAAS_");
        })
        .ConfigureLogging((context, logging) =>
        {
            Log.Logger = StandardLogging.ConfigureSerilog(context.Configuration,
                                                          daasComponentName: "SQLExecutor"
                                                          );

            logging.ClearProviders();
            logging.AddSerilog(Log.Logger);
        })
        .Build();
Ejemplo n.º 4
0
 /// <summary>
 /// Method for cleaning up the class current configuration
 /// </summary>
 public void ClearClass()
 {
     //  Every variable related to eye tracking gets reinitialized
     mouseControl = false;
     saveData     = false;
     if (controller != null)
     {
         controller = null;
     }
     if (logging != null)
     {
         logging.CloseLogTarget();
         logging = null;
     }
     if (drawingClass != null)
     {
         drawingClass.ClearUp();
         drawingClass = null;
     }
 }
 public SettingsManager()
 {
     logSettings = new StandardLogging();
 }