コード例 #1
0
 public RegistryImporter(
     [Dependency] IConfig config,
     [Dependency] IUserCollection users,
     [Dependency] IRegistryHiveCollection registryHives,
     [Dependency] IShellItemCollection shellItems,
     [Dependency] IShellItemFactory shellFactory
     )
 {
     Config        = config;
     Users         = users;
     RegistryHives = registryHives;
     ShellItems    = shellItems;
     ShellFactory  = shellFactory;
 }
コード例 #2
0
        public OverviewModule([Dependency] IShellEventCollection shellEvents, [Dependency] IShellItemCollection shellItems)
        {
            ShellEvents = shellEvents;

            PieModel = new PlotModel {
                Title = "ShellEvents"
            };

            OxyPlot.Series.PieSeries seriesP1 = new OxyPlot.Series.PieSeries {
                FontSize = 12, ExplodedDistance = 0.1, StrokeThickness = 2.0, InsideLabelPosition = 0.6, AngleSpan = 360, StartAngle = 0, InnerDiameter = 0.4
            };

            int OtherCount = 0;

            foreach (string type in shellEvents.FilteredView.OfType <IShellEvent>().Select(e => e.GetType()).Distinct().Select(t => t.Name))
            {
                if (((double)shellEvents.FilteredView.OfType <IShellEvent>().Where(e => (e.GetType().Name == type) == true).Count() / shellEvents.FilteredView.OfType <IShellEvent>().Count()) * 100 > 5)
                {
                    seriesP1.Slices.Add(new PieSlice(type.Replace("Event", ""), shellEvents.FilteredView.OfType <IShellEvent>().Where(e => (e.GetType().Name == type) == true).Count())
                    {
                        IsExploded = true
                    });
                }
                else
                {
                    OtherCount += shellEvents.FilteredView.OfType <IShellEvent>().Where(e => (e.GetType().Name == type) == true).Count();
                }
            }
            seriesP1.Slices.Add(new PieSlice("Other", OtherCount)
            {
                IsExploded = true
            });

            if (shellEvents.FilteredView.OfType <IShellEvent>().Any())
            {
                BeginDate = shellEvents.FilteredView.OfType <IShellEvent>().OrderBy(e => e.TimeStamp).First().TimeStamp.Date.ToString("MM-dd-yyyy");
                EndDate   = shellEvents.FilteredView.OfType <IShellEvent>().OrderBy(e => e.TimeStamp).Last().TimeStamp.Date.ToString("MM-dd-yyyy");
            }

            ShellbagsCount = shellItems.Count;
            EventsCount    = shellEvents.FilteredView.OfType <IShellEvent>().Count();

            PieModel.Series.Add(seriesP1);
        }