Пример #1
0
 private void OutputAttributes(CodeAttributeDeclarationCollection attributes, bool inLine, string prefix, bool closingLine)
 {
     if (attributes.Count != 0)
     {
         IEnumerator enumerator = attributes.GetEnumerator();
         bool flag = true;
         this.GenerateAttributeDeclarationsStart(attributes);
         while (enumerator.MoveNext())
         {
             if (flag)
             {
                 flag = false;
             }
             else
             {
                 base.Output.Write(", ");
                 if (!inLine)
                 {
                     this.ContinueOnNewLine("");
                     base.Output.Write(" ");
                 }
             }
             if ((prefix != null) && (prefix.Length > 0))
             {
                 base.Output.Write(prefix);
             }
             CodeAttributeDeclaration current = (CodeAttributeDeclaration)enumerator.Current;
             if (current.AttributeType != null)
             {
                 base.Output.Write(this.GetTypeOutput(current.AttributeType));
             }
             base.Output.Write("(");
             bool flag2 = true;
             foreach (CodeAttributeArgument argument in current.Arguments)
             {
                 if (flag2)
                 {
                     flag2 = false;
                 }
                 else
                 {
                     base.Output.Write(", ");
                 }
                 this.OutputAttributeArgument(argument);
             }
             base.Output.Write(")");
         }
         this.GenerateAttributeDeclarationsEnd(attributes);
         base.Output.Write(" ");
         if (!inLine)
         {
             if (closingLine)
             {
                 base.Output.WriteLine();
             }
             else
             {
                 this.ContinueOnNewLine("");
             }
         }
     }
 }
Пример #2
0
		protected virtual void OutputAttributeDeclarations (CodeAttributeDeclarationCollection attributes)
		{
			GenerateAttributeDeclarationsStart (attributes);
			
			IEnumerator enumerator = attributes.GetEnumerator();
			if (enumerator.MoveNext()) {
				CodeAttributeDeclaration attribute = (CodeAttributeDeclaration)enumerator.Current;

				OutputAttributeDeclaration (attribute);
				
				while (enumerator.MoveNext()) {
					attribute = (CodeAttributeDeclaration)enumerator.Current;

					output.WriteLine (',');
					OutputAttributeDeclaration (attribute);
				}
			}

			GenerateAttributeDeclarationsEnd (attributes);
		}
Пример #3
0
		private void OutputAttributes (CodeAttributeDeclarationCollection attributes, string prefix, LineHandling lineHandling) {
			if (attributes.Count == 0) {
				return;
			}

			GenerateAttributeDeclarationsStart (attributes);

			IEnumerator enumerator = attributes.GetEnumerator ();
			if (enumerator.MoveNext ()) {
				CodeAttributeDeclaration att = (CodeAttributeDeclaration) enumerator.Current;
				if (prefix != null) {
					Output.Write (prefix);
				}
				OutputAttributeDeclaration (att);

				while (enumerator.MoveNext ()) {
					Output.Write (", ");
					if (lineHandling != LineHandling.InLine) {
						ContinueOnNewLine ("");
						Output.Write (" ");
					}
					att = (CodeAttributeDeclaration) enumerator.Current;
					if (prefix != null) {
						Output.Write (prefix);
					}
					OutputAttributeDeclaration (att);
				}
			}
			GenerateAttributeDeclarationsEnd (attributes);
			Output.Write (" ");

			switch (lineHandling) {
				case LineHandling.ContinueLine:
					ContinueOnNewLine ("");
					break;
				case LineHandling.NewLine:
					Output.WriteLine ();
					break;
			}
		}
        private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine) {
            if (attributes.Count == 0) return;
            IEnumerator en = attributes.GetEnumerator();
            bool paramArray =false;

            while (en.MoveNext()) { 
                // we need to convert paramArrayAttribute to params keyword to 
                // make csharp compiler happy. In addition, params keyword needs to be after 
                // other attributes.

                CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;

                if( current.Name.Equals("system.paramarrayattribute", StringComparison.OrdinalIgnoreCase)) {
                    paramArray = true;
                    continue;
                }

                GenerateAttributeDeclarationsStart(attributes);
                if (prefix != null) {
                    Output.Write(prefix);
                }

                if( current.AttributeType != null) {
                    Output.Write(GetTypeOutput(current.AttributeType));
                }
                Output.Write("(");

                bool firstArg = true;
                foreach (CodeAttributeArgument arg in current.Arguments) {
                    if (firstArg) {
                        firstArg = false;
                    }
                    else {
                        Output.Write(", ");
                    }

                    OutputAttributeArgument(arg);
                }

                Output.Write(")");
                GenerateAttributeDeclarationsEnd(attributes);
                if (inLine) {
                    Output.Write(" ");
                } 
                else {
                    Output.WriteLine();
                }
            }

            if( paramArray) {
                if (prefix != null) {
                    Output.Write(prefix);
                }
                Output.Write("params");
                
                if (inLine) {
                    Output.Write(" ");
                } 
                else {
                    Output.WriteLine();
                }
            }


        }
