private void  encodeClipEventFlags(int flags, SwfEncoder w)
 {
     if (w.swfVersion >= 6)
     {
         w.write32(flags);
     }
     else
     {
         w.writeUI16(flags);
     }
 }
Beispiel #2
0
		private void  encodeSwdData(SwfEncoder buffer)
		{
			// Encode the header.
			buffer.write32(('F') | ('W' << 8) | ('D' << 16) | (version << 24));
			
			// Encode one kDebugID tag.
			buffer.write32(flash.swf.DebugTags_Fields.kDebugID);
			buffer.write(debugID);
			
			// Encode the kDebugScript and kDebugOffset tags.
			// The kDebugScript tags are in module number order (1,2,3,...).
			// After each one of these are the associated kDebugOffset tags
			// for that module number, in ascending order
			// by line number and byte offset.
			
			SupportClass.CollectionsSupport.Sort(debugScripts, null);
			int id = 0;
			System.Collections.IEnumerator debugScriptIter = debugScripts.GetEnumerator();
			//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'"
			while (debugScriptIter.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'"
				DebugScript debugScript = (DebugScript) debugScriptIter.Current;
				id++;
				
				buffer.write32(flash.swf.DebugTags_Fields.kDebugScript);
				buffer.write32(id);
				buffer.write32(debugScript.bitmap);
				buffer.writeString(debugScript.name);
				buffer.writeString(debugScript.text);
				
				SupportClass.CollectionsSupport.Sort(debugScript.debugOffsets, null);
				System.Collections.IEnumerator debugOffsetIter = debugScript.debugOffsets.GetEnumerator();
				//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'"
				while (debugOffsetIter.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'"
					DebugOffset debugOffset = (DebugOffset) debugOffsetIter.Current;
					
					buffer.write32(flash.swf.DebugTags_Fields.kDebugOffset);
					buffer.write32(id);
					buffer.write32(debugOffset.lineNumber);
					buffer.write32(debugOffset.byteOffset);
				}
			}
			
			// Encode the kDebugRegister tags
			SupportClass.CollectionsSupport.Sort(debugRegisters, null);
			System.Collections.IEnumerator itr = debugRegisters.GetEnumerator();
			//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'"
			while (itr.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'"
				DebugRegisters debug = (DebugRegisters) itr.Current;
				int size = debug.registerNumbers.Length;
				
				buffer.write32(flash.swf.DebugTags_Fields.kDebugRegisters);
				buffer.write32(debug.offset);
				buffer.writeUI8(size);
				for (int i = 0; i < debug.registerNumbers.Length; i++)
				{
					buffer.writeUI8(debug.registerNumbers[i]);
					buffer.writeString(debug.variableNames[i]);
				}
			}
			
			// Encode the kDebugBreakpoint tags
			SupportClass.CollectionsSupport.Sort(debugBreakpoints, null);
			System.Collections.IEnumerator debugBreakpointIterator = debugBreakpoints.GetEnumerator();
			//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'"
			while (debugBreakpointIterator.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'"
				DebugBreakpoint debugBreakpoint = (DebugBreakpoint) debugBreakpointIterator.Current;
				
				buffer.write32(flash.swf.DebugTags_Fields.kDebugBreakpoint);
				buffer.write32(debugBreakpoint.offset);
			}
		}
		private void  encodeSoundInfo(SoundInfo info, SwfEncoder w)
		{
			w.writeUBits(0, 2); // reserved
			w.writeBit(info.syncStop);
			w.writeBit(info.syncNoMultiple);
			w.writeBit(info.records != null);
			w.writeBit(info.loopCount != SoundInfo.UNINITIALIZED);
			w.writeBit(info.outPoint != SoundInfo.UNINITIALIZED);
			w.writeBit(info.inPoint != SoundInfo.UNINITIALIZED);
			
			if (info.inPoint != SoundInfo.UNINITIALIZED)
			{
				w.write32((int) info.inPoint);
			}
			if (info.outPoint != SoundInfo.UNINITIALIZED)
			{
				w.write32((int) info.outPoint);
			}
			if (info.loopCount != SoundInfo.UNINITIALIZED)
			{
				w.writeUI16(info.loopCount);
			}
			if (info.records != null)
			{
				w.writeUI8(info.records.Length);
				for (int k = 0; k < info.records.Length; k++)
				{
					w.write64(info.records[k]);
				}
			}
		}
		public override void  header(Header header)
		{
			// get some header properties we need to know
			int swfVersion = header.version;
			this.header_Renamed_Field = header;
			this.writer = createEncoder(swfVersion);
			this.tagw = createEncoder(swfVersion);
			width = header.size.Width;
			height = header.size.Height;
			frames = 0;
			
			// write the header
			writer.writeUI8(header.compressed?'C':'F');
			writer.writeUI8('W');
			writer.writeUI8('S');
			writer.writeUI8(header.version);
			writer.write32((int) header.length);
			if (header.compressed)
			{
				writer.markComp();
			}
			encodeRect(header.size, writer);
			writer.writeUI8(header.rate >> 8);
			writer.writeUI8(header.rate & 255);
			framecountPos = writer.Pos;
			writer.writeUI16(header.framecount);
		}
		private void  encodeGradientBevelFilter(SwfEncoder w, GradientBevelFilter f)
		{
			w.writeUI8(f.numcolors);
			for (int i = 0; i < f.numcolors; ++i)
				encodeRGBA(f.gradientColors[i], w);
			for (int i = 0; i < f.numcolors; ++i)
				w.writeUI8(f.gradientRatio[i]);
			
			//        w.write32( f.shadowColor );
			//        w.write32( f.highlightColor );
			w.write32(f.blurX);
			w.write32(f.blurY);
			w.write32(f.angle);
			w.write32(f.distance);
			w.writeUI16(f.strength);
			w.writeUI8(f.flags);
		}
		private void  encodeBevelFilter(SwfEncoder w, BevelFilter f)
		{
			encodeRGBA(f.shadowColor, w);
			encodeRGBA(f.highlightColor, w);
			w.write32(f.blurX);
			w.write32(f.blurY);
			w.write32(f.angle);
			w.write32(f.distance);
			w.writeUI16(f.strength);
			w.writeUI8(f.flags);
		}
		private void  encodeGlowFilter(SwfEncoder w, GlowFilter f)
		{
			encodeRGBA(f.color, w);
			w.write32(f.blurX);
			w.write32(f.blurY);
			w.writeUI16(f.strength);
			w.writeUI8(f.flags);
		}
		private void  encodeBlurFilter(SwfEncoder w, BlurFilter f)
		{
			w.write32(f.blurX);
			w.write32(f.blurY);
			w.writeUI8(f.passes);
		}
		private void  encodeDropShadowFilter(SwfEncoder w, DropShadowFilter f)
		{
			encodeRGBA(f.color, w);
			w.write32(f.blurX);
			w.write32(f.blurY);
			w.write32(f.angle);
			w.write32(f.distance);
			w.writeUI16(f.strength);
			w.writeUI8(f.flags);
		}
        /// <summary> encode a run of push actions into one action record.  The player
        /// supports this compact encoding since push is such a common
        /// opcode.  the format is:
        ///
        /// sactionPush type1 value1 type2 value2 ...
        ///
        /// </summary>
        /// <param name="push">
        /// </param>
        /// <param name="j">the index of the starting push action
        /// </param>
        /// <param name="actions">
        /// </param>
        /// <returns> the index of the last push action encoded.  the next action will
        /// not be a push action.
        /// </returns>
        public virtual int encodePush(Push push, int j, ActionList actions)
        {
            int updatePos = encodeActionHeader(push);

            do
            {
                System.Object value_Renamed = push.value_Renamed;
                int           type          = Push.getTypeCode(value_Renamed);
                writer.writeUI8(type);

                switch (type)
                {
                case 0:                          // string
                    //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                    writer.writeString(value_Renamed.ToString());
                    break;

                case 1:                          // float
                    //UPGRADE_ISSUE: Method 'java.lang.Float.floatToIntBits' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangFloatfloatToIntBits_float'"
                    //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Float.floatValue' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                    int bits = Float.floatToIntBits((float)((System.Single)value_Renamed));
                    writer.write32(bits);
                    break;

                case 2:                          // null
                    break;

                case 3:                          // undefined
                    break;

                case 4:                          // register
                    writer.writeUI8((int)((System.SByte)value_Renamed) & 0xFF);
                    break;

                case 5:                          // boolean
                    writer.writeUI8(((System.Boolean)value_Renamed)?1:0);
                    break;

                case 6:                          // double
                    double d = ((System.Double)value_Renamed);
                    //UPGRADE_ISSUE: Method 'java.lang.Double.doubleToLongBits' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangDoubledoubleToLongBits_double'"
                    long num = Double.doubleToLongBits(d);
                    writer.write32((int)(num >> 32));
                    writer.write32((int)num);
                    break;

                case 7:                          // integer
                    writer.write32(((System.Int32)value_Renamed));
                    break;

                case 8:                          // const8
                    writer.writeUI8((int)((System.Int16)value_Renamed));
                    break;

                case 9:                          // const16
                    writer.writeUI16((int)((System.Int16)value_Renamed) & 0xFFFF);
                    break;
                }

                if (debug == null)
                {
                    // ignore line records if we aren't debugging
                    while (j + 1 < actions.size() && actions.getAction(j + 1).code == ActionList.sactionLineRecord)
                    {
                        j++;
                    }
                }

                Action a;
                if (++j < actions.size() && (a = actions.getAction(j)).code == flash.swf.ActionConstants_Fields.sactionPush)
                {
                    push = (Push)a;
                }
                else
                {
                    push = null;
                }
            }while (push != null);
            updateActionHeader(updatePos);
            return(j - 1);
        }
