-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChaosUpdater.simba
53 lines (42 loc) · 1.36 KB
/
ChaosUpdater.simba
1
2
3
4
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
program ChaosUpdater;
const
SCRIPTS: array[0..1] of string = ['OGLDraynorChopper', 'OGLBonfire'];
var
i: integer;
script: string;
function proxyRequest(funcUrl: string): string;
begin
result := getPage('http://static.frement.net/proxy.php?u=' + funcUrl);
end;
procedure update(funcUrl, funcScriptName: string; funcUseProxy: boolean = true; funcPath: string = '')
var
funcFile: integer;
funcScript, funcFileName: string;
begin
if (funcUseProxy) and (pos('https://', funcUrl) <> 0) then
funcScript := proxyRequest(funcUrl)
else
funcScript := getPage(funcUrl);
if (funcPath = '') then
funcPath := scriptPath;
if (pos('.simba', funcScriptName) <> 0) then
funcFileName := funcPath + funcScriptName
else
funcFileName := funcPath + funcScriptName + '.simba';
funcFile := rewriteFile(funcFileName, true);
try
writeFileString(funcFile, funcScript);
writeln('[', funcScriptName, '] Updated script');
except
writeln('[', funcScriptName, '] Failed to write. Script was not updated!');
end;
closeFile(funcFile);
end;
begin
update('https://raw.githubusercontent.com/yuri-moens/simba-scripts/master/cLib.simba', 'cLib', true, includePath);
for i := 0 to length(SCRIPTS) do
begin
script := 'https://raw.githubusercontent.com/yuri-moens/simba-scripts/master/' + SCRIPTS[i] + '.simba';
update(script, SCRIPTS[i]);
end;
end.