private static void RunLoop() { AssettoCorsa ac = new AssettoCorsa(); ac.StaticInfoInterval = 1000; // Get StaticInfo updates ever 5 seconds ac.StaticInfoUpdated += StaticInfoUpdated; // Add event listener for StaticInfo ac.PhysicsInterval = 100; ac.PhysicsUpdated += PhysicsUpdated; ac.GraphicsInterval = 300; ac.GraphicsUpdated += GraphicsUpdated; ac.GameStatusChanged += GameStatusChanged; ac.Start(); // Connect to shared memory and start interval timers Console.WriteLine("Press Q to quit!"); Console.WriteLine("Serial buffer stats:"); while (true) { if (Console.KeyAvailable) { var key = Console.ReadKey(true); if (key.Key == ConsoleKey.Q) { break; } } Thread.Sleep(100); // buffer stats Console.Write("{0,5} / {1,5}\r", _port.BytesToWrite, _port.WriteBufferSize); } ac.Stop(); Console.WriteLine(); }
public void Stop() { ac.PhysicsUpdated -= OnACPhysics; ac.GraphicsUpdated -= OnACGraphics; ac.StaticInfoUpdated -= OnACInfo; joyControl.Stop(); ac.Stop(); }
protected override void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (ac != null) { ac.Stop(); } } // Release unmanaged resources. disposed = true; } }
void gameIntegrationWorkerDoWork(object sender, DoWorkEventArgs e) { bool assettoCorsaRunning = false; BackgroundWorker localbg = (BackgroundWorker)e.Argument; while (!localbg.CancellationPending) { if (Process.GetProcessesByName("acs").Length > 0) { if (assettoCorsaRunning) { } else { assettoCorsa.StaticInfoInterval = 5000; assettoCorsa.PhysicsInterval = 100; assettoCorsa.PhysicsUpdated += assettoCorsa_PhysicsUpdated; assettoCorsa.Start(); assettoCorsaRunning = true; Console.WriteLine("Started assettoCorsa"); } } else { if (assettoCorsaRunning) { assettoCorsa.Stop(); assettoCorsaRunning = false; Console.WriteLine("Stoped assettoCorsa"); } } Thread.Sleep(500); } }
public void Stop() { pAc.Stop(); }