Exemple #1
0
        ActionBase IActionVisitor <ushort, ActionBase> .Visit(ActionPush action, ushort length)
        {
            var position = _reader.Position;

            while (_reader.Position - position < length)
            {
                var item = new ActionPushItem();
                var type = (ActionPushItemType)_reader.ReadByte();
                item.Type = type;
                switch (type)
                {
                case ActionPushItemType.String:
                    item.String = _reader.ReadString();
                    break;

                case ActionPushItemType.Float:
                    item.Float = _reader.ReadSingle();
                    break;

                case ActionPushItemType.Null:
                    break;

                case ActionPushItemType.Undefined:
                    break;

                case ActionPushItemType.Register:
                    item.Register = _reader.ReadByte();
                    break;

                case ActionPushItemType.Boolean:
                    item.Boolean = _reader.ReadByte();
                    break;

                case ActionPushItemType.Double:
                    item.Double = _reader.ReadDouble();
                    break;

                case ActionPushItemType.Integer:
                    item.Integer = _reader.ReadInt32();
                    break;

                case ActionPushItemType.Constant8:
                    item.Constant8 = _reader.ReadByte();
                    break;

                case ActionPushItemType.Constant16:
                    item.Constant16 = _reader.ReadUInt16();
                    break;

                default:
                    throw new NotSupportedException("Unknown PushData type " + type);
                }
                action.Items.Add(item);
            }
            return(action);
        }