상속: System.Collections.CollectionBase
 public CodeRectangularArrayCreateExpression(CodeTypeReference createType, params CodeExpression[] lengths)
 {
     _typeOfExpr = new CodeTypeOfExpression(createType);
     _lengths = new CodeNotificationExpressionCollection(Refresh, lengths);
     Initialize();
     Refresh();
 }
 private void AnalyzeInvokeAttribute(RuleAnalysis analysis, Type contextType, Stack<MemberInfo> methodStack, CodeExpression targetExpression, RulePathQualifier targetQualifier, CodeExpressionCollection argumentExpressions, ParameterInfo[] parameters, List<CodeExpression> attributedExpressions)
 {
     foreach (MemberInfo info in contextType.GetMember(this.methodInvoked, MemberTypes.Property | MemberTypes.Method, BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance))
     {
         if (!methodStack.Contains(info))
         {
             methodStack.Push(info);
             object[] customAttributes = info.GetCustomAttributes(typeof(RuleAttribute), true);
             if ((customAttributes != null) && (customAttributes.Length != 0))
             {
                 foreach (RuleAttribute attribute in (RuleAttribute[]) customAttributes)
                 {
                     RuleReadWriteAttribute attribute2 = attribute as RuleReadWriteAttribute;
                     if (attribute2 != null)
                     {
                         attribute2.Analyze(analysis, info, targetExpression, targetQualifier, argumentExpressions, parameters, attributedExpressions);
                     }
                     else
                     {
                         ((RuleInvokeAttribute) attribute).AnalyzeInvokeAttribute(analysis, contextType, methodStack, targetExpression, targetQualifier, argumentExpressions, parameters, attributedExpressions);
                     }
                 }
             }
             methodStack.Pop();
         }
     }
 }
 internal override void Analyze(RuleAnalysis analysis, MemberInfo member, CodeExpression targetExpression, RulePathQualifier targetQualifier, CodeExpressionCollection argumentExpressions, ParameterInfo[] parameters, List<CodeExpression> attributedExpressions)
 {
     Stack<MemberInfo> methodStack = new Stack<MemberInfo>();
     methodStack.Push(member);
     this.AnalyzeInvokeAttribute(analysis, member.DeclaringType, methodStack, targetExpression, targetQualifier, argumentExpressions, parameters, attributedExpressions);
     methodStack.Pop();
 }
 internal override void Analyze(RuleAnalysis analysis, MemberInfo member, CodeExpression targetExpression, RulePathQualifier targetQualifier, CodeExpressionCollection argumentExpressions, ParameterInfo[] parameters, List<CodeExpression> attributedExpressions)
 {
     if (!analysis.ForWrites)
     {
         base.AnalyzeReadWrite(analysis, targetExpression, targetQualifier, argumentExpressions, parameters, attributedExpressions);
     }
 }
 public CodeRectangularArrayCreateExpression()
 {
     _typeOfExpr = new CodeTypeOfExpression();
     _lengths = new CodeNotificationExpressionCollection(Refresh);
     Initialize();
     Refresh();
 }
예제 #6
0
		public void Constructor1_NullItem ()
		{
			CodeExpression[] expressions = new CodeExpression[] { 
				new CodeExpression (), null };

			CodeExpressionCollection coll = new CodeExpressionCollection (
				expressions);
		}
 public static CodeExpressionCollection Clone(this CodeExpressionCollection collection)
 {
     if (collection == null) return null;
     CodeExpressionCollection c = new CodeExpressionCollection();
     foreach (CodeExpression expression in collection)
         c.Add(expression.Clone());
     return c;
 }
예제 #8
0
		public void Constructor0 ()
		{
			CodeExpressionCollection coll = new CodeExpressionCollection ();
			Assert.IsFalse (((IList) coll).IsFixedSize, "#1");
			Assert.IsFalse (((IList) coll).IsReadOnly, "#2");
			Assert.AreEqual (0, coll.Count, "#3");
			Assert.IsFalse (((ICollection) coll).IsSynchronized, "#4");
		}
