public Parse ( Stream input, |
||
input | Stream | |
bits | ||
firstFive | byte | |
caller | TagTypes | |
fillBits | ||
lineBits | ||
first | bool | |
Результат | void |
public void Parse(Stream input, BitStream bits, byte firstFive, TagTypes caller, ref UInt16 fillBits, ref UInt16 lineBits, bool first)
{
this._isFirst = first;
this._caller = caller;
this._numFillBits = fillBits;
this._numLineBits = lineBits;
this.GetFlags(firstFive);
switch (caller)
{
case TagTypes.DefineShape2:
this.ParseDefineShape23(input, bits, ref fillBits, ref lineBits, first);
break;
case TagTypes.DefineShape3:
this.ParseDefineShape23(input, bits, ref fillBits, ref lineBits, first);
break;
default:
this.ParseGeneric(input, bits, ref fillBits, ref lineBits, first);
break;
}
}
/// <summary> /// /// </summary> /// <param name="input"></param> /// <param name="caller"></param> public virtual void TryParseShapeRecords(MemoryStream input, TagTypes caller) { BitStream bits = new BitStream(input); this._shapeRecords = new List<ShapeRecord>(); StyleChangeRecord tempSCR = new StyleChangeRecord(this._SwfVersion); StraightEdgeRecord tempSER = new StraightEdgeRecord(this._SwfVersion); CurvedEdgeRecord tempCER = new CurvedEdgeRecord(this._SwfVersion); byte fiveBits = 0; bool endShapeRecordSeen = false; int numberOfStyleChanges = 0; UInt16 localNumFillBits = this._numFillBits; UInt16 localNumLineBits = this._numLineBits; do { bool typeFlag = (0 != bits.GetBits(1)) ? true : false; if (typeFlag) { bool straightFlag = Convert.ToBoolean(bits.GetBits(1)); if (straightFlag) { tempSER = new StraightEdgeRecord(this._SwfVersion); tempSER.Parse(input, bits); this._shapeRecords.Add(tempSER); } else { tempCER = new CurvedEdgeRecord(this._SwfVersion); tempCER.Parse(input, bits); this._shapeRecords.Add(tempCER); } } else { fiveBits = (byte)bits.GetBits(5); if (0 == fiveBits) { endShapeRecordSeen = true; } else { tempSCR = new StyleChangeRecord(this._SwfVersion); tempSCR.Parse(input, bits, fiveBits, caller, ref localNumFillBits, ref localNumLineBits, 0 == numberOfStyleChanges ? true : false); numberOfStyleChanges += 1; this._shapeRecords.Add(tempSCR); } } } while (!endShapeRecordSeen); bits.Reset(); }