Пример #5
0
        private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine) {
            if (attributes.Count == 0) return;
            IEnumerator en = attributes.GetEnumerator();
            while (en.MoveNext()) {
                GenerateAttributeDeclarationsStart(attributes);
                if (prefix != null) {
                    Output.Write(prefix);
                }

                CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
                Output.Write(GetBaseTypeOutput(current.Name));
                Output.Write("(");

                bool firstArg = true;
                foreach (CodeAttributeArgument arg in current.Arguments) {
                    if (firstArg) {
                        firstArg = false;
                    }
                    else {
                        Output.Write(", ");
                    }

                    OutputAttributeArgument(arg);
                }

                Output.Write(")");
                GenerateAttributeDeclarationsEnd(attributes);
                if (inLine) {
                    Output.Write(" ");
                } 
                else {
                    Output.WriteLine();
                }
            }
        }
Пример #6
0
        /// <devdoc>
        ///    <para>
        ///       Generates code for the specified System.CodeDom.CodeAttributeBlock.
        ///    </para>
        /// </devdoc>
        protected virtual void OutputAttributeDeclarations(CodeAttributeDeclarationCollection attributes) {
            if (attributes.Count == 0) return;
            GenerateAttributeDeclarationsStart(attributes);
            bool first = true;
            IEnumerator en = attributes.GetEnumerator();
            while (en.MoveNext()) {
                if (first) {
                    first = false;
                }
                else {
                    ContinueOnNewLine(", ");
                }

                CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
                Output.Write(current.Name);
                Output.Write("(");

                bool firstArg = true;
                foreach (CodeAttributeArgument arg in current.Arguments) {
                    if (firstArg) {
                        firstArg = false;
                    }
                    else {
                        Output.Write(", ");
                    }

                    OutputAttributeArgument(arg);
                }

                Output.Write(")");

            }
            GenerateAttributeDeclarationsEnd(attributes);
        }
