Ejemplo n.º 1
0
        public WMIRetriever(WMIContext context, WMIRetrieverOptions options)
        {
            Context = context;
            Options = options;

            m_retrieval_context = new RetrievalContext(Options.Timeout);
        }
Ejemplo n.º 2
0
        public List <EventLogRecord> Retrieve()
        {
            List <EventLogRecord> records   = new List <EventLogRecord>();
            WMIRetrieverOptions   options   = new WMIRetrieverOptions();
            WMIRetriever          retriever = new WMIRetriever(Context, options);

            Stopwatch watch = Stopwatch.StartNew();

            WMIRetriever.RetrievalContext retrieval_context = retriever.Retrieve(null);
            long retrieval = watch.ElapsedMilliseconds;

            watch.Restart();
            if (retrieval_context != null)
            {
                lock (retrieval_context.RetrievedData)
                {
                    retrieval_context.RetrievedData.ForEach(r =>
                    {
                        try
                        {
                            records.Add(new EventLogRecord(r));
                        }
                        catch (Exception)
                        {
                        }
                    });
                }
            }

            //ApplicationEventLog log = new ApplicationEventLog();
            //log.LogInformation($"GenericEventLogCollector: retrieval took {retrieval} ms and building list took {watch.ElapsedMilliseconds} ms for {records.Count} records");

            return(records);
        }
Ejemplo n.º 3
0
 public ApplicationsCollector(CollectorID id, Remote remote_info)
     : base(new WMIContext("Win32_Product", "Name,Version", remote_info),
            new DataCollectorContext(id, ECollectorType.InstalledApplications))
 {
     RetrieverOptions = new WMIRetrieverOptions()
     {
         Timeout = TimeSpan.FromMinutes(3)
     };
 }
Ejemplo n.º 4
0
 public WMIDataCollector(WMIContext wmi_context, DataCollectorContext dc_context)
     : base(dc_context)
 {
     WmiContext       = wmi_context;
     RetrieverOptions = new WMIRetrieverOptions();
 }