Example #1
0
        public void load(string[] args)
        {
            addItem(args[0]);

            Cereal.Buffer buff = new Cereal.Buffer(0);
            buff.readFile(args[0]);

            if (buff.Data[0] == 0x52 && buff.Data[1] == 0x4D)
            {
                Header header = new Header();
                header.read(ref buff);

                foreach (Database db in header.Databases)
                {
                    addItem(db.Name, args[0]);

                    foreach (Cereal.Object obj in db.Objects)
                    {
                        addItem(obj.Name, db.Name);

                        foreach (Cereal.Array arr in obj.Arrays)
                        {
                            addItem("Array: " + arr.Name, obj.Name);
                        }

                        foreach (Field f in obj.Fields)
                        {
                            addItem("Field: " + f.Name, obj.Name);
                        }
                    }
                }
            }
            else
            {
                Database db = new Database();
                db.read(ref buff);

                addItem(db.Name, args[0]);

                foreach (Cereal.Object obj in db.Objects)
                {
                    addItem(obj.Name, db.Name);

                    foreach (Cereal.Array arr in obj.Arrays)
                    {
                        addItem("Array: " + arr.Name, obj.Name);
                    }

                    foreach (Field f in obj.Fields)
                    {
                        addItem("Field: " + f.Name, obj.Name);
                    }
                }
            }

            treeView1.ExpandAll();
        }