/// <summary> /// Open the given Recorder /// </summary> /// <param name="name">ActiveRecorder name</param> public static void Open(string name, string location, IEnumerable <string> responseFilterExpressions) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name", "A valid ActiveRecorder name must be provided."); } if (!manager.activeRecorders.ContainsKey(name)) { throw new InvalidOperationException("An ActiveRecorder must first be created."); } qf4net.QF.Instance.Publish(new RecorderEvent(QFSignal.RecorderOpen, name, location, null, EntryStyle.Single, null, null, responseFilterExpressions)); ActiveRecorder aRecorder = manager.activeRecorders[name]; while ((!aRecorder.IsInState(aRecorder.m_StateFaulted)) && (!aRecorder.IsInState(aRecorder.m_StateOpened))) { System.Threading.Thread.Sleep(1); } }
private static void Create(IRecorder recorder) { if (recorder == null) { throw new ArgumentNullException("recorder", "A valid recorder must be provided."); } if ((string.IsNullOrEmpty(recorder.Name) || manager.activeRecorders.ContainsKey(recorder.Name))) { throw new ArgumentNullException("recorder.Name", "An ActiveRecorder must have a valid, unique name."); } manager.activeRecorders.Add(recorder.Name, new ActiveRecorder(recorder)); manager.activeRecorders[recorder.Name].Start(manager.priority++); ActiveRecorder aRecorder = manager.activeRecorders[recorder.Name]; while ((!aRecorder.IsInState(aRecorder.m_StateFaulted)) && (!aRecorder.IsInState(aRecorder.m_StateCreated))) { System.Threading.Thread.Sleep(1); } }
/// <summary> /// Close the given Recorder /// </summary> /// <param name="name">ActiveRecorder name</param> public static void Close(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name", "A valid ActiveRecorder name must be provided."); } if (!manager.activeRecorders.ContainsKey(name)) { throw new InvalidOperationException("An ActiveRecorder must first be created."); } qf4net.QF.Instance.Publish(new RecorderEvent(QFSignal.RecorderClose, name, null)); ActiveRecorder aRecorder = manager.activeRecorders[name]; while ((!aRecorder.IsInState(aRecorder.m_StateFaulted)) && (!aRecorder.IsInState(aRecorder.m_StateClosed))) { System.Threading.Thread.Sleep(1); } manager.activeRecorders[name].Dispose(); manager.activeRecorders.Remove(name); }