Example #1
0
        public void RestoreToCurrent(string path)
        {
            DebugUtil.Log("[OGSerializer] Restoring scene from " + path);

            XmlDocument doc = new XmlDocument();

            try {
                doc.Load(path);
            }catch (Exception) {
                DebugUtil.Log("[OGSerializer] failed to read XmlDocument");
                throw;
            }

            // begin restore
            OGActions.BeginRestoreExistingScene();

            // restore scene objects
            XMLInputStream stream = new XMLInputStream()
            {
                xml = doc
            };
            SceneSerializer serializer = new SceneSerializer()
            {
                SOFactory = new SOFactory()
            };

            serializer.Restore(stream, OG.Scene);

            // restore datamodel
            RestoreDataModel(doc);
        }