コード例 #1
0
        public static Dictionary <String, EntityObjectStringType> GetRegistryEntitiesFromObjectType(registry_object registryObject)
        {
            string hiveEntityName = registry_object_ItemsChoices.hive.ToString();
            string keyEntityName  = registry_object_ItemsChoices.key.ToString();
            string nameEntityName = registry_object_ItemsChoices.name.ToString();

            object[] allEntities    = registryObject.Items.ToArray();
            string[] allEntityNames = registryObject.RegistryObjectItemsElementName.Select(i => i.ToString()).ToArray <String>();

            Dictionary <String, EntityObjectStringType> registryEntities = new Dictionary <String, EntityObjectStringType>();

            registryEntities.Add(hiveEntityName, OvalHelper.GetEntityObjectByName(hiveEntityName, allEntities, allEntityNames));
            registryEntities.Add(keyEntityName, OvalHelper.GetEntityObjectByName(keyEntityName, allEntities, allEntityNames));
            registryEntities.Add(nameEntityName, OvalHelper.GetEntityObjectByName(nameEntityName, allEntities, allEntityNames));

            return(registryEntities);
        }
コード例 #2
0
        public static Dictionary <String, EntityObjectStringType> GetFileEffectiveRightsFromObjectType(fileeffectiverights_object fileEffectiveRightsObject)
        {
            string fileNameEntityName = fileeffectiverights_object_ItemsChoices.filename.ToString();
            string pathEntityName     = fileeffectiverights_object_ItemsChoices.path.ToString();
            string trusteeEntityName  = fileeffectiverights_object_ItemsChoices.trustee_name.ToString();

            object[] allEntities    = fileEffectiveRightsObject.Items.ToArray();
            string[] allEntityNames = fileEffectiveRightsObject.FileeffectiverightsObjectItemsElementName.Select(i => i.ToString()).ToArray <String>();

            Dictionary <String, EntityObjectStringType> fileEntities = new Dictionary <String, EntityObjectStringType>();

            fileEntities.Add(fileNameEntityName, OvalHelper.GetEntityObjectByName(fileNameEntityName, allEntities, allEntityNames));
            fileEntities.Add(pathEntityName, OvalHelper.GetEntityObjectByName(pathEntityName, allEntities, allEntityNames));
            fileEntities.Add(trusteeEntityName, OvalHelper.GetEntityObjectByName(trusteeEntityName, allEntities, allEntityNames));

            return(fileEntities);
        }
コード例 #3
0
        public static Dictionary <String, EntityObjectStringType> GetFileEntitiesFromObjectType(
            OVAL.Definitions.ObjectType objectType)
        {
            var filenameEntityName = GetFilenameEntityName(objectType);
            var filepathEntityName = GetFilepathEntityName(objectType);
            var pathEntityName     = GetPathEntityName(objectType);

            object[] allEntities    = GetAllItems(objectType);
            string[] allEntityNames = GetAllElementNames(objectType);

            var fileEntities = new Dictionary <String, EntityObjectStringType>();

            fileEntities.Add(filenameEntityName, OvalHelper.GetEntityObjectByName(filenameEntityName, allEntities, allEntityNames));
            fileEntities.Add(filepathEntityName, OvalHelper.GetEntityObjectByName(filepathEntityName, allEntities, allEntityNames));
            fileEntities.Add(pathEntityName, OvalHelper.GetEntityObjectByName(pathEntityName, allEntities, allEntityNames));

            return(fileEntities);
        }
コード例 #4
0
        public static string GetFullFilePathFromObjectType(Defs::ObjectType objectType)
        {
            var allEntities =
                (objectType is file_object)
                    ? OvalHelper.GetFileEntitiesFromObjectType((file_object)objectType)
                    : OvalHelper.GetFileEffectiveRightsFromObjectType((fileeffectiverights_object)objectType);

            string fullFilePath = string.Empty;

            if (OvalHelper.IsFilePathEntityDefined(allEntities))
            {
                fullFilePath = allEntities[file_object_ItemsChoices.filepath.ToString()].Value;
            }

            if (string.IsNullOrEmpty(fullFilePath))
            {
                string path     = allEntities[file_object_ItemsChoices.path.ToString()].Value;
                string filename = allEntities[file_object_ItemsChoices.filename.ToString()].Value;
                fullFilePath = string.Format(@"{0}\{1}", path, filename);
            }

            return(fullFilePath);
        }