public ResourcesData(string filePath)
        {
            _filePath = filePath;

            if (File.Exists(_filePath))
            {
                _resourcesDocument = new XmlDocument();
                _resourcesDocument.Load(_filePath);
                _container = new Container(_resourcesDocument.DocumentElement, null);
            }
        }
        public Container(XmlNode node,Container parentContainer)
        {
            Containers = new List<Container>();
            Name = node.Name;
            Shaders = new List<Shader>();
            Models = new List<Model>();
            TexturePacks = new List<TexturePack>();
            Particles = new List<Particles>();
            if (node.ParentNode != null)
            {
                ParentContainer = parentContainer;
            }

            _node = (XmlElement)node;
            LoadFromXML(_node);
        }
Exemple #3
0
        public Shader(XmlNode node, Container parentContainer)
        {
            _node = (XmlElement)node;

            ParentContainer = parentContainer;
        }
 public void AddContainer(Container container)
 {
     _node.AppendChild(container._node);
     Containers.Add(container);
     _newNode = true;
 }
 private void LoadFromXML(XmlNode parentNode)
 {
     foreach (XmlElement nodes in parentNode)
     {
         switch (GetType(nodes))
         {
             case "container":
                 Container newContainer = new Container(nodes, this);
                 Containers.Add(newContainer);
                 break;
             case "shader":
                 //Shaders.GetShader(nodes);
                 Shader newShader = new Shader(nodes, this);
                 Shaders.Add(newShader);
                 break;
             case "model":
                 Model newModel = new Model(nodes, this);
                 Models.Add(newModel);
                 break;
             case "texture_pack":
                 TexturePack newTexturePack = new TexturePack(nodes, this);
                 TexturePacks.Add(newTexturePack);
                 break;
             case "particles":
                 Particles newParticles = new Particles(nodes, this);
                 Particles.Add(newParticles);
                 break;
             default:
                 //System.Windows.Forms.MessageBox.Show("Error! Unsigned node detected!");
                 break;
         }
     }
 }
 public void DeleteContainer(Container container)
 {
     Containers.Remove(container);
 }
 public Container CreateContainer(string containerName)
 {
     XmlElement containerNode = _node.OwnerDocument.CreateElement(containerName);
     Container containter = new Container(containerNode, this);
     return containter;
 }
 public string SearchShaderPathInContainersByName(Container container, string shaderName, string outputShaderNodeValue)
 {
     outputShaderNodeValue = container.GetShaderPathByName(shaderName);
     if ((outputShaderNodeValue == String.Empty) && (container.Containers.Count > 0))
     {
         foreach (Container cont in container.Containers)
         {
             outputShaderNodeValue = cont.GetShaderPathByName(shaderName);
             if (outputShaderNodeValue == String.Empty)
             {
                 if (container.Containers.Count > 0)
                 {
                     outputShaderNodeValue = SearchShaderPathInContainersByName(cont, shaderName, outputShaderNodeValue);
                     if (outputShaderNodeValue != String.Empty)
                     {
                         return outputShaderNodeValue;
                     }
                 }
             }
             else
             {
                 return outputShaderNodeValue;
             }
         }
     }
     if (outputShaderNodeValue != String.Empty)
     {
         return outputShaderNodeValue;
     }
     return String.Empty;
 }
        public Particles(XmlNode node, Container parentContainer)
        {
            _node = (XmlElement)node;

            ParentContainer = parentContainer;
        }
        public TexturePack(XmlNode node, Container parentContainer)
        {
            _node = (XmlElement)node;

            ParentContainer = parentContainer;
        }