public CodeExpression[] Generate(Table table, HardwireCodeGenerationContext generatorContext, CodeTypeMemberCollection members)
		{
			string className = "AIDX_" + Guid.NewGuid().ToString("N");
			string name = table.Get("name").String;
			bool setter = table.Get("setter").Boolean;

			CodeTypeDeclaration classCode = new CodeTypeDeclaration(className);

			classCode.TypeAttributes = System.Reflection.TypeAttributes.NestedPrivate | System.Reflection.TypeAttributes.Sealed;

			classCode.BaseTypes.Add(typeof(ArrayMemberDescriptor));

			CodeConstructor ctor = new CodeConstructor();
			ctor.Attributes = MemberAttributes.Assembly;
			classCode.Members.Add(ctor);

			ctor.BaseConstructorArgs.Add(new CodePrimitiveExpression(name));
			ctor.BaseConstructorArgs.Add(new CodePrimitiveExpression(setter));
			
			DynValue vparams = table.Get("params");

			if (vparams.Type == DataType.Table)
			{
				List<HardwireParameterDescriptor> paramDescs = HardwireParameterDescriptor.LoadDescriptorsFromTable(vparams.Table);

				ctor.BaseConstructorArgs.Add(new CodeArrayCreateExpression(typeof(ParameterDescriptor), paramDescs.Select(e => e.Expression).ToArray()));
			}

			members.Add(classCode);
			return new CodeExpression[] { new CodeObjectCreateExpression(className) };
		}
 public CodeTypeDeclaration(string name)
 {
     this.attributes = System.Reflection.TypeAttributes.Public;
     this.baseTypes = new CodeTypeReferenceCollection();
     this.members = new CodeTypeMemberCollection();
     base.Name = name;
 }
 public CodeTypeDeclaration(string name)
 {
     this.attributes = System.Reflection.TypeAttributes.Public;
     this.baseTypes  = new CodeTypeReferenceCollection();
     this.members    = new CodeTypeMemberCollection();
     base.Name       = name;
 }
Пример #4
0
		public void Constructor1_NullItem ()
		{
			CodeTypeMember[] typeMembers = new CodeTypeMember[] { 
				new CodeTypeMember (), null };

			CodeTypeMemberCollection coll = new CodeTypeMemberCollection (
				typeMembers);
		}
 internal static void AddCallbackDeclaration(CodeTypeMemberCollection members, string callbackMember)
 {
     CodeMemberField field = new CodeMemberField {
         Type = new CodeTypeReference(typeof(SendOrPostCallback)),
         Name = callbackMember
     };
     members.Add(field);
 }
Пример #6
0
        public CodeDomArg(CodeExpression codeExpression, IScopeData scope)
        {
            MethodIdentifier = Guid.NewGuid().ToString("N");
            CodeExpression = codeExpression;
            Scope = scope;

            ParentMemberDefinitions = new CodeTypeMemberCollection();
            ParentStatements = new CodeStatementCollection();
        }
