예제 #1
0
        private void SettingDetectionList(UrlScan urlScan)
        {
            Task <List <Detection> > .Factory.StartNew(() =>
            {
                ShowProcess(true);

                List <Detection> detections = new List <Detection>();

                PropertyInfo[] propertyInfos = urlScan.scans.GetType().GetProperties();

                foreach (PropertyInfo propertyInfo in propertyInfos)
                {
                    if (propertyInfo.GetValue(urlScan.scans, null) is IUrlScanInfo fileScanInfo)
                    {
                        string engine = propertyInfo.Name;
                        bool detected = fileScanInfo.detected;
                        string result = fileScanInfo.result?.ToString();

                        detections.Add(Detection.CreateDetection(engine, detected, string.Empty, result, string.Empty));
                    }
                }

                return(detections);
            }).ContinueWith(e =>
            {
                DetectionListView.SetObjects(e.Result);
                ShowProcess(false);
            });
        }
예제 #2
0
        private void SettingDetectionList(FileScan fileScan)
        {
            Task <List <Detection> > .Factory.StartNew(() =>
            {
                ShowProcess(true);

                List <Detection> detections = new List <Detection>();

                PropertyInfo[] propertyInfos = fileScan.scans.GetType().GetProperties();

                foreach (PropertyInfo propertyInfo in propertyInfos)
                {
                    if (propertyInfo.GetValue(fileScan.scans, null) is IFileScanInfo fileScanInfo)
                    {
                        string engine  = propertyInfo.Name;
                        bool detected  = fileScanInfo.detected;
                        string version = fileScanInfo.version;
                        string result  = fileScanInfo.result?.ToString();
                        string update  = fileScanInfo.update;

                        detections.Add(Detection.CreateDetection(engine, detected, version, result, update));
                    }

                    //dynamic DetectionEngineClass = FileScan.scans.GetType().GetProperty(propertyInfo.Name).GetValue(FileScan.scans, null);

                    //if (DetectionEngineClass != null)
                    //{
                    //    string engine = propertyInfo.Name;
                    //    bool detected = DetectionEngineClass.detected;
                    //    string version = DetectionEngineClass.version;
                    //    string result = DetectionEngineClass.result;
                    //    string update = DetectionEngineClass.update;

                    //    detections.Add(Detection.CreateDetection(engine, detected, version, result, update));
                    //}
                }

                return(detections);
            }).ContinueWith(e =>
            {
                DetectionListView.SetObjects(e.Result);
                ShowProcess(false);
            });
        }