예제 #9
0
 internal void AnalyzeRuleAttributes(MemberInfo member, CodeExpression targetExpr, RulePathQualifier targetQualifier, CodeExpressionCollection argExprs, ParameterInfo[] parameters, List<CodeExpression> attributedExprs)
 {
     object[] attrs = member.GetCustomAttributes(typeof(RuleAttribute), true);
     if (attrs != null && attrs.Length > 0)
     {
         RuleAttribute[] ruleAttrs = (RuleAttribute[])attrs;
         for (int i = 0; i < ruleAttrs.Length; ++i)
             ruleAttrs[i].Analyze(this, member, targetExpr, targetQualifier, argExprs, parameters, attributedExprs);
     }
 }
 internal void AnalyzeRuleAttributes(MemberInfo member, CodeExpression targetExpr, RulePathQualifier targetQualifier, CodeExpressionCollection argExprs, ParameterInfo[] parameters, List<CodeExpression> attributedExprs)
 {
     object[] customAttributes = member.GetCustomAttributes(typeof(RuleAttribute), true);
     if ((customAttributes != null) && (customAttributes.Length > 0))
     {
         RuleAttribute[] attributeArray = (RuleAttribute[]) customAttributes;
         for (int i = 0; i < attributeArray.Length; i++)
         {
             attributeArray[i].Analyze(this, member, targetExpr, targetQualifier, argExprs, parameters, attributedExprs);
         }
     }
 }
 public void AddRange(CodeExpressionCollection value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     int count = value.Count;
     for (int i = 0; i < count; i++)
     {
         this.Add(value[i]);
     }
 }
예제 #12
0
        /// <include file='doc\CodeExpressionCollection.uex' path='docs/doc[@for="CodeExpressionCollection.AddRange1"]/*' />
        /// <devdoc>
        ///     <para>
        ///       Adds the contents of another <see cref='System.CodeDom.CodeExpressionCollection'/> to the end of the collection.
        ///    </para>
        /// </devdoc>
        public void AddRange(CodeExpressionCollection value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            int currentCount = value.Count;

            for (int i = 0; i < currentCount; i = ((i) + (1)))
            {
                this.Add(value[i]);
            }
        }
예제 #13
0
		public void Constructor1_Deny_Unrestricted ()
		{
			CodeExpressionCollection coll = new CodeExpressionCollection (array);
			coll.CopyTo (array, 0);
			Assert.AreEqual (1, coll.Add (ce), "Add");
			Assert.AreSame (ce, coll[0], "this[int]");
			coll.AddRange (array);
			coll.AddRange (coll);
			Assert.IsTrue (coll.Contains (ce), "Contains");
			Assert.AreEqual (0, coll.IndexOf (ce), "IndexOf");
			coll.Insert (0, ce);
			coll.Remove (ce);
		}
예제 #14
0
        public void AddRange(CodeExpressionCollection value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            int currentCount = value.Count;
            for (int i = 0; i < currentCount; i++)
            {
                Add(value[i]);
            }
        }
예제 #15
0
		public void Constructor1 ()
		{
			CodeExpression exp1 = new CodeExpression ();
			CodeExpression exp2 = new CodeExpression ();

			CodeExpression[] expressions = new CodeExpression[] { exp1, exp2 };
			CodeExpressionCollection coll = new CodeExpressionCollection (
				expressions);

			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (exp1), "#2");
			Assert.AreEqual (1, coll.IndexOf (exp2), "#3");
		}
예제 #16
0
파일: TypeList.cs 프로젝트: wskplho/Tools
 private static void AddTypes(string prepend, bool nested, CodeTypeDeclarationCollection types, CodeExpressionCollection into)
 {
     foreach (CodeTypeDeclaration t in types) {
         into.Add(new CodeTypeOfExpression(
             ((prepend == null || prepend == "") ? "" : (prepend + (nested ? "+" : "."))) + t.Name));
         CodeTypeDeclarationCollection ctd = new CodeTypeDeclarationCollection();
         foreach (CodeTypeMember m in t.Members) {
             if (m is CodeTypeDeclaration) ctd.Add((CodeTypeDeclaration)m);
         }
         AddTypes(
             ((prepend == null || prepend == "") ? "" : (prepend + (nested ? "+" : "."))) + t.Name,
             true, ctd, into);
     }
 }
