private void ListCameras(IEnumerable <ManufacturersManufacturer> m, ref List <Uri> lp) { foreach (var s in m) { var cand = s.url.ToList(); cand = cand.OrderBy(p => p.Source).ToList(); foreach (var u in cand) { Uri addr; Uri audioUri = null; int audioSourceTypeID = -1; addr = Conf.GetAddr(u, Uri, Channel, Username, Password); if (!lp.Contains(addr)) { lp.Add(addr); URLScan?.Invoke(addr, EventArgs.Empty); bool found = Helper.TestAddress(addr, u, Username, Password); if (found) { if (!string.IsNullOrEmpty(u.AudioSource)) { audioUri = Conf.GetAddr(u, Uri, Channel, Username, Password, true); audioSourceTypeID = Conf.GetSourceType(u.AudioSource, 1); } ManufacturersManufacturerUrl u1 = u; URLFound?.Invoke(this, new ConnectionOptionEventArgs(new ConnectionOption(addr, audioUri, Conf.GetSourceType(u1.Source, 2), audioSourceTypeID, u1))); } } if (Quiturlscanner) { ScanComplete?.Invoke(this, EventArgs.Empty); return; } } } ScanComplete?.Invoke(this, EventArgs.Empty); }
private void Scan(List <ManufacturersManufacturerUrl> cand) { if (_quit || cand.Count == 0) { return; } var un = Uri.EscapeDataString(Username); var pwd = Uri.EscapeDataString(Password); foreach (var s in cand) { Uri audioUri = null; int audioSourceTypeID = -1; var addr = _discoverer.GetAddr(s, Channel, un, pwd); if (addr != null && !_lp.Contains(addr)) { _lp.Add(addr); URLScan?.Invoke(addr, EventArgs.Empty); bool found = _discoverer.TestAddress(addr, s, un, pwd); if (found) { if (!string.IsNullOrEmpty(s.AudioSource)) { audioUri = _discoverer.GetAddr(s, Channel, un, pwd, true); audioSourceTypeID = Helper.GetSourceType(s.AudioSource, 1); } ManufacturersManufacturerUrl s1 = s; URLFound?.Invoke(this, new ConnectionOptionEventArgs(new ConnectionOption(addr, audioUri, Helper.GetSourceType(s1.Source, 2), audioSourceTypeID, s1))); } } if (_quit) { return; } } }
private void ListCameras(IEnumerable <ManufacturersManufacturer> m, ref List <Uri> lp) { foreach (var s in m) { var cand = s.url.ToList(); cand = cand.OrderBy(p => p.Source).ToList(); foreach (var u in cand) { Uri addr; Uri audioUri = null; int audioSourceTypeID = -1; switch (u.prefix.ToUpper()) { default: addr = Conf.GetAddr(u, Uri, Channel, Username, Password); if (!lp.Contains(addr)) { lp.Add(addr); URLScan?.Invoke(addr, EventArgs.Empty); if (Helper.TestHttpurl(addr.ToString(), u.cookies, Username, Password)) { if (!string.IsNullOrEmpty(u.AudioSource)) { audioUri = Conf.GetAddr(u, Uri, Channel, Username, Password, true); audioSourceTypeID = Conf.GetSourceType(u.AudioSource, 1); } ManufacturersManufacturerUrl u1 = u; URLFound?.Invoke(this, new ConnectionOptionEventArgs(new ConnectionOption(addr, audioUri, Conf.GetSourceType(u1.Source, 2), audioSourceTypeID, u1))); } } break; case "RTSP://": addr = Conf.GetAddr(u, Uri, Channel, Username, Password); if (!lp.Contains(addr)) { lp.Add(addr); URLScan?.Invoke(addr, EventArgs.Empty); if (Helper.TestRtspurl(addr, Username, Password)) { if (!string.IsNullOrEmpty(u.AudioSource)) { audioUri = Conf.GetAddr(u, Uri, Channel, Username, Password, true); audioSourceTypeID = Conf.GetSourceType(u.AudioSource, 1); } ManufacturersManufacturerUrl u1 = u; URLFound?.Invoke(this, new ConnectionOptionEventArgs(new ConnectionOption(addr, audioUri, Conf.GetSourceType(u1.Source, 2), audioSourceTypeID, u1))); } } break; } if (Quiturlscanner) { break; } } if (Quiturlscanner) { break; } } ScanComplete?.Invoke(this, EventArgs.Empty); }