Exemplo n.º 1
0
        public List <ScienceBaseNode> GetNodes()
        {
            var DataNodes = new List <ScienceBaseNode>();

            using (var ServerConnection = CreateConnection())
            {
                ServerConnection.Open();

                var ServerCommand = ServerConnection.CreateCommand();

                using (ServerCommand)
                {
                    ServerCommand.CommandText = "select * from sciencebase order by groupid, title, url";

                    var RowReader = ServerCommand.ExecuteReader();

                    using (RowReader)
                    {
                        while (RowReader.Read())
                        {
                            var CurrentNode = new ScienceBaseNode(0);

                            CurrentNode.Read(RowReader);

                            DataNodes.Add(CurrentNode);
                        }
                    }
                }
            }

            return(DataNodes);
        }
Exemplo n.º 2
0
        private void ExtractJSONStreamValues(List <ScienceBaseNode> dataNodes, Dictionary <string, object> values, ScienceBaseNode dataNode, int depth)
        {
            foreach (var Item in values)
            {
                if (Item.Value is Dictionary <string, object> )
                {
                    var NewDepth = (1 + depth);

                    ExtractJSONStreamValues(dataNodes, Item.Value as Dictionary <string, object>, CreateDataNode(dataNodes, NewDepth), NewDepth);
                }
                else if (Item.Value is object[])
                {
                    ExtractJSONStreamValues(dataNodes, Item.Value as object[], depth);
                }
                else
                {
                    dataNode.Read(depth, Item);
                }
            }

            return;
        }