예제 #1
0
        public PlistData CreatePlistData()
        {
            PlistData plistData = new PlistData();

            foreach (DataType item in DataList)
            {
                if (item.DataName == "frames")
                {
                    List <DataType> children = GetDataType(item.childrenID);
                    foreach (DataType child in children)
                    {
                        FrameData frameData = new FrameData();
                        frameData.PngName = child.DataName;
                        Type type = frameData.GetType();

                        List <DataType> frameDataList = GetDataType(child.childrenID);
                        foreach (DataType data in frameDataList)
                        {
                            System.Reflection.PropertyInfo propertyInfo = type.GetProperty(StringHelper.ToTitleCase(data.DataName));
                            if (propertyInfo != null)
                            {
                                propertyInfo.SetValue(frameData, data.Value);
                            }
                            else
                            {
                                Logger.Wran(type.ToString() + "不包含属性:" + data.DataName);
                            }
                        }
                        plistData.Frames.Add(frameData);
                    }
                }
                else if (item.DataName == "metadata")
                {
                    Metadata        metadata = new Metadata();
                    List <DataType> children = GetDataType(item.childrenID);
                    foreach (DataType child in children)
                    {
                        Type type = metadata.GetType();
                        System.Reflection.PropertyInfo propertyInfo = type.GetProperty(StringHelper.ToTitleCase(child.DataName));
                        if (propertyInfo != null)
                        {
                            propertyInfo.SetValue(metadata, child.Value);
                        }
                        else
                        {
                            Logger.Wran(type.ToString() + "不包含属性:" + child.DataName);
                        }
                    }
                    plistData.Metadata = metadata;
                }
            }
            plistData.Init();
            return(plistData);
        }
예제 #2
0
        public PlistData CreatePlistData()
        {
            PlistData plistData = new PlistData();
            foreach (DataType item in DataList)
            {
                if (item.DataName == "frames")
                {
                    List<DataType> children = GetDataType(item.childrenID);
                    foreach (DataType child in children)
                    {
                        FrameData frameData = new FrameData();
                        frameData.PngName = child.DataName;
                        Type type = frameData.GetType();

                        List<DataType> frameDataList = GetDataType(child.childrenID);
                        foreach (DataType data in frameDataList)
                        {
                            System.Reflection.PropertyInfo propertyInfo = type.GetProperty(StringHelper.ToTitleCase(data.DataName));
                            if (propertyInfo != null)
                            {
                                propertyInfo.SetValue(frameData, data.Value);
                            }
                            else
                            {
                                Logger.Wran(type.ToString() + "不包含属性:" + data.DataName);
                            }
                        }
                        plistData.Frames.Add(frameData);
                    }
                }
                else if (item.DataName == "metadata")
                {
                    Metadata metadata = new Metadata();
                    List<DataType> children = GetDataType(item.childrenID);
                    foreach (DataType child in children)
                    {
                        Type type = metadata.GetType();
                        System.Reflection.PropertyInfo propertyInfo = type.GetProperty(StringHelper.ToTitleCase(child.DataName));
                        if (propertyInfo != null)
                        {
                            propertyInfo.SetValue(metadata, child.Value);
                        }
                        else
                        {
                            Logger.Wran(type.ToString() + "不包含属性:" + child.DataName);
                        }
                    }
                    plistData.Metadata = metadata;
                }
            }
            plistData.Init();
            return plistData;
        }