public bool Startup() { if (IsInitialized) { return(true); } try { iRacingFile = MemoryMappedFile.OpenExisting(Defines.MemMapFileName); FileMapView = iRacingFile.CreateViewAccessor(); VarHeaderSize = Marshal.SizeOf(typeof(VarHeader)); var hEvent = OpenEvent(Defines.DesiredAccess, false, Defines.DataValidEventName); var are = new AutoResetEvent(false); are.Handle = hEvent; var wh = new WaitHandle[1]; wh[0] = are; WaitHandle.WaitAny(wh); Header = new CiRSDKHeader(FileMapView); GetVarHeaders(); IsInitialized = true; } catch (Exception) { return(false); } return(true); }
public CVarBuf(MemoryMappedViewAccessor mapView, CiRSDKHeader header) { FileMapView = mapView; Header = header; VarHeaderSize = Marshal.SizeOf(typeof(VarHeader)); VarBufSize = Marshal.SizeOf(typeof(VarBuf)); }