Class: SteamCodec::ACF::MountedDepots

Inherits:
Object
  • Object
show all
Defined in:
lib/steam_codec/acf.rb

Instance Method Summary collapse

Constructor Details

#initialize(mountedDepots = {}) ⇒ MountedDepots

Returns a new instance of MountedDepots.



160
161
162
# File 'lib/steam_codec/acf.rb', line 160

def initialize(mountedDepots = {})
    load(mountedDepots)
end

Instance Method Details

#depotsObject



176
177
178
# File 'lib/steam_codec/acf.rb', line 176

def depots
    @MountedDepots.keys
end

#get(path = '', seperator = '.') ⇒ Object



172
173
174
# File 'lib/steam_codec/acf.rb', line 172

def get(path = '', seperator = '.')
    @MountedDepots[path.to_i]
end

#getDepot(manifestID) ⇒ Object



191
192
193
194
195
196
# File 'lib/steam_codec/acf.rb', line 191

def getDepot(manifestID)
    @MountedDepots.each do |depot, manifest|
        return depot if manifest == manifestID
    end
    nil
end

#getManifest(depotID) ⇒ Object



184
185
186
187
188
189
# File 'lib/steam_codec/acf.rb', line 184

def getManifest(depotID)
    @MountedDepots.each do |depot, manifest|
        return manifest if depot == depotID
    end
    nil
end

#load(mountedDepots) ⇒ Object

Raises:

  • (ArgumentError)


164
165
166
167
168
169
170
# File 'lib/steam_codec/acf.rb', line 164

def load(mountedDepots)
    raise ArgumentError, "MountedDepots must be instance of Hash" unless mountedDepots.is_a?(Hash)
    @MountedDepots = {}
    mountedDepots.each do |depot, manifest|
        @MountedDepots[depot.to_i] = manifest
    end
end

#manifestsObject



180
181
182
# File 'lib/steam_codec/acf.rb', line 180

def manifests
    @MountedDepots.values
end

#remove(depot) ⇒ Object



202
203
204
# File 'lib/steam_codec/acf.rb', line 202

def remove(depot)
    @MountedDepots.delete(depot)
end

#set(depot, manifest) ⇒ Object



198
199
200
# File 'lib/steam_codec/acf.rb', line 198

def set(depot, manifest)
    @MountedDepots[depot] = manifest
end

#to_hashObject



206
207
208
# File 'lib/steam_codec/acf.rb', line 206

def to_hash
    @MountedDepots
end