Exemplo n.º 1
0
        static BlitChecker()
        {
            BlitChecker.unmanagedTypes = new SortedList <string, CppType>();
            if (!File.Exists("NativeMetaData.xml"))
            {
                return;
            }
            XmlDocument document = new XmlDocument();

            document.Load("NativeMetaData.xml");

            XmlElement[] typeElements =
                document.GetElementsByTagName("CppType").OfType <XmlElement>().ToArray();
            // Load the type information.
            for (int i = 0; i < typeElements.Length; i++)
            {
                // Load the name of the type.
                string       typeName      = typeElements[i].Name;
                XmlElement[] fieldElements =
                    typeElements[i].GetElementsByTagName("Field").OfType <XmlElement>().ToArray();
                CppType nativeType = new CppType
                {
                    // Load the size of objects of this type.
                    Size   = Convert.ToInt32(typeElements[i].GetAttribute("Size")),
                    Fields = new List <Tuple <string, Type> >()
                };
                for (int j = 0; j < fieldElements.Length; j++)
                {
                    // Load field metadata of the type.
                    nativeType.Fields.Add
                    (
                        new Tuple <string, Type>
                        (
                            fieldElements[j].GetAttribute("Name"),
                            Type.GetType(fieldElements[j].GetAttribute("TypeName"))
                        )
                    );
                }
                BlitChecker.unmanagedTypes.Add(typeName, nativeType);
            }
        }
Exemplo n.º 2
0
        static BlitChecker()
        {
            BlitChecker.unmanagedTypes = new SortedList<string, CppType>();
            if (!File.Exists("NativeMetaData.xml"))
            {
                return;
            }
            XmlDocument document = new XmlDocument();
            document.Load("NativeMetaData.xml");

            XmlElement[] typeElements =
                document.GetElementsByTagName("CppType").OfType<XmlElement>().ToArray();
            // Load the type information.
            for (int i = 0; i < typeElements.Length; i++)
            {
                // Load the name of the type.
                string typeName = typeElements[i].Name;
                XmlElement[] fieldElements =
                    typeElements[i].GetElementsByTagName("Field").OfType<XmlElement>().ToArray();
                CppType nativeType = new CppType
                {
                    // Load the size of objects of this type.
                    Size = Convert.ToInt32(typeElements[i].GetAttribute("Size")),
                    Fields = new List<Tuple<string, Type>>()
                };
                for (int j = 0; j < fieldElements.Length; j++)
                {
                    // Load field metadata of the type.
                    nativeType.Fields.Add
                    (
                        new Tuple<string, Type>
                        (
                            fieldElements[j].GetAttribute("Name"),
                            Type.GetType(fieldElements[j].GetAttribute("TypeName"))
                        )
                    );
                }
                BlitChecker.unmanagedTypes.Add(typeName, nativeType);
            }
        }