當前位置: 首頁>>代碼示例>>C#>>正文


C# SystemCharacteristics.ItemType類代碼示例

本文整理匯總了C#中Modulo.Collect.OVAL.SystemCharacteristics.ItemType的典型用法代碼示例。如果您正苦於以下問題:C# ItemType類的具體用法?C# ItemType怎麽用?C# ItemType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ItemType類屬於Modulo.Collect.OVAL.SystemCharacteristics命名空間,在下文中一共展示了ItemType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Modulo.Collect.OVAL.SystemCharacteristics.ItemType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。