class Overlook::Csgo::Demo::Header
Constants
- InvalidHeader
- MAX_STRING_LENGTH
Attributes
map_name[R]
ticks[R]
Public Class Methods
from_io(reader)
click to toggle source
# File lib/overlook/csgo/demo/header.rb, line 26 def self.from_io(reader) stamp = reader.read(8) demo_protocol = reader.signed_int32 network_protocol = reader.signed_int32 server_name = reader.string(MAX_STRING_LENGTH) client_name = reader.string(MAX_STRING_LENGTH) map_name = reader.string(MAX_STRING_LENGTH) game_directory = reader.string(MAX_STRING_LENGTH) playtime = reader.float ticks = reader.signed_int32 frames = reader.signed_int32 signon_length = reader.signed_int32 raise InvalidHeader, "#{self.class.name} only supports HL2DEMO, got #{stamp}" if stamp !~ /hl2demo/i raise InvalidHeader, "#{self.class.name} only supports Valve demo files." if server_name !~ /valve/i new(map_name, ticks) end
new(map_name, ticks)
click to toggle source
# File lib/overlook/csgo/demo/header.rb, line 12 def initialize(map_name, ticks) raise ArgumentError 'map_name can\'t be nil' if map_name.nil? @map_name = map_name @ticks = ticks end
Public Instance Methods
to_hash()
click to toggle source
# File lib/overlook/csgo/demo/header.rb, line 18 def to_hash { map_name: map_name } end