Exemplo n.º 1
0
        private void ParseDBNameLine(string line, Dictionary <string, DBNameEntry> dbnames)
        {
            string[] items = line.Split(',');
            if (items.Length < 3)
            {
                return;
            }

            string uuid = items[0].Substring(1); // .Replace("{", string.Empty);

            if (new Guid(uuid) == Guid.Empty)
            {
                return;                               // system meta object - global settings etc.
            }
            DBName dbname = new DBName()
            {
                Token    = items[1].Trim('\"'),             // .Replace("\"", string.Empty),
                TypeCode = int.Parse(items[2].TrimEnd('}')) // .Replace("}", string.Empty))
            };

            dbname.IsMainTable = IsMainTable(dbname.Token);

            if (!dbnames.TryGetValue(uuid, out DBNameEntry entry))
            {
                entry = new DBNameEntry();
                dbnames.Add(uuid, entry);
            }
            entry.DBNames.Add(dbname);

            if (dbname.IsMainTable)
            {
                entry.MetaObject.UUID      = new Guid(uuid);
                entry.MetaObject.Token     = dbname.Token;
                entry.MetaObject.TypeCode  = dbname.TypeCode;
                entry.MetaObject.TableName = CreateTableName(entry.MetaObject, dbname);
            }
        }
Exemplo n.º 2
0
        private void ParseDBNameLine(string line, Dictionary <string, DBNameEntry> dbnames)
        {
            string[] items = line.Split(',');
            if (items.Length < 3)
            {
                return;
            }

            string uuid = items[0].Substring(1); // .Replace("{", string.Empty);

            if (new Guid(uuid) == Guid.Empty)
            {
                return;                               // system meta object - global settings etc.
            }
            string token = items[1].Trim('\"');

            if (token == MetadataTokens.Fld)
            {
                if (DBFields.ContainsKey(uuid))
                {
                    return;
                }

                DBNameEntry Fld = new DBNameEntry();
                Fld.DBNames.Add(new DBName()
                {
                    Token       = token,
                    TypeCode    = int.Parse(items[2].TrimEnd('}')),
                    IsMainTable = false
                });
                DBFields.Add(uuid, Fld);

                return;
            }

            if (!IsTokenLoadingAllowed(token))
            {
                return;
            }

            DBName dbname = new DBName()
            {
                Token    = token,
                TypeCode = int.Parse(items[2].TrimEnd('}')) // .Replace("}", string.Empty))
            };

            dbname.IsMainTable = IsMainTable(dbname.Token);

            if (!dbnames.TryGetValue(uuid, out DBNameEntry entry))
            {
                entry = new DBNameEntry();
                dbnames.Add(uuid, entry);
            }
            entry.DBNames.Add(dbname);

            if (dbname.IsMainTable)
            {
                entry.MetaObject.UUID      = new Guid(uuid);
                entry.MetaObject.TypeName  = MapTokenToTypeName(dbname.Token);
                entry.MetaObject.TypeCode  = dbname.TypeCode;
                entry.MetaObject.TableName = CreateTableName(entry.MetaObject, dbname);
            }
        }