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



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

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

Instance Attribute Details

#AppInstallDirObject

Returns the value of attribute AppInstallDir.



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

def AppInstallDir
  @AppInstallDir
end

#BetaKeyObject

Returns the value of attribute BetaKey.



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

def BetaKey
  @BetaKey
end

#GameIDObject

Returns the value of attribute GameID.



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

def GameID
  @GameID
end

#InstalledObject

Returns the value of attribute Installed.



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

def Installed
  @Installed
end

#LanguageObject

Returns the value of attribute Language.



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

def Language
  @Language
end

#NameObject

Returns the value of attribute Name.



70
71
72
# File 'lib/steam_codec/ACF.rb', line 70

def Name
  @Name
end

Instance Method Details

#load(userConfig) ⇒ Object

Raises:

  • (ArgumentError)


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

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.installdir.to_i.zero? if @UserConfig.key?(:installdir)
    @AppInstallDir = @UserConfig.appinstalldir if @UserConfig.key?(:appinstalldir)
    @Language = @UserConfig.language if @UserConfig.key?(:language)
    @BetaKey = @UserConfig.BetaKey if @UserConfig.key?(:BetaKey)
end