public void StartReplaying(string replayFile) { InvalidStateException.Assert(mode == MillipedeMode.Unconfigured, "Recorder is already started", mode); NumberEvents = 0; timer = Stopwatch.StartNew(); mode = MillipedeMode.Playback; dataSink = null; sinkFile = File.OpenRead(replayFile); LastFileName = replayFile; LoadNextEvent(); }
public void StartPassThrough() { InvalidStateException.Assert(mode == MillipedeMode.Unconfigured, "Recorder is already started", mode); NumberEvents = 0; // timer = Stopwatch.StartNew(); mode = MillipedeMode.PassThrough; dataSink = null; sinkFile = null; syncingTimer = null; }
public void StartRecording(string recordingFile) { InvalidStateException.Assert(mode == MillipedeMode.Unconfigured, "Recorder is already started", mode); NumberEvents = 0; timer = Stopwatch.StartNew(); mode = MillipedeMode.Record; dataSink = new MemoryStream(); sinkFile = File.Create(recordingFile); LastFileName = recordingFile; syncingTimer = new Timer(SyncRecording, null, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10)); }
public void Dispose() { lock (this) { if(this == singleton) { singleton = null; } if(syncingTimer != null) { syncingTimer.Dispose(); } syncingTimer = null; if(sinkFile != null) { if(sinkFile != null && dataSink != null) { SyncRecording(null); } if(sinkFile != null) { sinkFile.Close(); } if(dataSink != null) { dataSink.Dispose(); } sinkFile = null; dataSink = null; } assignedDescriptors = null; } mode = MillipedeMode.PassThrough; }