unit uempaquetar_sala;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ExtCtrls, uempaquetar;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    OpenDialog1: TOpenDialog;
    rgEmpaquetado: TRadioGroup;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }


function BuscarArchivo(s: string): string;
begin
  form1.OpenDialog1.FileName := s;
  if form1.OpenDialog1.Execute then
  begin
    Result := form1.OpenDialog1.FileName;
  end
  else
    Result := '';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  OpenDialog1.Filter:= 'Sala SimSEE|*.ese';
  if OpenDialog1.Execute then
  begin
    if rgEmpaquetado.ItemIndex = 0 then
      EmpaquetarSalaEnZip(OpenDialog1.FileName, @buscarArchivo)
    else
      EmpaquetarSalaEnCarpeta(OpenDialog1.FileName, @buscarArchivo);
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  OpenDialog1.Filter:= 'ZipFile|*.zip';
  if OpenDialog1.Execute then
    Unzip(OpenDialog1.FileName);
end;

end.

