Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d48b357f4b
Fetching contributors…

Cannot retrieve contributors at this time

file 72 lines (58 sloc) 1.674 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
unit mainUnit;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ComCtrls;

type

  { TMain }

  TMain = class(TForm)
      about: TButton;
      join: TButton;
      filename: TEdit;
      Label1: TLabel;
      Label2: TLabel;
      progress: TProgressBar;
      procedure aboutClick(Sender: TObject);
      procedure joinClick(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Main: TMain;

implementation

{ TMain }

procedure TMain.joinClick(Sender: TObject);
var numberText : string;
var outputFilename : string;
var parts, i : integer;
var input : TFileStream;
var output : TFileStream;
begin
     numberText := ExtractFileExt(filename.Text);
     outputFilename := filename.Text;
     Delete(outputFilename, Length(outputFilename) - Length(ExtractFileExt(filename.Text)) + 1, Length(ExtractFileExt(filename.Text)));
     Delete(numberText, 1, 1);
     parts := StrToInt(numberText);
     progress.max := parts;
     output := TFileStream.Create(outputFilename, fmCreate);
     for i := 1 to parts do
     begin
      input := TFileStream.Create(outputFilename + '.' + IntToStr(i), fmOpenRead);
          output.CopyFrom(input, input.size);
          input.Free;
          progress.stepIt;
          Application.ProcessMessages;
     end;
     ShowMessage('Done!');
     output.Free;
end;

procedure TMain.aboutClick(Sender: TObject);
begin
     ShowMessage('File Joiner Utlity.' + #10#13 + 'Compiled 22 March 2009');
end;

initialization
  {$I mainunit.lrs}

end.

Something went wrong with that request. Please try again.