Пример #7
0
        private void ValidateAttributes(CodeAttributeDeclarationCollection attributes) {
            if (attributes.Count == 0) return;
            IEnumerator en = attributes.GetEnumerator();
            while (en.MoveNext()) {
                CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
                ValidateTypeName(current,"Name",current.Name);
                ValidateTypeReference(current.AttributeType);

                foreach (CodeAttributeArgument arg in current.Arguments) {
                  ValidateAttributeArgument(arg);
                }
            }
        }
 private void GenerateAssemblyAttributes(CodeAttributeDeclarationCollection attributes) {
   if (attributes.Count == 0) return;
   IEnumerator en = attributes.GetEnumerator();
   while (en.MoveNext()) {
     Output.Write("[");
     Output.Write("assembly: ");
     CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
     Output.Write(GetBaseTypeOutput(current.Name));
     Output.Write("(");
     bool firstArg = true;
     foreach (CodeAttributeArgument arg in current.Arguments) {
       if (firstArg) {
         firstArg = false;
       } else {
         Output.Write(", ");
       }
       OutputAttributeArgument(arg);
     }
     Output.Write(")");
     Output.Write("]");
     Output.WriteLine();
   }
 }
 private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine)
 {
     if (attributes.Count != 0)
     {
         IEnumerator enumerator1 = attributes.GetEnumerator();
         bool flag1 = false;
         while (enumerator1.MoveNext())
         {
             CodeAttributeDeclaration declaration1 = (CodeAttributeDeclaration) enumerator1.Current;
             if (declaration1.Name.Equals("system.paramarrayattribute", StringComparison.OrdinalIgnoreCase))
             {
                 flag1 = true;
             }
             else
             {
                 this.GenerateAttributeDeclarationsStart(attributes);
                 if (prefix != null)
                 {
                     this.Output.Write(prefix);
                 }
                 if (declaration1.AttributeType != null)
                 {
                     this.Output.Write(this.GetTypeOutput(declaration1.AttributeType));
                 }
                 this.Output.Write("(");
                 bool flag2 = true;
                 foreach (CodeAttributeArgument argument1 in declaration1.Arguments)
                 {
                     if (flag2)
                     {
                         flag2 = false;
                     }
                     else
                     {
                         this.Output.Write(", ");
                     }
                     this.OutputAttributeArgument(argument1);
                 }
                 this.Output.Write(")");
                 this.GenerateAttributeDeclarationsEnd(attributes);
                 if (inLine)
                 {
                     this.Output.Write(" ");
                     continue;
                 }
                 this.Output.WriteLine();
             }
         }
         if (flag1)
         {
             if (prefix != null)
             {
                 this.Output.Write(prefix);
             }
             this.Output.Write("params");
             if (inLine)
             {
                 this.Output.Write(" ");
             }
             else
             {
                 this.Output.WriteLine();
             }
         }
     }
 }
      // Generates code for the specified System.CodeDom.CodeAttributeBlock.
      protected override void OutputAttributeDeclarations(CodeAttributeDeclarationCollection attributes) {
        if (attributes.Count == 0) return;
        GenerateAttributeDeclarationsStart(attributes);
        IEnumerator en = attributes.GetEnumerator();
        while (en.MoveNext()) {
          CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;
          Output.Write(GetBaseTypeOutput(current.Name));
          Output.Write("(");

          bool firstArg = true;
          foreach (CodeAttributeArgument arg in current.Arguments) {
            if (firstArg) {
              firstArg = false;
            } else {
              Output.Write(", ");
            }
            OutputAttributeArgument(arg);
          }
          Output.Write(") ");
        }
        GenerateAttributeDeclarationsEnd(attributes);
      }
Пример #11
0
        private void OutputAttributes(CodeAttributeDeclarationCollection attributes, bool inLine, string prefix, bool closingLine) {
            if (attributes.Count == 0) return;
            IEnumerator en = attributes.GetEnumerator();
            bool firstAttr = true;
            GenerateAttributeDeclarationsStart(attributes);
            while (en.MoveNext()) {

                if (firstAttr) {
                    firstAttr = false;
                }
                else {
                    Output.Write(", ");
                    if (!inLine) {
                        ContinueOnNewLine("");
                        Output.Write(" ");
                    }
                }

                if (prefix != null && prefix.Length > 0) {
                    Output.Write(prefix);
                }

                CodeAttributeDeclaration current = (CodeAttributeDeclaration)en.Current;

                if( current.AttributeType != null) {                
                    Output.Write(GetTypeOutput(current.AttributeType));
                }
                Output.Write("(");

                bool firstArg = true;
                foreach (CodeAttributeArgument arg in current.Arguments) {
                    if (firstArg) {
                        firstArg = false;
                    }
                    else {
                        Output.Write(", ");
                    }

                    OutputAttributeArgument(arg);
                }

                Output.Write(")");

            }
            GenerateAttributeDeclarationsEnd(attributes);
            Output.Write(" ");            
            if (!inLine) {
                if (closingLine) {
                    Output.WriteLine();
                }
                else {
                    ContinueOnNewLine("");
                }
            }
        }
