BrashMonkey.Spriter.Data.IO.SCMLParser.ReadFolder C# (CSharp) Method

ReadFolder() private method

private ReadFolder ( XmlElement element ) : void
element System.Xml.XmlElement
return void
        void ReadFolder(XmlElement element)
        {
            int folderID = -1;
            string folderName = string.Empty;

            foreach(XmlAttribute attribute in element.Attributes)
            {
                // id
                if (attribute.Name.Equals("id"))
                    folderID = int.Parse(attribute.Value);

                // name
                else if (attribute.Name.Equals("name"))
                    folderName = attribute.Value;
            }

            foreach(XmlElement child in element)
            {
                if (!child.Name.Equals("file"))
                    continue;

                var pivot = new Vector2(0, 1);

                SpriterFile file = new SpriterFile();
                m_Data.files.Add(file);

                file.folderID = folderID;
                file.folderName = folderName;

                foreach(XmlAttribute attribute in child.Attributes)
                {
                    // type
                    if (attribute.Name.Equals("type"))
                    {
                        file.typeRaw = attribute.Value;
                        file.type = SpriterDataHelpers.ParseSpriterEnum<FileType>(file.typeRaw);
                    }

                    // id
                    else if (attribute.Name.Equals("id"))
                        file.ID = int.Parse(attribute.Value);

                    // name
                    else if (attribute.Name.Equals("name"))
                        file.name = attribute.Value;

                    // pivot
                    else if (attribute.Name.Equals("pivot_x"))
                        pivot.x = float.Parse(attribute.Value);
                    else if (attribute.Name.Equals("pivot_y"))
                        pivot.y = float.Parse(attribute.Value);

                    // width, height
                    else if (attribute.Name.Equals("width"))
                        file.width = int.Parse(attribute.Value);
                    else if (attribute.Name.Equals("height"))
                        file.height = int.Parse(attribute.Value);

                    // atlas_x, atlas_y
                    else if (attribute.Name.Equals("atlas_x"))
                        file.atlasX = int.Parse(attribute.Value);
                    else if (attribute.Name.Equals("atlas_y"))
                        file.atlasY = int.Parse(attribute.Value);

                    // offset_x, offset_y
                    else if (attribute.Name.Equals("offset_x"))
                        file.offsetX = int.Parse(attribute.Value);
                    else if (attribute.Name.Equals("offset_y"))
                        file.offsetY = int.Parse(attribute.Value);

                    // original_width, original_height
                    else if (attribute.Name.Equals("original_width"))
                        file.originalWidth = int.Parse(attribute.Value);
                    else if (attribute.Name.Equals("original_height"))
                        file.originalHeight = int.Parse(attribute.Value);

                }

                // Assign vector values
                file.pivot = pivot;
            }
        }