コード例 #1
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public ThinMember(ThinType declaringType, string memberName, string returnType, MemberTypes memberType,
                          IncludeStatus includeStatus, ITypeDefinitionMember memberNode, VisibilityOverride visibility)

            : this(declaringType, memberName, returnType, memberType,
                   includeStatus, memberNode, visibility, SecurityTransparencyStatus.Transparent)
        {
        }
コード例 #2
0
 public TrimType(String typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     _typeName                   = typeName;
     _typeMembers                = new Dictionary <string, MemberElement>();
     _includeStatus              = includeStatus;
     _visibilityOverride         = visibilityOverride;
     _securityTransparencyStatus = securityTransparencyStatus;
 }
コード例 #3
0
        internal CodeTypeElement(IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus, string key)
        {
            m_members = new Dictionary <string, MemberElement>();

            _includeStatus              = includeStatus;
            _visibilityOverride         = visibilityOverride;
            _securityTransparencyStatus = securityTransparencyStatus;
            _key = key;
        }
コード例 #4
0
 public CodeMemberElement(IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus, string key, string returnType, MemberTypes memberType, string name)
 {
     _includeStatus              = includeStatus;
     _visibilityOverride         = visibilityOverride;
     _securityTransparencyStatus = securityTransparencyStatus;
     _key        = key;
     _returnType = returnType;
     _memberType = memberType;
     _name       = name;
 }
コード例 #5
0
ファイル: ModelFileReader.cs プロジェクト: dsgouda/buildtools
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            // Identify the member by category (method/prop/field/event), name, and return type.  These
            // strings are what matched by ModelSigFormatter

            string memberSig = memberType.ToString() + " : " + memberName;
            if (returnType != null) memberSig = memberSig + " : " + returnType;

            CodeMemberElement member = new CodeMemberElement(includeStatus, visibilityOverride, securityTransparencyStatus, memberSig, returnType, memberType, memberName);
            (type as CodeTypeElement).m_members.Add(memberSig, member);
            return member;
        }
コード例 #6
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public ThinMember(ThinType declaringType, ThinMember memberToCopy)
        {
            _declaringType = declaringType;

            _memberNode = memberToCopy._memberNode;
            _memberFullName = memberToCopy._memberFullName;
            _returnType = memberToCopy._returnType;
            _memberType = memberToCopy._memberType;
            _includeStatus = memberToCopy._includeStatus;
            _visibility = memberToCopy._visibility;
            _securityTransparencyStatus = memberToCopy._securityTransparencyStatus;

            CheckVisibility();
        }
コード例 #7
0
 public TrimMember(TrimType declaringType, string memberName, string returnType, /*string paramListString, */ MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     _declaringType = declaringType;
     _memberName    = memberName;
     _returnType    = returnType;
     _memberType    = memberType;
     _includeStatus = includeStatus;
     _securityTransparencyStatus = securityTransparencyStatus;
     //_paramListString = paramListString;
     //if (null == paramListString)
     //    _paramQualifiedTypeNames = new List<string>();
     //else
     //    _paramQualifiedTypeNames = SplitParameterList(paramListString);
     _visibilityOverride = visibilityOverride;
 }
コード例 #8
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public ThinMember(ThinType declaringType, string memberName, string returnType, MemberTypes memberType,
                          IncludeStatus includeStatus, ITypeDefinitionMember memberNode, VisibilityOverride visibility,
                          SecurityTransparencyStatus securityTransparencyStatus)
        {
            _memberNode = memberNode;
            _declaringType = declaringType;
            _returnType = returnType;
            _memberType = memberType;
            _includeStatus = includeStatus;
            _visibility = visibility;
            _securityTransparencyStatus = securityTransparencyStatus;

            _memberFullName = memberName;

            CheckVisibility();
        }