Пример #7
0
		public void Constructor0 ()
		{
			CodeTypeMemberCollection coll = new CodeTypeMemberCollection ();
			Assert.IsFalse (((IList) coll).IsFixedSize, "#1");
			Assert.IsFalse (((IList) coll).IsReadOnly, "#2");
			Assert.AreEqual (0, coll.Count, "#3");
			Assert.IsFalse (((ICollection) coll).IsSynchronized, "#4");
			Assert.IsNotNull (((ICollection) coll).SyncRoot, "#5");
		}
 /// <summary>
 /// Asserts that the specified type contains a member with the given name
 /// </summary>
 private void AssertContainsName(CodeTypeMemberCollection coll, string name)
 {
     foreach (CodeTypeMember member in coll)
     {
         if (name == member.Name)
         {
             return;
         }
     }
     Assert.Fail("Failed to find [" + name + "] in CodeTypeMembers");
 }
 public void AddRange(CodeTypeMemberCollection value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     int count = value.Count;
     for (int i = 0; i < count; i++)
     {
         this.Add(value[i]);
     }
 }
		public CodeExpression[] Generate(Table table, HardwireCodeGenerationContext generatorContext, CodeTypeMemberCollection members)
		{
			string className = "DVAL_" + Guid.NewGuid().ToString("N");
			DynValue kval = table.Get("value");

			DynValue vtype = table.Get("type");
			DynValue vstaticType = table.Get("staticType");

			string type = (vtype.Type == DataType.String) ? vtype.String : null;
			string staticType = (vstaticType.Type == DataType.String) ? vstaticType.String : null;


			CodeTypeDeclaration classCode = new CodeTypeDeclaration(className);

			classCode.TypeAttributes = System.Reflection.TypeAttributes.NestedPrivate | System.Reflection.TypeAttributes.Sealed;

			classCode.BaseTypes.Add(typeof(DynValueMemberDescriptor));

			CodeConstructor ctor = new CodeConstructor();
			ctor.Attributes = MemberAttributes.Assembly;
			classCode.Members.Add(ctor);


			if (type == null)
			{
				Table tbl = new Table(null);
				tbl.Set(1, kval);
				string str = tbl.Serialize();

				ctor.BaseConstructorArgs.Add(new CodePrimitiveExpression(table.Get("name").String));
				ctor.BaseConstructorArgs.Add(new CodePrimitiveExpression(str));
			}
			else if (type == "userdata")
			{
				ctor.BaseConstructorArgs.Add(new CodePrimitiveExpression(table.Get("name").String));

				CodeMemberProperty p = new CodeMemberProperty();
				p.Name = "Value";
				p.Type = new CodeTypeReference(typeof(DynValue));
				p.Attributes = MemberAttributes.Override | MemberAttributes.Public;
				p.GetStatements.Add(
					new CodeMethodReturnStatement(
						new CodeMethodInvokeExpression(
							new CodeTypeReferenceExpression(typeof(UserData)),
							"CreateStatic", new CodeTypeOfExpression(staticType))));

				classCode.Members.Add(p);
			}


			members.Add(classCode);
			return new CodeExpression[] { new CodeObjectCreateExpression(className) };
		}
		protected override void AddPageFields (CodeTypeMemberCollection members)
		{
			base.AddPageFields (members);

			executableField = new CodeMemberField {
            Name = "_Executable",
            Type = new CodeTypeReference(typeof(XQueryExecutable)),
            Attributes = MemberAttributes.Private | MemberAttributes.Static
         };

			members.Add (executableField);
		}
Пример #12
0
		public void Constructor1 ()
		{
			CodeTypeMember tm1 = new CodeTypeMember ();
			CodeTypeMember tm2 = new CodeTypeMember ();

			CodeTypeMember[] typeMembers = new CodeTypeMember[] { tm1, tm2 };
			CodeTypeMemberCollection coll = new CodeTypeMemberCollection (
				typeMembers);

			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (tm1), "#2");
			Assert.AreEqual (1, coll.IndexOf (tm2), "#3");
		}
Пример #13
0
        /// <include file='doc\CodeTypeMemberCollection.uex' path='docs/doc[@for="CodeTypeMemberCollection.AddRange1"]/*' />
        /// <devdoc>
        ///     <para>
        ///       Adds the contents of another <see cref='System.CodeDom.CodeTypeMemberCollection'/> to the end of the collection.
        ///    </para>
        /// </devdoc>
        public void AddRange(CodeTypeMemberCollection 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]);
            }
        }
Пример #14
0
		public void Constructor1_Deny_Unrestricted ()
		{
			CodeTypeMemberCollection coll = new CodeTypeMemberCollection (array);
			coll.CopyTo (array, 0);
			Assert.AreEqual (1, coll.Add (ctm), "Add");
			Assert.AreSame (ctm, coll[0], "this[int]");
			coll.AddRange (array);
			coll.AddRange (coll);
			Assert.IsTrue (coll.Contains (ctm), "Contains");
			Assert.AreEqual (0, coll.IndexOf (ctm), "IndexOf");
			coll.Insert (0, ctm);
			coll.Remove (ctm);
		}
