Esempio n. 1
0
        /// <summary>
        /// Point d'entrée principal de l'application.
        /// </summary>
        static int Main(string[] args)
        {
            AppDataPath        = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "vJoyIOFeeder");
            AppCfgFilename     = AppDataPath + @"/ApplicationCfg.xml";
            HwdCfgFilename     = AppDataPath + @"/HardwareCfg.xml";
            CtlSetsCfgFilename = AppDataPath + @"/ControlSetsCfg.xml";

            if (!Directory.Exists(AppDataPath))
            {
                Directory.CreateDirectory(AppDataPath);
            }

            Manager = new vJoyManager();
            Manager.LoadConfigurationFiles(AppCfgFilename, HwdCfgFilename);
            Manager.LoadControlSetFiles();

            CommandLine.ParseCommandLine(args, out var outputArgs);
            CommandLine.ProcessOptions(outputArgs);

            if (vJoyManager.Config.Application.DumpLogToFile)
            {
                if (!Directory.Exists(vJoyManager.Config.Application.LogsDirectory))
                {
                    Directory.CreateDirectory(vJoyManager.Config.Application.LogsDirectory);
                }
                LogFilename = Path.Combine(vJoyManager.Config.Application.LogsDirectory, "_Log-" +
                                           DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace("/", "-").Replace(":", "-") + ".txt");
                Logfile         = File.CreateText(LogFilename);
                Logger.Loggers += LogToFile;
            }

            Console.Title   = "vJoyIOFeeder v" + typeof(vJoyManager).Assembly.GetName().Version.ToString() + " Made for Gamoover by njz3";
            Logger.Loggers += ConsoleLog;

            Logger.Start();
            Manager.Start();

            while (!vJoyManager.IsKeyPressed(ConsoleKey.Escape))
            {
                Thread.Sleep(500);
            }

            Manager.Stop();
            Manager.SaveConfigurationFiles(AppCfgFilename, HwdCfgFilename);
            // Make a backup of the control set, just in case
            Manager.SaveControlSetFiles(true, CtlSetsCfgFilename);
            Logger.Stop();

            if (vJoyManager.Config.Application.DumpLogToFile && Logfile != null)
            {
                Logfile.Close();
            }

            return(0);
        } // Main
Esempio n. 2
0
        static int Main(string[] args)
        {
            AppDataPath    = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"/vJoyIOFeeder";
            LogFilename    = AppDataPath + @"/log.txt";
            ConfigFilename = AppDataPath + @"/config.xml";

            if (!Directory.Exists(AppDataPath))
            {
                Directory.CreateDirectory(AppDataPath);
            }

            Manager = new vJoyManager();
            Manager.LoadConfigurationFiles(ConfigFilename);
            if (vJoyManager.Config.DumpToLogFile)
            {
                Logfile         = File.CreateText(LogFilename);
                Logger.Loggers += FileLog;
            }

            Logger.Start();
            Manager.Start();

            while (!vJoyManager.IsKeyPressed(ConsoleKey.Escape))
            {
                Thread.Sleep(500);
                if (vJoyManager.Config.DumpToLogFile && Logfile != null)
                {
                    Logfile.Flush();
                }
            }

            Manager.Stop();
            Manager.SaveConfigurationFiles(ConfigFilename);
            Logger.Stop();

            if (vJoyManager.Config.DumpToLogFile && Logfile != null)
            {
                Logfile.Close();
            }

            return(0);
        } // Main