/// <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);
        }
Esempio n. 2
0
		/// <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;
		}