def run
@sections_to_change = [
'friends_chat_text',
'friends_chat_text_self',
'friends_chat_history',
'friends_chat_event',
'friends_chat_bright_event',
'friends_chat_url',
'friends_chat_name_ingame',
'friends_chat_self',
'friends_chat_name',
'friends_chat_accountid',
'friends_chat_securitylink'
]
@path = SteamPath.new
begin
@path.load
rescue Errno::ENOENT => e
end
if @path.empty?
puts "Enter path to Steam:"
user_path = gets
if user_path.strip.empty?
puts 'Aborted.'
exit
end
@path.save user_path.strip
raise StandardError, 'Could not write config file.' unless @path.exists?
@path.load
end
styles_path = "#{@path}/resource/styles/steam.styles"
raise StandardError, "Could not find steam.styles at:\n#{styles_path}" unless File.exists? styles_path
styles = File.open(styles_path).read
new_styles = ''
processing_section = false
styles.each_line do |line|
processing_section = line.strip if @sections_to_change.include? line.strip
processing_section = false if line.strip == '}'
unless processing_section and line.include?('font-size')
new_styles << line
next
end
if processing_section.include? 'console_text'
if line.include? 'OSX]'
new_styles << " \tfont-size=14 [$OSX]\n"
else
new_styles << line
end
next
end
new_styles << "\t\tfont-size=14\n"
end
File.open(styles_path, 'w') do |file|
new_styles.each_line {|line| file << line}
end
puts 'Done.'
end