• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SystemCharacteristics.ItemType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Modulo.Collect.OVAL.SystemCharacteristics.ItemType的典型用法代码示例。如果您正苦于以下问题:C# ItemType类的具体用法?C# ItemType怎么用?C# ItemType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ItemType类属于Modulo.Collect.OVAL.SystemCharacteristics命名空间,在下文中一共展示了ItemType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var metabaseItem = (metabase_item)systemItem;

            try
            {
                if (string.IsNullOrWhiteSpace(MetabaseFileContent) || string.IsNullOrWhiteSpace(MetabaseSchemaContent))
                    throw new Exception(METABASE_CONTENT_NOT_FOUND_MSG);
                
                var metabaseSession = GetMetabaseProperty(metabaseItem.key.Value, metabaseItem.id1.Value);
                metabaseItem.data = CreateMetabaseEntityItemFromMetabaseDataProperty(metabaseSession.Value);
                
                if ((metabaseItem.data.Length == 1) && (metabaseItem.data[0].status == StatusEnumeration.doesnotexist))
                {
                    metabaseItem.status = StatusEnumeration.doesnotexist;
                    metabaseItem.id1.status = StatusEnumeration.doesnotexist;
                    metabaseItem.name = null;
                    metabaseItem.data_type = null;
                    metabaseItem.user_type = null;
                }
                else
                {
                    metabaseItem.name = CreateMetabaseEntityFromMetabaseProperty(metabaseSession.Name);
                    metabaseItem.data_type = CreateMetabaseEntityFromMetabaseProperty(metabaseSession.Type);
                    metabaseItem.user_type = CreateMetabaseEntityFromMetabaseProperty(metabaseSession.UserType);
                }
            }
            catch (MetabaseItemNotFoundException)
            {
                metabaseItem.status = StatusEnumeration.doesnotexist;
                metabaseItem.key.status = metabaseItem.status;
            }   
         
            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:35,代码来源:MetabaseObjectCollector.cs


