Пример #1
0
 public int Add(TypeEntry item)
 {
     return base.Add(item);
 }
Пример #2
0
        public static void LoadPattern(string filepath)
        {
            entities = new StringDictionary();
            types = new SortedList();
            basetypes = new SortedList();
            dbtypes = new SortedList();

            string dir = System.IO.Directory.GetCurrentDirectory();
            FileStream fs = new FileStream(filepath, FileMode.Open);

            XmlDocument dom = new XmlDocument();

            dom.Load(fs);

            string[] tags = new string[]
                {
                    TAG_CLASS,
                    TAG_ENGINE,
                    TAG_INSTANCE,
                    TAG_DECLARATION,
                    TAG_PROPERTY,
                    TAG_CONFIGFILE,
                    TAG_CONFIGBBDD
                };

            foreach(string tag in tags)
            {
                XmlNode node = dom.SelectSingleNode(XPATH_ROOT + tag);
                entities.Add(tag, node.InnerXml);
            }

            XmlNodeList nodes = dom.SelectNodes(XPATH_ROOT + TAG_TYPES + "/" + TAG_TYPE);
            foreach(XmlNode n in nodes)
            {
                TypeEntry te = new TypeEntry();

                te.name = n.Attributes[ATTR_NAME].Value;

                XmlAttribute attr = n.Attributes[ATTR_PREFIX];
                if(attr != null) te.prefix = attr.Value;

                attr = n.Attributes[ATTR_PARAMS];
                if(attr != null) te.parameters = attr.Value;

                attr = n.Attributes[ATTR_DBPARAMS];
                if(attr != null) te.dbparameters = attr.Value;

                attr = n.Attributes[ATTR_DBTYPE];
                if(attr != null) te.dbtype = attr.Value;

                attr = n.Attributes[ATTR_BASETYPE];
                if(attr != null) te.basetype = attr.Value;

                attr = n.Attributes[ATTR_NONNULLABLE];
                if(attr != null) te.nonNullable = (attr != null && attr.Value.ToLower() == "true");

                if(!types.Contains(te.Name)) types.Add(te.Name, te);
                if(!dbtypes.Contains(te.DBType)) dbtypes.Add(te.DBType, te);
                if(!basetypes.Contains(te.BaseType)) basetypes.Add(te.BaseType, te);

            }

            fs.Close();

            isLoaded = true;
        }
Пример #3
0
 public int Add(TypeEntry item)
 {
     return(base.Add(item));
 }
Пример #4
0
        public static TypeEntry[] GetTypes()
        {
            TypeEntry[] entries = new TypeEntry[types.Count];

            int i = 0;
            foreach(TypeEntry te in types.Values)
            {
                entries[i] = te;
                i++;
            }

            return entries;
        }