Пример #15
0
        public void AddRange(CodeTypeMemberCollection value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            int currentCount = value.Count;
            for (int i = 0; i < currentCount; i++)
            {
                Add(value[i]);
            }
        }
		public CodeExpression[] Generate(Table table, HardwireCodeGenerationContext generator,
			CodeTypeMemberCollection members)
		{
			string type = (string)table["$key"];
			string className = "TYPE_" + Guid.NewGuid().ToString("N");

			CodeTypeDeclaration classCode = new CodeTypeDeclaration(className);

			classCode.Comments.Add(new CodeCommentStatement("Descriptor of " + type));


			classCode.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, "Descriptor of " + type));
			
			classCode.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, string.Empty));


			classCode.TypeAttributes = System.Reflection.TypeAttributes.NestedPrivate | System.Reflection.TypeAttributes.Sealed;
			
			classCode.BaseTypes.Add(typeof(HardwiredUserDataDescriptor));

			CodeConstructor ctor = new CodeConstructor();
			ctor.Attributes = MemberAttributes.Assembly;
			ctor.BaseConstructorArgs.Add(new CodeTypeOfExpression(type));

			classCode.Members.Add(ctor);

			generator.DispatchTablePairs(table.Get("members").Table,
				classCode.Members, (key, exp) =>
				{
					var mname = new CodePrimitiveExpression(key);

					ctor.Statements.Add(new CodeMethodInvokeExpression(
						new CodeThisReferenceExpression(), "AddMember", mname, exp));
				});

			generator.DispatchTablePairs(table.Get("metamembers").Table,
				classCode.Members, (key, exp) =>
				{
					var mname = new CodePrimitiveExpression(key);
					
					ctor.Statements.Add(new CodeMethodInvokeExpression(
						new CodeThisReferenceExpression(), "AddMetaMember", mname, exp));
				});

			members.Add(classCode);

			return new CodeExpression[] {
					new CodeObjectCreateExpression(className)
			};
		}
Пример #17
0
        /// <summary>
        /// Generates the Request-classes for all methods in a resource.
        /// </summary>
        public CodeTypeMemberCollection GenerateRequestClasses(CodeTypeDeclaration resourceClass, IResource resource)
        {
            CodeTypeMemberCollection newMembers = new CodeTypeMemberCollection();
            IList<string> usedNames = new List<string>(GeneratorUtils.GetUsedWordsFromMembers(resourceClass.Members));
            foreach (IMethod method in resource.Methods.Values)
            {
                // Generate the request class and add it to the result collection.
                CodeTypeDeclaration requestClass = GenerateRequestClass(resource, method, resourceClass, usedNames);
                newMembers.Add(requestClass);
                usedNames.Add(requestClass.Name);
            }

            return newMembers;
        }
Пример #18
0
        public void AddRange(CodeTypeMemberCollection value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            int count = value.Count;

            for (int i = 0; i < count; i++)
            {
                Add(value[i]);
            }
        }
        protected override void AddPageProperties(CodeTypeMemberCollection members)
        {
            base.AddPageProperties(members);

             var executableProperty = new CodeMemberProperty {
            Name = "Executable",
            Type = executableField.Type,
            Attributes = MemberAttributes.Public | MemberAttributes.Override,
            HasSet = false,
            HasGet = true,
             };
             executableProperty.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(PageTypeReferenceExpression, executableField.Name)));

             members.Add(executableProperty);
        }
		public CodeExpression[] Generate(Table table, HardwireCodeGenerationContext generator, CodeTypeMemberCollection members)
		{
			MethodMemberDescriptorGenerator mgen = new MethodMemberDescriptorGenerator("VTDC");

			Table mt = new Table(null);

			mt["params"] = new Table(null);
			mt["name"] = "__new";
			mt["type"] = table["type"];
			mt["ctor"] = true;
			mt["extension"] = false;
			mt["decltype"] = table["type"];
			mt["ret"] = table["type"];
			mt["special"] = false;


			return mgen.Generate(mt, generator, members);
		}
		public CodeExpression[] Generate(Table table, HardwireCodeGenerationContext generator,
			CodeTypeMemberCollection members)
		{
			List<CodeExpression> initializers = new List<CodeExpression>();

			generator.DispatchTablePairs(table.Get("overloads").Table, members, exp =>
			{
				initializers.Add(exp);
			});

			var name = new CodePrimitiveExpression((table["name"] as string));
			var type = new CodeTypeOfExpression(table["decltype"] as string);

			var array = new CodeArrayCreateExpression(typeof(IOverloadableMemberDescriptor), initializers.ToArray());

			return new CodeExpression[] {
					new CodeObjectCreateExpression(typeof(OverloadedMethodMemberDescriptor), name, type, array)
			};
		}
		protected override void AddPageFields (CodeTypeMemberCollection members)
		{
         
			base.AddPageFields (members);

			executableField = new CodeMemberField { 
            Name = "_Executable",
            Type = new CodeTypeReference(typeof(XsltExecutable)),
            Attributes = MemberAttributes.Private | MemberAttributes.Static
         };
			members.Add (executableField);

			if (parser.PageType == XsltPageType.AssociatedStylesheet) {
            
				initialContextNodeField = new CodeMemberField { 
               Name = "_initialContextNode",
               Type = new CodeTypeReference(typeof(IXPathNavigable)),
               Attributes = MemberAttributes.Private | MemberAttributes.Static
            };

				members.Add (initialContextNodeField);
			}
		}
