Steamd

Build Status

Ruby interface to the Steam Language.

Installation

Add gem 'steamd' to your Gemfile

Usage

require 'steamd'
Steamd.load_language

hdr = MsgHdr.new
hdr.target_job_id = 123

bytes = hdr.serialize
  # => "\x00\x00\x00\x00{\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"

io = StringIO.new(bytes)
hdr = MsgHeader.new
hdr.deserialize(io)

hdr.target_job_id
 # => 123
hdr.source_job_id
 # => 0xFFFFFFFFFFFFFFFF

Each class contains an #serialize, and #deserialize(io) method for encoding the class into it's byte representation and decoding a valid class from a byte string.

Documentation

You can view the documentation of the generated classes here

Classes with Protobuf variables

Some generated classes, like MsgHdrProtoBuf contain variables that are Protobuf objects (CMsgProtoBufHeader). To have access to these you can use the steam-proto gem.

Updating the generated files

If the upstream language definitions change the code can be regenerated as follows.

bundle exec ./bin/steamd generate -o lib/steamd/generated/