Пример #12
0
 private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine)
 {
     if (attributes.Count != 0)
     {
         IEnumerator enumerator = attributes.GetEnumerator();
         while (enumerator.MoveNext())
         {
             this.GenerateAttributeDeclarationsStart(attributes);
             if (prefix != null)
             {
                 if (string.Compare(prefix, "assembly: ", false, CultureInfo.InvariantCulture) == 0)
                 {
                     base.Output.Write("@assembly ");
                 }
                 else if (string.Compare(prefix, "return: ", false, CultureInfo.InvariantCulture) == 0)
                 {
                     base.Output.Write("@attribute.return ");
                 }
                 else
                 {
                     base.Output.Write("@attribute ");
                 }
             }
             else
             {
                 base.Output.Write("@attribute ");
             }
             CodeAttributeDeclaration current = (CodeAttributeDeclaration) enumerator.Current;
             string baseTypeOutput = this.GetBaseTypeOutput(current.Name);
             base.Output.Write(baseTypeOutput);
             base.Output.Write("(");
             bool flag = true;
             foreach (CodeAttributeArgument argument in current.Arguments)
             {
                 if (flag)
                 {
                     flag = false;
                 }
                 else
                 {
                     base.Output.Write(", ");
                 }
                 this.fIsAttributeArg = true;
                 this.OutputAttributeArgument(argument);
                 this.fIsAttributeArg = false;
             }
             base.Output.Write(")");
             this.GenerateAttributeDeclarationsEnd(attributes);
             if (inLine)
             {
                 base.Output.Write(" ");
             }
             else
             {
                 base.Output.WriteLine();
             }
         }
     }
 }
Пример #13
0
        private void GenerateAttributes(CodeAttributeDeclarationCollection attributes, string prefix, bool inLine)
        {
            if (attributes.Count != 0)
            {
                IEnumerator enumerator = attributes.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    CodeAttributeDeclaration current = (CodeAttributeDeclaration)enumerator.Current;
                    this.GenerateAttributeDeclarationsStart(attributes);
                    if (prefix != null)
                    {

                        base.Output.Write(prefix + ": ");
                    }
                    else
                    {
                        base.Output.Write("@@");
                    }
                    if (current.AttributeType != null)
                    {
                        base.Output.Write(this.GetTypeOutput(current.AttributeType));
                    }
                    base.Output.Write("(");
                    bool flag = true;
                    foreach (CodeAttributeArgument argument in current.Arguments)
                    {
                        if (flag)
                        {
                            flag = false;
                        }
                        else
                        {
                            base.Output.Write(", ");
                        }
                        this.OutputAttributeArgument(argument);
                    }
                    base.Output.Write(")");
                    this.GenerateAttributeDeclarationsEnd(attributes);
                    if (inLine)
                    {
                        base.Output.Write(" ");
                    }
                    else
                    {
                        base.Output.WriteLine();
                    }
                }
            }
        }
 protected virtual void OutputAttributeDeclarations(CodeAttributeDeclarationCollection attributes)
 {
     if (attributes.Count != 0)
     {
         this.GenerateAttributeDeclarationsStart(attributes);
         bool flag = true;
         IEnumerator enumerator = attributes.GetEnumerator();
         while (enumerator.MoveNext())
         {
             if (flag)
             {
                 flag = false;
             }
             else
             {
                 this.ContinueOnNewLine(", ");
             }
             CodeAttributeDeclaration current = (CodeAttributeDeclaration) enumerator.Current;
             this.Output.Write(current.Name);
             this.Output.Write("(");
             bool flag2 = true;
             foreach (CodeAttributeArgument argument in current.Arguments)
             {
                 if (flag2)
                 {
                     flag2 = false;
                 }
                 else
                 {
                     this.Output.Write(", ");
                 }
                 this.OutputAttributeArgument(argument);
             }
             this.Output.Write(")");
         }
         this.GenerateAttributeDeclarationsEnd(attributes);
     }
 }