Class: SteamCodec::ACF::UserConfig

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(userConfig = nil) ⇒ UserConfig

Returns a new instance of UserConfig.



77
78
79
# File 'lib/steam_codec/acf.rb', line 77

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

Instance Attribute Details

#AppInstallDirObject

Returns the value of attribute AppInstallDir.



74
75
76
# File 'lib/steam_codec/acf.rb', line 74

def AppInstallDir
  @AppInstallDir
end

#BetaKeyObject

Returns the value of attribute BetaKey.



76
77
78
# File 'lib/steam_codec/acf.rb', line 76

def BetaKey
  @BetaKey
end

#GameIDObject

Returns the value of attribute GameID.



72
73
74
# File 'lib/steam_codec/acf.rb', line 72

def GameID
  @GameID
end

#InstalledObject

Returns the value of attribute Installed.



73
74
75
# File 'lib/steam_codec/acf.rb', line 73

def Installed
  @Installed
end

#LanguageObject

Returns the value of attribute Language.



75
76
77
# File 'lib/steam_codec/acf.rb', line 75

def Language
  @Language
end

#NameObject

Returns the value of attribute Name.



71
72
73
# File 'lib/steam_codec/acf.rb', line 71

def Name
  @Name
end

Instance Method Details

#load(userConfig) ⇒ Object

Raises:



81
82
83
84
85
86
87
88
89
90
# File 'lib/steam_codec/acf.rb', line 81

def load(userConfig)
    raise ArgumentError, "UserConfig must be instance of KeyValues" unless userConfig.is_a?(KeyValues)
    @UserConfig = userConfig
    @Name = @UserConfig.name if @UserConfig.key?(:name)
    @GameID = @UserConfig.gameid.to_i if @UserConfig.key?(:gameid)
    @Installed = !@UserConfig.installed.to_i.zero? if @UserConfig.key?(:installed)
    @AppInstallDir = @UserConfig.appinstalldir if @UserConfig.key?(:appinstalldir)
    @Language = @UserConfig.language if @UserConfig.key?(:language)
    @BetaKey = @UserConfig.BetaKey if @UserConfig.key?(:BetaKey)
end