コード例 #9
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public ThinMember(ThinType declaringType, ITypeDefinitionMember member, IncludeStatus includeStatus, VisibilityOverride visibility)
        {
            _declaringType = declaringType;

            _memberNode = member;
            _memberType = Util.TypeMemberType(member);
            _returnType = Util.GetConversionOperatorReturnType(member);
            _memberFullName = Util.GetMemberSignature(member, false);

            // Remove the trailing return type for conversion operators
            if (_returnType != null)
            {
                string suffix = " : " + _returnType;
                if (_memberFullName.EndsWith(suffix))
                    _memberFullName = _memberFullName.Substring(0, _memberFullName.Length - suffix.Length);
            }

            _includeStatus = includeStatus;
            _visibility = visibility;
            _securityTransparencyStatus = SecurityTransparencyStatus.Transparent;

            CheckVisibility();
        }
コード例 #10
0
ファイル: CodeModel.cs プロジェクト: natemcmaster/buildtools
        internal CodeTypeElement(IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus, string key)
        {
            m_members = new Dictionary<string, MemberElement>();

            _includeStatus = includeStatus;
            _visibilityOverride = visibilityOverride;
            _securityTransparencyStatus = securityTransparencyStatus;
            _key = key;
        }
コード例 #11
0
ファイル: IncludeSet.cs プロジェクト: TerabyteX/buildtools
        public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            TrimAssembly trimAssembly = (TrimAssembly)assembly;

            TrimType typeIncludeInfo = new TrimType(typeName, includeStatus, visibilityOverride, securityTransparencyStatus);
            trimAssembly.Types.Add(typeIncludeInfo.Key, typeIncludeInfo);
            return typeIncludeInfo;
        }
コード例 #12
0
ファイル: IncludeSet.cs プロジェクト: TerabyteX/buildtools
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            TrimType typeInfo = (TrimType)type;

            TrimMember id = new TrimMember(typeInfo, memberName, returnType, /*paramListString, */memberType, includeStatus, visibilityOverride, securityTransparencyStatus);
            typeInfo.Members.Add(id.Key, id);
            return id;
        }
コード例 #13
0
ファイル: IncludeSet.cs プロジェクト: TerabyteX/buildtools
 public TrimType(String typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     _typeName = typeName;
     _typeMembers = new Dictionary<string, MemberElement>();
     _includeStatus = includeStatus;
     _visibilityOverride = visibilityOverride;
     _securityTransparencyStatus = securityTransparencyStatus;
 }
コード例 #14
0
ファイル: IncludeSet.cs プロジェクト: TerabyteX/buildtools
 public TrimMember(TrimType declaringType, string memberName, string returnType, /*string paramListString, */MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     _declaringType = declaringType;
     _memberName = memberName;
     _returnType = returnType;
     _memberType = memberType;
     _includeStatus = includeStatus;
     _securityTransparencyStatus = securityTransparencyStatus;
     //_paramListString = paramListString;
     //if (null == paramListString)
     //    _paramQualifiedTypeNames = new List<string>();
     //else
     //    _paramQualifiedTypeNames = SplitParameterList(paramListString);
     _visibilityOverride = visibilityOverride;
 }
コード例 #15
0
ファイル: ModelFileReader.cs プロジェクト: dsgouda/buildtools
 public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
 {
     CodeTypeElement type = new CodeTypeElement(includeStatus, visibilityOverride, securityTransparencyStatus, typeName);
     (assembly as CodeAssemblyElement).m_types.Add(typeName, type);
     return type;
 }
コード例 #16
0
        public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            TrimAssembly trimAssembly = (TrimAssembly)assembly;

            TrimType typeIncludeInfo = new TrimType(typeName, includeStatus, visibilityOverride, securityTransparencyStatus);

            trimAssembly.Types.Add(typeIncludeInfo.Key, typeIncludeInfo);
            return(typeIncludeInfo);
        }
コード例 #17
0
 abstract public TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus);
コード例 #18
0
ファイル: XmlImporter.cs プロジェクト: TerabyteX/buildtools
 abstract public TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus);
コード例 #19
0
        public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            CodeTypeElement type = new CodeTypeElement(includeStatus, visibilityOverride, securityTransparencyStatus, typeName);

            (assembly as CodeAssemblyElement).m_types.Add(typeName, type);
            return(type);
        }
コード例 #20
0
ファイル: CodeModel.cs プロジェクト: natemcmaster/buildtools
 public CodeMemberElement(IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus, string key, string returnType, MemberTypes memberType, string name)
 {
     _includeStatus = includeStatus;
     _visibilityOverride = visibilityOverride;
     _securityTransparencyStatus = securityTransparencyStatus;
     _key = key;
     _returnType = returnType;
     _memberType = memberType;
     _name = name;
 }
