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.



94
95
96
# File 'lib/steam_codec/acf.rb', line 94

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

Instance Method Details

#depotsObject



106
107
108
# File 'lib/steam_codec/acf.rb', line 106

def depots
    @MountedDepots.keys
end

#getDepot(manifestID) ⇒ Object



121
122
123
124
125
126
# File 'lib/steam_codec/acf.rb', line 121

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

#getManifest(depotID) ⇒ Object



114
115
116
117
118
119
# File 'lib/steam_codec/acf.rb', line 114

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

#load(mountedDepots) ⇒ Object

Raises:

  • (ArgumentError)


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

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



110
111
112
# File 'lib/steam_codec/acf.rb', line 110

def manifests
    @MountedDepots.values
end

#remove(depot) ⇒ Object



132
133
134
# File 'lib/steam_codec/acf.rb', line 132

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

#set(depot, manifest) ⇒ Object



128
129
130
# File 'lib/steam_codec/acf.rb', line 128

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