예제 #17
0
        public void AddRange(CodeExpressionCollection value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            int count = value.Count;

            for (int i = 0; i < count; i++)
            {
                Add(value[i]);
            }
        }
 internal override void AnalyzeUsage(CodeExpression expression, RuleAnalysis analysis, bool isRead, bool isWritten, RulePathQualifier qualifier)
 {
     CodeBinaryOperatorExpression expression2 = (CodeBinaryOperatorExpression) expression;
     RuleBinaryExpressionInfo info = analysis.Validation.ExpressionInfo(expression2) as RuleBinaryExpressionInfo;
     if (info != null)
     {
         MethodInfo methodInfo = info.MethodInfo;
         if (methodInfo != null)
         {
             List<CodeExpression> attributedExprs = new List<CodeExpression>();
             CodeExpressionCollection argExprs = new CodeExpressionCollection();
             argExprs.Add(expression2.Left);
             argExprs.Add(expression2.Right);
             CodeExpression targetExpr = new CodeTypeReferenceExpression(methodInfo.DeclaringType);
             analysis.AnalyzeRuleAttributes(methodInfo, targetExpr, qualifier, argExprs, methodInfo.GetParameters(), attributedExprs);
         }
     }
     RuleExpressionWalker.AnalyzeUsage(analysis, expression2.Left, true, false, null);
     RuleExpressionWalker.AnalyzeUsage(analysis, expression2.Right, true, false, null);
 }
예제 #19
0
 /// <devdoc>
 ///     <para>
 ///       Initializes a new instance of <see cref='System.CodeDom.CodeExpressionCollection'/> based on another <see cref='System.CodeDom.CodeExpressionCollection'/>.
 ///    </para>
 /// </devdoc>
 public CodeExpressionCollection(CodeExpressionCollection value)
 {
     this.AddRange(value);
 }
예제 #20
0
 public CodeArrayCreateExpression(Type createType, params CodeExpression[] initializers)
 {
     this.initializers = new CodeExpressionCollection();
     this.createType   = new CodeTypeReference(createType);
     this.initializers.AddRange(initializers);
 }
 public CodePropertyReferenceExpression()
 {
     this.parameters = new CodeExpressionCollection();
 }
예제 #22
0
 protected virtual void OutputParameters(CodeExpressionCollection parameters)
 {
     int count = parameters.Count;
     Output.Write("(");
     if (count > 0)
     {
         GenerateExpression(parameters[0]);
         for (int i = 1; i < count; ++i)
         {
             Output.Write(", ");
             GenerateExpression(parameters[i]);
         }
     }
     Output.Write(")");
 }
예제 #23
0
		protected virtual void OutputExpressionList (CodeExpressionCollection expressions,
							     bool newLineBetweenItems)
		{
			++Indent;
			IEnumerator enumerator = expressions.GetEnumerator();
			if (enumerator.MoveNext()) {
				CodeExpression expression = (CodeExpression)enumerator.Current;

				GenerateExpression (expression);
				
				while (enumerator.MoveNext()) {
					expression = (CodeExpression)enumerator.Current;
					
					output.Write (',');
					if (newLineBetweenItems)
						output.WriteLine ();
					else
						output.Write (' ');
					
					GenerateExpression (expression);
				}
			}
			--Indent;
		}
예제 #24
0
 private void ValidateExpressionList(CodeExpressionCollection expressions) {
     IEnumerator en = expressions.GetEnumerator();
     while (en.MoveNext()) {
         ValidateExpression((CodeExpression)en.Current);
     }
 }
 /// <devdoc>
 ///    <para>
 ///       Generates code for the specified expression list.
 ///    </para>
 /// </devdoc>
 private void OutputExpressionList(CodeExpressionCollection expressions) {
     OutputExpressionList(expressions, false /*newlineBetweenItems*/);
 }
예제 #26
0
 public CodeMethodInvokeExpression(CodeExpression targetObject, string methodName, params CodeExpression[] parameters)
 {
     this.parameters = new CodeExpressionCollection();
     this.method     = new CodeMethodReferenceExpression(targetObject, methodName);
     this.Parameters.AddRange(parameters);
 }
예제 #27
0
 public CodeMethodInvokeExpression(CodeMethodReferenceExpression method, params CodeExpression[] parameters)
 {
     this.parameters = new CodeExpressionCollection();
     this.method     = method;
     this.Parameters.AddRange(parameters);
 }
예제 #28
0
 public CodeDelegateInvokeExpression(CodeExpression targetObject)
 {
     this.parameters   = new CodeExpressionCollection();
     this.TargetObject = targetObject;
 }
예제 #29
0
 public CodeDelegateInvokeExpression(CodeExpression targetObject, params CodeExpression[] parameters)
 {
     this.parameters   = new CodeExpressionCollection();
     this.TargetObject = targetObject;
     this.Parameters.AddRange(parameters);
 }