コード例 #21
0
        // Special case: If closureStatus == ApiRoot this will automatically
        // convert it to ImplRoot for internal types
        // TODO: Visitor should set status instead of this.
        public ThinModel ExportModel(IncludeStatus closureStatus)
        {
            _closureStatus = closureStatus;

            int nApiTypes          = 0;
            int nApiTypeForwarders = 0;
            int nApiMembers        = 0;

            ThinModel thinModel = new ThinModel(_thinModel.Options);
            Dictionary <String, ThinAssembly>           assemblies = new Dictionary <String, ThinAssembly>(_depot.AssembliesClosure.Count);
            Dictionary <INamedTypeDefinition, ThinType> types      = new Dictionary <INamedTypeDefinition, ThinType>(_depot.TypesClosure.Count);

            foreach (IAssembly assembly in _depot.AssembliesClosure.Values)
            {
                ThinAssembly thinAsm = new ThinAssembly(_thinModel, assembly.Name.Value, GetIncludeStatus(assembly), assembly);
                thinModel.Assemblies.Add(thinAsm.Name, thinAsm);
                assemblies.Add(assembly.Name.Value, thinAsm);
            }

            foreach (INamedTypeDefinition type in _depot.TypesClosure.Values)
            {
                IAssembly asm = TypeHelper.GetDefiningUnit(type) as IAssembly;
                if (asm != null && assemblies.ContainsKey(asm.Name.Value))
                {
                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideType(type))
                    {
                        vis = VisibilityOverride.Internal;
                    }

                    if (closureStatus != IncludeStatus.ApiRoot)
                    {
                        if (TypeIsVisibleInApi(type))
                        {
                            INamedTypeDefinition curType = type;
                            while (curType != null && curType != Dummy.Type && // TODO: Remove dummy check?
                                   CanInclude(curType))
                            {
                                if (WeHidThisType(curType))
                                {
                                    throw new Exception("API closure error!  Base type " + curType + " was hidden, but " + type + " is in the public API");
                                }
                                ITypeReference curTypeRef = TypeHelper.BaseClass(curType);
                                curType = curTypeRef != null?Util.CanonicalizeType(curTypeRef) : null;
                            }
                        }
                    }

                    ThinAssembly declaringAssembly = assemblies[asm.Name.Value];
                    ThinType     thinType          = new ThinType(declaringAssembly, Util.FullyQualifiedTypeNameFromType(type), GetIncludeStatus(type), type, vis);
                    declaringAssembly.Types.Add(thinType.Name, thinType);
                    types.Add(type, thinType);

                    if (thinType.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinType.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinType.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiTypes++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5004 : couldn't find declaring module of type {0} in closure", type);
                }
            }

            foreach (IAliasForType typeForwarder in _depot.TypeForwardersClosure.Values)
            {
                // TODO: Why is this getting an immutable copy of the assembly?
                IAssembly asm = Util.GetDefiningAssembly(typeForwarder);
                if (asm != null && assemblies.ContainsKey(asm.Name.Value))
                {
                    ThinAssembly      declaringAssembly = assemblies[asm.Name.Value];
                    ITypeReference    aliasedType       = typeForwarder.AliasedType;
                    ThinTypeForwarder thinTypeForwarder = new ThinTypeForwarder(declaringAssembly,
                                                                                Util.GetDefiningAssembly(aliasedType).Name.Value,
                                                                                Util.GetTypeName(aliasedType),
                                                                                GetIncludeStatus(typeForwarder),
                                                                                typeForwarder);

                    declaringAssembly.TypeForwarders.Add(thinTypeForwarder.Key, thinTypeForwarder);

                    if (thinTypeForwarder.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinTypeForwarder.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinTypeForwarder.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiTypeForwarders++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5001 : couldn't find declaring module of type forwarder {0} in closure", typeForwarder);
                }
            }

            foreach (ITypeDefinitionMember member in _depot.MembersClosure.Keys)
            {
                INamedTypeDefinition type = Util.ContainingTypeDefinition(member);
                if (types.ContainsKey(type))
                {
                    ThinType      declaringType = types[type];
                    IncludeStatus status        = GetIncludeStatus(member);

                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideMember(member))
                    {
                        vis = VisibilityOverride.Internal;
                    }

                    if ((type.IsInterface) &&
                        TypeIsVisibleInApi(type) &&
                        vis == VisibilityOverride.Internal)
                    {
                        throw new Exception(string.Format("Implementation required non-public member on public interface: {0} on {1}. This usually means you added a property to model.xml without adding the corresponding getter or setter.",
                                                          member.Name,
                                                          Util.FullyQualifiedTypeNameFromType(member.ContainingType)));
                    }

                    ThinMember thinMember = new ThinMember(declaringType, member, status, vis);
                    declaringType.Members.Add(thinMember.Key, thinMember);

                    if (thinMember.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinMember.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinMember.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiMembers++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5002 : couldn't find declaring type of member {0} in closure", member);
                }
            }

            foreach (IMethodDefinition method in _depot.MethodsClosure.Values)
            {
                INamedTypeDefinition type = Util.ContainingTypeDefinition(method);
                if (types.ContainsKey(type))
                {
                    ThinType      declaringType = types[type];
                    IncludeStatus status        = GetIncludeStatus(method);

                    VisibilityOverride vis = VisibilityOverride.None;
                    if (ShouldHideMember(method))
                    {
                        vis = VisibilityOverride.Internal;
                    }

                    if ((type.IsInterface) &&
                        TypeIsVisibleInApi(type) &&
                        vis == VisibilityOverride.Internal)
                    {
                        //throw new Exception(string.Format("WARNING: implementation required non-public member on public interface: {0} on {1}. This usually means you added a property to model.xml without adding the corresponding getter or setter.",
                        //    method.Name,
                        //    Util.FullyQualifiedTypeNameFromType(method.ContainingType)));
                    }

                    ThinMember thinMember = new ThinMember(declaringType, method, status, vis);
                    if (declaringType.Members.ContainsKey(thinMember.Key))
                    {
                        throw new Exception(String.Format("Found two members with the same signature: {0}", thinMember.Key));
                    }
                    declaringType.Members.Add(thinMember.Key, thinMember);

                    if (thinMember.IncludeStatus == IncludeStatus.ApiClosure ||
                        thinMember.IncludeStatus == IncludeStatus.ApiRoot ||
                        thinMember.IncludeStatus == IncludeStatus.ApiFxInternal)
                    {
                        nApiMembers++;
                    }
                }
                else
                {
                    Console.Error.WriteLine("BclRewriter : warning BR5003 : couldn't find declaring type of method {0} in closure", method);
                }
            }

            foreach (ThinMember thinMember in _missingMembers)
            {
                ThinType   typeToExtend  = types[thinMember.DeclaringType.Metadata];
                ThinMember newThinMember = new ThinMember(typeToExtend, thinMember);
                if (!typeToExtend.Members.ContainsKey(newThinMember.Key))
                {
                    typeToExtend.Members.Add(newThinMember.Key, newThinMember);
                }
            }

            return(thinModel);
        }
コード例 #22
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public ThinType(ThinAssembly declaringAssembly, ThinType typeToCopy)
        {
            _members = new Dictionary<string, MemberElement>();
            _declaringAssembly = declaringAssembly;

            _typeNode = typeToCopy._typeNode;
            _typeFullName = typeToCopy._typeFullName;
            _includeStatus = typeToCopy._includeStatus;
            _visibility = typeToCopy._visibility;
            _securityTransparencyStatus = typeToCopy._securityTransparencyStatus;
        }
コード例 #23
0
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            TrimType typeInfo = (TrimType)type;

            TrimMember id = new TrimMember(typeInfo, memberName, returnType, /*paramListString, */ memberType, includeStatus, visibilityOverride, securityTransparencyStatus);

            typeInfo.Members.Add(id.Key, id);
            return(id);
        }
