public CarInfos(ACSClient acsClient) { _acsClient = acsClient; _acsClient.OnNewConnection += (byte packetId, ConnectionEvent eventData) => RegisterNewCar(eventData.CarId, eventData.CarModel, eventData.DriverName); _acsClient.OnCarInfo += (byte packetId, CarInfoEvent eventData) => RegisterCar(eventData.CarId, eventData.Model, eventData.DriverName); _acsClient.OnConnectionClosed += (byte packetId, ConnectionEvent eventData) => UnregisterCar(eventData.CarId); }
public Program(Options options) { var name = $"{options.Name}-{options.PluginPort}-{options.ServerPort}"; var storagePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\acsRankingPlugin"; _options = options; //IStorage storage = new AccessDbStorage(storagePath, name, reset); _storage = new JsonStorage(storagePath, name, options.Reset); _leaderboard = new Leaderboard(_storage); _acsClient = new ACSClient(options.PluginPort, options.ServerPort); _carInfos = new CarInfos(_acsClient); }