Exemplo n.º 1
0
 void AddProperty(string defaultMemberName, PropertyDefinition property)
 {
     if ((property.GetMethod != null && IsVisible(property.GetMethod.Attributes)) ||
         (property.SetMethod != null && IsVisible(property.SetMethod.Attributes)))
     {
         DefaultProperty p = new DefaultProperty(this, property.Name);
         if (this.ClassType == ClassType.Interface)
         {
             p.Modifiers = ModifierEnum.Public | ModifierEnum.Abstract;
         }
         else
         {
             p.Modifiers = TranslateModifiers(property);
         }
         p.ReturnType = CreateType(this.ProjectContent, this, property.PropertyType, property);
         p.CanGet     = property.GetMethod != null && IsVisible(property.GetMethod.Attributes);
         p.CanSet     = property.SetMethod != null && IsVisible(property.SetMethod.Attributes);
         if (p.CanGet)
         {
             p.GetterModifiers = GetAccessorVisibility(p, property.GetMethod);
         }
         if (p.CanSet)
         {
             p.SetterModifiers = GetAccessorVisibility(p, property.SetMethod);
         }
         if (p.Name == defaultMemberName)
         {
             p.IsIndexer = true;
         }
         AddParameters(p, property.Parameters);
         AddAttributes(CompilationUnit.ProjectContent, p, p.Attributes, property);
         Properties.Add(p);
     }
 }
Exemplo n.º 2
0
            void ReadParameters(DefaultProperty m)
            {
                int count = reader.ReadUInt16();

                if (count > 0)
                {
                    ReadParameters(m.Parameters, count);
                }
                else
                {
                    m.Parameters = DefaultParameter.EmptyParameterList;
                }
            }
Exemplo n.º 3
0
        public override IMember Clone()
        {
            DefaultProperty p = new DefaultProperty(Name, ReturnType, Modifiers, Region, BodyRegion, DeclaringType);

            p.parameters      = DefaultParameter.Clone(this.Parameters);
            p.getterModifiers = this.getterModifiers;
            p.setterModifiers = this.setterModifiers;
            p.getterRegion    = this.getterRegion;
            p.setterRegion    = this.setterRegion;
            p.CopyDocumentationFrom(this);
            p.accessFlags = this.accessFlags;
            foreach (ExplicitInterfaceImplementation eii in InterfaceImplementations)
            {
                p.InterfaceImplementations.Add(eii.Clone());
            }
            return(p);
        }
Exemplo n.º 4
0
            IProperty ReadProperty()
            {
                DefaultProperty p = new DefaultProperty(currentClass, ReadString());

                ReadMember(p);
                p.accessFlags = reader.ReadByte();
                byte b = reader.ReadByte();

                if ((b & 1) == 1)
                {
                    p.GetterModifiers = (ModifierEnum)reader.ReadInt32();
                }
                if ((b & 2) == 2)
                {
                    p.SetterModifiers = (ModifierEnum)reader.ReadInt32();
                }
                ReadParameters(p);
                return(p);
            }
Exemplo n.º 5
0
            void WriteProperty(IProperty p)
            {
                WriteMember(p);
                DefaultProperty dp = p as DefaultProperty;

                if (dp != null)
                {
                    writer.Write(dp.accessFlags);
                }
                else
                {
                    writer.Write((byte)0);
                }
                writer.Write((byte)((p.GetterModifiers != ModifierEnum.None ? 1 : 0) + (p.SetterModifiers != ModifierEnum.None ? 2 : 0)));
                if (p.GetterModifiers != ModifierEnum.None)
                {
                    writer.Write((int)p.GetterModifiers);
                }
                if (p.SetterModifiers != ModifierEnum.None)
                {
                    writer.Write((int)p.SetterModifiers);
                }
                WriteParameters(p.Parameters);
            }