Ejemplo n.º 1
0
 public override bool Equals(IIntermediateType other)
 {
     if (other == null)
     {
         return(false);
     }
     if (base.Equals(other))
     {
         return(true);
     }
     if (this.IsGenericConstruct && other.IsGenericConstruct)
     {
         if (!(other is IGenericType))
         {
             return(false);
         }
         IGenericType otherGeneric = (IGenericType)other;
         if (this.GenericParameters.Count != otherGeneric.GenericParameters.Count)
         {
             return(false);
         }
         if (otherGeneric.IsGenericDefinition)
         {
             return(false);
         }
         return(otherGeneric.GenericParameters.SequenceEqual(this.GenericParameters));
     }
     return(false);
 }
Ejemplo n.º 2
0
            private string VisitIntermediateType(IIntermediateType intermediateType, IntermediateNameRequestDetails context)
            {
                string name = null;

                switch (context)
                {
                case IntermediateNameRequestDetails.TargetFileName:
                    this.fileNameLookup.TryGetValue(intermediateType.Assembly, out name);
                    if (this.HtmlContext)
                    {
                        name = string.Format("{0}#type{1:X8}", name, intermediateType.GetHashCode());
                    }
                    break;

                case IntermediateNameRequestDetails.SourceFileName:
                    name = intermediateType.Assembly.FileName;
                    break;

                case IntermediateNameRequestDetails.DisplayName:
                    name = intermediateType.Name;
                    break;

                case IntermediateNameRequestDetails.ReferenceName:
                    if (this.HtmlContext)
                    {
                        name = string.Format("type{0:X8}", intermediateType.GetHashCode());
                    }
                    break;
                }
                return(name);
            }
Ejemplo n.º 3
0
 private void DefineDeclaration(IIntermediateType declaration)
 {
     if (HasNameHandler)
     {
         this.EndSpan();
         this.HandleWriteInternal(string.Format("<a class=\"def\" name=\"{0}\">", declaration.Accept(this.translator.NameProvider, IntermediateNameRequestDetails.ReferenceName)));
     }
 }
Ejemplo n.º 4
0
 private void ReferenceDeclaration(IIntermediateType declaration)
 {
     if (this.HasNameHandler)
     {
         EndSpan();
         string name = declaration.Accept(this.translator.NameProvider, IntermediateNameRequestDetails.TargetFileName);
         TranslateRelativePath(name);
         referenceStack.Push(declaration);
     }
 }
 /// <summary>
 /// Returns whether the <see cref="IntermediateTypeBase{TTypeIdentifier, TType, TIntermediateType}"/> is equal to the
 /// <paramref name="other"/> type.
 /// </summary>
 /// <param name="other">The intermediate type to check against.</param>
 /// <returns>true if the current type is the <paramref name="other"/> type.</returns>
 public virtual bool Equals(IIntermediateType other)
 {
     return(object.ReferenceEquals(this, other));
 }
Ejemplo n.º 6
0
            public IEnumerator <IMetadatum> GetEnumerator()
            {
                Dictionary <IType, MetadatumInfo> usageInformation = new Dictionary <IType, MetadatumInfo>();
                List <IType>             singleUseMetadata         = new List <IType>();
                List <IIntermediateType> listenedTypes             = new List <IIntermediateType>();

                if (currentType == null)
                {
                    yield break;
                }
                try
                {
                    while (currentType != null)
                    {
                        currentType.BaseTypeChanged += currentType_BaseTypeChanged;
                        lock (syncObject)
                            listenedTypes.Add(currentType);
                        ChangeCheck();
                        var metadataSet = currentType.Metadata;
                        foreach (var metadata in metadataSet)
                        {
                            ChangeCheck();
                            bool first = true;
                            foreach (var metadatum in metadata)
                            {
                                if (first)
                                {
                                    first = false;
                                }
                                else
                                {
                                    ChangeCheck();
                                }
                                MetadatumInfo usage;
                                if (!usageInformation.TryGetValue(metadatum.Type, out usage))
                                {
                                    usageInformation.Add(metadatum.Type, usage = currentType.IdentityManager.MetadatumHandler.GetMetadatumInfo(metadatum.Type));
                                }
                                if (usage.MetadatumRepresentation == TypeMetadatumRepresentation.IsNotMetadata)
                                {
                                    continue;
                                }
                                if (!usage.Repeatable)
                                {
                                    if (singleUseMetadata.Contains(metadatum.Type))
                                    {
                                        continue;
                                    }
                                    singleUseMetadata.Add(metadatum.Type);
                                }
                                yield return(metadatum);
                            }
                        }
                        var nextType = currentType.BaseType;
                        currentType = nextType as IIntermediateType;
                    }
                }
                finally
                {
                    Unlisten();
                }
            }
Ejemplo n.º 7
0
 public Enumerator(IIntermediateType parent)
 {
     this.currentType = parent;
 }
Ejemplo n.º 8
0
 public void Dispose()
 {
     this.parent = null;
     GC.SuppressFinalize(this);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates a new <see cref="IntermediateTypeMetadataCollection"/>
 /// with the <paramref name="parent"/> provided.
 /// </summary>
 /// <param name="parent">The <see cref="IIntermediateType"/> which needs
 /// a merged series of custom attributes.</param>
 public IntermediateTypeMetadataCollection(IIntermediateType parent)
 {
     this.parent = parent;
 }