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.



93
94
95
# File 'lib/steam_codec/ACF.rb', line 93

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

Instance Method Details

#depotsObject



105
106
107
# File 'lib/steam_codec/ACF.rb', line 105

def depots
    @MountedDepots.keys
end

#getDepot(manifestID) ⇒ Object



120
121
122
123
124
125
# File 'lib/steam_codec/ACF.rb', line 120

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

#getManifest(depotID) ⇒ Object



113
114
115
116
117
118
# File 'lib/steam_codec/ACF.rb', line 113

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

#load(mountedDepots) ⇒ Object

Raises:

  • (ArgumentError)


97
98
99
100
101
102
103
# File 'lib/steam_codec/ACF.rb', line 97

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



109
110
111
# File 'lib/steam_codec/ACF.rb', line 109

def manifests
    @MountedDepots.values
end

#remove(depot) ⇒ Object



131
132
133
# File 'lib/steam_codec/ACF.rb', line 131

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

#set(depot, manifest) ⇒ Object



127
128
129
# File 'lib/steam_codec/ACF.rb', line 127

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