Class: SteamCodec::ACF

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

Defined Under Namespace

Classes: CheckGuid, InstallScripts, MountedDepots, SharedDepots, UserConfig

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(appState = nil) ⇒ ACF

Returns a new instance of ACF.



34
35
36
# File 'lib/steam_codec/ACF.rb', line 34

def initialize(appState = nil)
    load(appState || KeyValues.new)
end

Instance Attribute Details

#AppIDObject



5
6
7
# File 'lib/steam_codec/ACF.rb', line 5

def AppID
  @AppID
end

#BuildIDObject

Returns the value of attribute BuildID.



12
13
14
# File 'lib/steam_codec/ACF.rb', line 12

def BuildID
  @BuildID
end

#BytesDownloadedObject

Returns the value of attribute BytesDownloaded.



15
16
17
# File 'lib/steam_codec/ACF.rb', line 15

def BytesDownloaded
  @BytesDownloaded
end

#BytesToDownloadObject

Returns the value of attribute BytesToDownload.



14
15
16
# File 'lib/steam_codec/ACF.rb', line 14

def BytesToDownload
  @BytesToDownload
end

#CheckGuidObject (readonly)

Returns the value of attribute CheckGuid.



20
21
22
# File 'lib/steam_codec/ACF.rb', line 20

def CheckGuid
  @CheckGuid
end

#FullValidateOnNextUpdateObject

Returns the value of attribute FullValidateOnNextUpdate.



16
17
18
# File 'lib/steam_codec/ACF.rb', line 16

def FullValidateOnNextUpdate
  @FullValidateOnNextUpdate
end

#InstallDirObject

Returns the value of attribute InstallDir.



8
9
10
# File 'lib/steam_codec/ACF.rb', line 8

def InstallDir
  @InstallDir
end

#InstallScriptsObject (readonly)

Returns the value of attribute InstallScripts.



21
22
23
# File 'lib/steam_codec/ACF.rb', line 21

def InstallScripts
  @InstallScripts
end

#LastOwnerObject

Returns the value of attribute LastOwner.



13
14
15
# File 'lib/steam_codec/ACF.rb', line 13

def LastOwner
  @LastOwner
end

#LastUpdatedObject

Returns the value of attribute LastUpdated.



9
10
11
# File 'lib/steam_codec/ACF.rb', line 9

def LastUpdated
  @LastUpdated
end

#MountedDepotsObject (readonly)

Returns the value of attribute MountedDepots.



18
19
20
# File 'lib/steam_codec/ACF.rb', line 18

def MountedDepots
  @MountedDepots
end

#SharedDepotsObject (readonly)

Returns the value of attribute SharedDepots.



19
20
21
# File 'lib/steam_codec/ACF.rb', line 19

def SharedDepots
  @SharedDepots
end

#SizeOnDiskObject

Returns the value of attribute SizeOnDisk.



11
12
13
# File 'lib/steam_codec/ACF.rb', line 11

def SizeOnDisk
  @SizeOnDisk
end

#StateFlagsObject

Returns the value of attribute StateFlags.



7
8
9
# File 'lib/steam_codec/ACF.rb', line 7

def StateFlags
  @StateFlags
end

#UniverseObject

Returns the value of attribute Universe.



6
7
8
# File 'lib/steam_codec/ACF.rb', line 6

def Universe
  @Universe
end

#UpdateResultObject

Returns the value of attribute UpdateResult.



10
11
12
# File 'lib/steam_codec/ACF.rb', line 10

def UpdateResult
  @UpdateResult
end

#UserConfigObject (readonly)

Returns the value of attribute UserConfig.



17
18
19
# File 'lib/steam_codec/ACF.rb', line 17

def UserConfig
  @UserConfig
end

Class Method Details

.load(data) ⇒ Object



28
29
30
31
32
# File 'lib/steam_codec/ACF.rb', line 28

def self.load(data)
    acf = KeyValues::load(data)
    return self.new(acf.AppState) if acf and acf.key?(:AppState)
    nil
end

.loadFromFile(file) ⇒ Object



22
23
24
25
26
# File 'lib/steam_codec/ACF.rb', line 22

def self.loadFromFile(file)
    acf = KeyValues::loadFromFile(file)
    return self.new(acf.AppState) if acf and acf.key?(:AppState)
    nil
end

Instance Method Details

#load(appState) ⇒ Object

Raises:

  • (ArgumentError)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/steam_codec/ACF.rb', line 38

def load(appState)
    raise ArgumentError, "AppState must be instance of KeyValues" unless appState.is_a?(KeyValues)
    @AppState = appState
    @AppID = @AppState.AppID.to_i if @AppState.key?(:AppID)
    @Universe = @AppState.Universe.to_i if @AppState.key?(:Universe)
    @StateFlags = @AppState.StateFlags.to_i if @AppState.key?(:StateFlags)
    @InstallDir = @AppState.InstallDir if @AppState.key?(:InstallDir)
    @LastUpdated = @AppState.LastUpdated.to_i if @AppState.key?(:LastUpdated)
    @UpdateResult = @AppState.UpdateResult.to_i if @AppState.key?(:UpdateResult)
    @SizeOnDisk = @AppState.SizeOnDisk.to_i if @AppState.key?(:SizeOnDisk)
    @BuildID = @AppState.BuildID.to_i if @AppState.key?(:BuildID)
    @LastOwner = @AppState.LastOwner if @AppState.key?(:LastOwner)
    @BytesToDownload = @AppState.BytesToDownload.to_i if @AppState.key?(:BytesToDownload)
    @BytesDownloaded = @AppState.BytesDownloaded.to_i if @AppState.key?(:BytesDownloaded)
    @FullValidateOnNextUpdate = !@AppState.FullValidateOnNextUpdate.to_i.zero? if @AppState.key?(:FullValidateOnNextUpdate)
    userConfig = nil
    mountedDepots = {}
    sharedDepots = {}
    checkGuid = {}
    installScripts = {}
    userConfig = @AppState.UserConfig if @AppState.key?(:UserConfig)
    mountedDepots = @AppState.MountedDepots if @AppState.key?(:MountedDepots)
    sharedDepots = @AppState.SharedDepots if @AppState.key?(:sharedDepots)
    checkGuid = @AppState.CheckGuid if @AppState.key?(:CheckGuid)
    installScripts = @AppState.InstallScripts if @AppState.key?(:InstallScripts)
    @UserConfig = UserConfig.new(userConfig)
    @MountedDepots = MountedDepots.new(mountedDepots)
    @SharedDepots = SharedDepots.new(sharedDepots)
    @InstallScripts = InstallScripts.new(installScripts)
end