コード例 #24
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public ThinType(ThinAssembly declaringAssembly, string typeName,
                        IncludeStatus includeStatus, INamedTypeDefinition typeNode, VisibilityOverride visibility,
                        SecurityTransparencyStatus securityTransparencyStatus)
        {
            _members = new Dictionary<string, MemberElement>();
            _typeNode = typeNode;
            _declaringAssembly = declaringAssembly;
            _includeStatus = includeStatus;
            _visibility = visibility;
            _securityTransparencyStatus = securityTransparencyStatus;

            //_typeFullName = Util.CCI2StyleTypeName(typeName);
            _typeFullName = typeName;
        }
コード例 #25
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public ThinType(ThinAssembly declaringAssembly, string typeName,
                        IncludeStatus includeStatus, INamedTypeDefinition typeNode, VisibilityOverride visibility)

            : this(declaringAssembly, typeName, includeStatus, typeNode, visibility, SecurityTransparencyStatus.Transparent)
        {
        }
コード例 #26
0
        public void RecursivelyReadBlock(XmlReader reader, object parentObj, bool include)
        {
            while (reader.Read() && (reader.NodeType != XmlNodeType.EndElement))
            {
                XmlParseAssert(reader.IsStartElement());

                switch (reader.Name)
                {
                case XmlKeywords.Elements.Xml:
                {
                    XmlParseAssert(include);
                    XmlParseAssert(parentObj is ModelElement);
                    RecursivelyReadBlock(reader, parentObj, true);
                    break;
                }

                case XmlKeywords.Elements.ThinModel:
                {
                    XmlParseAssert(include);
                    XmlParseAssert(parentObj is ModelElement);
                    RecursivelyReadBlock(reader, parentObj, true);
                    break;
                }

                case XmlKeywords.Elements.Assembly:
                {
                    XmlParseAssert(include);
                    XmlParseAssert(parentObj is ModelElement);
                    XmlParseAssert(reader.AttributeCount > 0);
                    string assemblyName = reader.GetAttribute(XmlKeywords.Attributes.Name);
                    XmlParseAssert(assemblyName != null);

                    string includeStatusString = reader.GetAttribute(XmlKeywords.Attributes.IncludeStatus);

                    IncludeStatus includeStatus = IncludeStatus.Inherit;
                    if (includeStatusString != null)
                    {
                        includeStatus = XmlKeywords.ParseIncludeStatus(includeStatusString);
                    }

                    string platform     = reader.GetAttribute(XmlKeywords.Attributes.Platform);
                    string architecture = reader.GetAttribute(XmlKeywords.Attributes.Architecture);
                    string flavor       = reader.GetAttribute(XmlKeywords.Attributes.Flavor);
                    string condition    = reader.GetAttribute(XmlKeywords.Attributes.Condition);
                    bool   included     = IncludeBuild(platform, architecture, flavor, condition);

                    AssemblyElement assembly = null;
                    if (included)
                    {
                        assembly = CreateAssemblyElement((ModelElement)parentObj, assemblyName, includeStatus);
                    }

                    if (!reader.IsEmptyElement)
                    {
                        RecursivelyReadBlock(reader, assembly, included);
                    }
                    break;
                }

                case XmlKeywords.Elements.Type:
                {
                    TypeElement type     = null;
                    bool        included = false;

                    if (include)
                    {
                        XmlParseAssert(parentObj is AssemblyElement);
                        XmlParseAssert(reader.AttributeCount > 0);
                        string fullyQualifiedTypeName = reader.GetAttribute(XmlKeywords.Attributes.Name);
                        XmlParseAssert(fullyQualifiedTypeName != null);

                        AssemblyElement declaringAssembly = (AssemblyElement)parentObj;

                        IncludeStatus includeStatus       = declaringAssembly.IncludeStatus;
                        string        includeStatusString = reader.GetAttribute(XmlKeywords.Attributes.IncludeStatus);
                        if (includeStatusString != null)
                        {
                            includeStatus = XmlKeywords.ParseIncludeStatus(includeStatusString);
                        }

                        SecurityTransparencyStatus securityTransparencyStatus = SecurityTransparencyStatus.Transparent;
                        string securityTransparencyStatusString = reader.GetAttribute(XmlKeywords.Attributes.SecurityTransparencyStatus);
                        if (securityTransparencyStatusString != null)
                        {
                            securityTransparencyStatus = XmlKeywords.ParseSecurityTransparencyStatus(securityTransparencyStatusString);
                        }

                        string             visibilityOverrideString = reader.GetAttribute(XmlKeywords.Attributes.VisibilityOverride);
                        VisibilityOverride visibilityOverride       = XmlKeywords.ParseVisibilityOverride(visibilityOverrideString);

                        string platform     = reader.GetAttribute(XmlKeywords.Attributes.Platform);
                        string architecture = reader.GetAttribute(XmlKeywords.Attributes.Architecture);
                        string flavor       = reader.GetAttribute(XmlKeywords.Attributes.Flavor);
                        string condition    = reader.GetAttribute(XmlKeywords.Attributes.Condition);
                        included = IncludeBuild(platform, architecture, flavor, condition);

                        if (included)
                        {
                            type = CreateTypeElement(declaringAssembly, fullyQualifiedTypeName, includeStatus, visibilityOverride, securityTransparencyStatus);
                        }
                    }

                    if (!reader.IsEmptyElement)
                    {
                        RecursivelyReadBlock(reader, type, included);
                    }
                    break;
                }

                case XmlKeywords.Elements.TypeForwarder:
                {
                    TypeForwarderElement type = null;
                    bool included             = false;

                    if (include)
                    {
                        XmlParseAssert(parentObj is AssemblyElement);
                        XmlParseAssert(reader.AttributeCount > 1);
                        string assemblyName = reader.GetAttribute(XmlKeywords.Attributes.AssemblyName);
                        string typeName     = reader.GetAttribute(XmlKeywords.Attributes.TypeName);

                        XmlParseAssert(assemblyName != null);
                        XmlParseAssert(typeName != null);

                        AssemblyElement declaringAssembly = (AssemblyElement)parentObj;

                        IncludeStatus includeStatus       = declaringAssembly.IncludeStatus;
                        string        includeStatusString = reader.GetAttribute(XmlKeywords.Attributes.IncludeStatus);
                        if (includeStatusString != null)
                        {
                            includeStatus = XmlKeywords.ParseIncludeStatus(includeStatusString);
                        }

                        string platform     = reader.GetAttribute(XmlKeywords.Attributes.Platform);
                        string architecture = reader.GetAttribute(XmlKeywords.Attributes.Architecture);
                        string flavor       = reader.GetAttribute(XmlKeywords.Attributes.Flavor);
                        string condition    = reader.GetAttribute(XmlKeywords.Attributes.Condition);
                        included = IncludeBuild(platform, architecture, flavor, condition);

                        if (included)
                        {
                            type = CreateTypeForwarderElement(declaringAssembly, assemblyName, typeName, includeStatus);
                        }
                    }

                    if (!reader.IsEmptyElement)
                    {
                        RecursivelyReadBlock(reader, type, included);
                    }
                    break;
                }

                case XmlKeywords.Elements.Member:
                {
                    if (include)
                    {
                        XmlParseAssert(parentObj is TypeElement);
                        XmlParseAssert(reader.AttributeCount > 0);
                        string memberName = reader.GetAttribute(XmlKeywords.Attributes.Name);
                        XmlParseAssert(memberName != null);

                        TypeElement declaringType = (TypeElement)parentObj;

                        string returnType = reader.GetAttribute(XmlKeywords.Attributes.ReturnType);

                        string      memberTypeString = reader.GetAttribute(XmlKeywords.Attributes.MemberType);
                        MemberTypes memberType       = XmlKeywords.ParseMemberType(memberTypeString);
                        XmlParseAssert(memberType != MemberTypes.Unknown);

                        IncludeStatus includeStatus       = declaringType.IncludeStatus;
                        string        includeStatusString = reader.GetAttribute(XmlKeywords.Attributes.IncludeStatus);
                        if (includeStatusString != null)
                        {
                            includeStatus = XmlKeywords.ParseIncludeStatus(includeStatusString);
                        }
                        if (includeStatus == IncludeStatus.Inherit)
                        {
                            throw new FormatException(String.Format("Specify include status for Member \"{0}\" in Type \"{1}\"", memberName, declaringType.Key));
                        }
                        XmlParseAssert(includeStatus != IncludeStatus.Inherit);

                        // Inherited virtual members "sometimes" don't inherit transparency status (when following certain rulesets) and we don't know
                        // inheritance or rule status here. Therefore we can't say what the transparency status is here unless it's explicitly defined.
                        SecurityTransparencyStatus securityTransparencyStatus = SecurityTransparencyStatus.Undefined;
                        string securityTransparencyStatusString = reader.GetAttribute(XmlKeywords.Attributes.SecurityTransparencyStatus);
                        if (securityTransparencyStatusString != null)
                        {
                            securityTransparencyStatus = XmlKeywords.ParseSecurityTransparencyStatus(securityTransparencyStatusString);
                        }

                        string             visibilityOverrideString = reader.GetAttribute(XmlKeywords.Attributes.VisibilityOverride);
                        VisibilityOverride visibilityOverride       = XmlKeywords.ParseVisibilityOverride(visibilityOverrideString);

                        string platform     = reader.GetAttribute(XmlKeywords.Attributes.Platform);
                        string architecture = reader.GetAttribute(XmlKeywords.Attributes.Architecture);
                        string flavor       = reader.GetAttribute(XmlKeywords.Attributes.Flavor);
                        string condition    = reader.GetAttribute(XmlKeywords.Attributes.Condition);
                        bool   included     = IncludeBuild(platform, architecture, flavor, condition);

                        if (included)
                        {
                            CreateMemberElement(declaringType, memberName, returnType, memberType, includeStatus, visibilityOverride, securityTransparencyStatus);
                        }
                    }

                    break;
                }
                }
            }
        }