예제 #30
0
 public CodeDelegateInvokeExpression()
 {
     this.parameters = new CodeExpressionCollection();
 }
 public void AddRange(CodeExpressionCollection !value)
 {
     Contract.Requires(value != null);
 }
 public CodeExpressionCollection(CodeExpressionCollection value)
 {
     return(default(CodeExpressionCollection));
 }
예제 #33
0
 /// <include file='doc\CodeExpressionCollection.uex' path='docs/doc[@for="CodeExpressionCollection.CodeExpressionCollection1"]/*' />
 /// <devdoc>
 ///     <para>
 ///       Initializes a new instance of <see cref='System.CodeDom.CodeExpressionCollection'/> based on another <see cref='System.CodeDom.CodeExpressionCollection'/>.
 ///    </para>
 /// </devdoc>
 public CodeExpressionCollection(CodeExpressionCollection value)
 {
     this.AddRange(value);
 }
예제 #34
0
 public CodeMethodInvokeExpression()
 {
     this.parameters = new CodeExpressionCollection();
 }
 public CodeObjectCreateExpression(Type createType, params CodeExpression[] parameters)
 {
     this.parameters = new CodeExpressionCollection();
     this.CreateType = new CodeTypeReference(createType);
     this.Parameters.AddRange(parameters);
 }
예제 #36
0
 public void AddRange(CodeExpressionCollection value)
 {
     throw new NotImplementedException();
 }
예제 #37
0
 /// <include file='doc\CodeArrayIndexerExpression.uex' path='docs/doc[@for="CodeArrayIndexerExpression.CodeArrayIndexerExpression1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeArrayIndexerExpression(CodeExpression targetObject, params CodeExpression[] indices)
 {
     this.targetObject = targetObject;
     this.indices      = new CodeExpressionCollection();
     this.indices.AddRange(indices);
 }
예제 #38
0
 public CodeExpressionCollection(CodeExpressionCollection value)
 {
     throw new NotImplementedException();
 }
 /// <devdoc>
 ///    <para>
 ///       Generates code for the specified expression list.
 ///    </para>
 /// </devdoc>
 private void OutputExpressionList(CodeExpressionCollection expressions, bool newlineBetweenItems) {
     bool first = true;
     IEnumerator en = expressions.GetEnumerator();
     Indent++;
     while (en.MoveNext()) {
         if (first) {
             first = false;
         }
         else {
             if (newlineBetweenItems)
                 ContinueOnNewLine(",");
             else
                 Output.Write(", ");
         }
         ((ICodeGenerator)this).GenerateCodeFromExpression((CodeExpression)en.Current, output.InnerWriter, options);
     }
     Indent--;
 }
 public CodeObjectCreateExpression(Type createType, params CodeExpression[] parameters)
 {
     this.parameters = new CodeExpressionCollection();
     this.CreateType = new CodeTypeReference(createType);
     this.Parameters.AddRange(parameters);
 }
예제 #41
0
		protected virtual void OutputExpressionList (CodeExpressionCollection expressions)
		{
			OutputExpressionList (expressions, false);
		}
예제 #42
0
		private void CreateRegistrationParameters(CodeExpressionCollection methodParameters, XmlNodeList scriptParameters)
		{
			CodeExpression[] initializers = new CodeExpression[scriptParameters.Count];

			for (int i = 0; i < scriptParameters.Count; i++)
			{
				if (scriptParameters.Item(i) is XmlElement)
				{
					XmlElement element = (XmlElement) scriptParameters.Item(i);

					if (PARAMETER.Equals(element.Name))
					{
						string key = element.GetAttribute(KEY);

						if (key != null && key.Length != 0)
						{
							initializers[i] = new CodeObjectCreateExpression(
								typeof (ComponentParameter),
								new CodeExpression[] {new CodePrimitiveExpression(key)});
						}
						else if (element.Value != null && element.Value.Length != 0)
						{
							initializers[i] = new CodeObjectCreateExpression(
								typeof (ConstantParameter),
								new CodeExpression[] {new CodeTypeOfExpression(element.Value)});
						}
						else
						{
							throw new PicoCompositionException("Parameter not set");
						}
					}
				}
			}

			methodParameters.Add(new CodeArrayCreateExpression(
				"IParameter",
				initializers));
		}
