Ejemplo n.º 1
0
        public bool LoadFromFile(String Filename)
        {
            bool result = false;

            RootNode = new SExpression();
            RootNode.LoadFromFile(Filename);

            if (RootNode.Name == "fp_lib_table")
            {
                foreach (SNodeBase node in RootNode.Items)
                {
                    SExpression s_expr = node as SExpression;

                    if (s_expr.Name == "lib")
                    {
                        LibEntry lib = LibEntry.Parse(s_expr);
                        if (Entries == null)
                        {
                            Entries = new List <LibEntry>();
                        }
                        Entries.Add(lib);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public static LibEntry Parse(SExpression root_node)
        {
            LibEntry result = null;

            if (root_node.Name == "lib")
            {
                result = new LibEntry();
                int index = 0;

                //
                while (index < root_node.Items.Count)
                {
                    SNodeBase   node = root_node.Items[index];
                    SExpression sub  = node as SExpression;

                    switch (sub.Name)
                    {
                    case "name":
                        result.Name = sub.GetString();
                        break;

                    case "type":
                        result.Type = sub.GetString();
                        break;

                    case "uri":
                        result.Uri = sub.GetString();
                        break;

                    case "options":
                        result.Options = sub.GetString();
                        break;

                    case "descr":
                        result.Description = sub.GetString();
                        break;
                    }
                    index++;
                }

                return(result);
            }
            else
            {
                return(null);  // error
            }
        }