Пример #23
0
        public static string GenerateCodeFromMembers(CodeTypeMemberCollection collection)
        {
            var type = new CodeTypeDeclaration("DUMMY");
            type.Members.AddRange(collection);
            var cp = new CSharpCodeProvider();
            var sb = new StringBuilder();
            var strWriter = new StringWriter(sb);


            var ccu = new CodeCompileUnit();
            var ns = new CodeNamespace();
            ns.Types.Add(type);
            ccu.Namespaces.Add(ns);

            cp.GenerateCodeFromCompileUnit(ccu, strWriter, new CodeGeneratorOptions());
            var adjusted = new[] { "" }.Concat(
                sb.ToString()
                    .Split(new string[] { Environment.NewLine }, StringSplitOptions.None)
                    .Skip(14)
                    .Reverse()
                    .Skip(2)
                    .Reverse()).ToArray();
            return string.Join("\r\n", adjusted);
        }
Пример #24
0
 public CodeTypeMemberCollection(CodeTypeMemberCollection value)
 {
     throw new NotImplementedException();
 }
Пример #25
0
		public CodeExpression[] Generate(Table table, HardwireCodeGenerationContext generator, CodeTypeMemberCollection members)
		{
			generator.Error("Missing code generator for '{0}'.", ManagedType);

			return new CodeExpression[0];
		}
Пример #26
0
        /// <summary>
        /// Iterates a CodeTypeMemberCollection and returns an array of indexes
        /// to members that are not marked with the IsAttribute custom attribute.
        /// </summary>
        /// <param name="typeMembers">A CodeTypeMemberCollection containing contract members.</param>
        /// <returns>A integer array containing the indexes of none attribute type members.</returns>
        /// <remarks>Skip AnyAttr data member because it is moved to the attribute processing order.</remarks>
        internal static int[] GetListOfMembers(CodeTypeMemberCollection typeMembers)
        {
            int[] tempList = new int[typeMembers.Count];
            int index = 0;

            // Add members
            for (int i = 0; i < typeMembers.Count; ++i)
            {
                if (GetCustomAttributeArgumentValue("IsAttribute", typeMembers[i].CustomAttributes) == null)
                    if (typeMembers[i].Name != "AnyAttr")
                        tempList[index++] = i;
            }

            int[] sortOrder = new int[index];
            Array.Copy(tempList, sortOrder, index);
            return sortOrder;
        }
Пример #27
0
        /// <summary>
        /// Iterates a CodeTypeMemberCollection and returns an array of indexes
        /// to members that are marked with the IsAttribute custom attribute.
        /// </summary>
        /// <param name="typeMembers">A CodeTypeMemberCollection containing contract members.</param>
        /// <returns>A integer array containing the indexes of attribute type members.</returns>
        /// <remarks>
        /// Special provisiong are made to handle AnyAttribute. If an AnyAttr data member is found,
        /// the index will be moved to the end of the attribute list. This way attribute processing
        /// can occur before an the next data member element is read.
        /// </remarks>
        internal static int[] GetListOfAttributes(CodeTypeMemberCollection typeMembers)
        {
            int[] tempList = new int[typeMembers.Count];
            int index = 0;
            int anyAttribIndex = -1;

            // Add attribute members
            for (int i = 0; i < typeMembers.Count; ++i)
            {
                if (GetCustomAttributeArgumentValue("IsAttribute", typeMembers[i].CustomAttributes) != null)
                    tempList[index++] = i;
                else if (typeMembers[i].Name == "AnyAttr")
                    anyAttribIndex = i;
            }

            int[] sortOrder;
            if (anyAttribIndex == -1)
            {
                sortOrder = new int[index];
                Array.Copy(tempList, sortOrder, index);
            }
            else
            {
                sortOrder = new int[index + 1];
                Array.Copy(tempList, sortOrder, index);
                sortOrder[index] = anyAttribIndex;
            }
            return sortOrder;
        }
