示例#1
0
        public void AddMissingDependency(AssemblyInfo sourceAssembly, MemberInfo missingDependency, string recommendedChanges)
        {
            MissingTypeInfo typeInfo;

            try
            {
                var type = _types[Tuple.Create(missingDependency.DefinedInAssemblyIdentity, missingDependency.TypeDocId ?? missingDependency.MemberDocId)];
                typeInfo = new MissingTypeInfo(sourceAssembly, type.MemberDocId, type.TargetStatus, type.RecommendedChanges);
            }
            catch (KeyNotFoundException)
            {
                typeInfo = new MissingTypeInfo(sourceAssembly, missingDependency.TypeDocId ?? missingDependency.MemberDocId, missingDependency.TargetStatus, recommendedChanges);
            }

            // If we already have an entry for this type, get it.
            if (_missingTypes.Any(mt => mt.TypeName == typeInfo.TypeName))
            {
                typeInfo = _missingTypes.First(mt => mt.TypeName == typeInfo.TypeName);
                typeInfo.IncrementUsage(sourceAssembly);
            }
            else
            {
                _missingTypes.Add(typeInfo);
            }

            // If we did not receive a member entry, it means the entire type is missing -- flag it accordingly
            if (missingDependency.MemberDocId.StartsWith("M:", StringComparison.OrdinalIgnoreCase) ||
                missingDependency.MemberDocId.StartsWith("F:", StringComparison.OrdinalIgnoreCase) ||
                missingDependency.MemberDocId.StartsWith("P:", StringComparison.OrdinalIgnoreCase))
            {
                var memberInfo = new MissingMemberInfo(sourceAssembly, missingDependency.MemberDocId, missingDependency.TargetStatus, recommendedChanges);
                typeInfo.AddMissingMember(memberInfo, sourceAssembly);
            }
            else
            {
                typeInfo.MarkAsMissing();
            }
        }
        public void AddMissingDependency(AssemblyInfo SourceAssembly, MemberInfo missingDependency, string recommendedChanges)
        {
            MissingTypeInfo typeInfo;
            try
            {
                var type = _types[Tuple.Create(missingDependency.DefinedInAssemblyIdentity, (missingDependency.TypeDocId ?? missingDependency.MemberDocId))];
                typeInfo = new MissingTypeInfo(SourceAssembly, type.MemberDocId, type.TargetStatus, type.RecommendedChanges);
            }
            catch (KeyNotFoundException)
            {
                typeInfo = new MissingTypeInfo(SourceAssembly, missingDependency.TypeDocId ?? missingDependency.MemberDocId, missingDependency.TargetStatus, recommendedChanges);
            }

            // If we already have an entry for this type, get it.
            if (_missingTypes.Any(mt => mt.TypeName == typeInfo.TypeName))
            {
                typeInfo = _missingTypes.First(mt => mt.TypeName == typeInfo.TypeName);
                typeInfo.IncrementUsage(SourceAssembly);
            }
            else
            {
                _missingTypes.Add(typeInfo);
            }

            // If we did not receive a member entry, it means the entire type is missing -- flag it accordingly
            if (missingDependency.MemberDocId.StartsWith("M:", System.StringComparison.OrdinalIgnoreCase) ||
                missingDependency.MemberDocId.StartsWith("F:", System.StringComparison.OrdinalIgnoreCase) ||
                missingDependency.MemberDocId.StartsWith("P:", System.StringComparison.OrdinalIgnoreCase))
            {
                MissingMemberInfo memberInfo = new MissingMemberInfo(SourceAssembly, missingDependency.MemberDocId, missingDependency.TargetStatus, recommendedChanges);
                typeInfo.AddMissingMember(memberInfo, SourceAssembly);
            }
            else
            {
                typeInfo.MarkAsMissing();
            }
        }
        public override bool Equals(object obj)
        {
            MissingTypeInfo other = obj as MissingTypeInfo;

            return(other != null && StringComparer.Ordinal.Equals(other.TypeName, TypeName));
        }