예제 #1
0
		private void ParsePlaceObject3Tag(PlaceObject3Tag tag)
		{ 
			// the new features of PO3 aren't used
			ParsePlaceObject2Tag(tag);
		}
예제 #2
0
        private void ParseTags(SwfReader r, byte swfVersion)
        {
            bool tagsRemain = true;

            uint curFrame = 0;
            while (tagsRemain)
            {
                uint b = r.GetUI16();
                curTag = (TagType)(b >> 6);
                curTagLen = b & 0x3F;
                if (curTagLen == 0x3F)
                {
                    curTagLen = r.GetUI32();
                }
                uint tagEnd = r.Position + curTagLen;
                Debug.WriteLine("sprite type: " + ((uint)curTag).ToString("X2") + " -- " + Enum.GetName(typeof(TagType), curTag));

                switch (curTag)
                {
                    case TagType.End:
                        tagsRemain = false;
                        ControlTags.Add(new EndTag(r));
                        break;

                    case TagType.PlaceObject:
                        PlaceObjectTag pot = new PlaceObjectTag(r, tagEnd);
                        FirstFrameObjects.Add(pot);
                        ControlTags.Add(pot);
                        break;
                    case TagType.PlaceObject2:
                        PlaceObject2Tag po2t = new PlaceObject2Tag(r, swfVersion);
                        if (po2t.HasCharacter)
                        {
                            FirstFrameObjects.Add(po2t);
                        }
                        ControlTags.Add(po2t);
                        break;
                    case TagType.PlaceObject3:
                        PlaceObject3Tag po3t = new PlaceObject3Tag(r);
                        if (po3t.HasCharacter)
                        {
                            FirstFrameObjects.Add(po3t);
                        }
                        ControlTags.Add(po3t);
                        break;

                    case TagType.RemoveObject:
                        ControlTags.Add(new RemoveObjectTag(r));
                        break;

                    case TagType.RemoveObject2:
                        ControlTags.Add(new RemoveObject2Tag(r));
                        break;

                    case TagType.ShowFrame:
                        ControlTags.Add(new ShowFrame(r));
                        curFrame++;
                        break;

                    case TagType.SoundStreamHead:
                    case TagType.SoundStreamHead2:
                        ControlTags.Add(new SoundStreamHeadTag(r));
                        break;

                    case TagType.FrameLabel:
                        ControlTags.Add(new FrameLabelTag(r));
                        break;

                    case TagType.DoAction:
                        ControlTags.Add(new DoActionTag(r, curTagLen));
                        break;

                    case TagType.DoInitAction:
                        ControlTags.Add(new DoActionTag(r, curTagLen, true));
                        break;

                    default:
                        // skip if unknown
                        Debug.WriteLine("invalid sprite tag: " + ((uint)curTag).ToString("X2") + " -- " + Enum.GetName(typeof(TagType), curTag));
                        r.SkipBytes(curTagLen);
                        break;
                }
                if (tagEnd != r.Position)
                {
                    Console.WriteLine("bad tag in sprite: " + Enum.GetName(typeof(TagType), curTag));
                }
            }
        }
예제 #3
0
        private void ParseTags(SwfReader r, byte swfVersion)
        {
            bool tagsRemain = true;

            uint curFrame = 0;

            while (tagsRemain)
            {
                uint b = r.GetUI16();
                curTag    = (TagType)(b >> 6);
                curTagLen = b & 0x3F;
                if (curTagLen == 0x3F)
                {
                    curTagLen = r.GetUI32();
                }
                uint tagEnd = r.Position + curTagLen;
                Debug.WriteLine("sprite type: " + ((uint)curTag).ToString("X2") + " -- " + Enum.GetName(typeof(TagType), curTag));

                switch (curTag)
                {
                case TagType.End:
                    tagsRemain = false;
                    ControlTags.Add(new EndTag(r));
                    break;

                case TagType.PlaceObject:
                    PlaceObjectTag pot = new PlaceObjectTag(r, tagEnd);
                    FirstFrameObjects.Add(pot);
                    ControlTags.Add(pot);
                    break;

                case TagType.PlaceObject2:
                    PlaceObject2Tag po2t = new PlaceObject2Tag(r, swfVersion);
                    if (po2t.HasCharacter)
                    {
                        FirstFrameObjects.Add(po2t);
                    }
                    ControlTags.Add(po2t);
                    break;

                case TagType.PlaceObject3:
                    PlaceObject3Tag po3t = new PlaceObject3Tag(r);
                    if (po3t.HasCharacter)
                    {
                        FirstFrameObjects.Add(po3t);
                    }
                    ControlTags.Add(po3t);
                    break;

                case TagType.RemoveObject:
                    ControlTags.Add(new RemoveObjectTag(r));
                    break;

                case TagType.RemoveObject2:
                    ControlTags.Add(new RemoveObject2Tag(r));
                    break;

                case TagType.ShowFrame:
                    ControlTags.Add(new ShowFrame(r));
                    curFrame++;
                    break;

                case TagType.SoundStreamHead:
                case TagType.SoundStreamHead2:
                    ControlTags.Add(new SoundStreamHeadTag(r));
                    break;

                case TagType.FrameLabel:
                    ControlTags.Add(new FrameLabelTag(r));
                    break;

                case TagType.DoAction:
                    ControlTags.Add(new DoActionTag(r, curTagLen));
                    break;

                case TagType.DoInitAction:
                    ControlTags.Add(new DoActionTag(r, curTagLen, true));
                    break;

                default:
                    // skip if unknown
                    Debug.WriteLine("invalid sprite tag: " + ((uint)curTag).ToString("X2") + " -- " + Enum.GetName(typeof(TagType), curTag));
                    r.SkipBytes(curTagLen);
                    break;
                }
                if (tagEnd != r.Position)
                {
                    Console.WriteLine("bad tag in sprite: " + Enum.GetName(typeof(TagType), curTag));
                }
            }
        }