protected override void InitializeCustomFileProvider() { var wmiProvider = WmiDataProviderFactory.CreateWmiDataProviderForFileSearching(TargetInfo); var fileProvider = new WindowsFileProvider(TargetInfo, wmiProvider); CustomFileProvider = fileProvider; }
protected override void ConfigureObjectCollector() { if (ItemTypeGenerator == null) { var wmiProvider = WmiDataProviderFactory.CreateWmiDataProviderForFileSearching(TargetInfo); this.ObjectCollector = new FileEffectiveRights53ObjectCollector(wmiProvider); this.ItemTypeGenerator = new FileEffectiveRights53ItemTypeGenerator( new WindowsFileProvider(null, wmiProvider), (FileEffectiveRights53ObjectCollector)ObjectCollector); } }
protected override void ConfigureObjectCollector() { if (base.ObjectCollector == null) { var connectionScope = ((FileConnectionProvider)FileConnectionProvider).ConnectionScope; var newWmiDataProvider = new WmiDataProvider(connectionScope); var newFileProvider = new WindowsFileProvider(TargetInfo) { WmiDataProvider = newWmiDataProvider }; ObjectCollector = new TextFileContentObjectCollector() { FileContentProvider = newFileProvider, TargetInfo = TargetInfo }; FileDataSource = new FileObjectCollector() { WmiDataProvider = newWmiDataProvider }; } if (base.ItemTypeGenerator == null) { var newFileProvider = new WindowsFileProvider(this.TargetInfo) { WmiDataProvider = WmiDataProviderFactory .CreateWmiDataProviderForFileSearching(this.TargetInfo) }; var newOperationEvaluator = new TextFileContentEntityOperationEvaluator(ObjectCollector, newFileProvider, FamilyEnumeration.windows); ItemTypeGenerator = new TextFileContentItemTypeGenerator() { OperationEvaluator = newOperationEvaluator }; } }
public void CollectItemsTest() { var targetInfo = new TargetInfoFactory("10.1.0.176", "", "oval", "M0dul0-0v4l").Create(); var wmiProvider = WmiDataProviderFactory.CreateWmiDataProviderForFileSearching(targetInfo); var objectCollector = new FileEffectiveRights53ObjectCollector(wmiProvider); var start = DateTime.UtcNow; var collectedItems = objectCollector.CollectItems("c:\\windows\\win.ini", ".*", OperationEnumeration.patternmatch); var end = DateTime.UtcNow; var time = end.Subtract(start).Seconds; var start1 = DateTime.UtcNow; var collectedItems1 = objectCollector.CollectItems("c:\\windows\\tsoc.log", ".*", OperationEnumeration.patternmatch); var end1 = DateTime.UtcNow; var time1 = end1.Subtract(start1).Seconds; var start2 = DateTime.UtcNow; var collectedItems2 = objectCollector.CollectItems("c:\\windows\\control.ini", ".*", OperationEnumeration.patternmatch); var end2 = DateTime.UtcNow; var time2 = end2.Subtract(start2).Seconds; Assert.Fail("{0} {1} {2}", time.ToString(), time1.ToString(), time2.ToString()); }