コード例 #1
0
        public static ObjectDb FromXml(string xml)
        {
            ObjectDb    res = new ObjectDb();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            XmlNode n = doc.SelectSingleNode("/database");

            res.timestamp = int.Parse(n.Attributes["timestamp"].InnerText);
            foreach (XmlNode node in n.ChildNodes)
            {
                if (node.Name == "categories")
                {
                    foreach (XmlNode subn in node.ChildNodes)
                    {
                        res.Categories.Add(int.Parse(subn.Attributes["id"].InnerText), subn.InnerText);
                    }
                }
                else if (node.Name == "object")
                {
                    ObjectDbEntry tmp = ObjectDbEntry.FromXml(node.ChildNodes);
                    res.Entries.Add(node.Attributes["id"].InnerText, tmp);
                    if (tmp.model.Trim() != "")
                    {
                        res.IdToModel.Add(node.Attributes["id"].InnerText, tmp.model);
                    }
                }
            }
            return(res);
        }
コード例 #2
0
ファイル: FrmObjEditor.cs プロジェクト: RR0000/Odyssave
        public FrmObjEditor(Dictionary <string, object> Lev)
        {
            InitializeComponent();
            Value      = new LevelObj();
            Value.Prop = Lev;
            this.Text  = "Edit object: " + Value.ToString();
            Form1 owner = (Form1)Application.OpenForms["Form1"];

            ObjectDatabase = owner.ObjectDatabase;
        }
コード例 #3
0
ファイル: FrmAddObj.cs プロジェクト: RR0000/Odyssave
 public FrmAddObj(string[] _CCNT, ObjectDb db, string text, Vector3D SpawnPos)
 {
     InitializeComponent();
     LayerName        = text;
     CCNT             = _CCNT;
     comboBox1.Sorted = true;
     objPos           = SpawnPos;
     if (db != null)
     {
         List <string> objdb = new List <string>();
         objdb.AddRange(from n in db.Entries.Keys.ToArray() where db.Entries[n].Category != 255 && db.Entries[n].Known == 1 select n);
         ObjDb = objdb.ToArray();
     }
     ObjDb = null;
 }
コード例 #4
0
 public ObjectDbEditor(ObjectDb db)
 {
     InitializeComponent();
     database = db;
 }