func (p *Parser) ParseHeader() (common.DemoHeader, error) {
	var h common.DemoHeader
	h.Filestamp = p.bitReader.ReadCString(8)
	h.Protocol = p.bitReader.ReadSignedInt(32)
	h.NetworkProtocol = p.bitReader.ReadSignedInt(32)
	h.ServerName = p.bitReader.ReadCString(maxOsPath)
	h.ClientName = p.bitReader.ReadCString(maxOsPath)
	h.MapName = p.bitReader.ReadCString(maxOsPath)
	h.GameDirectory = p.bitReader.ReadCString(maxOsPath)
	h.PlaybackTime = time.Duration(p.bitReader.ReadFloat() * float32(time.Second))
	h.PlaybackTicks = p.bitReader.ReadSignedInt(32)
	h.PlaybackFrames = p.bitReader.ReadSignedInt(32)
	h.SignonLength = p.bitReader.ReadSignedInt(32)

	if h.Filestamp != "HL2DEMO" {
		return h, ErrInvalidFileType
	}

	// Initialize queue if the buffer size wasn't specified, the amount of ticks
	// seems to be a good indicator of how many events we'll get
	if p.msgQueue == nil {
		p.initMsgQueue(h.PlaybackTicks)
	}

	p.header = &h

	return h, nil
}
// ParseHeader attempts to parse the header of the demo and returns it.
// If not done manually this will be called by Parser.ParseNextFrame() or Parser.ParseToEnd().
//
// Returns ErrInvalidFileType if the filestamp (first 8 bytes) doesn't match HL2DEMO.
ParseHeader attempts to parse the header of the demo and returns it.
If not done manually this will be called by Parser.ParseNextFrame() or Parser.ParseToEnd().

Returns ErrInvalidFileType if the filestamp (first 8 bytes) doesn't match HL2DEMO.
// ParseHeader attempts to parse the header of the demo and returns it . // If not done manually this will be called by Parser . ParseNextFrame () or Parser . ParseToEnd () . // // Returns ErrInvalidFileType if the filestamp ( first 8 bytes ) doesn ' t match HL2DEMO .
func (p *Parser) ParseHeader() (common.DemoHeader, error) {
	var h common.DemoHeader
	h.Filestamp = p.bitReader.ReadCString(8)
	h.Protocol = p.bitReader.ReadSignedInt(32)
	h.NetworkProtocol = p.bitReader.ReadSignedInt(32)
	h.ServerName = p.bitReader.ReadCString(maxOsPath)
	h.ClientName = p.bitReader.ReadCString(maxOsPath)
	h.MapName = p.bitReader.ReadCString(maxOsPath)
	h.GameDirectory = p.bitReader.ReadCString(maxOsPath)
	h.PlaybackTime = time.Duration(p.bitReader.ReadFloat() * float32(time.Second))
	h.PlaybackTicks = p.bitReader.ReadSignedInt(32)
	h.PlaybackFrames = p.bitReader.ReadSignedInt(32)
	h.SignonLength = p.bitReader.ReadSignedInt(32)
	if h.Filestamp != "HL2DEMO" {
		return h, ErrInvalidFileType
	}
	if p.msgQueue == nil {
		p.initMsgQueue(h.PlaybackTicks)
	}
	p.header = &h
	return h, nil
}
func ( p * Parser ) ParseHeader ( ) ( common . DemoHeader , error ) { var h common . DemoHeader h . Filestamp = p . bitReader . ReadCString ( 8 ) h . Protocol = p . bitReader . ReadSignedInt ( 32 ) h . NetworkProtocol = p . bitReader . ReadSignedInt ( 32 ) h . ServerName = p . bitReader . ReadCString ( maxOsPath ) h . ClientName = p . bitReader . ReadCString ( maxOsPath ) h . MapName = p . bitReader . ReadCString ( maxOsPath ) h . GameDirectory = p . bitReader . ReadCString ( maxOsPath ) h . PlaybackTime = time . Duration ( p . bitReader . ReadFloat ( ) * float32 ( time . Second ) ) h . PlaybackTicks = p . bitReader . ReadSignedInt ( 32 ) h . PlaybackFrames = p . bitReader . ReadSignedInt ( 32 ) h . SignonLength = p . bitReader . ReadSignedInt ( 32 ) if h . Filestamp != " " { return h , ErrInvalidFileType } if p . msgQueue == nil { p . initMsgQueue ( h . PlaybackTicks ) } p . header = & h return h , nil }
ParseHeader attempts to parse the header of the demo and returns it.
ParseHeader attempts to parse the header of the demo and returns it .
// Initialize queue if the buffer size wasn't specified, the amount of ticks // seems to be a good indicator of how many events we'll get