コード例 #27
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType,
                                                          IncludeStatus includeStatus, VisibilityOverride visibilityOverride,
                                                          SecurityTransparencyStatus securityTransparencyStatus)
        {
            ThinType declaringType = (ThinType)type;
            includeStatus = AdjustIncludeStatus(includeStatus);
            ThinMember member = new ThinMember(declaringType, memberName, returnType, memberType,
                                               includeStatus, null, visibilityOverride, securityTransparencyStatus);

            String key = member.Key;
            if (declaringType.Members.ContainsKey(key))
            {
                String errMsg = String.Format("XML file error: duplicate Member element \"{0}\" in type \"{1}\"", key, type.Key);
                Console.Error.WriteLine(errMsg);
                throw new FormatException(errMsg);
            }

            declaringType.Members.Add(key, member);
            return member;
        }
コード例 #28
0
 abstract public MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus);
コード例 #29
0
ファイル: XmlImporter.cs プロジェクト: TerabyteX/buildtools
 abstract public MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus);
コード例 #30
0
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            // Identify the member by category (method/prop/field/event), name, and return type.  These
            // strings are what matched by ModelSigFormatter

            string memberSig = memberType.ToString() + " : " + memberName;

            if (returnType != null)
            {
                memberSig = memberSig + " : " + returnType;
            }

            CodeMemberElement member = new CodeMemberElement(includeStatus, visibilityOverride, securityTransparencyStatus, memberSig, returnType, memberType, memberName);

            (type as CodeTypeElement).m_members.Add(memberSig, member);
            return(member);
        }
コード例 #31
0
ファイル: Thinner.cs プロジェクト: jango2015/buildtools
        public override TypeElement CreateTypeElement(AssemblyElement assembly, string typeName,
                                                      IncludeStatus includeStatus, VisibilityOverride visibilityOverride,
                                                      SecurityTransparencyStatus securityTransparencyStatus)
        {
            ThinAssembly declaringAssembly = (ThinAssembly)assembly;
            includeStatus = AdjustIncludeStatus(includeStatus);
            ThinType type = new ThinType(declaringAssembly, typeName, includeStatus, null, visibilityOverride, securityTransparencyStatus);

            String key = type.Name;
            if (declaringAssembly.Types.ContainsKey(key))
            {
                String errMsg = String.Format("XML file error: duplicate Type element \"{0}\"", key);
                Console.Error.WriteLine(errMsg);
                throw new FormatException(errMsg);
            }

            declaringAssembly.Types.Add(key, type);

            return type;
        }