Exemplo n.º 1
0
 /// <summary>
 /// Adds the specified character id.
 /// </summary>
 /// <param name="characterId">Character id.</param>
 /// <param name="defineTag">Define tag.</param>
 public void Add(ushort characterId, DefineTag defineTag)
 {
     if (characterId != 0 && !base.Contains(characterId))
     {
         base.Add(characterId, defineTag);
     }
 }
Exemplo n.º 2
0
 public override void  exportAssets(ExportAssets tag)
 {
     // we only care what tags were exported in this frame, because all the
     // code in this frame could depend on those definitions.
     //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 = tag.exports.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'"
         DefineTag def = (DefineTag)i.Current;
         frame.addExport(def);
     }
 }
Exemplo n.º 3
0
        /// <summary> This is the method used during encoding.</summary>
        public virtual int add(DefineTag tag)
        {
            System.Diagnostics.Debug.Assert(tag != null);
            if (tags.Contains(tag))
            {
                //throw new IllegalArgumentException("symbol " +tag+ " redefined");
                return((int)tags[tag]);
            }

            int key = nextId++;

            tags[tag] = key;
            ids[key]  = tag;
            return(key);
        }
Exemplo n.º 4
0
 public static String idRef(DefineTag tag, Dictionary d)
 {
     if (tag == null)
     {
         // if tag is null then it isn't in the dict -- the SWF is invalid.
         // lets be lax and print something; Matador generates invalid SWF sometimes.
         return("-1");
     }
     else if (tag.name == null)
     {
         // just print the character id since no name was exported
         return(System.Convert.ToString(d.getId(tag)));
     }
     else
     {
         return(tag.name);
     }
 }
Exemplo n.º 5
0
        /// <throws>  IllegalArgumentException if the id is not defined </throws>
        /// <param name="idref">
        /// </param>
        /// <returns>
        /// </returns>
        public virtual DefineTag getTag(int idref)
        {
            System.Int32 key = (System.Int32)idref;
            DefineTag    t   = (DefineTag)ids[key];

            if (t == null)
            {
                // [tpr 7/6/04] work around authoring tool bug of bogus 65535 ids
                if (idref != 65535)
                {
                    throw new System.ArgumentException("symbol " + idref + " not defined");
                }
                else
                {
                    return(INVALID_TAG);
                }
            }
            return(t);
        }
Exemplo n.º 6
0
        public virtual int getId(DefineTag tag)
        {
            if (tag == null || tag == INVALID_TAG)
            {
                return(-1);                 //throw new NullPointerException("no ids for null tags");
            }
            else
            {
                // when we're encoding, we should definitely find the tag here.
                System.Object idobj = tags[tag];

                if (idobj == null)
                {
                    // When we're decoding, we don't fill in the tags map, and so we'll have
                    // to search for the tag to see what it had when we read it in.

                    foreach (System.Collections.DictionaryEntry entry in ids)
                    {
                        // [ets 1/14/04] we use an exact comparison here instead of equals() because this point
                        // should only be reached during *decoding*, by tools that want to report the id
                        // that is only stored in the ids map.  Since each DefineTag from a single swf will
                        // be a unique object, this should be safe.  During encoding, we will find ID's stored
                        // in the tags map, and the ids map should be empty.  if we use equals(), it is possible
                        // for tools to report the wrong ID, because the defineTags may not be fully decoded yet,
                        // for example the ExportAssets may not have been reached, so the tag might not have its
                        // name yet, and therefore compare equal to another unique but yet-unnamed tag.

                        if (entry.Value == tag)
                        {
                            idobj = entry.Key;
                            break;
                        }
                    }
                }

                if (idobj == null)
                {
                    System.Diagnostics.Debug.Assert(false, "encoding error, " + tag.name + " not in dictionary");
                }

                return((System.Int32)idobj);
            }
        }
