Subversion Repositories jumper

Rev

Rev 11 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 21
Line 4... Line 4...
4
 
4
 
5
uses
5
uses
6
  SysUtils, Dialogs, Graphics, Classes, ExtCtrls;
6
  SysUtils, Dialogs, Graphics, Classes, ExtCtrls;
7
 
7
 
8
function ExtractFileNameWithoutExt(filename: string): string;
8
function ExtractFileNameWithoutExt(filename: string): string;
9
function SecondsToTimeString(Seconds: Integer): string;
-
 
10
procedure ClearImage(Image: TImage; BackgroundColor: TColor);
9
procedure ClearImage(Image: TImage; BackgroundColor: TColor);
11
function Ganzzahlig(num: extended): boolean;
-
 
12
function Explode(Separator, Text: String): TStringList;
10
function Explode(Separator, Text: String): TStringList;
13
function Position(FullString, Search: String): Integer;
11
function Position(FullString, Search: String): Integer;
14
function ReadFile(InputFile: string): string;
12
function DotsAtBeginning(s: string): integer;
-
 
13
function DotsAtEnd(s: string): integer;
15
 
14
 
16
implementation
15
implementation
17
 
16
 
18
resourcestring
-
 
19
  LNG_COULD_NOT_OPEN_FILE = 'Could not open file "%s".';
-
 
20
 
-
 
21
function ExtractFileNameWithoutExt(filename: string): string;
17
function ExtractFileNameWithoutExt(filename: string): string;
22
begin
18
begin
23
  result := ExtractFileName(filename);
19
  result := ExtractFileName(filename);
24
  result := copy(result, 1, Length(result)-Length(ExtractFileExt(result)));
20
  result := copy(result, 1, Length(result)-Length(ExtractFileExt(result)));
25
end;
21
end;
26
 
22
 
27
function SecondsToTimeString(Seconds: Integer): string;
-
 
28
var
-
 
29
  h, m, s: integer;
-
 
30
  tim: TDateTime;
-
 
31
begin
-
 
32
  h := 0;
-
 
33
  m := 0;
-
 
34
  s := Seconds;
-
 
35
 
-
 
36
  while s - 60*60 >= 0 do
-
 
37
  begin
-
 
38
    dec(s, 60*60);
-
 
39
    inc(h);
-
 
40
  end;
-
 
41
 
-
 
42
  while s - 60 >= 0 do
-
 
43
  begin
-
 
44
    dec(s, 60);
-
 
45
    inc(m);
-
 
46
  end;
-
 
47
 
-
 
48
  tim := EncodeTime(h, m, s, 0);
-
 
49
 
-
 
50
  result := TimeToStr(tim);
-
 
51
end;
-
 
52
 
-
 
53
procedure ClearImage(Image: TImage; BackgroundColor: TColor);
23
procedure ClearImage(Image: TImage; BackgroundColor: TColor);
54
var
24
var
55
  OldPenColor, OldBrushColor: TColor;
25
  OldPenColor, OldBrushColor: TColor;
56
begin
26
begin
57
  OldPenColor := Image.Canvas.Pen.Color;
27
  OldPenColor := Image.Canvas.Pen.Color;
Line 61... Line 31...
61
  Image.Canvas.Rectangle(0, 0, Image.Width, Image.Height);
31
  Image.Canvas.Rectangle(0, 0, Image.Width, Image.Height);
62
  Image.Canvas.Pen.Color := OldPenColor;
32
  Image.Canvas.Pen.Color := OldPenColor;
63
  Image.Canvas.Brush.Color := OldBrushColor;
33
  Image.Canvas.Brush.Color := OldBrushColor;
64
end;
34
end;
65
 
35
 
66
function Ganzzahlig(num: extended): boolean;
-
 
67
begin
-
 
68
  result := num = round(num);
-
 
69
end;
-
 
70
 
-
 
71
function Explode(Separator, Text: String): TStringList;
36
function Explode(Separator, Text: String): TStringList;
72
var
37
var
73
  pos: integer;
38
  pos: integer;
74
  tmp: string;
39
  tmp: string;
75
begin
40
begin
Line 103... Line 68...
103
    result := -1
68
    result := -1
104
  else
69
  else
105
    result := Length(FullString) - x + 1;
70
    result := Length(FullString) - x + 1;
106
end;
71
end;
107
 
72
 
108
function ReadFile(InputFile: string): string;
73
function DotsAtBeginning(s: string): integer;
109
var
74
var
110
  f: textfile;
75
  i: integer;
111
  tmp: string;
-
 
112
begin
76
begin
113
  result := '';
77
  result := 0;
114
 
-
 
115
  if not FileExists(InputFile) then
78
  for i := 1 to Length(s) do
116
  begin
79
  begin
117
    MessageDlg(Format(LNG_COULD_NOT_OPEN_FILE, [InputFile]), mtError, [mbOk], 0);
80
    if s[i] = '.' then
-
 
81
      Inc(result)
-
 
82
    else
118
    Exit;
83
      Exit;
119
  end;
84
  end;
-
 
85
end;
120
 
86
 
121
  AssignFile(f, InputFile);
87
function DotsAtEnd(s: string): integer;
122
  Reset(f);
88
var
123
  while not Eof(f) do
89
  i: integer;
124
  begin
90
begin
125
    ReadLn(f, tmp);
91
  result := 0;
126
    result := result + tmp + #13#10;
92
  for i := Length(s) downto 1 do
-
 
93
  begin
-
 
94
    if s[i] = '.' then
-
 
95
      Inc(result)
-
 
96
    else
-
 
97
      Exit;
127
  end;
98
  end;
128
  CloseFile(f);
-
 
129
end;
99
end;
130
 
100
 
131
end.
101
end.
132
 
102
 
133
103