public override void visit(TagHandler h) { switch (code) { case Flash.Swf.TagValues.stagDefineShape: h.defineShape(this); break; case Flash.Swf.TagValues.stagDefineShape2: h.defineShape2(this); break; case Flash.Swf.TagValues.stagDefineShape3: h.defineShape3(this); break; case Flash.Swf.TagValues.stagDefineShape6: h.defineShape6(this); break; default: System.Diagnostics.Debug.Assert(false); break; } }
/// <summary> process the whole SWF stream, and close the input streams when finished.</summary> /// <param name="handler"> /// </param> /// <throws> IOException </throws> public void parse(TagHandler handler) { this.handler = handler; try { try { handler.DecoderDictionary = dict; header = decodeHeader(); handler.header(header); decodeTags(handler); handler.finish(); } catch (FatalParseException) { // errors already reported to TagHandler. } finally { if (swfIn != null) swfIn.Close(); } } finally { if (swdIn != null) swdIn.Close(); } }
public override void visit(Flash.Swf.TagHandler h) { if (code == Flash.Swf.TagValues.stagDefineBitsJPEG2) { h.defineBitsJPEG2(this); } else { h.defineBits(this); } }
//-------------------------------------------------------------------------- // // Visitor Methods // //-------------------------------------------------------------------------- /// <summary> Invokes the defineFont visitor on the given TagHandler. /// /// </summary> /// <param name="handler">The SWF TagHandler. /// </param> public override void visit(TagHandler handler) { if (code == Flash.Swf.TagValues.stagDefineFont) handler.defineFont(this); }
public override void visit(TagHandler t) { }
public override void visit(TagHandler h) { h.doInitAction(this); }
/// <summary> Subclasses implement this method to callback one of the methods in TagHandler...</summary> /// <param name="h"> /// </param> public abstract void visit(TagHandler h);
private void decodeTags(TagHandler handler) { int type, h, length, currentOffset; do { currentOffset = r.Offset; type = (h = r.readUI16()) >> 6; // is this a long tag header (>=63 bytes)? if (((length = h & 0x3F) == 0x3F)) { // [ed] the player treats this as a signed field and stops if it is negative. length = r.readSI32(); if (length < 0) { handler.error("negative tag length: " + length + " at offset " + currentOffset); break; } } int o = r.Offset; int eat = 0; if (type != 0) { Tag t = decodeTag(type, length); if (r.Offset - o != length) { handler.error("offset mismatch after " + Flash.Swf.TagValues.names[t.code] + ": read " + (r.Offset - o) + ", expected " + length); if (r.Offset - o < length) { eat = length - (r.Offset - o); } } handler.setOffsetAndSize(currentOffset, r.Offset - currentOffset); handler.any(t); t.visit(handler); if (eat > 0) // try to recover. (flash 8 sometimes writes nonsense, usually in fonts) { r.readFully(new byte[eat]); } } } while (type != 0); }