barbrady

Untitled

Apr 30th, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. {$I Soulsplit/core/tfile.Simba}
  2. {$I Socks.Simba}
  3.  
  4.  
  5. (*
  6. Soulsplit include updater written by Robert
  7. *)
  8.  
  9.  
  10.  
  11. type
  12. TUpdateNode = record
  13. link:string;
  14. sourceFile:TFile;
  15. end;
  16.  
  17. TUpdateSystem = array of TUpdateNode;
  18.  
  19. var
  20. soulsplitUpdater:TUpdateSystem;
  21.  
  22. procedure TUpdateNode.create(f:Tfile;pageLink:string);
  23. begin
  24. self.sourceFile := f;
  25. self.link := pageLink;
  26. end;
  27.  
  28. procedure TUpdateSystem.addNode(f:Tfile;pageLink:string);
  29. begin
  30. setLength(self, length(self) + 1);
  31. self[length(self) - 1].create(f, pageLink);
  32. end;
  33.  
  34. procedure TUpdateSystem.init;
  35. var
  36. FNA, PA:TStringArray;
  37. i:integer;
  38. begin
  39. self.addNode(newFile(appPath + 'Includes\Soulsplit\', 'Soulsplit', 'simba'), 'https://raw.githubusercontent.com/officerBarbrady/SSInclude/master/Soulsplit/Soulsplit.simba');
  40.  
  41. FNA := ['bank','chatbox','tDirectory','tfile','gametab','globals','interface',
  42. 'inventory','login','mainscreen','math','minimap','mouse','prayer',
  43. 'text','timing'];
  44.  
  45. for i := 0 to high(FNA) do
  46. self.addNode(newFile(appPath + 'Includes\Soulsplit\core\', FNA[i], 'simba'), 'https://raw.githubusercontent.com/officerBarbrady/SSInclude/master/Soulsplit/core/' + FNA[i] + '.simba');
  47.  
  48. self.addNode(newFile(appPath + 'Includes\Soulsplit\misc\', 'debug', 'simba'), 'https://raw.githubusercontent.com/officerBarbrady/SSInclude/master/Soulsplit/misc/debug.simba');
  49. self.addNode(newFile(appPath + 'Includes\Soulsplit\misc\', 'Simba', 'simba'), 'https://raw.githubusercontent.com/officerBarbrady/SSInclude/master/Soulsplit/misc/Simba.simba');
  50.  
  51. FNA := ['extendedarrays','integerarrays','string',
  52. 'stringarrays','tbox','tpoint','tpointarrays',
  53. 'typemath','types'];
  54.  
  55. for i := 0 to high(FNA) do
  56. self.addNode(newFile(appPath + 'Includes\Soulsplit\misc\datatypes\', FNA[i], 'simba'), 'https://raw.githubusercontent.com/officerBarbrady/SSInclude/master/Soulsplit/misc/datatypes/' + FNA[i] + '.simba');
  57. end;
  58.  
  59. procedure TUpdateSystem.update;
  60. var
  61. i:integer;
  62. f:TFile;
  63. p:string;
  64. gitPage: HTTPS;
  65. begin
  66. for i := 0 to high(self) do
  67. begin
  68. gitPage.Create(self[i].link, 443);
  69. p := gitPage.GetPage();
  70. gitPage.free();
  71. if (length(p) <> length(self[i].sourceFile.readString())) then
  72. begin
  73. writeln('Updating file ' , self[i].sourceFile.realPath);
  74. f.create(self[i].sourceFile.Path, self[i].sourceFile.name, 'simba', p, true);
  75. end;
  76. end;
  77. end;
  78.  
  79. begin
  80. soulsplitUpdater.init();
  81. soulsplitUpdater.update();
  82. end.
Advertisement
Add Comment
Please, Sign In to add comment