Rev 57 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
49 | daniel-mar | 1 | unit FastPHPConfig; |
2 | |||
3 | interface |
||
4 | |||
5 | type |
||
6 | TFastPHPConfig = class(TObject) |
||
7 | private |
||
8 | class function GetFontSize: integer; static; |
||
9 | class procedure SetFontSize(Value: integer); static; |
||
10 | class function GetScrapFile: string; static; |
||
11 | class procedure SetScrapFile(Value: string); static; |
||
12 | class function GetHelpIndex: string; static; |
||
13 | class procedure SetHelpIndex(const Value: string); static; |
||
14 | class function GetPhpInterpreter: string; static; |
||
15 | class procedure SetPhpInterpreter(const Value: string); static; |
||
16 | public |
||
17 | class property FontSize: integer read GetFontSize write SetFontSize; |
||
18 | class property ScrapFile: string read GetScrapFile write SetScrapFile; |
||
19 | class property HelpIndex: string read GetHelpIndex write SetHelpIndex; |
||
20 | class property PhpInterpreter: string read GetPhpInterpreter write SetPhpInterpreter; |
||
21 | end; |
||
22 | |||
23 | implementation |
||
24 | |||
25 | uses |
||
26 | Windows, Registry; |
||
27 | |||
28 | class function TFastPHPConfig.GetHelpIndex: string; |
||
29 | var |
||
30 | reg: TRegistry; |
||
31 | begin |
||
32 | result := ''; |
||
33 | reg := TRegistry.Create; |
||
34 | try |
||
35 | reg.RootKey := HKEY_CURRENT_USER; |
||
36 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
||
37 | begin |
||
38 | if reg.ValueExists('HelpIndex') then |
||
39 | result := reg.ReadString('HelpIndex'); |
||
40 | reg.CloseKey; |
||
41 | end; |
||
42 | finally |
||
43 | reg.Free; |
||
44 | end; |
||
45 | end; |
||
46 | |||
47 | class function TFastPHPConfig.GetPhpInterpreter: string; |
||
48 | var |
||
49 | reg: TRegistry; |
||
50 | begin |
||
51 | result := ''; |
||
52 | reg := TRegistry.Create; |
||
53 | try |
||
54 | reg.RootKey := HKEY_CURRENT_USER; |
||
55 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Common', false) then |
||
56 | begin |
||
57 | if reg.ValueExists('PhpInterpreter') then |
||
58 | result := reg.ReadString('PhpInterpreter'); |
||
59 | reg.CloseKey; |
||
60 | end; |
||
61 | finally |
||
62 | reg.Free; |
||
63 | end; |
||
64 | end; |
||
65 | |||
66 | class function TFastPHPConfig.GetScrapFile: string; |
||
67 | var |
||
68 | reg: TRegistry; |
||
69 | begin |
||
70 | result := ''; |
||
71 | reg := TRegistry.Create; |
||
72 | try |
||
73 | reg.RootKey := HKEY_CURRENT_USER; |
||
74 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
||
75 | begin |
||
76 | if reg.ValueExists('ScrapFile') then |
||
77 | result := reg.ReadString('ScrapFile'); |
||
78 | reg.CloseKey; |
||
79 | end; |
||
80 | finally |
||
81 | reg.Free; |
||
82 | end; |
||
83 | end; |
||
84 | |||
85 | class function TFastPHPConfig.GetFontSize: integer; |
||
86 | var |
||
87 | reg: TRegistry; |
||
88 | begin |
||
89 | result := -1; |
||
90 | reg := TRegistry.Create; |
||
91 | try |
||
92 | reg.RootKey := HKEY_CURRENT_USER; |
||
93 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
||
94 | begin |
||
95 | if reg.ValueExists('FontSize') then |
||
96 | result := reg.ReadInteger('FontSize'); |
||
97 | reg.CloseKey; |
||
98 | end; |
||
99 | finally |
||
100 | reg.Free; |
||
101 | end; |
||
102 | end; |
||
103 | |||
104 | class procedure TFastPHPConfig.SetFontSize(Value: integer); |
||
105 | var |
||
106 | reg: TRegistry; |
||
107 | begin |
||
108 | reg := TRegistry.Create; |
||
109 | try |
||
110 | reg.RootKey := HKEY_CURRENT_USER; |
||
111 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
||
112 | begin |
||
113 | reg.WriteInteger('FontSize', Value); |
||
114 | reg.CloseKey; |
||
115 | end; |
||
116 | finally |
||
117 | reg.Free; |
||
118 | end; |
||
119 | end; |
||
120 | class procedure TFastPHPConfig.SetHelpIndex(const Value: string); |
||
121 | var |
||
122 | reg: TRegistry; |
||
123 | begin |
||
124 | reg := TRegistry.Create; |
||
125 | try |
||
126 | reg.RootKey := HKEY_CURRENT_USER; |
||
127 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
||
128 | begin |
||
129 | reg.WriteString('HelpIndex', Value); |
||
130 | reg.CloseKey; |
||
131 | end; |
||
132 | finally |
||
133 | reg.Free; |
||
134 | end; |
||
135 | end; |
||
136 | |||
137 | class procedure TFastPHPConfig.SetPhpInterpreter(const Value: string); |
||
138 | var |
||
139 | reg: TRegistry; |
||
140 | begin |
||
141 | reg := TRegistry.Create; |
||
142 | try |
||
143 | reg.RootKey := HKEY_CURRENT_USER; |
||
144 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Common', true) then |
||
145 | begin |
||
146 | reg.WriteString('PhpInterpreter', Value); |
||
147 | reg.CloseKey; |
||
148 | end; |
||
149 | finally |
||
150 | reg.Free; |
||
151 | end; |
||
152 | end; |
||
153 | |||
154 | class procedure TFastPHPConfig.SetScrapFile(Value: string); |
||
155 | var |
||
156 | reg: TRegistry; |
||
157 | begin |
||
158 | reg := TRegistry.Create; |
||
159 | try |
||
160 | reg.RootKey := HKEY_CURRENT_USER; |
||
161 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
||
162 | begin |
||
163 | reg.WriteString('ScrapFile', Value); |
||
164 | reg.CloseKey; |
||
165 | end; |
||
166 | finally |
||
167 | reg.Free; |
||
168 | end; |
||
169 | end; |
||
170 | |||
171 | end. |
||
172 |