Exemplo n.º 1
0
 /// <summary>
 /// Caller method for the ScanComplete event.
 /// </summary>
 /// <param name="args"></param>
 protected virtual void OnScanCompleted(Hit[] readings)
 {
     ScanComplete?.Invoke(this, new ScanEventArgs()
     {
         Readings = readings, Timestamp = DateTime.Now.Ticks
     });
 }
Exemplo n.º 2
0
        //if the ping is succsessful then run an nmap scan and display the resutls in the results page
        public string LoadNmapScanInBackground(Action completionCallback)
        {
            if (State.SuccessfulPing)
            {
                var DisplayNmap = new NMapScan();
                NmapScanResults = DisplayNmap.RunScan(State.IPAddress).Result;
                //completionCallback();
                ScanComplete.Invoke(this, null);
                return(ScanResult.ToString());
            }

            else
            {
                return("Ping unsuccessful");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Scan the market
        /// </summary>
        private async void ScanMarket()
        {
            var url        = MarketURL;
            var httpClient = new HttpClient();
            var resp       = await httpClient.GetAsync(url);

            dynamic coinModel;

            if (resp.IsSuccessStatusCode)
            {
                var jsondata = await resp.Content.ReadAsStringAsync();

                coinModel = JsonConvert.DeserializeObject <CoinModel>(jsondata);
                ScanComplete?.Invoke(this, new MarketScannerEventArgs(coinModel));
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        private void ListCameras(IEnumerable <ManufacturersManufacturer> mm, string model)
        {
            model = (model ?? "").ToLowerInvariant();
            //find http port
            _discoverer = new URLDiscovery(Uri);

            foreach (var m in mm)
            {
                //scan selected model first
                var cand = m.url.Where(p => p.version.ToLowerInvariant() == model).ToList();
                Scan(cand);
                cand = m.url.Where(p => p.version.ToLowerInvariant() != model).ToList();
                Scan(cand);
                if (_quit)
                {
                    break;
                }
            }

            ScanComplete?.Invoke(this, EventArgs.Empty);
            Finished.Set();
        }
Exemplo n.º 6
0
        public void Scan(bool syncAfterScan = false)
        {
            Files.Clear();

            foreach (var dir in Dirs)
            {
                if (!IO.Directory.Exists(dir))
                {
                    continue;
                }

                foreach (var path in IO.Directory.EnumerateFiles(dir))
                {
                    AddFile(path);
                }
            }

            ScanComplete?.Invoke(this);

            if (syncAfterScan)
            {
                SyncFiles();
            }
        }
Exemplo n.º 7
0
 protected virtual void OnScanComplete()
 {
     ScanComplete?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        private void ListCameras(IEnumerable <ManufacturersManufacturer> mm, string model)
        {
            model = (model ?? "").ToLowerInvariant();
            //find http port
            _discoverer = new URLDiscovery(Uri);

            //check for onvif support first
            int i = 0;

            try
            {
                var httpUri = _discoverer.BaseUri.SetPort(_discoverer.HttpPort);

                //check for this devices
                foreach (var d in Discovery.DiscoveredDevices)
                {
                    if (d.DnsSafeHost == Uri.DnsSafeHost)
                    {
                        httpUri = _discoverer.BaseUri.SetPort(d.Port);
                        break;
                    }
                }

                var onvifurl = httpUri + "onvif/device_service";
                var dev      = new ONVIFDevice(onvifurl, Username, Password);
                if (dev.Profiles != null)
                {
                    foreach (var p in dev.Profiles)
                    {
                        var b = p?.VideoEncoderConfiguration?.Resolution;
                        if (b != null && b.Width > 0)
                        {
                            dev.SelectProfile(i);
                            var co = new ConnectionOption(onvifurl, null, 9, -1, null)
                            {
                                MediaIndex = i
                            };
                            URLFound?.Invoke(this,
                                             new ConnectionOptionEventArgs(co));
                        }
                        i++;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            foreach (var m in mm)
            {
                //scan selected model first
                var cand = m.url.Where(p => p.version.ToLowerInvariant() == model).ToList();
                Scan(cand);
                cand = m.url.Where(p => p.version.ToLowerInvariant() != model).ToList();
                Scan(cand);
                if (_quit)
                {
                    break;
                }
            }

            ScanComplete?.Invoke(this, EventArgs.Empty);
            Finished.Set();
        }
Exemplo n.º 10
0
 protected virtual void OnScanComplete()
 {
     ScanComplete?.Invoke(null, null);
 }
Exemplo n.º 11
0
 private void OnScanner_ScanComplete(object sender, EventArgs e)
 {
     ScanComplete?.Invoke(this, e);
 }
Exemplo n.º 12
0
 private void RaiseScanCompleteEvent(List <ScanHost> hosts)
 {
     ScanComplete?.Invoke(hosts);
 }