예제 #43
0
 public CodeArrayCreateExpression(Type createType, int size)
 {
     this.initializers = new CodeExpressionCollection();
     this.createType   = new CodeTypeReference(createType);
     this.size         = size;
 }
        private void SerializeMethodInvocation(IDesignerSerializationManager manager, CodeStatementCollection statements, object control, string methodName, CodeExpressionCollection parameters, System.Type[] paramTypes, StatementOrdering ordering)
        {
            using (CodeDomSerializerBase.TraceScope("ControlCodeDomSerializer::SerializeMethodInvocation(" + methodName + ")"))
            {
                manager.GetName(control);
                paramTypes = ToTargetTypes(control, paramTypes);
                if (TypeDescriptor.GetReflectionType(control).GetMethod(methodName, BindingFlags.Public | BindingFlags.Instance, null, paramTypes, null) != null)
                {
                    CodeMethodReferenceExpression expression2 = new CodeMethodReferenceExpression(base.SerializeToExpression(manager, control), methodName);
                    CodeMethodInvokeExpression expression = new CodeMethodInvokeExpression {
                        Method = expression2
                    };
                    if (parameters != null)
                    {
                        expression.Parameters.AddRange(parameters);
                    }
                    CodeExpressionStatement statement = new CodeExpressionStatement(expression);
                    switch (ordering)
                    {
                        case StatementOrdering.Prepend:
                            statement.UserData["statement-ordering"] = "begin";
                            break;

                        case StatementOrdering.Append:
                            statement.UserData["statement-ordering"] = "end";
                            break;
                    }
                    statements.Add(statement);
                }
            }
        }
예제 #45
0
 public CodeArrayCreateExpression(string createType, CodeExpression size)
 {
     this.initializers   = new CodeExpressionCollection();
     this.createType     = new CodeTypeReference(createType);
     this.sizeExpression = size;
 }
 private void SerializeResumeLayout(IDesignerSerializationManager manager, CodeStatementCollection statements, object control)
 {
     CodeExpressionCollection parameters = new CodeExpressionCollection();
     parameters.Add(new CodePrimitiveExpression(false));
     System.Type[] paramTypes = new System.Type[] { typeof(bool) };
     this.SerializeMethodInvocation(manager, statements, control, "ResumeLayout", parameters, paramTypes, StatementOrdering.Append);
 }
 public CodePropertyReferenceExpression(CodeExpression targetObject, string propertyName)
 {
     this.parameters   = new CodeExpressionCollection();
     this.TargetObject = targetObject;
     this.PropertyName = propertyName;
 }
		void AppendParameters(CodeExpressionCollection parameters)
		{
			codeBuilder.Append("(");
			bool firstParameter = true;
			foreach (CodeExpression expression in parameters) {
				if (firstParameter) {
					firstParameter = false;					
				} else {
					codeBuilder.Append(", ");
				}
				AppendExpression(expression);
			}
			codeBuilder.Append(")");
		}
예제 #49
0
 public CodeArrayCreateExpression()
 {
     this.initializers = new CodeExpressionCollection();
 }
		/// <summary>
		/// Appends initializers for an array.
		/// </summary>
		void AppendInitializers(CodeExpressionCollection initalizers)
		{
			codeBuilder.Append("(");
			codeBuilder.AppendLine();
			codeBuilder.IncreaseIndent();
			codeBuilder.AppendIndented("[");

			bool firstInitializer = true;
			foreach (CodeExpression expression in initalizers) {
				if (firstInitializer) {
					firstInitializer = false;					
				} else {
					codeBuilder.Append(",");
					codeBuilder.AppendLine();
					codeBuilder.AppendIndented(String.Empty);
				}
				AppendExpression(expression);
			}
			
			codeBuilder.Append("])");
			codeBuilder.DecreaseIndent();
		}
예제 #51
0
 /// <devdoc>
 ///    <para>
 ///       Initializes a new instance of <see cref='System.CodeDom.CodeIndexerExpression'/> using the specified target
 ///       object and index.
 ///    </para>
 /// </devdoc>
 public CodeIndexerExpression(CodeExpression targetObject, params CodeExpression[] indices) {
     this.targetObject = targetObject;
     this.indices = new CodeExpressionCollection();
     this.indices.AddRange(indices);
 }
 public CodeObjectCreateExpression()
 {
     this.parameters = new CodeExpressionCollection();
 }