Пример #28
0
 /// <summary>
 /// Iterates a CodeTypeMemberCollection and returns an array of indexes
 /// representing the collection sorted by attributes and then data members.
 /// </summary>
 /// <param name="typeMembers">A CodeTypeMemberCollection containing the contract members to sort.</param>
 /// <returns>A integer array containing the indexes of members sorted by attributes first then data members.</returns>
 internal static int[] SortMemberTypes(CodeTypeMemberCollection typeMembers)
 {
     int[] attribList = GetListOfAttributes(typeMembers);
     int[] memberList = GetListOfMembers(typeMembers);
     int[] sortOrder = new int[typeMembers.Count];
     Array.Copy(attribList, sortOrder, attribList.Length);
     Array.Copy(memberList, 0, sortOrder, attribList.Length, memberList.Length);
     return sortOrder;
 }
Пример #29
0
        public CodeTypeMemberCollection ParseMembers()
        {
            CodeTypeMemberCollection mc = new CodeTypeMemberCollection();

            while (TokenType != CDILToken.EOF && !IsKeyword("end"))
            {
                CodeTypeMember member = ParseMember();
                mc.Add(member);
            }
            return mc;
        }
Пример #30
0
		public ShaderDom(SourceShader source, string techniqueName, Platform platform, CompileDirectives directives)
		{
			this.domList = new List<DomBase>();
			this.domList.Add(this);

			//add custom dom's
			this.domList.Add(new ShaderBytes(source, techniqueName, platform));

			//needs to be passed to the registers as an interface provider
			ConstantSetup constantes = new ConstantSetup(source, techniqueName, platform);

			this.domList.Add(new ShaderRegisters(source, techniqueName, platform, constantes));
			this.domList.Add(constantes);
			this.domList.Add(new ShaderTextures(source, techniqueName, platform));

			foreach (DomBase dom in domList)
				dom.Setup(this);

			this.techniqueName = techniqueName;
			this.source = source;
			this.platform = platform;


			classDom = new CodeTypeDeclaration(techniqueName);
			classDom.IsClass = true;
			classDom.Attributes = MemberAttributes.Final | MemberAttributes.Public;
			classDom.TypeAttributes = TypeAttributes.Sealed | TypeAttributes.Public | TypeAttributes.Class;


			//provide a useful comment to the class
			GenerateClassComment();


			if (source.GenerateInternalClass)
			{
				classDom.Attributes = MemberAttributes.Final | MemberAttributes.Assembly;
				classDom.TypeAttributes = TypeAttributes.NestedAssembly | TypeAttributes.Class | TypeAttributes.Sealed;
			}
			
			classDom.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(System.Diagnostics.DebuggerStepThroughAttribute))));
			classDom.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(System.CodeDom.Compiler.GeneratedCodeAttribute)),new CodeAttributeArgument(new CodePrimitiveExpression(GetType().Assembly.ManifestModule.Name)),new CodeAttributeArgument(new CodePrimitiveExpression(GetType().Assembly.ManifestModule.ModuleVersionId.ToString()))));

			classDom.BaseTypes.Add(new CodeTypeReference(typeof(BaseShader)));

			//add custom base types to the shader
			//these are defined in TechniqueExtraData
			AsmTechnique asmTechnique = this.source.GetAsmTechnique(this.techniqueName, this.platform);

			if (asmTechnique.TechniqueExtraData != null && asmTechnique.TechniqueExtraData.ClassBaseTypes != null)
			{
				foreach (string baseTypeName in asmTechnique.TechniqueExtraData.ClassBaseTypes)
					classDom.BaseTypes.Add(new CodeTypeReference(baseTypeName));
			}


			this.directives = directives;

			SetupMembers(techniqueName);
			foreach (DomBase dom in domList)
				dom.SetupMembers(this);

			CreateConstructor();
			CreateStaticGraphicsInitMethod();
			CreateBindMethod();

			CreateWarmShaderMethod();

			CreateChangedMethod();

			CreateVertexInputMethods();

			CodeTypeMemberCollection pcMembers = new CodeTypeMemberCollection();
			CodeTypeMemberCollection xboxMembers = new CodeTypeMemberCollection();

			foreach (DomBase dom in this.domList)
			{
				dom.AddMembers(this, delegate(CodeTypeMember s, string c) { Comment(s, c); classDom.Members.Add(s); }, Platform.Both);

				if (!source.DefinePlatform) // no need for specialization when the platform is constant
				{
					dom.AddMembers(this, delegate(CodeTypeMember s, string c) { Comment(s, c); pcMembers.Add(s); }, Platform.Windows);
					dom.AddMembers(this, delegate(CodeTypeMember s, string c) { Comment(s, c); xboxMembers.Add(s); }, Platform.Xbox);
				}
			}


			foreach (DomBase dom in this.domList)
			{
				dom.AddReadonlyMembers(this, 
					delegate(CodeTypeMember s, string c)
					{
						CodeTypeMember readonlySnip = directives.CreateReadOnlySnippet();
						Comment(readonlySnip ?? s, c);
						if (readonlySnip != null) classDom.Members.Add(readonlySnip);
						classDom.Members.Add(s); 
					}, Platform.Both);

				if (!source.DefinePlatform)
				{
					dom.AddReadonlyMembers(this,
						delegate(CodeTypeMember s, string c)
						{
							CodeTypeMember readonlySnip = directives.CreateReadOnlySnippet();
							Comment(readonlySnip ?? s, c);
							if (readonlySnip != null) pcMembers.Add(readonlySnip);
							pcMembers.Add(s);
						}, Platform.Windows);

					dom.AddReadonlyMembers(this,
						delegate(CodeTypeMember s, string c)
						{
							CodeTypeMember readonlySnip = directives.CreateReadOnlySnippet();
							Comment(readonlySnip ?? s, c);
							if (readonlySnip != null) xboxMembers.Add(readonlySnip);
							xboxMembers.Add(s);
						}, Platform.Xbox);
				}
			}

			if (pcMembers.Count > 0 || xboxMembers.Count > 0)
			{
				//add #if / else blocks

				classDom.Members.Add(directives.IfXboxStatement);

				foreach (CodeTypeMember type in xboxMembers)
					classDom.Members.Add(type);

				classDom.Members.Add(directives.ElseStatement);

				foreach (CodeTypeMember type in pcMembers)
					classDom.Members.Add(type);

				classDom.Members.Add(directives.EndifStatement);
			}

			//finally, create the attribute setters

			CreateSetAttributeMethod(typeof(float), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(Vector2), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(Vector3), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(Vector4), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(Matrix), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(bool), "SetAttributeImpl", "attribute");

			CreateSetAttributeMethod(typeof(float[]), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(Vector2[]), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(Vector3[]), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(Vector4[]), "SetAttributeImpl", "attribute");
			CreateSetAttributeMethod(typeof(Matrix[]), "SetAttributeImpl", "attribute");

			CreateSetAttributeMethod(typeof(Xen.Graphics.TextureSamplerState), "SetSamplerStateImpl", "sampler");
			CreateSetAttributeMethod(typeof(Texture), "SetTextureImpl", "texture");
			CreateSetAttributeMethod(typeof(Texture2D), "SetTextureImpl", "texture");
			CreateSetAttributeMethod(typeof(Texture3D), "SetTextureImpl", "texture");
			CreateSetAttributeMethod(typeof(TextureCube), "SetTextureImpl", "texture");

		}
 public CodeTypeMemberCollection(CodeTypeMemberCollection value)
 {
     AddRange(value);
 }
 protected override void DbusServiceTargetField(CodeTypeReference typerefDbusInterface, CodeTypeReference typerefDbusMarshal, CodeTypeMemberCollection members)
 {
     CodeMemberField memberProxy = new CodeMemberField(typerefDbusInterface, CodeBuilderCommon.targetName);
     memberProxy.Attributes = MemberAttributes.Private;
     members.Add(memberProxy);
 }
