5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/fix-steam-font/fix_steam_font.rb', line 5
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
|