Exemplo n.º 7
0
        /// <summary> This is method used during decoding.
        ///
        /// </summary>
        /// <param name="id">
        /// </param>
        /// <param name="s">
        /// </param>
        /// <throws>  IllegalArgumentException if the dictionary already has that id </throws>
        public virtual void  add(int id, DefineTag s)
        {
            System.Int32 key = (System.Int32)id;
            Tag          t   = (Tag)ids[key];

            if (t == null)
            {
                ids[key] = s;
                // This DefineTag is potentially very generic, for example
                // it's name is most likely null, so don't bother adding
                // it to the tags Map.
            }
            else
            {
                if (t.Equals(s))
                {
                    throw new System.ArgumentException("symbol " + id + " redefined by identical tag");
                }
                else
                {
                    throw new System.ArgumentException("symbol " + id + " redefined by different tag");
                }
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Removes the specified define tag.
 /// </summary>
 /// <param name="defineTag">Define tag.</param>
 public void Remove(DefineTag defineTag)
 {
     base.Remove(defineTag.CharacterId);
 }
Exemplo n.º 9
0
 public virtual void  addName(DefineTag s, String name)
 {
     names[name] = s;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Adds the specified define tag.
 /// </summary>
 /// <param name="defineTag">Define tag.</param>
 public void Add(DefineTag defineTag)
 {
     Add(defineTag.CharacterId, defineTag);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Removes the specified define tag.
 /// </summary>
 /// <param name="defineTag">Define tag.</param>
 public void Remove(DefineTag defineTag)
 {
     base.Remove (defineTag.CharacterId);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Adds the specified character id.
 /// </summary>
 /// <param name="characterId">Character id.</param>
 /// <param name="defineTag">Define tag.</param>
 public void Add(ushort characterId, DefineTag defineTag)
 {
     if (characterId != 0 && !base.Contains(characterId))
         base.Add(characterId, defineTag);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Adds the specified define tag.
 /// </summary>
 /// <param name="defineTag">Define tag.</param>
 public void Add(DefineTag defineTag)
 {
     Add(defineTag.CharacterId, defineTag);
 }
Exemplo n.º 14
0
        public virtual void  export(Movie m)
        {
            // define the header
            Header h = new Header();

            h.version    = m.version;
            h.compressed = Header.useCompression(m.version);
            h.size       = m.size;
            h.rate       = m.framerate;

            handler.header(h);

            // movie-wide tags
            if (m.fileAttributes != null)
            {
                if (m.metadata != null)
                {
                    m.fileAttributes.hasMetadata = true;
                }

                m.fileAttributes.visit(handler);                 // FileAttributes MUST be first tag after header!
            }
            if (m.metadata != null)
            {
                m.metadata.visit(handler);
            }
            if (m.enableDebugger != null)
            {
                m.enableDebugger.visit(handler);
            }
            if (m.uuid != null)
            {
                new DebugID(m.uuid).visit(handler);
            }
            if (m.protect != null)
            {
                m.protect.visit(handler);
            }
            if (m.scriptLimits != null)
            {
                m.scriptLimits.visit(handler);
            }
            if (m.bgcolor != null)
            {
                m.bgcolor.visit(handler);
            }
            if (m.productInfo != null)
            {
                m.productInfo.visit(handler);
            }
            if (m.sceneAndFrameLabelData != null)
            {
                m.sceneAndFrameLabelData.visit(handler);
            }

            // finally, output the frames
            bool associateRootClass = (m.topLevelClass != null);

            //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 = m.frames.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'"
                Frame frame = (Frame)i.Current;

                if (frame.label != null)
                {
                    frame.label.visit(handler);
                }

                if (!(frame.imports.Count == 0))
                {
                    //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 j = frame.imports.GetEnumerator(); j.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'"
                        ImportAssets importAssets = (ImportAssets)j.Current;
                        importAssets.visit(handler);
                    }
                }

                // definitions needed in this frame
                //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 j = frame.References; j.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'"
                    DefineTag ref_Renamed = (DefineTag)j.Current;
                    define(ref_Renamed);
                }

                // exports
                if (frame.hasExports())
                {
                    ExportAssets exportAssets = new ExportAssets();
                    //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 j = frame.exportIterator(); j.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'"
                        DefineTag tag = (DefineTag)j.Current;
                        exportAssets.exports.Add(tag);
                    }
                    exportAssets.visit(handler);
                }

                // TODO: Review this... temporarily special casing fonts here as they should not be
                // included in ExportAssets as they are not required to be exported by name!

                // fonts
                if (frame.hasFonts())
                {
                    //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 k = frame.fontsIterator(); k.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'"
                        DefineFont tag = (DefineFont)k.Current;

                        // We may have already visited this font because of symbolClasses.
                        if (!done.Contains(tag))
                        {
                            tag.visit(handler);
                            done.Add(tag);
                        }
                    }
                }

                // abc tags
                //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 j = frame.doABCs.GetEnumerator(); j.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'"
                    Tag tag = (Tag)j.Current;
                    tag.visit(handler);
                }

                SymbolClass classes = new SymbolClass();

                if (frame.hasSymbolClasses())
                {
                    SupportClass.MapSupport.PutAll(classes.class2tag, frame.symbolClass.class2tag);
                }
                if (associateRootClass)
                {
                    // only works on frame 1
                    classes.topLevelClass = m.topLevelClass;                     // Why do we do this on every frame's symclass?
                }
                if (associateRootClass || frame.hasSymbolClasses())
                {
                    classes.visit(handler);
                }
                associateRootClass = false;

                // control tags
                //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 j = frame.controlTags.GetEnumerator(); j.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'"
                    Tag tag = (Tag)j.Current;
                    tag.visit(handler);
                }

                // then frame actions
                //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 j = frame.doActions.GetEnumerator(); j.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'"
                    ActionList list = (ActionList)j.Current;
                    new DoAction(list).visit(handler);
                }

                // oh yeah, then showFrame!
                new ShowFrame().visit(handler);
            }

            handler.finish();
        }
Exemplo n.º 15
0
 internal String idRef(DefineTag tag)
 {
     return(idRef(tag, dict));
 }
Exemplo n.º 16
0
		private System.String id(DefineTag tag)
		{
			//UPGRADE_NOTE: Final was removed from the declaration of 'id '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
			int id = dict.getId(tag);
			return System.Convert.ToString(id);
		}
Exemplo n.º 17
0
		private System.String idRef(DefineTag tag)
		{
			if (tag == null)
			{
				// if tag is null then it isn't in the dict -- the SWF is invalid.
				// lets be lax and print something; Matador generates invalid SWF sometimes.
				return "-1";
			}
			else if (tag.name == null)
			{
				// just print the character id since no name was exported
				return System.Convert.ToString(dict.getId(tag));
			}
			else
			{
				return tag.name;
			}
		}
Exemplo n.º 18
0
 public virtual bool contains(DefineTag tag)
 {
     return(tags.Contains(tag));
 }