示例2: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            if (systemItem.status.Equals(StatusEnumeration.notcollected))
            {
                var userToBeCollected = ((user_item)systemItem).user.Value;
                try
                {
                    var collectedUser = this.WindowsAccountProvider.GetUserByName(userToBeCollected);
                    systemItem = new user_item()
                    {
                        status = StatusEnumeration.exists,
                        user = OvalHelper.CreateItemEntityWithStringValue(collectedUser.Name),
                        enabled = OvalHelper.CreateBooleanEntityItemFromBoolValue((bool)collectedUser.Enabled),
                    };

                    var userGroups = this.WindowsAccountProvider.GetUserGroups(userToBeCollected, AccountSearchReturnType.Name);
                    if (userGroups.Count() > 0)
                        ((user_item)systemItem).group = userGroups.Select(grp => new EntityItemStringType() { Value = grp }).ToArray();
                    else
                        ((user_item)systemItem).group = new EntityItemStringType[] { new EntityItemStringType() { status = StatusEnumeration.doesnotexist } };
                }
                catch (WindowsUserNotFound)
                {
                    systemItem.status = StatusEnumeration.doesnotexist;
                    ((user_item)systemItem).user.status = systemItem.status;
                }
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:ywcsz,项目名称:modSIC,代码行数:30,代码来源:UserObjectCollector.cs


示例3: CreateCollectedItemsWithOneErrorItem

 public IEnumerable<CollectedItem> CreateCollectedItemsWithOneErrorItem(
     ItemType itemType, IEnumerable<ProbeLogItem> logItems, string errorMessage)
 {
     itemType.message = MessageType.FromErrorString(errorMessage);
     itemType.status = StatusEnumeration.error;
     return CreateCollectedItems(itemType, logItems);
 }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:7,代码来源:ItemTypeHelper.cs


示例4: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var filePath = string.Empty;
            try
            {
                var fileContentItem = (textfilecontent_item)systemItem;
                filePath = Path.Combine(fileContentItem.path.Value, fileContentItem.filename.Value);
                var interimList = WinNetUtils.getWinTextFileContent(hostUNC, filePath, fileContentItem.line.Value);

                var collectedItems = new List<CollectedItem>();
                foreach (FileContentItemSystemData srcItem in interimList)
                {
                    var destItem = new textfilecontent_item();
                    this.BuilderFileContentItem(destItem, srcItem, fileContentItem);
                    var newCollectedItem = new CollectedItem() { ItemType = destItem, ExecutionLog = BuildExecutionLog() };
                    collectedItems.Add(newCollectedItem);
                }

                return collectedItems;
            }
            catch (FileNotFoundException)
            {
                base.SetDoesNotExistStatusForItemType(systemItem, filePath);
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:27,代码来源:FileContentSystemDataSource.cs


示例5: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            if (systemItem.status.Equals(StatusEnumeration.notcollected))
            {
                var userSIDItem = ((user_sid_item)systemItem);
                try
                {
                    var allUsers = this.WindowsAccountProvider.GetAllGroupByUsers();
                    var userSidValue = userSIDItem.user_sid.Value;
                    
                    var collectedUserItem = allUsers.Where(user => user.AccountSID.Equals(userSidValue)).FirstOrDefault();
                    if (collectedUserItem == null)
                        throw new UserSIDNotFoundException(userSidValue);

                    systemItem.status = StatusEnumeration.exists;
                    userSIDItem.enabled = OvalHelper.CreateBooleanEntityItemFromBoolValue((bool)collectedUserItem.Enabled);
                    userSIDItem.group_sid = new EntityItemStringType[] { new EntityItemStringType() { status = StatusEnumeration.doesnotexist } };
                    if ((collectedUserItem.Members != null) && (collectedUserItem.Members.Count() > 0))
                        userSIDItem.group_sid =
                            collectedUserItem.Members.Select(grp => OvalHelper.CreateItemEntityWithStringValue(grp.AccountSID)).ToArray();
                }
                catch (UserSIDNotFoundException)
                {
                    SetDoesNotExistStatusForItemType(systemItem, userSIDItem.user_sid.Value);
                    ((user_sid_item)systemItem).user_sid.status = StatusEnumeration.doesnotexist;
                }
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:30,代码来源:UserSID55ObjectCollector.cs


示例6: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            this.CreateSMFCollectorInstance();

            var smfItem = (smf_item)systemItem;

            try
            {
                var collectedSmf = this.TryToCollectSMF(smfItem.fmri.Value);
                smfItem.service_name = OvalHelper.CreateItemEntityWithStringValue(collectedSmf.ServiceName);
                smfItem.service_state = new EntityItemSmfServiceStateType() { Value = collectedSmf.ServiceState };
                smfItem.protocol = new EntityItemSmfProtocolType() { Value = collectedSmf.Protocol };
                smfItem.server_executable = OvalHelper.CreateItemEntityWithStringValue(collectedSmf.ServerExecutable);
                smfItem.server_arguements = OvalHelper.CreateItemEntityWithStringValue(collectedSmf.ServerArgs);
                smfItem.exec_as_user = OvalHelper.CreateItemEntityWithStringValue(collectedSmf.ExecAsUser);
            }
            catch (NoSMFDataException)
            {
                ExecutionLogBuilder.AddInfo("An error occurred while trying to collect smf_object");
                smfItem.status = StatusEnumeration.error;
                smfItem.message = MessageType.FromErrorString("The fmri format is invalid.");
                smfItem.fmri.status = StatusEnumeration.error;
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(smfItem, BuildExecutionLog());
        }
开发者ID:JorgeHudson,项目名称:modSIC,代码行数:26,代码来源:SMFObjectCollector.cs


示例7: collectDataForSystemItem

 protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
 {
     var xmlFilepath = string.Empty;
     var xmlFileContentItem = (xmlfilecontent_item)systemItem;
     
     try
     {
         xmlFilepath = this.GetCompleteFilepath(xmlFileContentItem);
         if (string.IsNullOrWhiteSpace(xmlFilepath))
             throw new XPathNoResultException();
         var xPathResult = this.XPathOperator.Apply(xmlFilepath, xmlFileContentItem.xpath.Value);
         this.ConfigureXmlFileContentItem(xmlFileContentItem, xPathResult);
     }
     catch (FileNotFoundException)
     {
         var completeFilepath = this.GetCompleteFilepath((xmlfilecontent_item)xmlFileContentItem);
         base.SetDoesNotExistStatusForItemType(systemItem, completeFilepath);
     }
     catch (XPathNoResultException)
     {
         var xpath = string.Format("xpath: '{0}'", xmlFileContentItem.xpath.Value);
         base.SetDoesNotExistStatusForItemType(systemItem, xpath);
     }
     
     return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
 }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:26,代码来源:XmlFileContentObjectCollector.cs


示例8: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var registryItem = (registry_item)systemItem;
            var fullKeyPath = Path.Combine(registryItem.hive.Value, registryItem.key.Value, registryItem.name.Value);
            var itemBuilder = new RegistryItemTypeBuilder(registryItem);
            
            try
            {
                base.ExecutionLogBuilder.CollectingDataFrom(fullKeyPath);
                if (this.IsAllEntitiesIsSet(systemItem))
                {
                    var collectedSystemData = this.collectSystemDataForRegistryItem(registryItem);
                    itemBuilder.FillItemTypeWithData(collectedSystemData);
                }
            }
            catch (RegistryKeyNotFoundException)
            {
                base.ExecutionLogBuilder.Warning(string.Format("The registry key {0} is not found ", registryItem.key.Value));
                itemBuilder.SetRegistryKeyStatus(StatusEnumeration.doesnotexist);
                itemBuilder.SetItemTypeStatus(StatusEnumeration.doesnotexist, null);
                itemBuilder.ClearRegistryName();
            }
            catch (RegistryNameNotFoundException)
            {
                base.ExecutionLogBuilder.Warning(string.Format("The registry name {0} is not found ", registryItem.name.Value));
                itemBuilder.SetRegistryNameStatus(StatusEnumeration.doesnotexist);
                itemBuilder.SetItemTypeStatus(StatusEnumeration.doesnotexist, null);
            }

            itemBuilder.BuildItemType();
            itemBuilder.ClearEntitiesWithEmptyValueIfStatusDoesNotExists();
            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(itemBuilder.BuiltItemType, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:33,代码来源:RegistryObjectCollector.cs


示例9: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var filepath   = string.Empty;
            var trusteeSID = string.Empty;

            try
            {
                filepath = ((fileauditedpermissions_item)systemItem).filepath.Value;
                trusteeSID = ((fileauditedpermissions_item)systemItem).trustee_sid.Value;
                base.ExecutionLogBuilder.AddInfo(string.Format(TRYING_TO_COLLECT_AUDITED_PERMISSIONS_LOG, trusteeSID, filepath));

                CreateFileAuditedPermissions53ItemType((fileauditedpermissions_item)systemItem, filepath, trusteeSID);
                var SACLs = this.CollectSecurityDescriptorForFileAndUser(filepath, trusteeSID);
                MapSACLsToFileAuditedPermissionsItem((fileauditedpermissions_item)systemItem, SACLs);
            }
            catch (InvalidInvokeMethodException)
            {
                base.SetDoesNotExistStatusForItemType(systemItem, filepath);
                this.SetAllAuditEntitiesItemToNULL((fileauditedpermissions_item)systemItem);
            }
            catch (ACLNotFoundException)
            {
                base.SetDoesNotExistStatusForItemType(systemItem, trusteeSID);
            }
            catch (Exception ex)
            {
                this.SetAllAuditEntitiesItemToEMPTY((fileauditedpermissions_item)systemItem);
                throw ex;
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:ywcsz,项目名称:modSIC,代码行数:32,代码来源:FileAuditedPermissionsObjectCollector.cs


示例10: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            this.CreateWmiDataProviderFromWmiItem((wmi_item)systemItem);
            var wmiResult = this.WmiDataProvider.ExecuteWQL(((wmi_item)systemItem).wql.Value);
            ((wmi_item)systemItem).result = this.ConvertWmiResultToEntityItemList(wmiResult);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:8,代码来源:WMIObjectCollector.cs


示例11: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            base.ExecutionLogBuilder.CollectingDataFrom(TargetHostName);
            var collectedPasswordPolicies = PasswordPolicyHelper.getUserModalsInfo0(TargetHostName);
            this.MapPasswrodPolicyToPasswordPolicyItemType((passwordpolicy_item)systemItem, collectedPasswordPolicies);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, base.BuildExecutionLog());
        }
开发者ID:ywcsz,项目名称:modSIC,代码行数:8,代码来源:PasswordPolicyObjectCollector.cs


示例12: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            base.ExecutionLogBuilder.CollectingDataFrom("Family Object");

            var collectedFamily = this.FamilyCollector.GetOperatingSystemFamily();
            ((family_item)systemItem).family = new EntityItemFamilyType() { Value = collectedFamily };

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:9,代码来源:FamilyObjectCollector.cs


示例13: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var commandOutput = UnameCollector.RunUnameCommand();

            UnixTerminalParser
                .MapUnameCommandOutputToUnameItem((uname_item)systemItem, commandOutput);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:JorgeHudson,项目名称:modSIC,代码行数:9,代码来源:UnameObjectCollector.cs


示例14: AssertItemTypeWithErrorStatus

 public static void AssertItemTypeWithErrorStatus(ItemType itemToAssert, string expectedChunkOfMessageTypeValue)
 {
     Assert.AreEqual(StatusEnumeration.error, itemToAssert.status, "Unexpected item status was found.");
     if (!string.IsNullOrEmpty(expectedChunkOfMessageTypeValue))
     {
         Assert.IsNotNull(itemToAssert.message, "The message type was not created.");
         Assert.IsTrue(itemToAssert.message.First().Value.Contains(expectedChunkOfMessageTypeValue));
     }
 }
开发者ID:ywcsz,项目名称:modSIC,代码行数:9,代码来源:ItemTypeChecker.cs


示例15: AssertItemsWithExistsStatus

 public static void AssertItemsWithExistsStatus(ItemType[] itemsToAssert, int expectedItemCount, Type expectedTypeInstanceOfItems)
 {
     Assert.AreEqual(expectedItemCount, itemsToAssert.Count(), "Unexpected system data items count was found.");
     foreach (var itemType in itemsToAssert) 
     {
         Assert.IsInstanceOfType(itemType, expectedTypeInstanceOfItems, "An item with unexpected instance type was found.");
         Assert.AreEqual(StatusEnumeration.exists, itemType.status, "An item with unexpected status was found.");
     }
 }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:9,代码来源:WindowsTestHelper.cs


示例16: SetDoesNotExistStatusForItemType

        protected void SetDoesNotExistStatusForItemType(ItemType systemItem, string itemIdentifier)
        {
            systemItem.status = StatusEnumeration.doesnotexist;

            if (!string.IsNullOrEmpty(itemIdentifier))
            {
                var messageToLog = string.Format(ITEM_NOT_FOUND_LOG_MESSAGE, ObjectCollectorName, itemIdentifier);
                this.ExecutionLogBuilder.AddInfo(messageToLog);
            }
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:10,代码来源:BaseObjectCollector.cs


示例17: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            base.ExecutionLogBuilder.CollectingDataFrom(TargetHostName);
            var securityPrincipleEntity = ((accesstoken_item)systemItem).security_principle;
            
            var collectedAccessToken = this.AccessTokenProvider.GetAccessTokens(this.TargetHostName, securityPrincipleEntity.Value);
            new AccessTokenItemTypeBuilder().FillItemTypeWithData((accesstoken_item)systemItem, collectedAccessToken);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:10,代码来源:AccessTokenObjectCollector.cs


示例18: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            if (this.AuditEventPolicyHelper == null)
                this.AuditEventPolicyHelper = new AuditEventPolicyHelper(this.TargetInfo);

            var auditEventPolicySubcategories = this.AuditEventPolicyHelper.GetAuditEventSubcategoriesPolicy(this.TargetInfo);

            this.MapAuditEventSubcategoriesDictionaryToItemType(auditEventPolicySubcategories, (auditeventpolicysubcategories_item)systemItem);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:11,代码来源:AuditEventPolicySubcategoriesObjectCollector.cs


示例19: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            CreateAuditEventPolicyHelper();
            var itemTypeBuilder = new AuditEventPolicyItemTypeBuilder(systemItem);

            var auditEventPolicies = this.AuditEventPolicyHelper.GetAuditEventPolicies(this.TargetInfo);
            itemTypeBuilder.FillItemTypeWithData(auditEventPolicies);
            itemTypeBuilder.SetItemTypeStatus(StatusEnumeration.exists, null);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(itemTypeBuilder.BuiltItemType, BuildExecutionLog());
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:11,代码来源:AuditEventPolicyObjectCollector.cs


示例20: collectDataForSystemItem

        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            try
            {
                string trusteeSID = ((sid_sid_item)systemItem).trustee_sid.Value;
                base.ExecutionLogBuilder.CollectingDataFrom(trusteeSID);
                this.collectSidItemSystemData((sid_sid_item)systemItem);
            }
            catch (KeyNotFoundException)
            {
                SetTrusteeSIDEntityStatus((sid_sid_item)systemItem, StatusEnumeration.doesnotexist);
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
开发者ID:ywcsz,项目名称:modSIC,代码行数:15,代码来源:SID_SIDObjectCollector.cs



注:本文中的Modulo.Collect.OVAL.SystemCharacteristics.ItemType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.BankAccountDetails类代码示例发布时间:2022-05-26
下一篇:
C# Vector结构体代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap