Inheritance: ResourceReaderBase
Exemplo n.º 1
0
        private void JudgeType()
        {
            if (SectionType == SectionType.Closed || SectionType == SectionType.Opend)
            {
                layerType = LayerType.Group;
            }
            else if (this.resources.Contains("SoLd.Idnt"))
            {
                layerType = LayerType.Normal;
            }
            else if (this.resources.Contains("SoCo") == true)
            {
                layerType = LayerType.Color;
            }
            else if (this.resources.Contains("TySh.Idnt"))
            {
                layerType = LayerType.Text;

                Readers.LayerResources.Reader_TySh reader = resources["TySh"] as Readers.LayerResources.Reader_TySh;
                DescriptorStructure text = null;
                if (reader.TryGetValue <DescriptorStructure>(ref text, "Text"))
                {
                    textinfo = new TextInfo(text);
                }
            }
            else if (deepth > 6)
            {
                layerType = LayerType.Overflow;
            }
            else
            {
                layerType = LayerType.Complex;
            }
        }
Exemplo n.º 2
0
        public void SetExtraRecords(LayerMask layerMask, LayerBlendingRanges blendingRanges, IProperties resources, string name)
        {
            this.layerMask      = layerMask;
            this.blendingRanges = blendingRanges;
            this.resources      = resources;
            this.name           = name;


            this.resources.TryGetValue <string>(ref this.name, "luni.Name");
            this.resources.TryGetValue <SectionType>(ref this.sectionType, "lsct.SectionType");

            if (SectionType == SectionType.Divider)
            {
                layerType = LayerType.Divider;
            }
            else if (SectionType == SectionType.Closed || SectionType == SectionType.Opend)
            {
                layerType = LayerType.Group;
            }
            else if (this.resources.Contains("SoLd.Idnt") == true)
            {
                this.placedID = this.resources.ToGuid("SoLd.Idnt");
                layerType     = LayerType.Normal;
            }
            else if (this.resources.Contains("SoLE.Idnt") == true)
            {
                this.placedID = this.resources.ToGuid("SoLE.Idnt");
                throw new Exception("WaitDefine");
            }
            else if (this.resources.Contains("TySh.Idnt"))
            {
                Readers.LayerResources.Reader_TySh reader = resources["TySh"] as Readers.LayerResources.Reader_TySh;
                DescriptorStructure text = null;
                if (reader.TryGetValue <DescriptorStructure>(ref text, "Text"))
                {
                    textinfo = new TextInfo(text);
                }

                layerType = LayerType.Text;
            }
            else
            {
                layerType = LayerType.SolidImage;
            }

            foreach (var item in this.channels)
            {
                switch (item.Type)
                {
                case ChannelType.Mask:
                {
                    if (this.layerMask != null)
                    {
                        item.Width  = this.layerMask.Width;
                        item.Height = this.layerMask.Height;
                    }
                }
                break;

                case ChannelType.Alpha:
                {
                    if (this.resources.Contains("iOpa") == true)
                    {
                        byte opa = this.resources.ToByte("iOpa", "Opacity");
                        item.Opacity = opa / 255.0f;
                    }
                }
                break;
                }
            }
        }