public static void LoadServer(Guid serverId) { DetectorServer.Logger.Info((object)(" Server Loaded - ServerID -" + (object)serverId)); try { DetectorServer.TryRefreshDevices(); DetectorServer.MainServer = BcDetectorServer.LoadById(serverId); } catch (Exception ex) { DetectorServer.Logger.Error((object)ex); } DetectorServer._isLoaded = true; }
public static void VideoThread(object device) { BcDevices dev = (BcDevices)device; while (!ExtractorServer.StopFlag) { try { if (!dev.IsActive) { Thread.Sleep(1000); continue; } if (dev.Dsid != Guid.Empty) { ExtractorServer.DetectorClientCallback detectorClientCallback = new ExtractorServer.DetectorClientCallback(); BcDetectorServer ds = BcDetectorServer.LoadById(dev.Dsid); WcfExtensions.Using <DetectorServerClient>(new DetectorServerClient(new InstanceContext((object)detectorClientCallback)), (Action <DetectorServerClient>)(server => { server.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)ds.Ip + ":" + (string)(object)ds.Port + "/CSDetectorServer/DetectorServer"); server.Open(); while (dev.IsActive && !ExtractorServer.StopFlag) { ExtractorServer._logger.Debug((object)string.Format("Request to Detector DevId={0}", (object)dev.Id)); FaceFrame lastFrame = server.GetLastFrame(dev.Id); if (lastFrame == null) { Thread.Sleep(20); } else { ExtractorServer._logger.Debug((object)string.Format("Response from Detector DevId={0} FrameId={1} FrameIndex={2}", (object)dev.Id, (object)lastFrame.FrameId, (object)lastFrame.FrameIndex)); ExtractorServer._faceframes.Enqueue(lastFrame); } } })); } } catch (Exception ex) { ExtractorServer.Logger.Error((object)"Video Thread error ", ex); } Thread.Sleep(1000); } }