Пример #33
0
 static CodeTypeMemberCollection BuildOneToManyRelationships(EntityMetadata entity, ServiceProvider serviceProvider)
 {
     var members = new CodeTypeMemberCollection();
     if (entity.OneToManyRelationships != null)
     {
         foreach (var metadata in from metadata in entity.OneToManyRelationships
                                                            orderby metadata.SchemaName
                                                            select metadata)
         {
             var entityMetadata = GetEntityMetadata(metadata.ReferencingEntity, serviceProvider);
             if (string.Equals(metadata.SchemaName, "calendar_calendar_rules", StringComparison.Ordinal) || string.Equals(metadata.SchemaName, "service_calendar_rules", StringComparison.Ordinal))
             {
                 members.Add(BuildCalendarRuleAttribute(entity, entityMetadata, metadata, serviceProvider));
             }
             else if (serviceProvider.CodeFilterService.GenerateEntity(entityMetadata, serviceProvider) && serviceProvider.CodeFilterService.GenerateRelationship(metadata, entityMetadata, serviceProvider))
             {
                 members.Add(BuildOneToMany(entity, entityMetadata, metadata, serviceProvider));
             }
             else
             {
                 Trace.TraceInformation("Skipping {0}.OneToMany {1} from being generated.", new object[] {entity.LogicalName, metadata.SchemaName});
             }
         }
     }
     return members;
 }
