Пример #1
0
        private void OnAnalyzerEvent(AnalyzerEvent ae)
        {
            switch (ae.type)
            {
            case AnalyzerEvent.EType.Added:
                ion.SaveAnalyzerAsync();
                break;

            case AnalyzerEvent.EType.ManifoldAdded:
                ion.SaveAnalyzerAsync();
                break;

            case AnalyzerEvent.EType.ManifoldRemoved:
                ion.SaveAnalyzerAsync();
                break;

            case AnalyzerEvent.EType.Removed:
                ion.SaveAnalyzerAsync();
                break;

            case AnalyzerEvent.EType.Swapped:
                ion.SaveAnalyzerAsync();
                break;
            }
        }
Пример #2
0
        private void OnAnalyzerEvent(AnalyzerEvent e)
        {
            switch (e.type)
            {
            case AnalyzerEvent.EType.Added:
            case AnalyzerEvent.EType.Removed:
            case AnalyzerEvent.EType.Swapped:
            case AnalyzerEvent.EType.ManifoldAdded:
            case AnalyzerEvent.EType.ManifoldRemoved:
                SaveAnalyzerAsync();
                break;

            case AnalyzerEvent.EType.ManifoldEvent: {
                switch (e.manifoldEvent.type)
                {
                case ManifoldEvent.EType.SecondarySensorAdded:
                case ManifoldEvent.EType.SecondarySensorRemoved:
                case ManifoldEvent.EType.SensorPropertySwapped:
                case ManifoldEvent.EType.SensorPropertyAdded:
                case ManifoldEvent.EType.SensorPropertyRemoved:
                    SaveAnalyzerAsync();
                    break;
                }
                break;
            } // AnalyzerEvent.EType.ManifoldEvent
            }
        }
 private void OnAnalyzerEvent(AnalyzerEvent e)
 {
     switch (e.type)
     {
     case AnalyzerEvent.EType.Added:
     case AnalyzerEvent.EType.Removed:
         handler.Post(InvalidateLocation);
         break;
     }
 }
Пример #4
0
        private void Analyze(string URI, int Depth)
        {
            try
            {
                string          pagestring = null;
                Uri             uri        = new Uri(URI);
                HttpWebRequest  request    = (HttpWebRequest)WebRequest.Create(URI);
                HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    Stream       receiveStream = response.GetResponseStream();
                    StreamReader readStream    = null;
                    if (String.IsNullOrWhiteSpace(response.CharacterSet))
                    {
                        readStream = new StreamReader(receiveStream);
                    }
                    else
                    {
                        readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
                    }
                    pagestring = readStream.ReadToEnd();
                    response.Close();
                    readStream.Close();
                }

                Regex emailregex = new Regex(@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", RegexOptions.IgnoreCase);
                Match emailmatch = emailregex.Match(pagestring);
                while (emailmatch.Success)
                {
                    AnalyzerEvent?.Invoke(URI, Depth, emailmatch.Value);
                    emailmatch = emailmatch.NextMatch();
                }
                if (Depth > 0)
                {
                    Regex hrefregex = new Regex("(href\\s*=\\s*(?:\"|')(.*?)(?:\"|'))", RegexOptions.IgnoreCase);
                    Match hrefmatch;
                    hrefmatch = hrefregex.Match(pagestring);
                    while (hrefmatch.Success)
                    {
                        string href = hrefmatch.Value.Substring(5).Trim('"', ' ');
                        if (href.StartsWith("/ru/"))
                        {
                            href = uri.GetLeftPart(UriPartial.Authority) + href;
                        }
                        if (href.Contains("susu.ru/ru/") && href != URI)
                        {
                            Analyze(href, Depth - 1);
                        }
                        hrefmatch = hrefmatch.NextMatch();
                    }
                }
            }
            catch {}
        }
Пример #5
0
        private void OnAnalyzerEvent(AnalyzerEvent e)
        {
            switch (e.type)
            {
            case AnalyzerEvent.EType.Added:
            case AnalyzerEvent.EType.Removed:
                handler.Post(() => {
                    var index = IndexOfSensor(e.sensor);

                    if (index >= 0)
                    {
                        NotifyItemChanged(index);
                    }
                });
                break;
            }
        }