aboutsummaryrefslogtreecommitdiff
path: root/pkg/classes/consoleCmd.go
blob: 83f7333a40fa5cf40c05475573174050a45474c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package classes

import (
	"strings"

	"github.com/pektezol/bitreader"
	"github.com/pektezol/sdp.go/pkg/types"
)

type ConsoleCmd struct {
	Size int32  `json:"size"`
	Data string `json:"data"`
}

func (consoleCmd *ConsoleCmd) ParseConsoleCmd(reader *bitreader.Reader, demo *types.Demo) {
	consoleCmd.Size = reader.TryReadSInt32()
	consoleCmd.Data = reader.TryReadStringLength(uint64(consoleCmd.Size))
	demo.Writer.AppendLine("\t%s", strings.TrimSpace(consoleCmd.Data))
}