internal void DataToBytecode(object data) { if (_swf.Bookmark != -1) { //ActionRecord length is UINT16 (max 65535) int byteCodeLength = (int)(_swf.Position - _swf.Bookmark); if (byteCodeLength >= 65520) // For testing use >= 2) { EndPush(); _swf.Put(SwxAssembler.ActionPushData); _swf.Mark(); //start marking for length check _swf.Skip(2); //Skip ActionRecord length } } else { _swf.Put(SwxAssembler.ActionPushData); _swf.Mark(); //start marking for length check _swf.Skip(2); //Skip ActionRecord length } if (data == null) { PushNull(); return; } Type type = data.GetType(); ISWXWriter swxWriter = SWXWriterTable[type] as ISWXWriter; //Second try with basetype (enums and arrays for example) if (swxWriter == null) { swxWriter = SWXWriterTable[type.BaseType] as ISWXWriter; } if (swxWriter == null) { lock (SWXWriterTable) { if (!SWXWriterTable.Contains(type)) { swxWriter = new SWXObjectWriter(); SWXWriterTable.Add(type, swxWriter); } else { swxWriter = SWXWriterTable[type] as ISWXWriter; } } } swxWriter.WriteData(this, data); }
internal void DataToBytecode(object data) { if (this._swf.Bookmark != -1L) { int num = (int)(this._swf.Position - this._swf.Bookmark); if (num >= 0xfff0) { this.EndPush(); this._swf.Put(ActionPushData); this._swf.SetBookmark(); this._swf.Skip(2); } } else { this._swf.Put(ActionPushData); this._swf.SetBookmark(); this._swf.Skip(2); } if (data == null) { this.PushNull(); } else { Type key = data.GetType(); ISWXWriter writer = SWXWriterTable[key] as ISWXWriter; if (writer == null) { writer = SWXWriterTable[key.BaseType] as ISWXWriter; } if (writer == null) { lock (SWXWriterTable) { if (!SWXWriterTable.Contains(key)) { writer = new SWXObjectWriter(); SWXWriterTable.Add(key, writer); } else { writer = SWXWriterTable[key] as ISWXWriter; } } } writer.WriteData(this, data); } }