예제 #1
0
        private void  patchForwardBranches()
        {
            // now patch forward branches
            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            for (System.Collections.IEnumerator i = updates.GetEnumerator(); i.MoveNext();)
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                UpdateEntry entry = (UpdateEntry)i.Current;
                switch (entry.source.code)
                {
                case flash.swf.ActionConstants_Fields.sactionIf:
                case flash.swf.ActionConstants_Fields.sactionJump:
                    int target = getLabelOffset(((Branch)entry.source).target);
                    writer.writeSI16at(entry.updatePos, target - entry.anchor);
                    break;

                case flash.swf.ActionConstants_Fields.sactionWith:
                    int endWith = getLabelOffset(((With)entry.source).endWith);
                    writer.writeUI16at(entry.updatePos, endWith - entry.anchor);
                    break;

                case flash.swf.ActionConstants_Fields.sactionWaitForFrame:
                case flash.swf.ActionConstants_Fields.sactionWaitForFrame2:
                    int skipTarget = getLabelCount(((WaitForFrame)entry.source).skipTarget);
                    writer.writeUI8at(entry.updatePos, skipTarget - entry.anchor);
                    break;

                case flash.swf.ActionConstants_Fields.sactionTry:
                    Try t      = (Try)entry.source;
                    int endTry = getLabelOffset(t.endTry);
                    writer.writeUI16at(entry.updatePos, endTry - entry.anchor);
                    entry.anchor = endTry;
                    if (t.hasCatch())
                    {
                        int endCatch = getLabelOffset(t.endCatch);
                        writer.writeUI16at(entry.updatePos + 2, endCatch - entry.anchor);
                        entry.anchor = endCatch;
                    }
                    if (t.hasFinally())
                    {
                        int endFinally = getLabelOffset(t.endFinally);
                        writer.writeUI16at(entry.updatePos + 4, endFinally - entry.anchor);
                    }
                    break;

                default:
                    Debug.Assert(false, "invalid action in UpdateEntry");
                    break;
                }
            }
        }
예제 #2
0
		private void  encodeButtonCondAction(ButtonCondAction condAction, SwfEncoder w, bool last)
		{
			int pos = w.Pos;
			w.writeUI16(0);
			
			w.writeUBits(condAction.keyPress, 7);
			w.writeBit(condAction.overDownToIdle);
			
			w.writeBit(condAction.idleToOverDown);
			w.writeBit(condAction.outDownToIdle);
			w.writeBit(condAction.outDownToOverDown);
			w.writeBit(condAction.overDownToOutDown);
			w.writeBit(condAction.overDownToOverUp);
			w.writeBit(condAction.overUpToOverDown);
			w.writeBit(condAction.overUpToIdle);
			w.writeBit(condAction.idleToOverUp);
			
			new ActionEncoder(w, debug).encode(condAction.actionList);
			w.writeUI8(0); // end action byte
			
			if (!last)
			{
				w.writeUI16at(pos, w.Pos - pos);
			}
		}
예제 #3
0
		public override void  defineSprite(DefineSprite tag)
		{
			int id = dict.add(tag);
			tagw.writeUI16(id);
			tagw.writeUI16(tag.framecount);
			
			if (Debug)
			{
				debug.adjust = writer.Pos + 6;
			}
			
			// save frame count
			int oldFrames = frames;
			frames = 0;
			
			// save the movie writer, and push a new writer
			SwfEncoder oldWriter = writer;
			writer = tagw;
			tagw = createEncoder(SwfVersion);
			
			// write sprite tags
			System.Collections.IList tags = tag.tagList.tags;
			int size = tags.Count;
			for (int i = 0; i < size; i++)
			{
				Tag t = (Tag) tags[i];
				if (!(t is DefineTag))
					t.visit(this);
			}
			
			// terminate with end marker
			writer.writeUI16(0);
			
			// update frame count
			writer.writeUI16at(2, frames);
			
			// restore writers
			tagw = writer;
			writer = oldWriter;
			frames = oldFrames;
			
			if (Debug)
			{
				debug.adjust = 0;
			}
			
			encodeTag(tag);
		}