Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 30th, 2013  |  syntax: Delphi  |  size: 1.79 KB  |  views: 53  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. unit Unit6;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, IdBaseComponent,
  8.   IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;
  9.  
  10. type
  11.   TForm6 = class(TForm)
  12.     Edit1: TEdit;
  13.     Label1: TLabel;
  14.     Label2: TLabel;
  15.     Button1: TButton;
  16.     IdHTTP1: TIdHTTP;
  17.     procedure FormCreate(Sender: TObject);
  18.   private
  19.     { Private declarations }
  20.   public
  21.     { Public declarations }
  22.   end;
  23.  
  24. var
  25.   Form6: TForm6;
  26.  
  27. implementation
  28.  
  29. {$R *.dfm}
  30.  
  31. function GetDOSEnvVar(const VarName: string): string;
  32. var
  33.   i: integer;
  34. begin
  35.   Result := '';
  36.   try
  37.     i := GetEnvironmentVariable(PChar(VarName), nil, 0);
  38.     if i > 0 then
  39.     begin
  40.       SetLength(Result, i);
  41.       GetEnvironmentVariable(Pchar(VarName), PChar(Result), i);
  42.       SetLength(Result, Pos(#0, Result)-1);
  43.     end;
  44.   except
  45.     Result := '';
  46.   end;
  47. end;
  48.  
  49. function checkver(): boolean;
  50. var ver, verw: String;
  51.     f: textfile;
  52. begin
  53.   if (fileExists(GetDOSEnvVar('AppData')+'/.minecraft/version.txt')) then
  54.     begin
  55.       verw:= form6.idhttp1.Get('http://dl.dropbox.com/u/25047725/Client/version.txt');
  56.       assignfile(f, GetDOSEnvVar('AppData')+'/.minecraft/version.txt');
  57.       reset(f);
  58.       read(f, ver);
  59.       if verw <> ver then
  60.         checkver:= true
  61.       else
  62.         checkver:= false;
  63.       closefile(f);
  64.     end
  65.   else
  66.     begin
  67.       assignfile(f, GetDOSEnvVar('AppData')+'/.minecraft/version.txt');
  68.       rewrite(f);
  69.       write(f, '0');
  70.       closefile(f);
  71.       checkver();
  72.     end;
  73. end;
  74.  
  75. function refresh(): boolean;
  76. begin
  77.   //refresh:= false;
  78. end;
  79.  
  80. procedure TForm6.FormCreate(Sender: TObject);
  81. begin
  82.   if checkver() then
  83.     if refresh() then
  84.  
  85. end;
  86.  
  87. end.
clone this paste RAW Paste Data