Пример #1
0
        public void Record()
        {
            if (Process.GetProcessesByName("rfactor").Length == 0)
            {
                Assert.Ignore();
            }
            var rFactorProcess = Process.GetProcessesByName("rfactor")[0];

            IntPtr alloc = Marshal.AllocHGlobal(512 * 1024 * 1024);

            using (var host = new Plugins())
            {
                host.PluginDirectory = TestConstants.SimulatorsBinFolder;

                host.Load();

                // Simulators are now loaded

                var testPlugin = host.Simulators.Where(x => x.Name == "Test simulator").FirstOrDefault();
                testPlugin.SimulatorStart(rFactorProcess);

                var telSource = new Domain.Aggregates.Telemetry(testPlugin.TelemetryProvider, rFactorProcess);
                var telLogger = new TelemetryLogger("testSim", new TelemetryLoggerConfiguration(true, false, true, false));
                telLogger.SetAnnotater(new TelemetryArchive());
                telSource.SetLogger(telLogger);

                Thread.Sleep(60000);

                telLogger.Close();
                telSource = null;
            }

            Marshal.FreeHGlobal(alloc);
        }
Пример #2
0
        public void Record()
        {
            if (Process.GetProcessesByName("rfactor").Length == 0) Assert.Ignore();
            var rFactorProcess = Process.GetProcessesByName("rfactor")[0];

            IntPtr alloc = Marshal.AllocHGlobal(512 * 1024 * 1024);

            using (var host = new Plugins())
            {
                host.PluginDirectory = TestConstants.SimulatorsBinFolder;

                host.Load();

                // Simulators are now loaded

                var testPlugin = host.Simulators.Where(x => x.Name == "Test simulator").FirstOrDefault();
                testPlugin.SimulatorStart(rFactorProcess);

                var telSource = new Domain.Aggregates.Telemetry(testPlugin.TelemetryProvider, rFactorProcess);
                var telLogger = new TelemetryLogger("testSim", new TelemetryLoggerConfiguration(true, false, true, false));
                telLogger.SetAnnotater(new TelemetryArchive());
                telSource.SetLogger(telLogger);

                Thread.Sleep(15000);

                telLogger.Close();
                telSource = null;
            }

            Marshal.FreeHGlobal(alloc);
        }