Advertisement
HEX0x29A

uPastebinCom (TPastebinCom class)

Mar 12th, 2014
500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 17.14 KB | None | 0 0
  1. unit uPastebinCom;
  2. (*
  3. TPastebinCom class (Based on Pastebin APIs)
  4. Date  : 13.03.2014
  5. Author: HEX0x29A
  6. Notes :
  7. *Requere Delphi XE+
  8. *)
  9. interface
  10.  
  11. {$M+}
  12.  
  13. uses
  14.   Windows, IdHttp, HTTPApp, Classes, SysUtils, RegularExpressions;
  15.  
  16. const
  17.   USER_AGENT       = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080401';
  18.   PRIVACY_PUBLIC   = 0;
  19.   PRIVACY_UNLISTED = 1;
  20.   PRIVAСY_PRIVATE  = 2;
  21.   EXPIRY_10MINUTES = '10M';
  22.   EXPIRY_1HOUR     = '1H';
  23.   EXPIRY_1DAY      = '1D';
  24.   EXPIRY_1WEEK     = '1W';
  25.   EXPIRY_2WEEKS    = '2W';
  26.   EXPIRY_1MONTH    = '1M';
  27.   EXPIRY_NEVER     = 'N';
  28.  
  29.   LANGUAGES: packed array [0..218] of string =
  30. ('4cs'{4CS}, '6502acme'{6502 ACME Cross Assembler}, '6502kickass'{6502 Kick Assembler}, '6502tasm'{6502 TASM/64TASS},
  31.  'abap'{ABAP}, 'actionscript'{ActionScript}, 'actionscript3'{ActionScript 3}, 'ada'{Ada}, 'algol68'{ALGOL 68},
  32.  'apache'{Apache Log}, 'applescript'{AppleScript}, 'apt_sources'{APT Sources}, 'arm'{ARM}, 'asm'{ASM (NASM)},
  33.  'asp'{ASP}, 'asymptote'{Asymptote}, 'autoconf'{autoconf}, 'autohotkey'{Autohotkey}, 'autoit'{AutoIt},
  34.  'avisynth'{Avisynth}, 'awk'{Awk}, 'bascomavr'{BASCOM AVR}, 'bash'{Bash}, 'basic4gl'{Basic4GL}, 'bibtex'{BibTeX},
  35.  'blitzbasic'{Blitz Basic}, 'bnf'{BNF}, 'boo'{BOO}, 'bf'{BrainFuck}, 'c'{C}, 'c_mac'{C for Macs},
  36.  'cil'{C Intermediate Language}, 'csharp'{C#}, 'cpp'{C++}, 'cpp-qt'{C++ (with QT extensions)},
  37.  'c_loadrunner'{C: Loadrunner}, 'caddcl'{CAD DCL}, 'cadlisp'{CAD Lisp}, 'cfdg'{CFDG}, 'chaiscript'{ChaiScript},
  38.  'clojure'{Clojure}, 'klonec'{Clone C}, 'klonecpp'{Clone C++}, 'cmake'{CMake}, 'cobol'{COBOL},
  39.  'coffeescript'{CoffeeScript}, 'cfm'{ColdFusion}, 'css'{CSS}, 'cuesheet'{Cuesheet}, 'd'{D}, 'dcl'{DCL},
  40.  'dcpu16'{DCPU-16}, 'dcs'{DCS}, 'delphi'{Delphi}, 'oxygene'{Delphi Prism (Oxygene)}, 'diff'{Diff}, 'div'{DIV},
  41.  'dos'{DOS}, 'dot'{DOT}, 'e'{E}, 'ecmascript'{ECMAScript}, 'eiffel'{Eiffel}, 'email'{Email}, 'epc'{EPC},
  42.  'erlang'{Erlang}, 'fsharp'{F#}, 'falcon'{Falcon}, 'fo'{FO Language}, 'f1'{Formula One}, 'fortran'{Fortran},
  43.  'freebasic'{FreeBasic}, 'freeswitch'{FreeSWITCH}, 'gambas'{GAMBAS}, 'gml'{Game Maker}, 'gdb'{GDB}, 'genero'{Genero},
  44.  'genie'{Genie}, 'gettext'{GetText}, 'go'{Go}, 'groovy'{Groovy}, 'gwbasic'{GwBasic}, 'haskell'{Haskell}, 'haxe'{Haxe},
  45.  'hicest'{HicEst}, 'hq9plus'{HQ9 Plus}, 'html4strict'{HTML}, 'html5'{HTML 5}, 'icon'{Icon}, 'idl'{IDL},
  46.  'ini'{INI file}, 'inno'{Inno Script}, 'intercal'{INTERCAL}, 'io'{IO}, 'j'{J}, 'java'{Java}, 'java5'{Java 5},
  47.  'javascript'{JavaScript}, 'jquery'{jQuery}, 'kixtart'{KiXtart}, 'latex'{Latex}, 'ldif'{LDIF}, 'lb'{Liberty BASIC},
  48.  'lsl2'{Linden Scripting}, 'lisp'{Lisp}, 'llvm'{LLVM}, 'locobasic'{Loco Basic}, 'logtalk'{Logtalk},
  49.  'lolcode'{LOL Code}, 'lotusformulas'{Lotus Formulas}, 'lotusscript'{Lotus Script}, 'lscript'{LScript}, 'lua'{Lua},
  50.  'm68k'{M68000 Assembler}, 'magiksf'{MagikSF}, 'make'{Make}, 'mapbasic'{MapBasic}, 'matlab'{MatLab}, 'mirc'{mIRC},
  51.  'mmix'{MIX Assembler}, 'modula2'{Modula 2}, 'modula3'{Modula 3}, '68000devpac'{Motorola 68000 HiSoft Dev}, 'mpasm'{MPASM},
  52.  'mxml'{MXML}, 'mysql'{MySQL}, 'nagios'{Nagios}, 'newlisp'{newLISP}, 'text'{None}, 'nsis'{NullSoft Installer},
  53.  'oberon2'{Oberon 2}, 'objeck'{Objeck Programming Langua}, 'objc'{Objective C}, 'ocaml-brief'{OCalm Brief}, 'ocaml'{OCaml},
  54.  'octave'{Octave}, 'pf'{OpenBSD PACKET FILTER}, 'glsl'{OpenGL Shading}, 'oobas'{Openoffice BASIC}, 'oracle11'{Oracle 11},
  55.  'oracle8'{Oracle 8}, 'oz'{Oz}, 'parasail'{ParaSail}, 'parigp'{PARI/GP}, 'pascal'{Pascal}, 'pawn'{PAWN}, 'pcre'{PCRE},
  56.  'per'{Per}, 'perl'{Perl}, 'perl6'{Perl 6}, 'php'{PHP}, 'php-brief'{PHP Brief}, 'pic16'{Pic 16}, 'pike'{Pike},
  57.  'pixelbender'{Pixel Bender}, 'plsql'{PL/SQL}, 'postgresql'{PostgreSQL}, 'povray'{POV-Ray}, 'powershell'{Power Shell},
  58.  'powerbuilder'{PowerBuilder}, 'proftpd'{ProFTPd}, 'progress'{Progress}, 'prolog'{Prolog}, 'properties'{Properties},
  59.  'providex'{ProvideX}, 'purebasic'{PureBasic}, 'pycon'{PyCon}, 'python'{Python}, 'pys60'{Python for S60}, 'q'{q/kdb+},
  60.  'qbasic'{QBasic}, 'rsplus'{R}, 'rails'{Rails}, 'rebol'{REBOL}, 'reg'{REG}, 'rexx'{Rexx}, 'robots'{Robots},
  61.  'rpmspec'{RPM Spec}, 'ruby'{Ruby}, 'gnuplot'{Ruby Gnuplot}, 'sas'{SAS}, 'scala'{Scala}, 'scheme'{Scheme}, 'scilab'{Scilab},
  62.  'sdlbasic'{SdlBasic}, 'smalltalk'{Smalltalk}, 'smarty'{Smarty}, 'spark'{SPARK}, 'sparql'{SPARQL}, 'sql'{SQL},
  63.  'stonescript'{StoneScript}, 'systemverilog'{SystemVerilog}, 'tsql'{T-SQL}, 'tcl'{TCL}, 'teraterm'{Tera Term},
  64.  'thinbasic'{thinBasic}, 'typoscript'{TypoScript}, 'unicon'{Unicon}, 'uscript'{UnrealScript}, 'ups'{UPC}, 'urbi'{Urbi},
  65.  'vala'{Vala}, 'vbnet'{VB.NET}, 'vedit'{Vedit}, 'verilog'{VeriLog}, 'vhdl'{VHDL}, 'vim'{VIM}, 'visualprolog'{Visual Pro Log},
  66.  'vb'{VisualBasic}, 'visualfoxpro'{VisualFoxPro}, 'whitespace'{WhiteSpace}, 'whois'{WHOIS}, 'winbatch'{Winbatch},
  67.  'xbasic'{XBasic}, 'xml'{XML}, 'xorg_conf'{Xorg Config}, 'xpp'{XPP}, 'yaml'{YAML}, 'z80'{Z80 Assembler}, 'zxbasic'{ZXBasic});
  68.  
  69. type
  70.   TUserInfo = packed record
  71.     Name       : string;
  72.     FormatShort: string;
  73.     Expiry     : string;
  74.     Avatar     : string;
  75.     Privacy    : integer;
  76.     WebSite    : string;
  77.     Email      : string;
  78.     Location   : string;
  79.     ProUser    : Boolean;
  80.   end;
  81.   TPaste = packed record
  82.     Key        : string;
  83.     Date       : TDateTime;
  84.     Title      : string;
  85.     Size       : integer;
  86.     Expiry     : TDateTime;
  87.     Privacy    : integer;
  88.     FormatLong : string;
  89.     FormatShort: string;
  90.     Url        : string;
  91.     Hits       : integer;
  92.   end;
  93.   TPasteList = packed array of TPaste;
  94.   TPastebinCom = class
  95.   private
  96.     bAutoUserKey: Boolean;
  97.     DevApiKey   : string;
  98.     LocUserKey  : string;
  99.     Http        : TIdHttp;
  100.     Params      : TStringList;
  101.     function GetUserAgent: string;
  102.     function GetProxyHost: string;
  103.     function GetProxyPort: integer;
  104.     function GetApiKey: string;
  105.     procedure SetUserAgent(const Value: string);
  106.     procedure SetProxyHost(const Value: string);
  107.     procedure SetProxyPort(const Value: integer);
  108.     procedure SetApiKey(const Value: string);
  109.     procedure XMLToPasteList(const XML      : string;
  110.                              var   PasteList: TPasteList);
  111.   public
  112.     constructor Create(const szApiKey: string = '');
  113.     destructor Destroy; override;
  114.     function Login(var   UserKey : string;
  115.                    const Name    : string;
  116.                    const Password: string): Boolean;
  117.     function GetPasteList(var   PasteList: TPasteList;
  118.                           const UserKey  : string  = '';
  119.                           const Limit    : integer = 50 {1..1000}): Boolean;
  120.     function GetTrendingPasteList(var PasteList: TPasteList): Boolean;
  121.     function SendPaste(var   Response: string;
  122.                        const Content : string;
  123.                        const Title   : string = '';
  124.                        const Language: string = '';
  125.                        const UserKey : string = '';
  126.                        const Expiry  : string = EXPIRY_NEVER;
  127.                        const Privacy : dword  = PRIVACY_PUBLIC): Boolean;
  128.     function DeletePaste(const PasteKey: string;
  129.                          const UserKey : string = ''): Boolean;
  130.     function GetPasteRAW(const PasteKey: string): string;
  131.     function GetUserInfo(var   UserInfo: TUserInfo;
  132.                          const UserKey : string = ''): Boolean;
  133.   published
  134.     property ApiKey     : string  read GetApiKey    write SetApiKey;
  135.     property UserAgent  : string  read GetUserAgent write SetUserAgent;
  136.     property ProxyHost  : string  read GetProxyHost write SetProxyHost;
  137.     property ProxyPort  : integer read GetProxyPort write SetProxyPort;
  138.     property AutoUserKey: Boolean read bAutoUserKey write bAutoUserKey;
  139.   end;
  140.  
  141.   function UnixDateTimeToDelphiDateTime(UnixDateTime: longint): TDateTime;
  142.   function DelphiDateTimeToUnixDateTime(DateTime: TDateTime): longint;
  143. implementation
  144.  
  145. function DelphiDateTimeToUnixDateTime(DateTime: TDateTime): longint;
  146. const
  147.   SecsPerDay = 24 * 60 * 60;
  148. begin
  149.   Result := Trunc((DateTime - EncodeDate(1970, 1, 1)) * SecsPerDay);
  150. end;
  151.  
  152. function UnixDateTimeToDelphiDateTime(UnixDateTime: longint): TDateTime;
  153. const
  154.   SecsPerDay = 24 * 60 * 60;
  155. begin
  156.   Result := EncodeDate(1970, 1, 1) + (UnixDateTime / SecsPerDay);
  157. end;
  158.  
  159. { TPastebinCom }
  160.  
  161. constructor TPastebinCom.Create(const szApiKey: string = '');
  162. begin
  163.   Http         := TIdHttp.Create(nil);
  164.   Params       := TStringList.Create;
  165.   DevApiKey    := szApiKey;
  166.   LocUserKey   := '';
  167.   bAutoUserKey := True;
  168.   Http.Request.UserAgent := USER_AGENT;
  169. end;
  170.  
  171. function TPastebinCom.DeletePaste(const PasteKey: string;
  172.                                   const UserKey : string = ''): Boolean;
  173. const
  174.   BAD_REQUEST = 'Bad API request';
  175. var
  176.   buffer: string;
  177. begin
  178.   with Params do
  179.   begin
  180.     Clear;
  181.     Add('api_option='    + 'delete');
  182.     Add('api_paste_key=' + PasteKey);
  183.     if (UserKey = '')and(bAutoUserKey) then
  184.       Add('api_user_key='  + LocUserKey)
  185.     else
  186.       Add('api_user_key='  + UserKey);
  187.     Add('api_dev_key='   + DevApiKey);
  188.   end;
  189.   try
  190.     buffer := Http.Post('http://pastebin.com/api/api_post.php', Params);
  191.     if Trim(buffer) = '' then
  192.       buffer := BAD_REQUEST;
  193.   except
  194.     buffer := BAD_REQUEST;
  195.   end;
  196.   Result := ((Pos(BAD_REQUEST, buffer) <> 1) and (Pos('Paste Removed', buffer) = 1));
  197. end;
  198.  
  199. destructor TPastebinCom.Destroy;
  200. begin
  201.   Params.Free;
  202.   Http.Free;
  203.   inherited;
  204. end;
  205.  
  206. function TPastebinCom.GetApiKey: string;
  207. begin
  208.   Result := DevApiKey;
  209. end;
  210.  
  211. function TPastebinCom.GetPasteList(var   PasteList: TPasteList;
  212.                                    const UserKey  : string  = '';
  213.                                    const Limit    : integer = 50): Boolean;
  214. const
  215.   BAD_REQUEST = 'Bad API request';
  216. var
  217.   buffer: string;
  218. begin
  219.   with Params do
  220.   begin
  221.     Clear;
  222.     Add('api_option='        + 'list');
  223.     Add('api_results_limit=' + IntToStr(Limit));
  224.     if (UserKey = '')and(bAutoUserKey) then
  225.       Add('api_user_key='      + LocUserKey)
  226.     else
  227.       Add('api_user_key='      + UserKey);
  228.     Add('api_dev_key='       + DevApiKey);
  229.   end;
  230.   try
  231.     buffer := Http.Post('http://pastebin.com/api/api_post.php', Params);
  232.     if Trim(buffer) = '' then
  233.       buffer := BAD_REQUEST;
  234.   except
  235.     buffer := BAD_REQUEST;
  236.   end;
  237.   Result := (Pos(BAD_REQUEST, buffer) <> 1);
  238.   SetLength(PasteList, 0);
  239.   if Result then
  240.   begin
  241.     XMLToPasteList(buffer, PasteList);
  242.   end;
  243. end;
  244.  
  245. function TPastebinCom.GetPasteRAW(const PasteKey: string): string;
  246. begin
  247.   try
  248.     Result := Http.Get('http://pastebin.com/raw.php?i=' + PasteKey);
  249.   except
  250.     Result := '';
  251.   end;
  252. end;
  253.  
  254. function TPastebinCom.GetProxyHost: string;
  255. begin
  256.   Result := Http.ProxyParams.ProxyServer;
  257. end;
  258.  
  259. function TPastebinCom.GetProxyPort: integer;
  260. begin
  261.   Result := Http.ProxyParams.ProxyPort;
  262. end;
  263.  
  264. function TPastebinCom.GetTrendingPasteList(var PasteList: TPasteList): Boolean;
  265. const
  266.   BAD_REQUEST = 'Bad API request';
  267. var
  268.   buffer: string;
  269. begin
  270.   with Params do
  271.   begin
  272.     Clear;
  273.     Add('api_option='  + 'trends');
  274.     Add('api_dev_key=' + DevApiKey);
  275.   end;
  276.   try
  277.     buffer := Http.Post('http://pastebin.com/api/api_post.php', Params);
  278.     if Trim(buffer) = '' then
  279.       buffer := BAD_REQUEST;
  280.   except
  281.     buffer := BAD_REQUEST;
  282.   end;
  283.   Result := (Pos(BAD_REQUEST, buffer) <> 1);
  284.   SetLength(PasteList, 0);
  285.   if Result then
  286.   begin
  287.     XMLToPasteList(buffer, PasteList);
  288.   end;
  289. end;
  290.  
  291. function TPastebinCom.GetUserAgent: string;
  292. begin
  293.   Result := Http.Request.UserAgent;
  294. end;
  295.  
  296. function TPastebinCom.GetUserInfo(var   UserInfo: TUserInfo;
  297.                                   const UserKey : string = ''): Boolean;
  298. const
  299.   BAD_REQUEST = 'Bad API request';
  300. var
  301.   buffer: string;
  302.   i     : integer;
  303.   mc    : TMatchCollection;
  304. begin
  305.   with Params do
  306.   begin
  307.     Clear;
  308.     Add('api_option='        + 'userdetails');
  309.     if (UserKey = '')and(bAutoUserKey) then
  310.       Add('api_user_key='      + LocUserKey)
  311.     else
  312.       Add('api_user_key='      + UserKey);
  313.     Add('api_dev_key='       + DevApiKey);
  314.   end;
  315.   try
  316.     buffer := Http.Post('http://pastebin.com/api/api_post.php', Params);
  317.     if Trim(buffer) = '' then
  318.       buffer := BAD_REQUEST;
  319.   except
  320.     buffer := BAD_REQUEST;
  321.   end;
  322.   Result := (Pos(BAD_REQUEST, buffer) <> 1);
  323.   if Result then
  324.   begin
  325.     mc := TRegEx.Matches(buffer, '<user>[^>]+>([^<]*)[^>]+>[^>]+>([^<]*)[^>]+>[^>]+>' +
  326.                                  '([^<]*)[^>]+>[^>]+>([^<]*)[^>]+>[^>]+>(\d*)[^>]+>' +
  327.                                  '[^>]+>([^<]*)[^>]+>[^>]+>([^<]*)[^>]+>[^>]+>([^<]*)' +
  328.                                  '[^>]+>[^>]+>(\d*)[^>]+>[^>]+>');
  329.     if (mc.Count <> 0) then
  330.     begin
  331.       for i := 0 to Pred(mc.Count) do
  332.       with UserInfo do
  333.       begin
  334.         Name        := mc.Item[i].Groups.Item[1].Value;
  335.         FormatShort := mc.Item[i].Groups.Item[2].Value;
  336.         Expiry      := mc.Item[i].Groups.Item[3].Value;
  337.         Avatar      := mc.Item[i].Groups.Item[4].Value;
  338.         Privacy     := StrToIntDef(mc.Item[i].Groups.Item[5].Value, 0);
  339.         WebSite     := mc.Item[i].Groups.Item[6].Value;
  340.         Email       := mc.Item[i].Groups.Item[7].Value;
  341.         Location    := mc.Item[i].Groups.Item[8].Value;
  342.         ProUser     := Boolean(StrToIntDef(mc.Item[i].Groups.Item[9].Value, 0) = 1);
  343.       end;
  344.     end;
  345.   end;
  346. end;
  347.  
  348. function TPastebinCom.Login(var   UserKey : string;
  349.                             const Name    : string;
  350.                             const Password: string): Boolean;
  351. const
  352.   BAD_REQUEST = 'Bad API request';
  353. begin
  354.   with Params do
  355.   begin
  356.     Clear;
  357.     Add('api_user_name='     + String(HTTPEncode(AnsiString(Name))));
  358.     Add('api_user_password=' + String(HTTPEncode(AnsiString(Password))));
  359.     Add('api_dev_key='       + DevApiKey);
  360.   end;
  361.   try
  362.     UserKey := Http.Post('http://pastebin.com/api/api_login.php', Params);
  363.     if Trim(UserKey) = '' then
  364.       UserKey := BAD_REQUEST;
  365.   except
  366.     UserKey := BAD_REQUEST;
  367.   end;
  368.   Result := (Pos(BAD_REQUEST, UserKey) <> 1);
  369.   if not Result then
  370.     UserKey := ''
  371.   else
  372.     LocUserKey := UserKey;
  373. end;
  374.  
  375. function TPastebinCom.SendPaste(var   Response: string;
  376.                                 const Content : string;
  377.                                 const Title   : string = '';
  378.                                 const Language: string = '';
  379.                                 const UserKey : string = '';
  380.                                 const Expiry  : string = EXPIRY_NEVER;
  381.                                 const Privacy : dword  = PRIVACY_PUBLIC): Boolean;
  382. const
  383.   BAD_REQUEST = 'Bad API request';
  384. begin
  385.   with Params do
  386.   begin
  387.     Clear;
  388.     Add('api_option='            + 'paste');
  389.     if (UserKey = '')and(bAutoUserKey) then
  390.       Add('api_user_key='          + LocUserKey)
  391.     else
  392.       Add('api_user_key='          + UserKey);
  393.     Add('api_paste_private='     + IntToStr(Privacy));
  394.     Add('api_paste_name='        + Title);
  395.     Add('api_paste_expire_date=' + Expiry);
  396.     Add('api_paste_format='      + Language);
  397.     Add('api_dev_key='           + DevApiKey);
  398.     Add('api_paste_code='        + Content);
  399.   end;
  400.   try
  401.     Response := Http.Post('http://pastebin.com/api/api_post.php', Params);
  402.     if Trim(Response) = '' then
  403.       Response := BAD_REQUEST;
  404.   except
  405.     Response := BAD_REQUEST;
  406.   end;
  407.   Result := (Pos(BAD_REQUEST, Response) <> 1);
  408.   if not Result then
  409.     Response := '';
  410. end;
  411.  
  412. procedure TPastebinCom.SetApiKey(const Value: string);
  413. begin
  414.   DevApiKey := Value;
  415. end;
  416.  
  417. procedure TPastebinCom.SetProxyHost(const Value: string);
  418. begin
  419.   Http.ProxyParams.ProxyServer := Value;
  420. end;
  421.  
  422. procedure TPastebinCom.SetProxyPort(const Value: integer);
  423. begin
  424.   Http.ProxyParams.ProxyPort := Value;
  425. end;
  426.  
  427. procedure TPastebinCom.SetUserAgent(const Value: string);
  428. begin
  429.   Http.Request.UserAgent := Value;
  430. end;
  431.  
  432. procedure TPastebinCom.XMLToPasteList(const XML      : string;
  433.                                       var   PasteList: TPasteList);
  434. var
  435.   i  : integer;
  436.   mc : TMatchCollection;
  437. begin
  438.   try
  439.     mc := TRegEx.Matches(XML, '<paste>[^>]+>([^<]*)[^>]+>[^>]+>(\d*)[^>]+>[^>]+>' +
  440.                               '([^<]*)[^>]+>[^>]+>(\d*)[^>]+>[^>]+>(\d*)[^>]+>[^>]+>' +
  441.                               '(\d*)[^>]+>[^>]+>([^<]*)[^>]+>[^>]+>([^<]*)[^>]+>[^>]+>' +
  442.                               '([^<]*)[^>]+>[^>]+>(\d*)[^>]+>[^>]+>');
  443.     SetLength(PasteList, mc.Count);
  444.     if mc.Count <> 0 then
  445.     begin
  446.       for i := 0 to Pred(mc.Count) do
  447.       with PasteList[i] do
  448.       begin
  449.         Key         := mc.Item[i].Groups.Item[1].Value;
  450.         Date        := UnixDateTimeToDelphiDateTime(StrToInt(mc.Item[i].Groups.Item[2].Value));
  451.         Title       := mc.Item[i].Groups.Item[3].Value;
  452.         Size        := StrToIntDef(mc.Item[i].Groups.Item[4].Value, 0);
  453.         Expiry      := UnixDateTimeToDelphiDateTime(StrToIntDef(mc.Item[i].Groups.Item[5].Value, 0));
  454.         Privacy     := StrToIntDef(mc.Item[i].Groups.Item[6].Value, 0);
  455.         FormatLong  := mc.Item[i].Groups.Item[7].Value;
  456.         FormatShort := mc.Item[i].Groups.Item[8].Value;
  457.         Url         := mc.Item[i].Groups.Item[9].Value;
  458.         Hits        := StrToIntDef(mc.Item[i].Groups.Item[10].Value, 0);
  459.       end;
  460.     end;
  461.   except end;
  462. end;
  463.  
  464. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement