Exemple #1
0
        public ScanResult Scan(string filename)
        {
            FileInfo       fileInfo = new FileInfo(filename);
            LoggingSection log      = logging.CreateChild(fileInfo.Name);

            log.Verbose($"Starting {GetType().Name} on {fileInfo.FullName}");
            DateTime  timeStarted = DateTime.Now;
            string    result      = null;
            bool      succeeded;
            Exception exception = null;

            try
            {
                result    = DoScan(fileInfo.FullName, log);
                succeeded = true;
                log.Verbose("Scan was successfull");
            }
            catch (Exception e)
            {
                succeeded = false;
                exception = e;
                log.Warning($"Scan failed: {e.Message}{Environment.NewLine}{e.StackTrace}");
            }
            DateTime timeEnded = DateTime.Now;

            log.Dispose();
            return(new ScanResult(result, fileInfo.FullName, this, timeStarted, timeEnded, succeeded, exception));
        }