예제 #1
0
        private void ProcessResults(FileType fileType)
        {
            var ratingsReader = new MetadataSecurityRatingsReader(fileType);
            foreach (string key in ratingsReader.RiskElements.Keys)
            {
                var metadataType = (MetadataType)Enum.Parse(typeof(MetadataType), key, true);
                if (!FileTypeHelper.IsSupportedRiskElements(fileType, metadataType))
                    continue;

                MetadataSecurityRatingsReader.RiskRatingType rating = ratingsReader.RiskElements[key];
                
                var metadataItemsForType = DiscoveryResult.GetItemsForType(metadataType);
                if (metadataItemsForType == null)
                    continue;

                if (metadataItemsForType.Count == 0)
                    continue;

                var items = metadataItemsForType.ToList().ConvertAll(input => new MetadataItemWrapper(input));

                switch (metadataType)
                {
                    case MetadataType.Field:
                    {
                        IgnoredFieldCount = RemoveExcludedFields(items);
                        IgnoredFieldCount += RemoveIgnoredFields(items);
                        break;
                    }
                    case MetadataType.TrackedChange:
                    {
                        RemoveTrackChangesWithNoContent(items);
                        break;
                    }
                    case MetadataType.BuiltInProperty:
                    {
                        RemoveCleanedProperties(items);
                        break;
                    }
                    case MetadataType.DocumentStatistic:
                    {
                        RemoveCleanedStatistics(items);
                        break;
                    }
                    case MetadataType.Properties:
                    {
                        RemoveCleanedPdfProperties(items);
                        break;
                    }
                    case MetadataType.Footnote:
                    {
                        if (!PolicyBridge.TreatFootNotesAsMetadata())
                        {
                            continue;
                        }
                        break;
                    }
                    case MetadataType.SmartTag:
                    {
                        if (Globals.Application != null && OutlookVersion.Convert(Globals.Application.Version) > OutlookVersion.Version.Outlook2010)
                        {
                            //Not supported in Office 2013
                            continue;
                        }
                        break;
                    }
                    case MetadataType.Header:
                    case MetadataType.Footer:
                    {
                        if (!FileTypeHelper.IsExcel(fileType) && !FileTypeHelper.IsPowerPoint(fileType))
                        {
                            // We clean these for Excel and PowerPoint only
                            continue;
                        }
                        break;
                    }
                }

                CategorizeResults(items, rating, metadataType);
            }
        }
예제 #2
0
        private void CategorizeResults(List<MetadataItemWrapper> items, MetadataSecurityRatingsReader.RiskRatingType rating, MetadataType metadataType)
        {
            if (items.Count > 0)
            {
                switch (rating)
                {
                    case MetadataSecurityRatingsReader.RiskRatingType.High:
                        {
                            High.Add(metadataType, items.Count);
                            break;
                        }
                    case MetadataSecurityRatingsReader.RiskRatingType.Medium:
                        {
                            Medium.Add(metadataType, items.Count);
                            break;
                        }

                    case MetadataSecurityRatingsReader.RiskRatingType.Low:
                        {
                            Low.Add(metadataType, items.Count);
                            break;
                        }
                }
            }
        }