Пример #1
0
 private void Mark <T>(IEnumerable <T> entities) where T : BaseEntity
 {
     foreach (T entity in entities)
     {
         List <String> lines = entity.Summary;
         String        line  = lines.FirstOrDefault();
         if (String.IsNullOrEmpty(line))
         {
             continue;
         }
         AvailabilityHelper.AddMention(entity, line);
     }
 }
Пример #2
0
        /// <summary>
        ///   Appends the end condition for OS version.
        /// </summary>
        /// <param name = "entity">The entity.</param>
        protected void AppendEndCondition(BaseEntity entity)
        {
            String define = AvailabilityHelper.GetDefine(entity.MinAvailability);

            if (!String.IsNullOrEmpty(define))
            {
                this.Writer.WriteLineFormat(0, "#endif");
            }
            if (entity.Obsolete == null)
            {
                define = AvailabilityHelper.GetDefine(entity.MaxAvailability);
                if (!String.IsNullOrEmpty(define))
                {
                    this.Writer.WriteLineFormat(0, "#endif");
                }
            }
        }
Пример #3
0
        /// <summary>
        ///   Appends the start condition for OS version.
        /// </summary>
        /// <param name = "entity">The entity.</param>
        protected void AppendStartCondition(BaseEntity entity)
        {
            String define = AvailabilityHelper.GetDefine(entity.MinAvailability);

            if (!String.IsNullOrEmpty(define))
            {
                this.Writer.WriteLineFormat(0, "#if {0}", define);
            }
            if (String.IsNullOrEmpty(entity.Obsolete))
            {
                define = AvailabilityHelper.GetDefine(entity.MaxAvailability);
                if (!String.IsNullOrEmpty(define))
                {
                    this.Writer.WriteLineFormat(0, "#if !{0}", define);
                }
            }
        }
Пример #4
0
        /// <summary>
        ///   Appends the obsolete attribute.
        /// </summary>
        /// <param name = "entity">The entity.</param>
        protected void AppendObsoleteAttribute(BaseEntity entity)
        {
            if (entity.Obsolete != null)
            {
                String message = String.Empty;
                if (entity.Obsolete != String.Empty)
                {
                    message = " " + entity.Obsolete;
                }

                String define = AvailabilityHelper.GetDefine(entity.MaxAvailability);
                if (!String.IsNullOrEmpty(define))
                {
                    this.Writer.WriteLineFormat(0, "#if {0}", define);
                }
                this.Writer.WriteLineFormat(2, "[Obsolete(\"Deprecated in {0}.{1}\")]", entity.MaxAvailability, message);
                if (!String.IsNullOrEmpty(define))
                {
                    this.Writer.WriteLineFormat(0, "#endif");
                }
            }
        }