Class: Tassadar::SC2::SerializedData

Inherits:
BinData::BasePrimitive
  • Object
show all
Defined in:
lib/tassadar/sc2/serialized_data.rb

Instance Method Summary collapse

Instance Method Details

#read_and_return_value(io) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tassadar/sc2/serialized_data.rb', line 4

def read_and_return_value(io)
  key = io.readbytes(1).unpack("C").first

  case key
  when 0
    read_array(io)
  when 2
    read_byte_string(io)
  when 3
    flag = io.readbytes(1)
    read_and_return_value(io)
  when 4
    read_flag(io)
  when 5
    read_kvo(io)
  when 6
    read_small_int(io)
  when 7
    io.readbytes(4)
  when 9
    read_vlf_int(io)
  else
    puts "No parser for key: #{key}"
  end
end

#value_to_binary_string(value) ⇒ Object



30
31
32
# File 'lib/tassadar/sc2/serialized_data.rb', line 30

def value_to_binary_string(value)
  value.pack("V")
end