public override void PageInject(string url, Collection <string> toInject, Collection <KeyValuePair <string, string> > replacements) { if (AcApiHosts.Contains(url.GetDomainNameFromUrl(), StringComparer.OrdinalIgnoreCase)) { toInject.Add(@"<script>!function(){ window.__AC = {}; window.__AC.CarsArray = JSON.parse(window.external.GetCars()); window.__AC.TracksArray = JSON.parse(window.external.GetTracks()); window.__AC.Cars = {}; window.__AC.Tracks = window.__AC.TracksArray.reduce(function (a, b){ a[b.id] = b; return a; }, {}); for (var i = 0; i < window.__AC.CarsArray.length; i++){ var car = window.__AC.CarsArray[i]; window.__AC.Cars[car.id] = car; car.__defineGetter__('skins', getSkins.bind(null, car)); car.__defineGetter__('skinmeta', getSkinMeta.bind(null, car)); } function getSkins(car){ return car._skins || (car._skins = JSON.parse(window.external.GetSkins(car.id))); } function getSkinMeta(car){ return car._skinmeta || (car._skinmeta = JSON.parse(window.external.GetSkinMeta(car.id))); } function find(a, f, p1, p2) { if (p1 === 'id') window.external.SetLastAccessed(f, a === __AC.CarsArray); return p1 && a.filter(function (n){ return (p2 ? n[p1][p2] : n[p1]).indexOf(f) > -1; }); } window.__AC.findCar = find.bind(null, __AC.CarsArray); window.__AC.findTrack = find.bind(null, __AC.TracksArray); }()</script>"); } }
public RaceUApiBridge() { AcApiHosts.Add(@"raceu.net"); AcApiHosts.Add(@"localhost:3000"); }
public SrsFixAcCompatibleApiBridge() { _srsFix = null; AcApiHosts.Add(@"simracingsystem.com"); }
public TrackTitanApiBridge() { AcApiHosts.Add(@"tracktitan.io"); AcApiHosts.Add(@"www.tracktitan.io"); }
public UnitedRacingDataApiBridge() { AcApiHosts.Add(@"unitedracingdata.com"); AcApiHosts.Add(@"www.unitedracingdata.com"); }
public GridFinderApiBridge() { AcApiHosts.Add(@"grid-finder.com"); AcApiHosts.Add(@"www.grid-finder.com"); }
public WorldSimSeriesApiBridge() { AcApiHosts.Add(@"worldsimseries.com"); AcApiHosts.Add(@"paddock.worldsimseries.com"); AcApiHosts.Add(@"local.wss:8000"); }