Пример #34
0
 static CodeTypeMemberCollection BuildManyToManyRelationships(EntityMetadata entity, ServiceProvider serviceProvider)
 {
     var members = new CodeTypeMemberCollection();
     if (entity.ManyToManyRelationships != null)
     {
         foreach (var metadata in from metadata in entity.ManyToManyRelationships
                                                             orderby metadata.SchemaName
                                                             select metadata)
         {
             var entityLogicalName = (entity.LogicalName != metadata.Entity1LogicalName) ? metadata.Entity1LogicalName : metadata.Entity2LogicalName;
             var entityMetadata = GetEntityMetadata(entityLogicalName, serviceProvider);
             if (serviceProvider.CodeFilterService.GenerateEntity(entityMetadata, serviceProvider) && serviceProvider.CodeFilterService.GenerateRelationship(metadata, entityMetadata, serviceProvider))
             {
                 if (entityMetadata.LogicalName != entity.LogicalName)
                 {
                     EntityRole? reflexiveRole = null;
                     var propertyName = serviceProvider.NamingService.GetNameForRelationship(entity, metadata, reflexiveRole, serviceProvider);
                     EntityRole? entityRole = null;
                     var member = BuildManyToMany(entity, entityMetadata, metadata, propertyName, entityRole, serviceProvider);
                     members.Add(member);
                 }
                 else
                 {
                     var str3 = serviceProvider.NamingService.GetNameForRelationship(entity, metadata, 0, serviceProvider);
                     var member2 = BuildManyToMany(entity, entityMetadata, metadata, str3, 0, serviceProvider);
                     members.Add(member2);
                     var str4 = serviceProvider.NamingService.GetNameForRelationship(entity, metadata, EntityRole.Referenced, serviceProvider);
                     var member3 = BuildManyToMany(entity, entityMetadata, metadata, str4, EntityRole.Referenced, serviceProvider);
                     members.Add(member3);
                 }
             }
             else
             {
                 Trace.TraceInformation("Skipping {0}.ManyToMany {1} from being generated.", new object[] {entity.LogicalName, metadata.SchemaName});
             }
         }
     }
     return members;
 }
 public void AddRange(CodeTypeMemberCollection !value)
 {
     Contract.Requires(value != null);
 }
Пример #36
0
 public void AddRange(CodeTypeMemberCollection value)
 {
     throw new NotImplementedException();
 }
Пример #37
0
 static CodeTypeMemberCollection BuildManyToOneRelationships(EntityMetadata entity, ServiceProvider serviceProvider)
 {
     var members = new CodeTypeMemberCollection();
     if (entity.ManyToOneRelationships != null)
     {
         foreach (var metadata in from metadata in entity.ManyToOneRelationships
                                                            orderby metadata.SchemaName
                                                            select metadata)
         {
             var entityMetadata = GetEntityMetadata(metadata.ReferencedEntity, serviceProvider);
             if (serviceProvider.CodeFilterService.GenerateEntity(entityMetadata, serviceProvider) && serviceProvider.CodeFilterService.GenerateRelationship(metadata, entityMetadata, serviceProvider))
             {
                 var member = BuildManyToOne(entity, entityMetadata, metadata, serviceProvider);
                 members.Add(member);
             }
             else
             {
                 Trace.TraceInformation("Skipping {0}.ManyToOne {1} from being generated.", new object[] {entity.LogicalName, metadata.SchemaName});
             }
         }
     }
     return members;
 }
 public CodeTypeMemberCollection(CodeTypeMemberCollection value)
 {
     return(default(CodeTypeMemberCollection));
 }