/// <summary> /// 删除管道 /// </summary> /// <param name="cameraNO"></param> public VideoPipe DeleteVideoPipe(string cameraNO) { if (listVideoPipeOperateLock.TryEnterWriteLock(CgwConst.ENTER_PIPE_LOCK_WAIT_TIME)) { try { if (listVideoPipe.Exists((x) => { return(x.CameraNo == cameraNO ? true : false); })) { VideoPipe videoPipe = listVideoPipe.Find((x) => { return(x.CameraNo == cameraNO ? true : false); }); if (videoPipe != null) { listVideoPipe.Remove(videoPipe); return(videoPipe); } } } finally { listVideoPipeOperateLock.ExitWriteLock(); } } return(null); }
/// <summary> /// 增加管道、成功返回管道,失败返回空 /// </summary> /// <param name="cameraNO">摄像机编码</param> public VideoPipe AddVideoPipe(string cameraNO) { if (listVideoPipeOperateLock.TryEnterWriteLock(CgwConst.ENTER_PIPE_LOCK_WAIT_TIME)) { try { int index = listVideoPipe.FindIndex((x) => { return(x.CameraNo == cameraNO ? true : false); }); if (index == -1) { string pipeName = GetVideoPipeName(cameraNO); VideoPipe pipe = new VideoPipe(pipeName); pipe.PipeName = pipeName; pipe.CameraNo = cameraNO; if (pipeName != string.Empty) { listVideoPipe.Add(pipe); return(pipe); } } } finally { listVideoPipeOperateLock.ExitWriteLock(); } } return(null); }
/// <summary> /// 查询管道 /// </summary> /// <param name="cameraNO">摄像机编码</param> /// <returns></returns> public VideoPipe GetVideoPipe(string cameraNO) { if (listVideoPipeOperateLock.TryEnterWriteLock(CgwConst.ENTER_PIPE_LOCK_WAIT_TIME)) { try { int index = listVideoPipe.FindIndex((x) => { return(x.CameraNo == cameraNO ? true : false); }); if (index != -1) { VideoPipe videoPipe = listVideoPipe.Find((x) => { return(x.CameraNo == cameraNO ? true : false); }); return(videoPipe); } } finally { listVideoPipeOperateLock.ExitWriteLock(); } } return(null); }
/// <summary> /// 增加管道、成功返回管道,失败返回空 /// </summary> /// <param name="cameraNO">摄像机编码</param> public VideoPipe AddVideoPipe(string cameraNO) { if (listVideoPipeOperateLock.TryEnterWriteLock(CgwConst.ENTER_PIPE_LOCK_WAIT_TIME)) { try { int index = listVideoPipe.FindIndex((x) => { return x.CameraNo == cameraNO ? true : false; }); if (index == -1) { string pipeName = GetVideoPipeName(cameraNO); VideoPipe pipe = new VideoPipe(pipeName); pipe.PipeName = pipeName; pipe.CameraNo = cameraNO; if (pipeName != string.Empty) { listVideoPipe.Add(pipe); return pipe; } } } finally { listVideoPipeOperateLock.ExitWriteLock(); } } return null; }