Beispiel #11
0
		private void  encodeClipEventFlags(int flags, SwfEncoder w)
		{
			if (w.swfVersion >= 6)
				w.write32(flags);
			else
				w.writeUI16(flags);
		}
        private void  encodeSwdData(SwfEncoder buffer)
        {
            // Encode the header.
            buffer.write32(('F') | ('W' << 8) | ('D' << 16) | (version << 24));

            // Encode one kDebugID tag.
            buffer.write32(flash.swf.DebugTags_Fields.kDebugID);
            buffer.write(debugID);

            // Encode the kDebugScript and kDebugOffset tags.
            // The kDebugScript tags are in module number order (1,2,3,...).
            // After each one of these are the associated kDebugOffset tags
            // for that module number, in ascending order
            // by line number and byte offset.

            SupportClass.CollectionsSupport.Sort(debugScripts, null);
            int id = 0;

            System.Collections.IEnumerator debugScriptIter = debugScripts.GetEnumerator();
            //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'"
            while (debugScriptIter.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'"
                DebugScript debugScript = (DebugScript)debugScriptIter.Current;
                id++;

                buffer.write32(flash.swf.DebugTags_Fields.kDebugScript);
                buffer.write32(id);
                buffer.write32(debugScript.bitmap);
                buffer.writeString(debugScript.name);
                buffer.writeString(debugScript.text);

                SupportClass.CollectionsSupport.Sort(debugScript.debugOffsets, null);
                System.Collections.IEnumerator debugOffsetIter = debugScript.debugOffsets.GetEnumerator();
                //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'"
                while (debugOffsetIter.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'"
                    DebugOffset debugOffset = (DebugOffset)debugOffsetIter.Current;

                    buffer.write32(flash.swf.DebugTags_Fields.kDebugOffset);
                    buffer.write32(id);
                    buffer.write32(debugOffset.lineNumber);
                    buffer.write32(debugOffset.byteOffset);
                }
            }

            // Encode the kDebugRegister tags
            SupportClass.CollectionsSupport.Sort(debugRegisters, null);
            System.Collections.IEnumerator itr = debugRegisters.GetEnumerator();
            //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'"
            while (itr.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'"
                DebugRegisters debug = (DebugRegisters)itr.Current;
                int            size  = debug.registerNumbers.Length;

                buffer.write32(flash.swf.DebugTags_Fields.kDebugRegisters);
                buffer.write32(debug.offset);
                buffer.writeUI8(size);
                for (int i = 0; i < debug.registerNumbers.Length; i++)
                {
                    buffer.writeUI8(debug.registerNumbers[i]);
                    buffer.writeString(debug.variableNames[i]);
                }
            }

            // Encode the kDebugBreakpoint tags
            SupportClass.CollectionsSupport.Sort(debugBreakpoints, null);
            System.Collections.IEnumerator debugBreakpointIterator = debugBreakpoints.GetEnumerator();
            //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'"
            while (debugBreakpointIterator.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'"
                DebugBreakpoint debugBreakpoint = (DebugBreakpoint)debugBreakpointIterator.Current;

                buffer.write32(flash.swf.DebugTags_Fields.kDebugBreakpoint);
                buffer.write32(debugBreakpoint.offset);
            }
        }