Пример #1
0
        public static void ReadDistanceSchema()
        {
            // Get the Schema for distance functions from the DLL
            int           schemaLength = GetDistanceSchemaLength();
            StringBuilder sb           = new StringBuilder(schemaLength);

            GetDistanceSchema(sb);

            using (XmlReader reader = XmlReader.Create(new StringReader(sb.ToString())))
            {
                while (reader.NodeType != XmlNodeType.EndElement && reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "DISTANCESCHEMA")
                    {
                        while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
                        {
                            if (reader.NodeType == XmlNodeType.Element && (reader.Name == "FLOATFUNC" || reader.Name == "VECFUNC" || reader.Name == "NULLFUNC"))
                            {
                                DistFunc newFunc = new DistFunc();
                                newFunc.Read(reader);
                                _DistFunc.Add(newFunc);
                            }
                            if (reader.NodeType == XmlNodeType.Element && (reader.Name == "FLOATVAR" || reader.Name == "VECVAR"))
                            {
                                FuncVar newVar = new FuncVar();
                                newVar.Read(reader);
                                _FuncVar.Add(newVar);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public static void ReadDistanceSchema()
        {
            // Get the Schema for distance functions from the DLL
            int schemaLength = GetDistanceSchemaLength();
            StringBuilder sb = new StringBuilder(schemaLength);
            GetDistanceSchema(sb);

            using (XmlReader reader = XmlReader.Create(new StringReader(sb.ToString())))
            {
                while (reader.NodeType != XmlNodeType.EndElement && reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "DISTANCESCHEMA")
                    {
                        while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
                        {
                            if (reader.NodeType == XmlNodeType.Element && (reader.Name == "FLOATFUNC" || reader.Name == "VECFUNC" || reader.Name == "NULLFUNC"))
                            {
                                DistFunc newFunc = new DistFunc();
                                newFunc.Read(reader);
                                _DistFunc.Add(newFunc);
                            }
                            if (reader.NodeType == XmlNodeType.Element && (reader.Name == "FLOATVAR" || reader.Name == "VECVAR"))
                            {
                                FuncVar newVar = new FuncVar();
                                newVar.Read(reader);
                                _FuncVar.Add(newVar);
                            }
                        }
                    }
                }
            }
        }